Subject: bug#66394: 29.1; Make register-read-with-preview more useful

From: Thierry Volpiatto <[email-masked]>
Date: Sat, 02 Dec 2023 09:52:41 +0000

Bastien <[email-masked]> writes:

> I use registers ~100 times a day, so enhancements here are very
> welcome, thanks!
>
> Thierry Volpiatto <[email-masked]> writes:
>
>> A minibuffer is used now instead of read-key.
>
> I wonder about this, though. It badly hinders my usual flow, where I
> do remember what registers I use and like to store new ones quickly.
>
> When a register is empty, I believe it's more efficient to just read
> the key and store the content in the register directly.
>
> E.g. if the "a" contains "A string" and "b" is an empty register:
>
> - C-x r s would display the preview and copy the region to the "b"
>   register as soon as the "b" key is hit (using read-key).

I suggest you use M-n RET instead if you want to be sure you don't
overwrite a register.
Also don't forget you can now use C-n/p or <up>/<down> to navigate in preview.

> - C-x r s would display the preview and if the user hits "a", it will
>   warn about overwriting the existing register and RET can confirm.

It is what it is doing actually with minibuffer.  Hitting "a" highlight
register "a" and send a message "overwriting register", then you can hit
RET if you want to overwrite.

> This supposes using read-key by default and switch to using a
> minibuffer when the user hits keys for existing registers.
>
> What do you think?

I think using read-key+minibuffer would be very complicated and would
need much more code, this for a small benefit: Saving one key (RET).
Also I think hitting RET in any case is better as it does a kind of
"confirm I want to do this".
Also using read-key leads to bug like we had previously as we must mimic
a keymap which is often wrong.

Thanks.

-- 
Thierry