* lisp/subr.el (read-char-from-minibuffer, y-or-n-p): Simplify to use HIST=t.

This commit is contained in:
Juri Linkov 2022-07-17 21:06:31 +03:00
parent 60185819b6
commit ef77070727

View file

@ -3306,9 +3306,7 @@ while calling this function, then pressing `help-char'
causes it to evaluate `help-form' and display the result.
There is no need to explicitly add `help-char' to CHARS;
`help-char' is bound automatically to `help-form-show'."
(defvar empty-history)
(let* ((empty-history '())
(map (if (consp chars)
(let* ((map (if (consp chars)
(or (gethash (list help-form (cons help-char chars))
read-char-from-minibuffer-map-hash)
(let ((map (make-sparse-keymap))
@ -3335,9 +3333,7 @@ There is no need to explicitly add `help-char' to CHARS;
read-char-from-minibuffer-map))
;; Protect this-command when called from pre-command-hook (bug#45029)
(this-command this-command)
(result
(read-from-minibuffer prompt nil map nil
(or history 'empty-history)))
(result (read-from-minibuffer prompt nil map nil (or history t)))
(char
(if (> (length result) 0)
;; We have a string (with one character), so return the first one.
@ -3538,9 +3534,7 @@ like) while `y-or-n-p' is running)."
(discard-input)))
(t
(setq prompt (funcall padded prompt))
(defvar empty-history)
(let* ((empty-history '())
(enable-recursive-minibuffers t)
(let* ((enable-recursive-minibuffers t)
(msg help-form)
(keymap (let ((map (make-composed-keymap
y-or-n-p-map query-replace-map)))
@ -3557,7 +3551,7 @@ like) while `y-or-n-p' is running)."
(this-command this-command)
(str (read-from-minibuffer
prompt nil keymap nil
(or y-or-n-p-history-variable 'empty-history))))
(or y-or-n-p-history-variable t))))
(setq answer (if (member str '("y" "Y")) 'act 'skip)))))
(let ((ret (eq answer 'act)))
(unless noninteractive