emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] save-excursion not saving when I call org-capture-goto-last-stor


From: David Maus
Subject: Re: [O] save-excursion not saving when I call org-capture-goto-last-stored
Date: Thu, 09 Feb 2012 07:28:37 +0100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/24.0.93 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

At Sat, 4 Feb 2012 22:01:32 -0500,
Jon Miller wrote:
>
> I'm currently trying to write a function to do some post-capture
> updates to an entry. My intention is to add it to
> org-capture-after-finalize-hook. First step is navigating to the
> captured item but I'd like to return to the current buffer I was in
> before. I'm still a novice with elisp, so I could use a pointer here.
>
> Here is a simplified example:
> M-: (save-excursion (org-capture-goto-last-stored))
>
> Is there a better way to navigate to the last capture and then return
> to my current buffer?

Well, save-excursion does restore the current buffer but is not
switching to it. Executing

,----
| (progn
|   (save-excursion
|     (org-capture-goto-last-stored))
|   (princ (current-buffer)))
`----

in *scratch* tells me that the current-buffer after the excursion is
*scratch*. What you are looking for is saving and restoring the
windows configuration (visible buffers in a frame).

C-h f save-window-excursion RET

This should do the trick:

,----
| (progn
|   (save-excursion
|     (save-window-excursion
|       (org-capture-goto-last-stored))))
`----

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgpBnVcRCi0Py.pgp
Description: PGP signature


reply via email to

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