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

Previous Next

Package: emacs;

Reported by: Filipp Gunbin <fgunbin <at> fastmail.fm>

Date: Thu, 7 Sep 2023 14:54:02 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Filipp Gunbin <fgunbin <at> fastmail.fm>, 65805 <at> debbugs.gnu.org
Subject: bug#65805: 30.0.50; quoted-insert doesn't work in zap-to-char
Date: Thu, 14 Sep 2023 09:45:05 +0300
>> @@ -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").

Hmm, maybe then RET should be bound to a command that signals an error
since the behavior is undefined for the case when the minibuffer gets
more characters than one, or when the minibuffer is empty.

>> 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)

I have only one doubt how this will affect the users who already bind
this command in own configs.  Probably there should be no problems.

>> @@ -3589,7 +3593,15 @@ read-char-from-minibuffer
>> +         (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?

Picking just the first char looks like a random choice.  So indeed maybe
better to signal an error.




This bug report was last modified 1 year and 247 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.