From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Thierry Volpiatto <thievol@posteo.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Sat, 02 Dec 2023 12:43:32 +0000
Message-ID: <87msusepvv.fsf@posteo.net>
References: <87il7ib6cu.fsf@posteo.net> <87sf67qqmp.fsf@web.de>
 <875y3386ep.fsf@posteo.net> <87a5sddh14.fsf@web.de>
 <8734y5vnj7.fsf@posteo.net> <87bkcslr18.fsf@web.de>
 <87y1fwtyrl.fsf@posteo.net> <87y1fut1wp.fsf@web.de>
 <87ttqgpjiz.fsf@posteo.net> <87wmvbibpr.fsf@web.de>
 <877cnb2n63.fsf@posteo.net> <8734xyc8z0.fsf@web.de>
 <87zg05rewi.fsf@posteo.net> <87ttqcg8gw.fsf@web.de>
 <87h6mcr8ol.fsf@posteo.net> <87r0l73029.fsf@web.de>
 <877cmdx8ud.fsf@posteo.net> <87v89hufbw.fsf@gnu.org>
 <87zfytdj86.fsf@posteo.net> <87plzo3n5o.fsf@bzg.fr>
 <87ttp0es35.fsf@posteo.net>
Mime-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="18411"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: Michael Heerdegen <michael_heerdegen@web.de>, jonas@bernoul.li,
 66394@debbugs.gnu.org, stefankangas@gmail.com, monnier@iro.umontreal.ca
To: Bastien Guerry <bzg@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 02 13:44:10 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1r9PLt-0004aT-M3
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Dec 2023 13:44:09 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1r9PLg-0004NP-Lo; Sat, 02 Dec 2023 07:43:56 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1r9PLe-0004N9-Ow
 for bug-gnu-emacs@gnu.org; Sat, 02 Dec 2023 07:43:54 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1r9PLd-0006wz-Gg
 for bug-gnu-emacs@gnu.org; Sat, 02 Dec 2023 07:43:53 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1r9PLm-000617-EL
 for bug-gnu-emacs@gnu.org; Sat, 02 Dec 2023 07:44:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Thierry Volpiatto <thievol@posteo.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 02 Dec 2023 12:44:02 +0000
Resent-Message-ID: <handler.66394.B66394.170152103523109@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 66394
X-GNU-PR-Package: emacs
Original-Received: via spool by 66394-submit@debbugs.gnu.org id=B66394.170152103523109
 (code B ref 66394); Sat, 02 Dec 2023 12:44:02 +0000
Original-Received: (at 66394) by debbugs.gnu.org; 2 Dec 2023 12:43:55 +0000
Original-Received: from localhost ([127.0.0.1]:56852 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1r9PLf-00060d-6s
 for submit@debbugs.gnu.org; Sat, 02 Dec 2023 07:43:55 -0500
Original-Received: from mout01.posteo.de ([185.67.36.65]:48801)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <thievol@posteo.net>) id 1r9PLd-00060R-Gv
 for 66394@debbugs.gnu.org; Sat, 02 Dec 2023 07:43:54 -0500
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 8CE8B24002B
 for <66394@debbugs.gnu.org>; Sat,  2 Dec 2023 13:43:38 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1701521018; bh=CsDBnsT0WMU/CeHG0IFlDCS2B+K7hui/Vieav7TfCtQ=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Autocrypt:OpenPGP:
 From;
 b=gmezI7AgzFWUC1oA9Owi5kakRQ9+5ODvT0DE1xnRMQg9SGKJyjhT3GewbDWD7iPZ1
 zwGZcCT7SM3U0uiO4rwgkekL3fgD9LKcoG22xwTfffvGIXGzXCERTL8/yvu96Pk7Q3
 pBVpJiJEbxxz14LcEBTuvTSXM8CSbOxMiFjUokTJvraUPz/WnY3MeoUlH+NrWakNWy
 5yNzTLaK0U5Vv5pePNdMV4jWPu2Tg1m2U30Wl9H6w5q2V/ud0cVX5piGa9U5v4yKfs
 gJg8TJtx4zNKON0/9TVWKR8FPTs6S479DHQe9vT0wXOLQWEALORNl/8ZICVV9xuFy7
 tidA6h1vax8+Q==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Sj8jz3KX7z6tmv;
 Sat,  2 Dec 2023 13:43:35 +0100 (CET)
In-Reply-To: <87ttp0es35.fsf@posteo.net> (Thierry Volpiatto's message of "Sat, 
 02 Dec 2023 12:55:58 +0100 (45 minutes, 33 seconds ago)")
Autocrypt: addr=thievol@posteo.net; prefer-encrypt=mutual;
 keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA
 edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p
 kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb
 tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ
 GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC
 WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha
 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA
 Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA
 FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h
 Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslx
 hU46VSz1Z83NwIG3mpdYNV5WUTUdgzxExHTNTFCd7NKv0nlHKQaA 
OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:275371
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/275371>

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Thierry Volpiatto <thievol@posteo.net> writes:

> Hi Bastien and Eshel,
>
> Bastien Guerry <bzg@gnu.org> writes:
>
>> Hi Thierry,
>>
>> thanks for your anwer.
>>
>> Thierry Volpiatto <thievol@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-wind=
ow)
> -                                    (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 @@
=2D                              (if (member pat strs)
=2D                                  (with-selected-window (minibuffer-wind=
ow)
=2D                                    (minibuffer-message msg pat))
=2D                                (with-selected-window (minibuffer-window)
=2D                                  (minibuffer-message
=2D                                   "Register `%s' is empty" pat)))))))))
+                              (with-selected-window (minibuffer-window)
+                                (if (and (member pat strs) (memq act '(set=
 modify)))
+                                    (with-selected-window (minibuffer-wind=
ow)
+                                      (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)))))))))


=2D-=20
Thierry

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmVrJnQTHHRoaWV2b2xA
cG9zdGVvLm5ldAAKCRAOxW0UHRbvk8ALDACcAup1tIpaRjExuTqRKSU1hQIPyF8I
nd9H8knuAszcgvrvTkbXeGflDef9MEbhO0EQQO20WX8zmEzxzZksujljbNnobdA4
A0OgWJg401Vqn/I0pZVyDrt5TQdnlDcpXwfYlmHP+3UcBCcpnkoajka1qto7kpia
0sHkzrqJBvtqeeyZs0PEJxUVs8f0SM43YoD6dNvL7OVHOXY3awGXueTNElN27FfY
j4g4RvgVPhCoo8GAWkPf2cJv5Yhk8Urzl5GHFkBXxHYnmGB9KcMHN5QfMPWexakq
UM61eMtwwrYXrzDeKPEZSO3LvdWCRRWqDG0wfAOv/Ya42sexPzUG4wR6teH+MC5r
5W8W9VNdvjX4cksJEg59zi4sJ75ULouXGr0bgpIL7TYYcK4QDJyaQrADUTNfH0/o
dA/WYdHEVOz63CgSSlI5ykfqSg4W6TIEIo8nqKp50IT/9R06Jaw8napva5Z4FFXk
TMY7UxZq2QxK/O7LuAdeFaUY8uI5L+dRjxE=
=7oHH
-----END PGP SIGNATURE-----
--=-=-=--