From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Miller Subject: Re: save-excursion not saving when I call org-capture-goto-last-stored Date: Thu, 9 Feb 2012 12:02:03 -0500 Message-ID: References: <87liocmsfe.wl%dmaus@ictsoc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:47126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvXOA-0004x8-Pt for emacs-orgmode@gnu.org; Thu, 09 Feb 2012 12:02:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvXO5-0002nl-JQ for emacs-orgmode@gnu.org; Thu, 09 Feb 2012 12:02:30 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:57396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvXO5-0002nR-6r for emacs-orgmode@gnu.org; Thu, 09 Feb 2012 12:02:25 -0500 Received: by wibhj13 with SMTP id hj13so1765536wib.0 for ; Thu, 09 Feb 2012 09:02:23 -0800 (PST) In-Reply-To: <87liocmsfe.wl%dmaus@ictsoc.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: orgmode 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 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 > | =A0 (save-excursion > | =A0 =A0 (org-capture-goto-last-stored)) > | =A0 (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 > | =A0 (save-excursion > | =A0 =A0 (save-window-excursion > | =A0 =A0 =A0 (org-capture-goto-last-stored)))) > `---- > > Best, > =A0-- David > -- > OpenPGP... 0x99ADB83B5A4478E6 > Jabber.... dmjena@jabber.org > Email..... dmaus@ictsoc.de