bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char


From: Stefan Monnier
Subject: bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char
Date: Thu, 07 Sep 2023 12:47:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii [2023-09-07 18:07:46] wrote:

>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> Date: Thu, 07 Sep 2023 17:53:33 +0300
>> 
>> Hi, I'm not sure this should be treated as bug (and can be fixed), but
>> still I find it inconvenient.
>> 
>> - emacs -Q
>> - Open new buffer in text mode
>> - Type "foo C-q C-i bar"
>> - Now, with point at "foo", isearch for tab character works: "C-s C-q C-i"
>> - But zap-to-char doesn't: "M-z C-q C-i RET" displays "Wrong answer"
>
> That's because we switched to using read-from-minibuffer (via
> read-char-from-minibuffer) instead of using read-char, for the dubious
> benefit of being able to use history in this command, see bug#10477.
> And read-from-minibuffer interprets some characters specially.
>
> Stefan, is there a way to have this cake and eat it, too?

How 'bout the patch below?

AFAICT it would also make it unnecessary to use
`read-char-from-minibuffer-insert-char`.


        Stefan


diff --git a/lisp/subr.el b/lisp/subr.el
index 216981eaf31..5b268e9a069 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3733,7 +3733,14 @@ read-char-from-minibuffer
                 read-char-from-minibuffer-map))
          ;; Protect this-command when called from pre-command-hook (bug#45029)
          (this-command this-command)
-         (result (progn
+         (result (minibuffer-with-setup-hook
+                     (lambda ()
+                       (add-hook 'post-command-hook
+                                 (lambda ()
+                                   (if (= (1+ (minibuffer-prompt-end))
+                                          (point-max))
+                                       (exit-minibuffer)))
+                                 'local))
                    ;; Disable text conversion if it is enabled.
                    ;; (bug#65370)
                    (when (fboundp 'set-text-conversion-style)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]