From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: Re: save-excursion fails to restore point Date: Wed, 10 Jun 2009 09:11:20 -0700 Message-ID: <20524da70906100911s69317d3awc297688c6a9fc2fa@mail.gmail.com> References: <20524da70906091356x1f0dc7e4h249e2d92f93b9977@mail.gmail.com> <63D26AC4-B7EA-46B1-8D05-A679C67ABF3A@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEQP9-0002cz-4h for emacs-orgmode@gnu.org; Wed, 10 Jun 2009 12:11:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEQP1-0002YL-Pk for emacs-orgmode@gnu.org; Wed, 10 Jun 2009 12:11:58 -0400 Received: from [199.232.76.173] (port=33666 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEQP1-0002Y6-Je for emacs-orgmode@gnu.org; Wed, 10 Jun 2009 12:11:51 -0400 Received: from wa-out-1112.google.com ([209.85.146.183]:42223) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MEQP1-0005Go-77 for emacs-orgmode@gnu.org; Wed, 10 Jun 2009 12:11:51 -0400 Received: by wa-out-1112.google.com with SMTP id m34so183841wag.26 for ; Wed, 10 Jun 2009 09:11:49 -0700 (PDT) In-Reply-To: <63D26AC4-B7EA-46B1-8D05-A679C67ABF3A@gmail.com> 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: Carsten Dominik Cc: emacs-orgmode@gnu.org OK, thanks. I won't expect s-e to work all the time. The following does not work. (add-hook 'org-after-todo-state-change-hook 'alpha-org-after-todo-state-change-hook) (defun alpha-org-after-todo-state-change-hook () (let ((alpha-oatsch (point))) (if (alpha-org-entry-is-todo-type :doneish) (alpha-org-sort-siblings :very-coarse) (hide-leaves)) (goto-char alpha-oatsch))) Is this related? (defadvice org-todo (around fix-point activate) (let ((alpha-defadvice-org-todo (point))) ad-do-it (goto-char alpha-defadvice-org-todo))) does work. Thanks. On Wed, Jun 10, 2009 at 00:03, Carsten Dominik w= rote: > > On Jun 9, 2009, at 10:56 PM, Samuel Wales wrote: > >> Here is a minimal test case: >> >> (save-excursion >> =A0(outline-up-heading 1 'invisible-ok) >> =A0(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. =A0But when I do so >> from org-after-todo-state-change-hook, point gets placed on >> the parent headline. =A0Point 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. > > I think it is in fact unavoidable when you delete and re-insert > text that contained a marker. =A0Not impossible to fix, or does > in fact do if for clock history markers, but for the sorting routine > that would really be too much to ask. > > - Carsten > > >> >> 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. =A0Conflicts of interest are destroying research. =A0/You= / can >> get the disease at any time permanently. =A0Do science and justice matte= r to >> you? =A0http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > --=20 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