diff options
author | Rasmus <rasmus@gmx.us> | 2017-12-06 15:02:15 +0100 |
---|---|---|
committer | Rasmus <rasmus@gmx.us> | 2017-12-06 15:37:41 +0100 |
commit | 445eefd238eb7c3843e18cd265c05f07233f8aff (patch) | |
tree | 1b80ecda2301629cf8e1f0b2941e1f729952ca84 /lisp/org/org-capture.el | |
parent | 5381c70b7a9d46fe4de205363b99f761e2475f1f (diff) | |
download | emacs-445eefd238eb7c3843e18cd265c05f07233f8aff.tar.gz emacs-445eefd238eb7c3843e18cd265c05f07233f8aff.tar.bz2 emacs-445eefd238eb7c3843e18cd265c05f07233f8aff.zip |
Backport: Update Org to v9.1.4
Please note this is a bugfix release. See etc/ORG-NEWS for details.
(cherry picked from commit 567b5efe1f338c10c574758fb968915c5c34c909)
Diffstat (limited to 'lisp/org/org-capture.el')
-rw-r--r-- | lisp/org/org-capture.el | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index 862cdb27623..03210210864 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -79,6 +79,12 @@ (defvar org-capture-is-refiling nil "Non-nil when capture process is refiling an entry.") +(defvar org-capture--prompt-history-table (make-hash-table :test #'equal) + "Hash table for all history lists per prompt.") + +(defvar org-capture--prompt-history nil + "History list for prompt placeholders.") + (defgroup org-capture nil "Options concerning capturing new entries." :tag "Org Capture" @@ -1311,8 +1317,8 @@ Of course, if exact position has been required, just put it there." (defun org-capture-mark-kill-region (beg end) "Mark the region that will have to be killed when aborting capture." - (let ((m1 (move-marker (make-marker) beg)) - (m2 (move-marker (make-marker) end))) + (let ((m1 (copy-marker beg)) + (m2 (copy-marker end t))) (org-capture-put :begin-marker m1) (org-capture-put :end-marker m2))) @@ -1792,19 +1798,25 @@ The template may still contain \"%?\" for cursor positioning." (let* ((upcase? (equal (upcase key) key)) (org-end-time-was-given nil) (time (org-read-date upcase? t nil prompt))) - (let ((org-time-was-given upcase?)) - (org-insert-time-stamp - time org-time-was-given - (member key '("u" "U")) - nil nil (list org-end-time-was-given))))) + (org-insert-time-stamp + time (or org-time-was-given upcase?) + (member key '("u" "U")) + nil nil (list org-end-time-was-given)))) (`nil + ;; Load history list for current prompt. + (setq org-capture--prompt-history + (gethash prompt org-capture--prompt-history-table)) (push (org-completing-read (concat (or prompt "Enter string") (and default (format " [%s]" default)) ": ") - completions nil nil nil nil default) + completions + nil nil nil 'org-capture--prompt-history default) strings) - (insert (car strings))) + (insert (car strings)) + ;; Save updated history list for current prompt. + (puthash prompt org-capture--prompt-history + org-capture--prompt-history-table)) (_ (error "Unknown template placeholder: \"%%^%s\"" key)))))))) |