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

From: Bastien Guerry <[email-masked]>
Date: Sat, 02 Dec 2023 11:37:55 +0100

Hi Thierry,

thanks for your anwer.

Thierry Volpiatto <[email-masked]> writes:

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

What I am suggesting is to store the register _as soon as_ the user
hits the "b" key.

Since the recent changes, I need to hit one additional keystroke for
zero benefit, which is a net less when you use registers a lot.

I use "a", "b", "c" registers for quick copy and paste and can easily
remember them; when I need more, I use register-list.el.

> 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 might be useful in some cases. I don't suggest to change this. I
suggest to allow the previous behavior for empty registers.

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

I would say this is not a small benefit.

> Also I think hitting RET in any case is better as it does a kind of
> "confirm I want to do this".

IMHO confirmation is good for cases where mistakes can have bad
consequences.  I don't see them when using an empty register.

> Also using read-key leads to bug like we had previously as we must mimic
> a keymap which is often wrong.

I know there are always trade-offs. I just wanted to report the slight
"eww" moment I had wrt this UX change, which I still think is wrong.

If we set this issue aside, I wonder if read-key could be augmented so
that certain keystrokes let the user enter in "editing mode" (a bit
like when users hit C-s then C-e to edit the search string.) I can see
several situations where a read-key prompt would benefit from allowing
to switch to a minibuffer prompt with all the flexibility it provides:

- Allowing for confirmation when overwriting a register is one;

- Allowing to hit two keystrokes to facilitate navigation for C-h:
  e.g. `C-h k l' would list keybindings; `C-h k d` would describe a
  keybinding, etc.

This touches explorations that perhaps Jonas made while designing
transient, so I'm adding him to this conversation.
  
-- 
 Bastien Guerry