From 6a4b6c3e836ce06bb1f69615bbdcb6745d2aff6f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 19 Aug 2023 08:48:20 +0800 Subject: [PATCH] Disable text conversion within read-char-from-minibuffer * lisp/subr.el (read-char-from-minibuffer): Disable text conversion. (bug#65370) (y-or-n-p): Remove redundant binding of `override-text-conversion-style', given that read-key already disables text conversion. * src/textconv.c (Fset_text_conversion_style): Always reset text conversion for the selected frame in addition to any displaying current_buffer. --- lisp/subr.el | 10 ++++++---- src/textconv.c | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 51545fb5f11..f6332ce35e6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3569,7 +3569,12 @@ 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 t))) + (result (progn + ;; Disable text conversion if it is enabled. + ;; (bug#65370) + (when (fboundp 'set-text-conversion-style) + (set-text-conversion-style text-conversion-style)) + (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. @@ -3753,9 +3758,6 @@ like) while `y-or-n-p' is running)." (while (let* ((scroll-actions '(recenter scroll-up scroll-down scroll-other-window scroll-other-window-down)) - ;; Disable text conversion so that real key events - ;; are sent. - (overriding-text-conversion-style nil) (key (let ((cursor-in-echo-area t)) (when minibuffer-auto-raise diff --git a/src/textconv.c b/src/textconv.c index 60f3ba80577..a4de991ef02 100644 --- a/src/textconv.c +++ b/src/textconv.c @@ -2138,7 +2138,10 @@ replacement key sequence returned starts a new key sequence and makes if (WINDOW_LIVE_P (f->old_selected_window) && FRAME_WINDOW_P (f) && EQ (XWINDOW (f->old_selected_window)->contents, - buffer)) + buffer) + /* Always reset the text conversion style of the + selected frame. */ + || (f == SELECTED_FRAME ())) { block_input (); reset_frame_state (f); -- 2.39.2