forked from mirrors/org-mode
Merge branch 'maint'
This commit is contained in:
commit
235d3c5e45
|
@ -750,8 +750,7 @@ captured item after finalizing."
|
||||||
;; Store this place as the last one where we stored something
|
;; Store this place as the last one where we stored something
|
||||||
;; Do the marking in the base buffer, so that it makes sense after
|
;; Do the marking in the base buffer, so that it makes sense after
|
||||||
;; the indirect buffer has been killed.
|
;; the indirect buffer has been killed.
|
||||||
(when org-capture-bookmark
|
(org-capture-store-last-position)
|
||||||
(org-capture-bookmark-last-stored-position))
|
|
||||||
|
|
||||||
;; Run the hook
|
;; Run the hook
|
||||||
(run-hooks 'org-capture-before-finalize-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))))
|
(_ (error "Cannot find target ID \"%s\"" id))))
|
||||||
(`(file+headline ,path ,headline)
|
(`(file+headline ,path ,headline)
|
||||||
(set-buffer (org-capture-target-buffer path))
|
(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)
|
(unless (derived-mode-p 'org-mode)
|
||||||
(error "Target buffer \"%s\" for file+headline not in Org mode"
|
(error "Target buffer \"%s\" for file+headline not in Org mode"
|
||||||
(current-buffer)))
|
(current-buffer)))
|
||||||
|
(org-capture-put-target-region-and-position)
|
||||||
|
(widen)
|
||||||
|
(goto-char (point-min))
|
||||||
(if (re-search-forward (format org-complex-heading-regexp-format
|
(if (re-search-forward (format org-complex-heading-regexp-format
|
||||||
(regexp-quote headline))
|
(regexp-quote headline))
|
||||||
nil t)
|
nil t)
|
||||||
|
@ -928,8 +927,12 @@ Store them in the capture property list."
|
||||||
`file+weektree
|
`file+weektree
|
||||||
`file+weektree+prompt))
|
`file+weektree+prompt))
|
||||||
,path)
|
,path)
|
||||||
(require 'org-datetree)
|
|
||||||
(set-buffer (org-capture-target-buffer path))
|
(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)
|
(org-capture-put-target-region-and-position)
|
||||||
(widen)
|
(widen)
|
||||||
;; Make a date/week tree entry, with the current date (or
|
;; 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))))
|
(org-table-current-dline))))
|
||||||
(t (error "This should not happen"))))
|
(t (error "This should not happen"))))
|
||||||
|
|
||||||
(defun org-capture-bookmark-last-stored-position ()
|
(defun org-capture-store-last-position ()
|
||||||
"Bookmark the last-captured position."
|
"Store the last-captured position."
|
||||||
(let* ((where (org-capture-get :position-for-last-stored 'local))
|
(let* ((where (org-capture-get :position-for-last-stored 'local))
|
||||||
(pos (cond
|
(pos (cond
|
||||||
((markerp where)
|
((markerp where)
|
||||||
|
@ -1312,14 +1315,11 @@ Of course, if exact position has been required, just put it there."
|
||||||
(point-at-bol))
|
(point-at-bol))
|
||||||
(point))))))
|
(point))))))
|
||||||
(with-current-buffer (buffer-base-buffer (current-buffer))
|
(with-current-buffer (buffer-base-buffer (current-buffer))
|
||||||
(org-with-wide-buffer
|
(org-with-point-at pos
|
||||||
(goto-char pos)
|
(when org-capture-bookmark
|
||||||
(let ((bookmark-name (plist-get org-bookmark-names-plist
|
(let ((bookmark (plist-get org-bookmark-names-plist :last-capture)))
|
||||||
:last-capture)))
|
(when bookmark (with-demoted-errors (bookmark-set bookmark)))))
|
||||||
(when bookmark-name
|
(move-marker org-capture-last-stored-marker (point))))))
|
||||||
(with-demoted-errors
|
|
||||||
(bookmark-set bookmark-name))))
|
|
||||||
(move-marker org-capture-last-stored-marker (point))))))
|
|
||||||
|
|
||||||
(defun org-capture-narrow (beg end)
|
(defun org-capture-narrow (beg end)
|
||||||
"Narrow, unless configuration says not to narrow."
|
"Narrow, unless configuration says not to narrow."
|
||||||
|
|
Loading…
Reference in New Issue