summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-11 11:58:51 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-01-11 11:58:51 +0100
commit235d3c5e45716eb4ff23d3790ff0676d8ac4f335 (patch)
tree79f4f0a4440a6b53961c2956b9e396b39941621c
parent7404e3d22a3a7705d04a180f3f659f63266c9384 (diff)
parent71890398cd22c198d502949834b0296fbf7beebb (diff)
downloadorg-mode-235d3c5e45716eb4ff23d3790ff0676d8ac4f335.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-capture.el32
1 files changed, 16 insertions, 16 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index add187c..a8b9879 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -750,8 +750,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))
@@ -888,12 +887,12 @@ Store them in the capture property list."
(_ (error "Cannot find target ID \"%s\"" id))))
(`(file+headline ,path ,headline)
(set-buffer (org-capture-target-buffer path))
- (org-capture-put-target-region-and-position)
- (widen)
- (goto-char (point-min))
(unless (derived-mode-p 'org-mode)
(error "Target buffer \"%s\" for file+headline not in Org mode"
(current-buffer)))
+ (org-capture-put-target-region-and-position)
+ (widen)
+ (goto-char (point-min))
(if (re-search-forward (format org-complex-heading-regexp-format
(regexp-quote headline))
nil t)
@@ -928,8 +927,12 @@ Store them in the capture property list."
`file+weektree
`file+weektree+prompt))
,path)
- (require 'org-datetree)
(set-buffer (org-capture-target-buffer path))
+ (unless (derived-mode-p 'org-mode)
+ (error "Target buffer \"%s\" for %s should be in Org mode"
+ (current-buffer)
+ type))
+ (require 'org-datetree)
(org-capture-put-target-region-and-position)
(widen)
;; Make a date/week tree entry, with the current date (or
@@ -1298,8 +1301,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)
@@ -1312,14 +1315,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."