emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alex Kosorukoff <alex@3form.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Fix capture to make it save the point location
Date: Thu, 1 May 2014 19:03:28 -0700	[thread overview]
Message-ID: <CAHD9_tShM+aSp1sZTpz8Y93KEUJzHV+KQGWH_BS5JJnb7aJyxg@mail.gmail.com> (raw)
In-Reply-To: <CAHD9_tTuftxwA=c3enmTdgchSdWKZV+-fGSskmM6tppP-gOpjw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 527 bytes --]

sorry, I accidentally sent my previous patch. This is the one that belongs
here.


On Thu, May 1, 2014 at 7:00 PM, Alex Kosorukoff <alex@3form.com> wrote:

> Hello:
>
> this is another small patch to org-capture.el to make sure that after
> completion it returns to the same place from where it was invoked. This way
> users won't loose track of where they were before capturing something. The
> minimal setup to reproduce the case where capture fails to return to the
> place of its invocation is attached.
>
> Best,
> Alex
>

[-- Attachment #1.2: Type: text/html, Size: 893 bytes --]

[-- Attachment #2: 0001-org-capture-fix-org-capture-to-make-it-save-the-poin.patch --]
[-- Type: text/x-patch, Size: 1106 bytes --]

From cf97dd81aa94510e5dcd5be478b515c732cd93d4 Mon Sep 17 00:00:00 2001
From: Alex Kosorukoff <alex@3form.com>
Date: Thu, 1 May 2014 18:50:43 -0700
Subject: [PATCH] org-capture: fix org-capture to make it save the point position

* lisp/org-capture.el (org-capture-fill template) can change the point
  position in the buffer where capture was invoked, so user may not return
  to the same place after capture completion
---
 lisp/org-capture.el |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index c053640..1e3ae5b 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -584,7 +584,9 @@ of the day at point (if any) or the current HH:MM time."
 			     (org-current-time)))
 	(org-capture-set-target-location)
 	(condition-case error
-	    (org-capture-put :template (org-capture-fill-template))
+	    (org-capture-put :template
+			     (save-excursion
+			       (org-capture-fill-template)))
 	  ((error quit)
 	   (if (get-buffer "*Capture*") (kill-buffer "*Capture*"))
 	   (error "Capture abort: %s" error)))
-- 
1.7.0.4


  reply	other threads:[~2014-05-02  2:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02  2:00 [PATCH] Fix capture to make it save the point location Alex Kosorukoff
2014-05-02  2:03 ` Alex Kosorukoff [this message]
2014-05-23 12:30   ` Bastien
2014-05-23 15:24     ` Alex Kosorukoff
2014-05-23 15:39       ` Bastien
2014-05-23 16:04         ` Alex Kosorukoff
2014-05-23 17:36           ` Bastien

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=CAHD9_tShM+aSp1sZTpz8Y93KEUJzHV+KQGWH_BS5JJnb7aJyxg@mail.gmail.com \
    --to=alex@3form.com \
    --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).