emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org c7e1bbfd1c 03/50: Backport commit 664094222 from Em


From: ELPA Syncer
Subject: [elpa] externals/org c7e1bbfd1c 03/50: Backport commit 664094222 from Emacs
Date: Tue, 4 Oct 2022 21:57:58 -0400 (EDT)

branch: externals/org
commit c7e1bbfd1c14a28251f0190e7825083c24d97d27
Author: Stefan Kangas <stefan@marxist.se>
Commit: Kyle Meyer <kyle@kyleam.com>

    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
---
 lisp/org-capture.el | 11 +++++++----
 lisp/org-refile.el  | 12 +++++++-----
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index bfead3aa5a..2fd9a9c74d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1816,10 +1816,13 @@ by their respective `org-store-link-plist' properties 
if present."
                     ;; 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))
-                                   ": ")
+                     (push (org-completing-read
+                            ;; `format-prompt' is new in Emacs 28.1.
+                            (if (fboundp 'format-prompt)
+                                (format-prompt (or prompt "Enter string") 
default)
+                              (concat (or prompt "Enter string")
+                                      (and default (format " [%s]" default))
+                                      ": "))
                            completions
                            nil nil nil 'org-capture--prompt-history default)
                           strings)
diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 5ad73422ef..f76ebefe7b 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -640,11 +640,13 @@ this function appends the default value from
               org-refile-target-table))
         (completion-ignore-case t)
         cdef
-        (prompt (concat prompt
-                        (or (and (car org-refile-history)
-                                 (concat " (default " (car org-refile-history) 
")"))
-                            (and (assoc cbnex tbl) (setq cdef cbnex)
-                                 (concat " (default " cbnex ")"))) ": "))
+         (prompt (let ((default (or (car org-refile-history)
+                                    (and (assoc cbnex tbl) (setq cdef cbnex)
+                                         cbnex))))
+                   ;; `format-prompt' is new in Emacs 28.1.
+                   (if (fboundp 'format-prompt)
+                       (format-prompt prompt default)
+                     (concat prompt " (default " default ": "))))
         pa answ parent-target child parent old-hist)
     (setq old-hist org-refile-history)
     (setq answ (funcall cfunc prompt tbl nil (not new-nodes)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]