Skip to content

Commit c7e1bbf

Browse files
skangaskyleam
authored andcommitted
Backport commit 664094222 from Emacs
* lisp/org-capture.el (org-capture-fill-template): * lisp/org-refile.el (org-refile-get-location): Prefer format-prompt when it is fboundp. Use format-prompt for many more prompts 66409422214a0a90e1d2a12ef2c4ebf86f2c01a9 Stefan Kangas Tue Oct 5 03:44:56 2021 +0200
1 parent e7572fa commit c7e1bbf

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

lisp/org-capture.el

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,10 +1816,13 @@ by their respective `org-store-link-plist' properties if present."
18161816
;; Load history list for current prompt.
18171817
(setq org-capture--prompt-history
18181818
(gethash prompt org-capture--prompt-history-table))
1819-
(push (org-completing-read
1820-
(concat (or prompt "Enter string")
1821-
(and default (format " [%s]" default))
1822-
": ")
1819+
(push (org-completing-read
1820+
;; `format-prompt' is new in Emacs 28.1.
1821+
(if (fboundp 'format-prompt)
1822+
(format-prompt (or prompt "Enter string") default)
1823+
(concat (or prompt "Enter string")
1824+
(and default (format " [%s]" default))
1825+
": "))
18231826
completions
18241827
nil nil nil 'org-capture--prompt-history default)
18251828
strings)

lisp/org-refile.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,13 @@ this function appends the default value from
640640
org-refile-target-table))
641641
(completion-ignore-case t)
642642
cdef
643-
(prompt (concat prompt
644-
(or (and (car org-refile-history)
645-
(concat " (default " (car org-refile-history) ")"))
646-
(and (assoc cbnex tbl) (setq cdef cbnex)
647-
(concat " (default " cbnex ")"))) ": "))
643+
(prompt (let ((default (or (car org-refile-history)
644+
(and (assoc cbnex tbl) (setq cdef cbnex)
645+
cbnex))))
646+
;; `format-prompt' is new in Emacs 28.1.
647+
(if (fboundp 'format-prompt)
648+
(format-prompt prompt default)
649+
(concat prompt " (default " default ": "))))
648650
pa answ parent-target child parent old-hist)
649651
(setq old-hist org-refile-history)
650652
(setq answ (funcall cfunc prompt tbl nil (not new-nodes)

0 commit comments

Comments
 (0)