emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] saveplace


From: Bastien
Subject: Re: [Orgmode] saveplace
Date: Fri, 30 Nov 2007 12:07:08 +0000
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux)

Hi Kevin,

Kevin Brubeck Unhammer <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]