emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jon Miller <jonebird@gmail.com>
To: David Maus <dmaus@ictsoc.de>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: save-excursion not saving when I call org-capture-goto-last-stored
Date: Thu, 9 Feb 2012 12:02:03 -0500	[thread overview]
Message-ID: <CAG7ukFqH-jZH8xAOLEEgs0JoAwVBmghNLHh1OXiGPuDA1oaoMw@mail.gmail.com> (raw)
In-Reply-To: <87liocmsfe.wl%dmaus@ictsoc.de>

Awesome, thanks. That worked for me.
  Now to add my conditional logic for which parent headings I want
this behavior to apply to and I'm done.

Thanks again,
Jon Miller

On Thu, Feb 9, 2012 at 1:28 AM, David Maus <dmaus@ictsoc.de> wrote:
> 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.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de

      reply	other threads:[~2012-02-09 17:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-05  3:01 save-excursion not saving when I call org-capture-goto-last-stored Jon Miller
2012-02-09  6:28 ` David Maus
2012-02-09 17:02   ` Jon Miller [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=CAG7ukFqH-jZH8xAOLEEgs0JoAwVBmghNLHh1OXiGPuDA1oaoMw@mail.gmail.com \
    --to=jonebird@gmail.com \
    --cc=dmaus@ictsoc.de \
    --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).