* saveplace
@ 2007-11-29 13:36 Kevin Brubeck Unhammer
2007-11-30 12:07 ` saveplace Bastien
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Brubeck Unhammer @ 2007-11-29 13:36 UTC (permalink / raw)
To: emacs-orgmode
Hi,
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?
--
Kevin Brubeck Unhammer
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: saveplace
2007-11-29 13:36 saveplace Kevin Brubeck Unhammer
@ 2007-11-30 12:07 ` Bastien
0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2007-11-30 12:07 UTC (permalink / raw)
To: emacs-orgmode
Hi Kevin,
Kevin Brubeck Unhammer <kun041@student.uib.no> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-30 12:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29 13:36 saveplace Kevin Brubeck Unhammer
2007-11-30 12:07 ` saveplace Bastien
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).