emacs-diffs
[Top][All Lists]
Advanced

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

master 130bf51: Make format-prompt interpret a nil default value as "no


From: Lars Ingebrigtsen
Subject: master 130bf51: Make format-prompt interpret a nil default value as "no default"
Date: Sun, 30 Aug 2020 09:23:01 -0400 (EDT)

branch: master
commit 130bf51c411f817c799175a456942ca8a6649e29
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make format-prompt interpret a nil default value as "no default"
    
    * doc/lispref/minibuf.texi (Text from Minibuffer): Document it.
    
    * lisp/help-fns.el (describe-function): Adjust the caller.
    
    * lisp/minibuffer.el (format-prompt): Interpret a nil default
    value as "no default".
---
 doc/lispref/minibuf.texi | 3 +++
 lisp/help-fns.el         | 4 +---
 lisp/minibuffer.el       | 8 ++++++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 8b4240c..cca06c7 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -437,6 +437,9 @@ passed to @code{format} (@pxref{Formatting Strings}).
 
 @code{minibuffer-default-prompt-format} can be @samp{""}, in which
 case no default values are displayed.
+
+If @var{default} is @code{nil}, there is no default value, and
+therefore no ``default value'' string is included in the result value.
 @end defun
 
 @node Object from Minibuffer
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index d302c05..617f6ae 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -151,9 +151,7 @@ When called from lisp, FUNCTION may also be a function 
object."
    (let* ((fn (function-called-at-point))
           (enable-recursive-minibuffers t)
           (val (completing-read
-                (if fn
-                    (format-prompt "Describe function" fn)
-                  "Describe function: ")
+                (format-prompt "Describe function" fn)
                 #'help--symbol-completion-table
                 (lambda (f) (or (fboundp f) (get f 'function-documentation)))
                 t nil nil
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 47f28d0..864726e 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3863,12 +3863,16 @@ the minibuffer was activated, and execute the forms."
 If FORMAT-ARGS is nil, PROMPT is used as a plain string.  If
 FORMAT-ARGS is non-nil, PROMPT is used as a format control
 string, and FORMAT-ARGS are the arguments to be substituted into
-it.  See `format' for details."
+it.  See `format' for details.
+
+If DEFAULT is nil, no \"default value\" string is included in the
+return value."
   (concat
    (if (null format-args)
        prompt
      (apply #'format prompt format-args))
-   (format minibuffer-default-prompt-format default)
+   (and default
+        (format minibuffer-default-prompt-format default))
    ": "))
 
 (provide 'minibuffer)



reply via email to

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