From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: saveplace Date: Fri, 30 Nov 2007 12:07:08 +0000 Message-ID: <8763zkq6mr.fsf@bzg.ath.cx> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iy4oq-00033c-Rh for emacs-orgmode@gnu.org; Fri, 30 Nov 2007 07:18:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iy4oo-00033Q-Bc for emacs-orgmode@gnu.org; Fri, 30 Nov 2007 07:18:07 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iy4oo-00033N-68 for emacs-orgmode@gnu.org; Fri, 30 Nov 2007 07:18:06 -0500 Received: from ug-out-1314.google.com ([66.249.92.175]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iy4on-0007aJ-T6 for emacs-orgmode@gnu.org; Fri, 30 Nov 2007 07:18:06 -0500 Received: by ug-out-1314.google.com with SMTP id a2so2114588ugf for ; Fri, 30 Nov 2007 04:18:04 -0800 (PST) In-Reply-To: (Kevin Brubeck Unhammer's message of "Thu, 29 Nov 2007 13:36:00 +0000 (UTC)") 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 Hi Kevin, Kevin Brubeck Unhammer writes: > What's the best way to make a hook that runs show-entry on finding an > org-mode file, but after the save-place-hook? (Seeing as putting > show-entry in org-mode- hook doesn't work, since save-place goes > afterwards.) Should I just append something to find-file-hook that > runs show-entry iff we're in org-mode? Are you using the save-place feature in Emacs or XEmacs? I've done some searching in Emacs, and I found the right thing to do is to advise the `save-place-find-file-hook' function. Adding show-entry to org-mode-hook won't work because the mode is loaded before save-place find the last saved place. So here it is: (defadvice save-place-find-file-hook (after show-entry activate) "In org-mode, show entry at point if any." (when (org-mode-p) (save-excursion (unless (catch 'no-entry (condition-case nil (not (org-back-to-heading t)) (error (message "No entry to show") (throw 'no-entry t)))) (show-entry))))) Please tell me if it's working for you. -- Bastien