>From 6b68a42ef77fcb4c07e5a110e4c77be10985852b Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Mon, 19 Apr 2021 08:20:50 +0200 Subject: [PATCH 1/6] completing-read: If HIST is the symbol `t', history is not recorded. * lisp/minibuffer.el (completion-all-sorted-completions): Check if `minibuffer-history-variable` is `t` * src/minibuf.c (completing-read): Update docstring * doc/lispref/minibuf.texi: Update documentation of `read-from-minibuffer` and `completing-read` --- doc/lispref/minibuf.texi | 13 ++++++++----- lisp/minibuffer.el | 2 +- src/minibuf.c | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index d16409d6c8..e922f1836b 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -167,8 +167,10 @@ Text from Minibuffer The argument @var{history} specifies a history list variable to use for saving the input and for history commands used in the minibuffer. -It defaults to @code{minibuffer-history}. You can optionally specify -a starting position in the history list as well. @xref{Minibuffer History}. +It defaults to @code{minibuffer-history}. If @var{history} is the +symbol @code{t}, history is not recorded. You can optionally specify +a starting position in the history list as well. @xref{Minibuffer +History}. If the variable @code{minibuffer-allow-text-properties} is non-@code{nil}, then the string that is returned includes whatever text @@ -1107,9 +1109,10 @@ Minibuffer Completion @code{minibuffer-local-must-match-map} if @var{require-match} is non-@code{nil}. @xref{Completion Commands}. -The argument @var{history} specifies which history list variable to use for -saving the input and for minibuffer history commands. It defaults to -@code{minibuffer-history}. @xref{Minibuffer History}. +The argument @var{history} specifies which history list variable to +use for saving the input and for minibuffer history commands. It +defaults to @code{minibuffer-history}. If @var{history} is the symbol +@code{t}, history is not recorded. @xref{Minibuffer History}. The argument @var{initial} is mostly deprecated; we recommend using a non-@code{nil} value only in conjunction with specifying a cons cell diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c900b0d7ce..06a5e1e988 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1390,7 +1390,7 @@ completion-all-sorted-completions (t ;; Prefer shorter completions, by default. (setq all (sort all (lambda (c1 c2) (< (length c1) (length c2))))) - (if (minibufferp) + (if (and (minibufferp) (not (eq minibuffer-history-variable t))) ;; Prefer recently used completions and put the default, if ;; it exists, on top. (let ((hist (symbol-value minibuffer-history-variable))) diff --git a/src/minibuf.c b/src/minibuf.c index a3c1b99bf3..f025817276 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2023,7 +2023,8 @@ DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, (This is the only case in which you should use INITIAL-INPUT instead of DEF.) Positions are counted starting from 1 at the beginning of the list. The variable `history-length' controls the maximum length - of a history list. + of a history list. If HIST is the symbol `t', history is not + recorded. DEF, if non-nil, is the default value or the list of default values. -- 2.20.1