From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: save-excursion fails to restore point Date: Tue, 9 Jun 2009 13:56:52 -0700 Message-ID: <20524da70906091356x1f0dc7e4h249e2d92f93b9977@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ME8Nj-0000R0-Js for emacs-orgmode@gnu.org; Tue, 09 Jun 2009 16:57:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ME8Ne-0000QV-GJ for emacs-orgmode@gnu.org; Tue, 09 Jun 2009 16:57:18 -0400 Received: from [199.232.76.173] (port=53246 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ME8Ne-0000QS-8s for emacs-orgmode@gnu.org; Tue, 09 Jun 2009 16:57:14 -0400 Received: from mail-px0-f202.google.com ([209.85.216.202]:45908) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ME8Nd-0007Ss-Qp for emacs-orgmode@gnu.org; Tue, 09 Jun 2009 16:57:14 -0400 Received: by pxi40 with SMTP id 40so287143pxi.14 for ; Tue, 09 Jun 2009 13:57:12 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Here is a minimal test case: (save-excursion (outline-up-heading 1 'invisible-ok) (org-sort-entries-or-items nil ?a)) What happens is that point stays on the parent headline. What I expect is for save-excursion to save point no differently from just saving point and doing goto-char. Also: When I change a todo state and then sort entries manually using my sort function, everything works. But when I do so from org-after-todo-state-change-hook, point gets placed on the parent headline. Point gets changed right after the save-excursion in org-todo (3rd paren from last). Reproducible? RMS in the reply to http://www.archivum.info/bug-gnu-emacs@gnu.org/2006-01/msg00053.html seems to say that it is inevitable. Is there a way for org to work around this? If not, it is a warning to the wise. -- Myalgic encephalomyelitis denialism is causing death and severe suffering, worse than MS. Conflicts of interest are destroying research. /You/ can get the disease at any time permanently. Do science and justice matter to you? http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm