From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-fill-paragraph leaves point at end of table Date: Mon, 25 Feb 2013 10:21:49 +0100 Message-ID: <24BE6F65-CD8B-4964-AA13-DB61F21F402D@gmail.com> References: <87vc9hxfen.fsf@ericabrahamsen.net> <87hal0u5bi.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:58180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9uGC-0006pP-OW for emacs-orgmode@gnu.org; Mon, 25 Feb 2013 04:22:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9uFu-0003gP-62 for emacs-orgmode@gnu.org; Mon, 25 Feb 2013 04:22:12 -0500 Received: from mail-ea0-f176.google.com ([209.85.215.176]:38626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9uFt-0003fs-Tw for emacs-orgmode@gnu.org; Mon, 25 Feb 2013 04:21:54 -0500 Received: by mail-ea0-f176.google.com with SMTP id a13so1130882eaa.21 for ; Mon, 25 Feb 2013 01:21:53 -0800 (PST) In-Reply-To: <87hal0u5bi.fsf@gmail.com> 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: Nicolas Goaziou Cc: Eric Abrahamsen , emacs-orgmode@gnu.org On 25 feb. 2013, at 10:10, Nicolas Goaziou wrote: > Hello, >=20 > Eric Abrahamsen writes: >=20 >> Calling `org-fill-paragraph' inside a table leaves point at the end = of >> the table, for reasons that are totally unclear to me. >>=20 >> I've tested this with up-to-date org and emacs -Q, so I'm hoping it's >> reproducible. I edebugged org-fill-paragraph, and it appears to do = the >> right thing, going from the save-excursion to the cond to the = org-table >> cond statement, and there calling `org-table-align'. That works >> correctly, but stepping forward you come to the end of the enclosing >> `save-excursion', and emerging from `save-excursion' puts point at = the >> end of the table -- precisely what it's not supposed to do! >>=20 >> I made a minimum sexp to reproduce the relevant bits of >> org-fill-paragraph: >>=20 >> #+BEGIN_SRC emacs-lisp >> (save-excursion >> (let ((element (org-element-at-point))) >> (case (org-element-type element) >> (table-row (org-table-align) t)))) >> #+END_SRC >>=20 >> Putting point in a table and eval'ing that also leaves point at the = end >> of the table. I tried using (call-interactively 'org-table-align) and = it >> did the same thing. >>=20 >> I'm baffled, particularly as it doesn't do this for any other element >> type. Any clever ideas? M-q after a bit of typing is already stuck in = my >> fingers, and this bit of strangeness doesn't set the mark, so editing >> long tables is a pain... >=20 > `org-table-align' inserts a whole new table and removes completely the > previous one. This confuses `save-excursion' which doesn't recognize = any > familiar location anymore. >=20 > I've pushed a fix for it. All filling tests pass, but if you notice > anything suspicious, please signal it. I do not expect problems, because you now fall back onto org-table-align = without any save-excursion around it, AFAICS. org-table-align remembers = line number and table row number and restores them, so this should work. - Carsten=