From a3e10af95c6267c63276fc0452ce810f19885eb6 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 10 Oct 2021 20:31:15 +0300 Subject: [PATCH] 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) --- lisp/subr.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 78767b259d4..8ff403e1139 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3035,6 +3035,7 @@ If there is a natural number at point, use it as default." (set-keymap-parent map minibuffer-local-map) (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 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-down] #'minibuffer-scroll-other-window-down) - (define-key map [escape] #'abort-recursive-edit) - (dolist (symbol '(quit exit exit-prefix)) + (define-key map [remap exit] #'y-or-n-p-insert-other) + (dolist (symbol '(exit-prefix quit)) (define-key map (vector 'remap symbol) #'abort-recursive-edit)) + (define-key map [escape] #'abort-recursive-edit) ;; FIXME: try catch-all instead of explicit bindings: ;; (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'. 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 by consulting the bindings in `query-replace-map'; see the -- 2.39.2