unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thievol@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: michael_heerdegen@web.de, 66394@debbugs.gnu.org,
	stefankangas@gmail.com, monnier@iro.umontreal.ca
Subject: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Mon, 11 Dec 2023 06:55:17 +0000	[thread overview]
Message-ID: <87h6kp44a2.fsf@posteo.net> (raw)
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)")


[-- Attachment #1.1: Type: text/plain, Size: 1828 bytes --]


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

-- 
Thierry

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Don-t-confirm-with-RET-even-when-overwriting-in-regi.patch --]
[-- Type: text/x-diff, Size: 6629 bytes --]

From f5ded67a4e3dfe8ef96971f8018b12cf26c13af2 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.
---
 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
--- 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 register."
-  types msg act smatch)
+  types msg act smatch noconfirm)
 
 (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 accept 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-register)))
+  (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-register)))
+  (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-register)))
+  (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-register)))
+  (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))
 
 (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)
-         types msg result timer act win strs smatch)
+         types msg result timer act win strs smatch noconfirm)
     (if 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))
+        (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= pat "")
                               (with-selected-window (minibuffer-window)
-                                (if (and (member pat strs) (memq act '(set modify)))
+                                (if (and (member pat strs)
+                                         (memq act '(set modify))
+                                         (null noconfirm))
                                     (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 (bug#66394).
+                                  ;; The action is insert or
+                                  ;; jump or noconfirm is specifed
+                                  ;; explicitely, don't ask for
+                                  ;; confirmation and exit immediately (bug#66394).
                                   (setq result pat)
                                   (exit-minibuffer)))))))))
              (setq result (read-from-minibuffer
-- 
2.34.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]

  parent reply	other threads:[~2023-12-11  6:55 UTC|newest]

Thread overview: 121+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07 19:03 bug#66394: 29.1; Make register-read-with-preview more useful Thierry Volpiatto
2023-10-08  6:45 ` bug#66394: [RE] " Thierry Volpiatto
2023-10-12  6:43 ` Thierry Volpiatto
2023-10-14  2:04   ` Richard Stallman
2023-10-14  5:59     ` Thierry Volpiatto
2023-10-16  2:04       ` Richard Stallman
2023-10-15  7:56     ` Thierry Volpiatto
2023-10-15  8:18       ` Stefan Kangas
2023-10-15 10:05         ` Thierry Volpiatto
2023-10-15 12:55           ` Stefan Kangas
2023-11-18 18:39             ` Thierry Volpiatto
2023-10-19  2:42 ` bug#66394: 29.1; " Michael Heerdegen
2023-10-19  6:16   ` Thierry Volpiatto
2023-10-20  5:00     ` Michael Heerdegen
2023-10-20  5:49       ` Thierry Volpiatto
2023-10-21  1:09         ` Michael Heerdegen
2023-10-21  3:34           ` Thierry Volpiatto
2023-10-23  4:09             ` Michael Heerdegen
2023-10-23  5:14               ` Thierry Volpiatto
2023-10-24  3:42                 ` Michael Heerdegen
2023-10-24  3:54                   ` Michael Heerdegen
2023-10-24  5:30                   ` Thierry Volpiatto
2023-10-25  3:54                     ` Michael Heerdegen
2023-10-24  7:19               ` Thierry Volpiatto
2023-10-25  4:10                 ` Michael Heerdegen
2023-10-25  6:38                   ` Thierry Volpiatto
2023-10-26  4:18                     ` Michael Heerdegen
2023-10-26  6:17                       ` Thierry Volpiatto
2023-10-27  1:27                         ` Michael Heerdegen
2023-10-27  4:24                           ` Thierry Volpiatto
2023-11-03  4:58                             ` Michael Heerdegen
2023-11-19 19:37                               ` Thierry Volpiatto
2023-11-20  6:00                               ` Thierry Volpiatto
2023-11-20 17:33                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-20 18:51                                   ` Thierry Volpiatto
2023-11-25 10:23                                     ` Eli Zaretskii
2023-11-25 19:59                                       ` Thierry Volpiatto
2023-11-25 20:10                                         ` Eli Zaretskii
2023-11-25 21:14                                           ` Thierry Volpiatto
2023-11-26 10:38                                             ` Eli Zaretskii
2023-11-26 16:46                                               ` Thierry Volpiatto
2023-11-29 14:04                                             ` Eli Zaretskii
2023-11-29 18:18                                               ` Thierry Volpiatto
2023-11-30  6:00                                                 ` Eli Zaretskii
2023-11-30 10:21                                                   ` Thierry Volpiatto
2023-12-02  5:51                                                   ` Thierry Volpiatto
2023-12-02  7:50                                                     ` Eli Zaretskii
2023-12-02  8:08                                                       ` Thierry Volpiatto
2023-12-03 14:35                                                       ` Thierry Volpiatto
2023-12-03 15:05                                                         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-03 16:48                                                           ` Thierry Volpiatto
2023-12-03 18:29                                                             ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-03 18:39                                                               ` Eli Zaretskii
2023-12-03 21:23                                                                 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-04  7:30                                                                   ` Thierry Volpiatto
2023-12-04  7:57                                                                     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-11  6:55                                                                 ` Thierry Volpiatto [this message]
2023-12-11  9:30                                                       ` Thierry Volpiatto
2023-12-11  9:58                                                         ` Thierry Volpiatto
2023-12-11 12:30                                                         ` Eli Zaretskii
2023-12-11 13:10                                                           ` Thierry Volpiatto
2023-12-11 17:32                                                             ` Thierry Volpiatto
2023-12-11 23:36                                                               ` Dmitry Gutov
2023-12-12  6:29                                                                 ` Thierry Volpiatto
2023-12-12  9:31                                                                   ` Thierry Volpiatto
2023-12-12 10:16                                                                     ` Thierry Volpiatto
2023-12-12 16:44                                                                       ` Thierry Volpiatto
2023-12-14  1:46                                                                       ` Dmitry Gutov
2023-12-14  5:34                                                                         ` Thierry Volpiatto
2023-12-14  7:38                                                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-14  8:24                                                                             ` Eli Zaretskii
2023-12-14  7:44                                                                           ` Eli Zaretskii
2023-12-14 15:50                                                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-14 17:58                                                                               ` Thierry Volpiatto
2023-12-14 19:19                                                                                 ` Andreas Schwab
2023-12-14 20:29                                                                               ` Stefan Kangas
2023-12-15 14:45                                                                                 ` Thierry Volpiatto
2023-12-15 15:18                                                                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-15 18:36                                                                                     ` Thierry Volpiatto
2023-12-15 23:30                                                                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-16 13:18                                                                                         ` Thierry Volpiatto
2023-12-16 15:31                                                                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-16 20:39                                                                                             ` Thierry Volpiatto
2023-12-17 23:20                                                                                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-18  5:15                                                                                                 ` Thierry Volpiatto
2023-12-18 13:20                                                                                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-18 18:11                                                                                                     ` Thierry Volpiatto
2023-12-18 18:22                                                                                                     ` Dmitry Gutov
2023-12-18  6:18                                                                                                 ` Thierry Volpiatto
2023-12-19 17:40                                                                                             ` Thierry Volpiatto
2023-12-19 17:47                                                                                               ` Thierry Volpiatto
2023-12-20 12:05                                                                                               ` Eli Zaretskii
2023-12-20 17:23                                                                                                 ` Thierry Volpiatto
2023-12-21 11:47                                                                                                   ` Eli Zaretskii
2023-12-21 18:04                                                                                                     ` Thierry Volpiatto
2023-12-23 10:49                                                                                                       ` Eli Zaretskii
2023-12-16 15:07                                                                                   ` Dmitry Gutov
2023-12-16 20:20                                                                                     ` Thierry Volpiatto
2023-12-16 23:28                                                                                       ` Dmitry Gutov
2023-12-14  2:10                                                                     ` Dmitry Gutov
2023-12-14  5:30                                                                       ` Thierry Volpiatto
2023-12-14 19:39                                                                   ` Stefan Kangas
2023-12-12  6:06                                                         ` Alfred M. Szmidt
2023-12-12  9:37                                                         ` Steve Perry via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-12 12:15                                                           ` Eli Zaretskii
2023-12-12 17:58                                                             ` Steve Perry via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-25 21:38                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-02  9:24                                 ` Bastien
2023-12-02  9:52                                   ` Thierry Volpiatto
2023-12-02 10:37                                     ` Bastien Guerry
2023-12-02 10:54                                       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-02 11:55                                       ` Thierry Volpiatto
2023-12-02 12:43                                         ` Thierry Volpiatto
2023-12-02 13:02                                           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-02 13:50                                           ` Bastien Guerry
2023-12-02 15:01                                             ` Thierry Volpiatto
2023-12-05  7:34 ` Tino Calancha
2023-12-05  7:38 ` Tino Calancha
2023-12-05  7:43 ` Tino Calancha
2023-12-12  5:46 ` Pedro Andres Aranda Gutierrez
2023-12-12 12:01   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6kp44a2.fsf@posteo.net \
    --to=thievol@posteo.net \
    --cc=66394@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).