From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: org-fill-paragraph leaves point at end of table Date: Mon, 25 Feb 2013 11:04:32 +0800 Message-ID: <87vc9hxfen.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9oI0-0003mF-9A for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 21:59:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9oHy-0002RE-Rn for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 21:59:40 -0500 Received: from plane.gmane.org ([80.91.229.3]:58074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9oHy-0002Qo-Kr for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 21:59:38 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U9oIG-0000t3-7e for emacs-orgmode@gnu.org; Mon, 25 Feb 2013 03:59:56 +0100 Received: from 114.250.113.48 ([114.250.113.48]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Feb 2013 03:59:56 +0100 Received: from eric by 114.250.113.48 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Feb 2013 03:59:56 +0100 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 Calling `org-fill-paragraph' inside a table leaves point at the end of the table, for reasons that are totally unclear to me. 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! I made a minimum sexp to reproduce the relevant bits of org-fill-paragraph: #+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 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. 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... Thanks! E