From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Tables recently stopped aligning Date: Thu, 09 Jul 2015 11:47:35 +0200 Message-ID: <87zj35slvs.fsf@gmx.us> References: <87si9036r1.fsf@pierrot.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD8RC-0004by-93 for emacs-orgmode@gnu.org; Thu, 09 Jul 2015 05:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZD8R8-00042B-UW for emacs-orgmode@gnu.org; Thu, 09 Jul 2015 05:48:14 -0400 Received: from plane.gmane.org ([80.91.229.3]:53541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD8R8-00041v-Ng for emacs-orgmode@gnu.org; Thu, 09 Jul 2015 05:48:10 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZD8R3-0001Wl-N4 for emacs-orgmode@gnu.org; Thu, 09 Jul 2015 11:48:05 +0200 Received: from 46.166.190.129 ([46.166.190.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jul 2015 11:48:05 +0200 Received: from rasmus by 46.166.190.129 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jul 2015 11:48:05 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org William Denton writes: > Thanks for locating this. I don't know enough about Org's workings to > see what in the change introduced the bug, but something did go wrong, > and column widths + table alignments are broken. I hope someone can > fix it! The problem is that the highlighted condition is always true. There are two things causing this. First, format doesn't truncate string unless you do something like %40.40. Second, buffer-substring also returns invisible text. In practice this imply that tables can only grow and not truncate now. ;; Replace modified lines only. (dolist (l lines) (let ((line (if l (apply #'format rfmt (append (pop fields) emptystrings)) hfmt))) (if (equal (buffer-substring (point) (line-beginning-position 2)) line) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Rasmus -- A page of history is worth a volume of logic