Keep reading when typed RET in read-char-from-minibuffer and y-or-n-p

* lisp/subr.el (read-char-from-minibuffer-map):
Remap exit-minibuffer to read-char-from-minibuffer-insert-other.
(y-or-n-p-map): Remap 'exit' to y-or-n-p-insert-other.
(y-or-n-p): Don't mention RET in docstring.  (Bug#51101)
This commit is contained in:
Juri Linkov 2021-10-10 20:31:15 +03:00
parent 013e3be832
commit a3e10af95c

View file

@ -3035,6 +3035,7 @@ If there is a natural number at point, use it as default."
(set-keymap-parent map minibuffer-local-map) (set-keymap-parent map minibuffer-local-map)
(define-key map [remap self-insert-command] #'read-char-from-minibuffer-insert-char) (define-key map [remap self-insert-command] #'read-char-from-minibuffer-insert-char)
(define-key map [remap exit-minibuffer] #'read-char-from-minibuffer-insert-other)
(define-key map [remap recenter-top-bottom] #'minibuffer-recenter-top-bottom) (define-key map [remap recenter-top-bottom] #'minibuffer-recenter-top-bottom)
(define-key map [remap scroll-up-command] #'minibuffer-scroll-up-command) (define-key map [remap scroll-up-command] #'minibuffer-scroll-up-command)
@ -3152,9 +3153,10 @@ There is no need to explicitly add `help-char' to CHARS;
(define-key map [remap scroll-other-window] #'minibuffer-scroll-other-window) (define-key map [remap scroll-other-window] #'minibuffer-scroll-other-window)
(define-key map [remap scroll-other-window-down] #'minibuffer-scroll-other-window-down) (define-key map [remap scroll-other-window-down] #'minibuffer-scroll-other-window-down)
(define-key map [escape] #'abort-recursive-edit) (define-key map [remap exit] #'y-or-n-p-insert-other)
(dolist (symbol '(quit exit exit-prefix)) (dolist (symbol '(exit-prefix quit))
(define-key map (vector 'remap symbol) #'abort-recursive-edit)) (define-key map (vector 'remap symbol) #'abort-recursive-edit))
(define-key map [escape] #'abort-recursive-edit)
;; FIXME: try catch-all instead of explicit bindings: ;; FIXME: try catch-all instead of explicit bindings:
;; (define-key map [remap t] #'y-or-n-p-insert-other) ;; (define-key map [remap t] #'y-or-n-p-insert-other)
@ -3218,7 +3220,7 @@ PROMPT is also updated to show `help-char' like \"(y, n or C-h) \",
where `help-char' is automatically bound to `help-form-show'. where `help-char' is automatically bound to `help-form-show'.
No confirmation of the answer is requested; a single character is No confirmation of the answer is requested; a single character is
enough. RET and SPC also means yes, and DEL means no. enough. SPC also means yes, and DEL means no.
To be precise, this function translates user input into responses To be precise, this function translates user input into responses
by consulting the bindings in `query-replace-map'; see the by consulting the bindings in `query-replace-map'; see the