summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-11 09:52:57 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-11 09:52:57 +0100
commit71890398cd22c198d502949834b0296fbf7beebb (patch)
tree438d026800d2da5ec6b8a4adbf42a53da6e9ce9b
parent6a49de8862364bc15059d7c10a74ce4edf5e35e4 (diff)
downloadorg-mode-71890398cd22c198d502949834b0296fbf7beebb.tar.gz
org-capture: Fix :jump-+to-captured when `org-capture-bookmark' is nil
* lisp/org-capture.el (org-capture-bookmark-last-stored-position): Rename to ... (org-capture-store-last-position): ... this. Also store last position unconditionally. * lisp/org-capture.el (org-capture-finalize): Apply renaming.
-rw-r--r--lisp/org-capture.el20
1 files changed, 8 insertions, 12 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index b3b7f2f..ea1ed10 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -749,8 +749,7 @@ captured item after finalizing."
;; Store this place as the last one where we stored something
;; Do the marking in the base buffer, so that it makes sense after
;; the indirect buffer has been killed.
- (when org-capture-bookmark
- (org-capture-bookmark-last-stored-position))
+ (org-capture-store-last-position)
;; Run the hook
(run-hooks 'org-capture-before-finalize-hook))
@@ -1305,8 +1304,8 @@ Of course, if exact position has been required, just put it there."
(org-table-current-dline))))
(t (error "This should not happen"))))
-(defun org-capture-bookmark-last-stored-position ()
- "Bookmark the last-captured position."
+(defun org-capture-store-last-position ()
+ "Store the last-captured position."
(let* ((where (org-capture-get :position-for-last-stored 'local))
(pos (cond
((markerp where)
@@ -1319,14 +1318,11 @@ Of course, if exact position has been required, just put it there."
(point-at-bol))
(point))))))
(with-current-buffer (buffer-base-buffer (current-buffer))
- (org-with-wide-buffer
- (goto-char pos)
- (let ((bookmark-name (plist-get org-bookmark-names-plist
- :last-capture)))
- (when bookmark-name
- (with-demoted-errors
- (bookmark-set bookmark-name))))
- (move-marker org-capture-last-stored-marker (point))))))
+ (org-with-point-at pos
+ (when org-capture-bookmark
+ (let ((bookmark (plist-get org-bookmark-names-plist :last-capture)))
+ (when bookmark (with-demoted-errors (bookmark-set bookmark)))))
+ (move-marker org-capture-last-stored-marker (point))))))
(defun org-capture-narrow (beg end)
"Narrow, unless configuration says not to narrow."