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: Mon, 11 Dec 2023 06:55:17 +0000 Message-ID: <87h6kp44a2.fsf@posteo.net> References: <87il7ib6cu.fsf@posteo.net> <87ttqcg8gw.fsf@web.de> <87h6mcr8ol.fsf@posteo.net> <87r0l73029.fsf@web.de> <877cmdx8ud.fsf@posteo.net> <jwvjzqcxrnq.fsf-monnier+emacs@gnu.org> <87sf50s1gh.fsf@posteo.net> <83o7ficesp.fsf@gnu.org> <878r6leh9d.fsf@posteo.net> <83il5pbnmh.fsf@gnu.org> <87zfz1cz7s.fsf@posteo.net> <83bkbc7j1o.fsf@gnu.org> <8734wov2wv.fsf@posteo.net> <83v89j6arv.fsf@gnu.org> <87cyvpf8y6.fsf@posteo.net> <83plzp82mb.fsf@gnu.org> <87fs0jtkue.fsf@posteo.net> <m1bkb7qqca.fsf@dazzs-mbp.home> <87a5qrtepm.fsf@posteo.net> <m1r0k3gmww.fsf@dazzs-mbp.home> <837clv6sga.fsf@gnu.org> 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="2865"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, 66394@debbugs.gnu.org, stefankangas@gmail.com, monnier@iro.umontreal.ca To: Eli Zaretskii <eliz@gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 11 07:56:04 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 1rCaCx-0000Y7-8o for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Dec 2023 07:56:03 +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 1rCaCm-0003eX-M5; Mon, 11 Dec 2023 01:55:52 -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 1rCaCh-0003Xm-Ub for bug-gnu-emacs@gnu.org; Mon, 11 Dec 2023 01:55:48 -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 1rCaCh-00016k-Hx for bug-gnu-emacs@gnu.org; Mon, 11 Dec 2023 01:55:47 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rCaCw-0005Wj-3l for bug-gnu-emacs@gnu.org; Mon, 11 Dec 2023 01:56: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: Mon, 11 Dec 2023 06:56:02 +0000 Resent-Message-ID: <handler.66394.B66394.170227775021225@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.170227775021225 (code B ref 66394); Mon, 11 Dec 2023 06:56:02 +0000 Original-Received: (at 66394) by debbugs.gnu.org; 11 Dec 2023 06:55:50 +0000 Original-Received: from localhost ([127.0.0.1]:52306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1rCaCj-0005WH-OS for submit@debbugs.gnu.org; Mon, 11 Dec 2023 01:55:50 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:40535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <thievol@posteo.net>) id 1rCaCe-0005Vu-Ix for 66394@debbugs.gnu.org; Mon, 11 Dec 2023 01:55:48 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CD724240101 for <66394@debbugs.gnu.org>; Mon, 11 Dec 2023 07:55:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1702277723; bh=izjJnKPkb1xun3NX/iwp9LznUCa8SF7obqL2/ZYe82E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Autocrypt:OpenPGP: From; b=VWDePe8pqz9bs0phY1O74kl/PrhMV4ZuWL+V0n9/mM/IxDkBFSDSlXKuUdGOg24mT upn6ipGgacsg4jxEIY3jmzqfPqMAMI9wvH9pvCF4okvHPmvhg79w1vdmnhHN6aXl/4 iyDyLKh7k11LyvQXVljxAJgjkcj29eb3oKNZtXUd8XOErbf6M6kGE+rk5zMdIsOq1v fcLrwkqYCjSUYYb8Poo3PmgxXlynAZSBAmNTBv7jJenQzzYtLPGcijTDAIV0C1yVot GE/AlrIjVyQPcVVEv94jL/U3wqGwoo1jjq3epO69yCU+SZ+9eA4ZGmeO8rJs8HRWyH n7mNgUUcjCx+Q== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SpXZ12LmVz6tsj; Mon, 11 Dec 2023 07:55:21 +0100 (CET) In-Reply-To: <837clv6sga.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 03 Dec 2023 20:39:49 +0200 (1 week, 11 hours, 42 minutes 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:275966 Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/275966> --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hello Eli, I tried to fullfill the requests on Emacs-devel about overwriting a register with no confirmation, this will happen when register-use-preview is nil or 'never. Even with this configuration we still have filtering when preview buffer is visible and in any case we have defaults with M-n available when the register command is of type 'set'. So now to resume the situation: 1) register-use-preview =3D=3D t We have a register-preview buffer with navigation and selected register highlighted, when the register is selected we have to press RET to do the action on this register. Defaults are provided for registers of type set. Registers are filtered depending on the command used. 2) register-use-preview =3D=3D nil We have a register-preview buffer with no navigation and no highlighting. No confirmation with RET is requested, as soon as you enter the register name, minibuffer is exited immediately. Filtering and defaults for register of type set are still provided. 3) register-use-preview =3D=3D 'never Same behavior as 2) but there is no preview buffer at all, however if user type C-h, a preview buffer is provided behaving like 1) i.e. RET is requested when selecting a register. 4) For registers which are key sequence e.g. C-a For entering manually in minibuffer such a register one have to hit C-d C-a. This is now the only thing that differ from Emacs-29.1 behavior. Let me know if I can push this patch. I think all this is a real improvement for Emacs despite the several complaints we had recently, however if all the arrangements I did are not enough, we could add a new variable register-read-preview-function and reinstall the old code exactly as it was (it's easy, let me know if you want this I will provide the patch). Thanks. =2D-=20 Thierry --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Don-t-confirm-with-RET-even-when-overwriting-in-regi.patch Content-Transfer-Encoding: quoted-printable From=20f5ded67a4e3dfe8ef96971f8018b12cf26c13af2 Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto <thievol@posteo.net> Date: Mon, 11 Dec 2023 07:02:40 +0100 Subject: [PATCH] Don't confirm with RET even when overwriting in register commands This happen when register-use-preview is nil or never. This reproduce what we had previously in 29.1 but with filtering in the preview and default registers are provided for the commands of type 'set'. This is implemented with cl-defmethod to keep the code as much as possible configurable. * lisp/register.el (register-preview-info): New slot. (register-command-info): Add new methods for copy-to-register, point-to-register, number-to-register, window-configuration-to-register, frameset-to-register and copy-rectangle-to-register. (register-read-with-preview): Bind noconfirm. =2D-- lisp/register.el | 67 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/lisp/register.el b/lisp/register.el index ade65b5bdc2..2f2f5682e34 100644 =2D-- a/lisp/register.el +++ b/lisp/register.el @@ -155,7 +155,7 @@ TYPES are the types of register supported. MSG is the minibuffer message to send when a register is selected. ACT is the type of action the command is doing on register. SMATCH accept a boolean value to say if command accept non matching regist= er." =2D types msg act smatch) + types msg act smatch noconfirm) =20 (cl-defgeneric register-command-info (command) "Returns a `register-preview-info' object storing data for COMMAND." @@ -178,24 +178,66 @@ SMATCH accept a boolean value to say if command accep= t non matching register." :types '(all) :msg "View register `%s'" :act 'view + :noconfirm (memq register-preview-use-preview '(nil never)) :smatch t)) (cl-defmethod register-command-info ((_command (eql append-to-register))) (make-register-preview-info :types '(string number) :msg "Append to register `%s'" :act 'modify + :noconfirm (memq register-preview-use-preview '(nil never)) :smatch t)) (cl-defmethod register-command-info ((_command (eql prepend-to-register))) (make-register-preview-info :types '(string number) :msg "Prepend to register `%s'" :act 'modify + :noconfirm (memq register-preview-use-preview '(nil never)) :smatch t)) (cl-defmethod register-command-info ((_command (eql increment-register))) (make-register-preview-info :types '(string number) :msg "Increment register `%s'" :act 'modify + :noconfirm (memq register-preview-use-preview '(nil never)) + :smatch t)) +(cl-defmethod register-preview-command-info ((_command (eql copy-to-regist= er))) + (make-register-preview-info + :types '(all) + :msg "Copy to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)))) +(cl-defmethod register-preview-command-info ((_command (eql point-to-regis= ter))) + (make-register-preview-info + :types '(all) + :msg "Point to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)))) +(cl-defmethod register-preview-command-info ((_command (eql number-to-regi= ster))) + (make-register-preview-info + :types '(all) + :msg "Number to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)))) +(cl-defmethod register-preview-command-info + ((_command (eql window-configuration-to-register))) + (make-register-preview-info + :types '(all) + :msg "Window configuration to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)))) +(cl-defmethod register-preview-command-info ((_command (eql frameset-to-re= gister))) + (make-register-preview-info + :types '(all) + :msg "Frameset to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)))) +(cl-defmethod register-preview-command-info ((_command (eql copy-rectangle= -to-register))) + (make-register-preview-info + :types '(all) + :msg "Copy rectangle to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)) :smatch t)) =20 (defun register-preview-forward-line (arg) @@ -327,12 +369,13 @@ display such a window regardless." m)) (data (register-command-info this-command)) (enable-recursive-minibuffers t) =2D types msg result timer act win strs smatch) + types msg result timer act win strs smatch noconfirm) (if data =2D (setq types (register-preview-info-types data) =2D msg (register-preview-info-msg data) =2D act (register-preview-info-act data) =2D smatch (register-preview-info-smatch data)) + (setq types (register-preview-info-types data) + msg (register-preview-info-msg data) + act (register-preview-info-act data) + smatch (register-preview-info-smatch data) + noconfirm (register-preview-info-noconfirm data)) (setq types '(all) msg "Overwrite register `%s'" act 'set)) @@ -399,13 +442,15 @@ display such a window regardless." "Register `%s' is empty" pat)))))) (unless (string=3D pat "") (with-selected-window (minibuffer-window) =2D (if (and (member pat strs) (memq act '(s= et modify))) + (if (and (member pat strs) + (memq act '(set modify)) + (null noconfirm)) (with-selected-window (minibuffer-wind= ow) (minibuffer-message msg pat)) =2D ;; An empty register or an existing =2D ;; one but the action is insert or =2D ;; jump, don't ask for confirmation =2D ;; and exit immediately (bug#66394). + ;; The action is insert or + ;; jump or noconfirm is specifed + ;; explicitely, don't ask for + ;; confirmation and exit immediately (bu= g#66394). (setq result pat) (exit-minibuffer))))))))) (setq result (read-from-minibuffer =2D-=20 2.34.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmV2slYTHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvkx2LC/9f89SCmhvlaQkKlD+NEDTodxlVAYfN fB7gGHdkky+2p8MAb0fu7U2+lcXSMWi08kDAuySBLVS+Ip5VakNjoccDqpmu5J9v WsD01F5C56lTLT+lsrbnUMj6U2cpBOMhi+Gjt5SEZY76wlABiFC+UrgTgAyNK5az lsk7ItJ3+nJJN1NGWRym9S85izM5/oz5OV1s/oeo2hLaB0qbLHwRU7IOtlWoLm0z Nau5UldAP2uWipGc0+nvfMx6r0nHfKerSPaXNd7Dp6HELtrgyrBZBjj948yrDgSq M5yDptMGDAnod+ZAvvmEYCN2r2UY2srQu96az8FY5A1vUaNaaY7NSiOHeUw88OlU N92x579uJuli04owjKt0+29RqSwiMoB2iqRS9pk6Ou2SiSvyBJYflrwKhrTwvOO8 L2CyBNfxCWZCDt118kCXElZnLmH7daSShKPtf1IpHElkXNQ+CD51wxLVGTWr+CXo 6mG4A40Yx83DFzr964jKL77NvejFJeolr8M= =quB0 -----END PGP SIGNATURE----- --==-=-=--