From 130bf51c411f817c799175a456942ca8a6649e29 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 30 Aug 2020 15:22:20 +0200 Subject: [PATCH] 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 8b4240c5d80..cca06c70a51 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 d302c05283c..617f6ae5e80 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 47f28d0010c..864726e3cc0 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) -- 2.39.2