summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-08-23 10:28:39 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-08-23 10:28:39 +0200
commit2ff3101c0e555627421162a759c4342f0b923a34 (patch)
tree4c0162e6e57e91ddb418f00c49715ad54a76d939
parentfc84ffee227dfbe6aad3315aa7654f2e6666266c (diff)
downloadorg-mode-2ff3101c0e555627421162a759c4342f0b923a34.tar.gz
org-capture: Fix %^T and %^U placeholders
* lisp/org-capture.el (org-capture-fill-template): Fix %^T and %^U placeholders. Reported-by: Ken Mankoff <mankoff@gmail.com> <http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00528.html>
-rw-r--r--lisp/org-capture.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 557ae94..deb33c8 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1751,24 +1751,31 @@ The template may still contain \"%?\" for cursor positioning."
(_ (error "Invalid `org-capture--clipboards' value: %S"
org-capture--clipboards)))))
("p" (org-set-property prompt nil))
- ((guard key)
+ ((or "t" "T" "u" "U")
;; These are the date/time related ones.
(let* ((upcase? (equal (upcase key) key))
(org-time-was-given upcase?)
(org-end-time-was-given)
- (time (org-read-date upcase? t nil prompt)))
+ (time
+ (org-read-date
+ upcase? t nil prompt nil
+ (pcase key
+ ("t" v-t) ("T" v-T) ("u" v-u) ("U" v-U)))))
(org-insert-time-stamp
time org-time-was-given
(member key '("u" "U"))
nil nil (list org-end-time-was-given))))
- (_
+ (`nil
(push (org-completing-read
(concat (or prompt "Enter string")
(and default (format " [%s]" default))
": ")
completions nil nil nil nil default)
strings)
- (insert (car strings)))))))))
+ (insert (car strings)))
+ (_
+ (error "Unknown template placeholder: \"%%^%s\""
+ key))))))))
;; Replace %n escapes with nth %^{...} string.
(setq strings (nreverse strings))