emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: emacs-orgmode@gnu.org
Subject: Re: saveplace
Date: Fri, 30 Nov 2007 12:07:08 +0000	[thread overview]
Message-ID: <8763zkq6mr.fsf@bzg.ath.cx> (raw)
In-Reply-To: <loom.20071129T133257-578@post.gmane.org> (Kevin Brubeck Unhammer's message of "Thu, 29 Nov 2007 13:36:00 +0000 (UTC)")

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

      reply	other threads:[~2007-11-30 12:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 13:36 saveplace Kevin Brubeck Unhammer
2007-11-30 12:07 ` Bastien [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8763zkq6mr.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).