From 5fc950a494989e39f1735462e4e2e48cfdb2d9db Mon Sep 17 00:00:00 2001 From: Bastien Date: Fri, 7 Feb 2020 20:43:50 +0100 Subject: [PATCH] org-capture.el: Fix entry template insertion * lisp/org-capture.el (org-capture-place-entry): Place point correctly before narrowing the buffer. * testing/lisp/test-org-capture.el (test-org-capture/entry): Fix test. Thanks to Bernt Hansen for reporting this. --- lisp/org-capture.el | 2 +- testing/lisp/test-org-capture.el | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 2d5e2f131..c4feae7b7 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1151,7 +1151,7 @@ may have been stored before." (org-capture-empty-lines-after) (unless (org-at-heading-p) (outline-next-heading)) (org-capture-mark-kill-region origin (point)) - (org-capture-narrow beg (1- (point))) + (org-capture-narrow beg (point)) (when (or (search-backward "%?" beg t) (search-forward "%?" nil t)) (replace-match "")))))) diff --git a/testing/lisp/test-org-capture.el b/testing/lisp/test-org-capture.el index 124ef43b1..10cfcbfaa 100644 --- a/testing/lisp/test-org-capture.el +++ b/testing/lisp/test-org-capture.el @@ -208,7 +208,6 @@ (org-capture-templates `(("t" "Todo" entry (file+headline ,file "A") "** H1 %?")))) (org-capture nil "t") - (goto-char (point-max)) (insert "Capture text") (org-capture-finalize)) (buffer-string))))