diff options
| author | Juri Linkov | 2022-07-17 21:06:31 +0300 |
|---|---|---|
| committer | Juri Linkov | 2022-07-17 21:06:31 +0300 |
| commit | ef77070727f262d9cecefd8a204c49a47ce4fc45 (patch) | |
| tree | dd1da367b4054bc5ea951b07b5e2c49660269e54 | |
| parent | 60185819b62e1c06161c93ebdc1dc73e7813604b (diff) | |
| download | emacs-ef77070727f262d9cecefd8a204c49a47ce4fc45.tar.gz emacs-ef77070727f262d9cecefd8a204c49a47ce4fc45.zip | |
* lisp/subr.el (read-char-from-minibuffer, y-or-n-p): Simplify to use HIST=t.
| -rw-r--r-- | lisp/subr.el | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index ef2edcff102..ca4d52535a0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3306,9 +3306,7 @@ while calling this function, then pressing `help-char' | |||
| 3306 | causes it to evaluate `help-form' and display the result. | 3306 | causes it to evaluate `help-form' and display the result. |
| 3307 | There is no need to explicitly add `help-char' to CHARS; | 3307 | There is no need to explicitly add `help-char' to CHARS; |
| 3308 | `help-char' is bound automatically to `help-form-show'." | 3308 | `help-char' is bound automatically to `help-form-show'." |
| 3309 | (defvar empty-history) | 3309 | (let* ((map (if (consp chars) |
| 3310 | (let* ((empty-history '()) | ||
| 3311 | (map (if (consp chars) | ||
| 3312 | (or (gethash (list help-form (cons help-char chars)) | 3310 | (or (gethash (list help-form (cons help-char chars)) |
| 3313 | read-char-from-minibuffer-map-hash) | 3311 | read-char-from-minibuffer-map-hash) |
| 3314 | (let ((map (make-sparse-keymap)) | 3312 | (let ((map (make-sparse-keymap)) |
| @@ -3335,9 +3333,7 @@ There is no need to explicitly add `help-char' to CHARS; | |||
| 3335 | read-char-from-minibuffer-map)) | 3333 | read-char-from-minibuffer-map)) |
| 3336 | ;; Protect this-command when called from pre-command-hook (bug#45029) | 3334 | ;; Protect this-command when called from pre-command-hook (bug#45029) |
| 3337 | (this-command this-command) | 3335 | (this-command this-command) |
| 3338 | (result | 3336 | (result (read-from-minibuffer prompt nil map nil (or history t))) |
| 3339 | (read-from-minibuffer prompt nil map nil | ||
| 3340 | (or history 'empty-history))) | ||
| 3341 | (char | 3337 | (char |
| 3342 | (if (> (length result) 0) | 3338 | (if (> (length result) 0) |
| 3343 | ;; We have a string (with one character), so return the first one. | 3339 | ;; We have a string (with one character), so return the first one. |
| @@ -3538,9 +3534,7 @@ like) while `y-or-n-p' is running)." | |||
| 3538 | (discard-input))) | 3534 | (discard-input))) |
| 3539 | (t | 3535 | (t |
| 3540 | (setq prompt (funcall padded prompt)) | 3536 | (setq prompt (funcall padded prompt)) |
| 3541 | (defvar empty-history) | 3537 | (let* ((enable-recursive-minibuffers t) |
| 3542 | (let* ((empty-history '()) | ||
| 3543 | (enable-recursive-minibuffers t) | ||
| 3544 | (msg help-form) | 3538 | (msg help-form) |
| 3545 | (keymap (let ((map (make-composed-keymap | 3539 | (keymap (let ((map (make-composed-keymap |
| 3546 | y-or-n-p-map query-replace-map))) | 3540 | y-or-n-p-map query-replace-map))) |
| @@ -3557,7 +3551,7 @@ like) while `y-or-n-p' is running)." | |||
| 3557 | (this-command this-command) | 3551 | (this-command this-command) |
| 3558 | (str (read-from-minibuffer | 3552 | (str (read-from-minibuffer |
| 3559 | prompt nil keymap nil | 3553 | prompt nil keymap nil |
| 3560 | (or y-or-n-p-history-variable 'empty-history)))) | 3554 | (or y-or-n-p-history-variable t)))) |
| 3561 | (setq answer (if (member str '("y" "Y")) 'act 'skip))))) | 3555 | (setq answer (if (member str '("y" "Y")) 'act 'skip))))) |
| 3562 | (let ((ret (eq answer 'act))) | 3556 | (let ((ret (eq answer 'act))) |
| 3563 | (unless noninteractive | 3557 | (unless noninteractive |