GNU bug report logs - #66394
29.1; Make register-read-with-preview more useful

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thievol <at> posteo.net>

Date: Sat, 7 Oct 2023 19:07:01 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Thierry Volpiatto <thievol <at> posteo.net>
To: Bastien Guerry <bzg <at> gnu.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, jonas <at> bernoul.li, 66394 <at> debbugs.gnu.org, stefankangas <at> gmail.com, monnier <at> iro.umontreal.ca
Subject: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Sat, 02 Dec 2023 12:43:32 +0000
[Message part 1 (text/plain, inline)]
Thierry Volpiatto <thievol <at> posteo.net> writes:

> Hi Bastien and Eshel,
>
> Bastien Guerry <bzg <at> gnu.org> writes:
>
>> Hi Thierry,
>>
>> thanks for your anwer.
>>
>> Thierry Volpiatto <thievol <at> posteo.net> 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.
>
> I see, you want to go fast.
> Using read-key+minibuffer, as I said would be a pain to implement,
> hopefully (IIUC) we can use only minibuffer and exit immediately and it
> is simple to implement (3 lines):
>
> 1) Set register-use-preview to nil.
> 2) Apply this patch on register.el:
>
> @@ -388,6 +388,3 @@
> -                              (if (member pat strs)
> -                                  (with-selected-window (minibuffer-window)
> -                                    (minibuffer-message msg pat))
> -                                (with-selected-window (minibuffer-window)
> -                                  (minibuffer-message
> -                                   "Register `%s' is empty" pat)))))))))
> +                              (with-selected-window (minibuffer-window)
> +                                (setq result pat)
> +                                (exit-minibuffer))))))))
>
> 3) Try your "a", "b", "c" registers and also to set a new register, if
> needed you can call C-h to have a preview, in this case you will have to
> hit RET.
>
> Let me know if this is acceptable for you.
>
> Thanks.

Even better is this patch which ask for confirmation when overwriting a
register but not when jumping, inserting or setting a new register:

@@ -388,6 +388,10 @@
-                              (if (member pat strs)
-                                  (with-selected-window (minibuffer-window)
-                                    (minibuffer-message msg pat))
-                                (with-selected-window (minibuffer-window)
-                                  (minibuffer-message
-                                   "Register `%s' is empty" pat)))))))))
+                              (with-selected-window (minibuffer-window)
+                                (if (and (member pat strs) (memq act '(set modify)))
+                                    (with-selected-window (minibuffer-window)
+                                      (minibuffer-message msg pat))
+                                  ;; An empty register or an existing
+                                  ;; one but the action is insert or
+                                  ;; jump, don't ask for confirmation
+                                  ;; and exit immediately.
+                                  (setq result pat)
+                                  (exit-minibuffer)))))))))


-- 
Thierry
[signature.asc (application/pgp-signature, inline)]

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

Previous Next


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