Hi Kevin,

Kevin Brubeck Unhammer <[EMAIL PROTECTED]> 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


_______________________________________________
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

Reply via email to