[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: |
Wed, 13 Sep 2023 13:48:34 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> `read-char-from-minibuffer` usually doesn't require the user to use an
>> explicit key to exit (because it tries to mimic `read-char`).
> I don't remember how I got into a situation that required typing RET
> to exit the minibuffer. Probably pasted a character into the minibuffer
> with C-y. I see that your patch handles this now.
Yes, I tested `C-y` as well :-)
Tho the ideal behavior when doing things like "C-y inserts a string of
length > 1" is unclear.
> @@ -3499,7 +3499,7 @@ read-char-from-minibuffer-map
> (let ((map (make-sparse-keymap)))
> (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)
>
> Maybe remapping exit-minibuffer is not needed anymore too?
I think it's still needed (RET would otherwise cause exit with an empty
minibuffer, and hence no "char").
> @@ -3530,7 +3530,7 @@ read-char-from-minibuffer-insert-other
> such key, this command discard all minibuffer input and displays
> an error message."
> (interactive)
> - (when (minibufferp)
> + (when (minibufferp) ;;FIXME: Why?
>
> Because of bug#45029.
Thank you.
> Maybe this bug number should be mentioned in the comments.
[ Or maybe I should have bothered to `C-x v h` :-( ]
> Interesting that [remap self-insert-command] is applied even to the
> commands explicitly bound to 'self-insert-command' in the same keymap.
Indeed, the command remapping doesn't pay attention to "in which keymap
did I find this binding". We could try and refine it, but it could be
a lot of work, I think.
> I see no way to override this. So 'read-char-from-minibuffer-insert-char'
> can't be replaced with 'self-insert-command'.
Exactly. We could use something like:
(defalias 'read-char-from-minibuffer-insert-char 'self-insert-command)
> @@ -3589,7 +3593,15 @@ 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 ()
> + ;; FIXME: Should we use `<='?
> + (if (= (1+ (minibuffer-prompt-end))
> + (point-max))
> + (exit-minibuffer)))
> + nil 'local))
>
> I think we should use `<=' to handle the case when a string with
> more than 1 character is pasted with 'C-y'.
Indeed, that's one option. But I was thinking that maybe we should try
and signal an error. Do the users really expect that yanking a string
into that prompt will end up picking just the first char of that string?
Stefan
- bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char, Filipp Gunbin, 2023/09/07
- bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char, Eli Zaretskii, 2023/09/10
- bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char, Stefan Monnier, 2023/09/10
- bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char, Eli Zaretskii, 2023/09/11
- bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char, Stefan Monnier, 2023/09/12