* Adding a binding for 'undo-redo'
@ 2021-09-29 1:56 Dmitry Gutov
2021-09-29 5:38 ` Lars Ingebrigtsen
2021-09-29 16:25 ` [External] : " Drew Adams
0 siblings, 2 replies; 16+ messages in thread
From: Dmitry Gutov @ 2021-09-29 1:56 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
Hi all,
This discussion has been living in a subthread, but I think it deserves
a separate one, for all to see.
The main technical hurdle to adding this binding was the lack of a good
binding, but Richard suggested C-? and C-M-_, which should cover both
GUI Emacs and tty. This change doesn't change the existing 'undo'
binding, so it's not going to break anybody's workflow. But it adds a
key combination we can recommend to the users who are accustomed to
separate 'undo' and 'redo' commands.
WDYT? Should we add this to Emacs 28?
A follow-up patch could add 'undo-redo' to cua-mode as well.
[-- Attachment #2: undo-redo-bindings.diff --]
[-- Type: text/x-patch, Size: 1680 bytes --]
diff --git a/etc/NEWS b/etc/NEWS
index 21cc3c50cd..6b1e74eddd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -957,7 +957,11 @@ for CJK text mixed with Latin text.
+++
** New command 'undo-redo'.
It undoes previous undo commands, but doesn't record itself as an
-undoable command.
+undoable command. It is bound to 'C-?' and 'C-M-_', the first binding
+works well in graphical mode, and the second one is easy to hit on tty.
+
+For full conventional undo/redo behavior, you can also customize the
+user option 'undo-no-redo' to t.
+++
** New commands 'copy-matching-lines' and 'kill-matching-lines'.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 343f1ba0fa..9a3505058c 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -994,6 +994,9 @@ undo-repeat-map
"Keymap to repeat undo key sequences `C-x u u'. Used in `repeat-mode'.")
(put 'undo 'repeat-map 'undo-repeat-map)
+(define-key global-map (kbd "C-?") 'undo-redo)
+(define-key global-map [?\C-\M-_] 'undo-redo)
+
(define-key esc-map "!" 'shell-command)
(define-key esc-map "|" 'shell-command-on-region)
(define-key esc-map "&" 'async-shell-command)
diff --git a/lisp/simple.el b/lisp/simple.el
index dd480396f6..7eba33116d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2942,8 +2942,9 @@ undo-equiv-table
(defvar undo-in-region nil
"Non-nil if `pending-undo-list' is not just a tail of `buffer-undo-list'.")
-(defvar undo-no-redo nil
- "If t, `undo' doesn't go through redo entries.")
+(defcustom undo-no-redo nil
+ "If t, `undo' doesn't go through redo entries."
+ :type 'boolean)
(defvar pending-undo-list nil
"Within a run of consecutive undo commands, list remaining to be undone.
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: Adding a binding for 'undo-redo'
2021-09-29 1:56 Adding a binding for 'undo-redo' Dmitry Gutov
@ 2021-09-29 5:38 ` Lars Ingebrigtsen
2021-09-29 11:26 ` Dmitry Gutov
2021-09-29 13:02 ` Eli Zaretskii
2021-09-29 16:25 ` [External] : " Drew Adams
1 sibling, 2 replies; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-29 5:38 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: emacs-devel
Dmitry Gutov <dgutov@yandex.ru> writes:
> The main technical hurdle to adding this binding was the lack of a
> good binding, but Richard suggested C-? and C-M-_, which should cover
> both GUI Emacs and tty. This change doesn't change the existing 'undo'
> binding, so it's not going to break anybody's workflow. But it adds a
> key combination we can recommend to the users who are accustomed to
> separate 'undo' and 'redo' commands.
I think that sounds like a good idea.
> WDYT? Should we add this to Emacs 28?
My preference would be to put it in Emacs 29, but I won't object if Eli
prefers to put it in Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Adding a binding for 'undo-redo'
2021-09-29 5:38 ` Lars Ingebrigtsen
@ 2021-09-29 11:26 ` Dmitry Gutov
2021-09-29 12:21 ` Bozhidar Batsov
` (2 more replies)
2021-09-29 13:02 ` Eli Zaretskii
1 sibling, 3 replies; 16+ messages in thread
From: Dmitry Gutov @ 2021-09-29 11:26 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
On 29.09.2021 08:38, Lars Ingebrigtsen wrote:
>> WDYT? Should we add this to Emacs 28?
> My preference would be to put it in Emacs 29, but I won't object if Eli
> prefers to put it in Emacs 28.
Any particular reason to delay it?
The odds of breakage are minimal, and we'll start collecting feedback a
few more years earlier.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Adding a binding for 'undo-redo'
2021-09-29 11:26 ` Dmitry Gutov
@ 2021-09-29 12:21 ` Bozhidar Batsov
2021-09-29 15:50 ` Lars Ingebrigtsen
2021-09-29 16:26 ` [External] : " Drew Adams
2 siblings, 0 replies; 16+ messages in thread
From: Bozhidar Batsov @ 2021-09-29 12:21 UTC (permalink / raw)
To: Emacs Devel
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
I also think it's a good idea to make this change sooner. There's little point in delaying tiny/safe changes for years.
On Wed, Sep 29, 2021, at 2:26 PM, Dmitry Gutov wrote:
> On 29.09.2021 08:38, Lars Ingebrigtsen wrote:
> >> WDYT? Should we add this to Emacs 28?
> > My preference would be to put it in Emacs 29, but I won't object if Eli
> > prefers to put it in Emacs 28.
>
> Any particular reason to delay it?
>
> The odds of breakage are minimal, and we'll start collecting feedback a
> few more years earlier.
>
>
[-- Attachment #2: Type: text/html, Size: 925 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Adding a binding for 'undo-redo'
2021-09-29 11:26 ` Dmitry Gutov
2021-09-29 12:21 ` Bozhidar Batsov
@ 2021-09-29 15:50 ` Lars Ingebrigtsen
2021-09-29 19:37 ` Dmitry Gutov
2021-09-29 16:26 ` [External] : " Drew Adams
2 siblings, 1 reply; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-29 15:50 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: emacs-devel
Dmitry Gutov <dgutov@yandex.ru> writes:
> Any particular reason to delay it?
Just that we're very close to cutting the release branch.
> The odds of breakage are minimal, and we'll start collecting feedback
> a few more years earlier.
You can say that about a huge number of proposed new changes and new key
bindings. I don't see anything special about this one.
But as I said, if Eli's in favour of it, I'm not opposed to it, and it
sounded like he's in favour of it? (Or at least not opposed to it. :-))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Adding a binding for 'undo-redo'
2021-09-29 15:50 ` Lars Ingebrigtsen
@ 2021-09-29 19:37 ` Dmitry Gutov
0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Gutov @ 2021-09-29 19:37 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
On 29.09.2021 18:50, Lars Ingebrigtsen wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>> Any particular reason to delay it?
>
> Just that we're very close to cutting the release branch.
>
>> The odds of breakage are minimal, and we'll start collecting feedback
>> a few more years earlier.
>
> You can say that about a huge number of proposed new changes and new key
> bindings. I don't see anything special about this one.
I would probably handle all similarly safe changes the same way, as long
as we're sure in each case that the change is wanted, and it's
implemented in a way that we're unlikely to regret later.
> But as I said, if Eli's in favour of it, I'm not opposed to it, and it
> sounded like he's in favour of it? (Or at least not opposed to it. :-))
Cool. :-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [External] : Re: Adding a binding for 'undo-redo'
2021-09-29 11:26 ` Dmitry Gutov
2021-09-29 12:21 ` Bozhidar Batsov
2021-09-29 15:50 ` Lars Ingebrigtsen
@ 2021-09-29 16:26 ` Drew Adams
2 siblings, 0 replies; 16+ messages in thread
From: Drew Adams @ 2021-09-29 16:26 UTC (permalink / raw)
To: Dmitry Gutov, Lars Ingebrigtsen; +Cc: emacs-devel@gnu.org
> Any particular reason to delay it?
Any particular reason to even propose it now?
> The odds of breakage are minimal, and we'll start collecting feedback a
> few more years earlier.
Since when do we add _default_ bindings to collect feedback?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Adding a binding for 'undo-redo'
2021-09-29 5:38 ` Lars Ingebrigtsen
2021-09-29 11:26 ` Dmitry Gutov
@ 2021-09-29 13:02 ` Eli Zaretskii
1 sibling, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2021-09-29 13:02 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel, dgutov
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 29 Sep 2021 07:38:40 +0200
> Cc: emacs-devel@gnu.org
>
> Dmitry Gutov <dgutov@yandex.ru> writes:
>
> > The main technical hurdle to adding this binding was the lack of a
> > good binding, but Richard suggested C-? and C-M-_, which should cover
> > both GUI Emacs and tty. This change doesn't change the existing 'undo'
> > binding, so it's not going to break anybody's workflow. But it adds a
> > key combination we can recommend to the users who are accustomed to
> > separate 'undo' and 'redo' commands.
>
> I think that sounds like a good idea.
>
> > WDYT? Should we add this to Emacs 28?
>
> My preference would be to put it in Emacs 29, but I won't object if Eli
> prefers to put it in Emacs 28.
I don't object having this in Emacs 28.
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [External] : Adding a binding for 'undo-redo'
2021-09-29 1:56 Adding a binding for 'undo-redo' Dmitry Gutov
2021-09-29 5:38 ` Lars Ingebrigtsen
@ 2021-09-29 16:25 ` Drew Adams
2021-09-29 16:34 ` Eli Zaretskii
` (2 more replies)
1 sibling, 3 replies; 16+ messages in thread
From: Drew Adams @ 2021-09-29 16:25 UTC (permalink / raw)
To: Dmitry Gutov, emacs-devel@gnu.org
> The main technical hurdle to adding this binding was the lack of a good
> binding, but Richard suggested C-? and C-M-_, which should cover both
> GUI Emacs and tty. This change doesn't change the existing 'undo'
> binding, so it's not going to break anybody's workflow. But it adds a
> key combination we can recommend to the users who are accustomed to
> separate 'undo' and 'redo' commands.
>
> WDYT? Should we add this to Emacs 28?
Why promote a default binding before users have,
themselves, actually been binding the command
for a while?
Just because we add a command, and it might be
useful, and it might get used, and users might
bind it, doesn't mean that it needs to have a
default binding.
A fortiori, if users haven't (yet) been binding
it for a while, or if we don't know they have.
The "technical hurdle" of finding a good binding
isn't the place to start. The place to start is
to wait for users to use and bind it, and then
see how much a default binding would make sense.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [External] : Adding a binding for 'undo-redo'
2021-09-29 16:25 ` [External] : " Drew Adams
@ 2021-09-29 16:34 ` Eli Zaretskii
2021-09-29 16:46 ` Manuel Uberti
2021-09-29 17:08 ` Alfred M. Szmidt
2 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2021-09-29 16:34 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel, dgutov
> From: Drew Adams <drew.adams@oracle.com>
> Date: Wed, 29 Sep 2021 16:25:33 +0000
>
> Why promote a default binding before users have,
> themselves, actually been binding the command
> for a while?
Because we have pretty good ideas what those keys should be to be easy
to remember.
> Just because we add a command
We didn't add these commands.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [External] : Adding a binding for 'undo-redo'
2021-09-29 16:25 ` [External] : " Drew Adams
2021-09-29 16:34 ` Eli Zaretskii
@ 2021-09-29 16:46 ` Manuel Uberti
2021-09-29 17:08 ` Alfred M. Szmidt
2 siblings, 0 replies; 16+ messages in thread
From: Manuel Uberti @ 2021-09-29 16:46 UTC (permalink / raw)
To: emacs-devel
On 29/09/21 18:25, Drew Adams wrote:
> Why promote a default binding before users have,
> themselves, actually been binding the command
> for a while?
FWIW, I've been using C-S-z for undo-redo for a long time, which I use as the
counterpart of C-z which I bound to undo-only.
--
Manuel Uberti
www.manueluberti.eu
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [External] : Adding a binding for 'undo-redo'
2021-09-29 16:25 ` [External] : " Drew Adams
2021-09-29 16:34 ` Eli Zaretskii
2021-09-29 16:46 ` Manuel Uberti
@ 2021-09-29 17:08 ` Alfred M. Szmidt
2021-09-29 17:25 ` Drew Adams
2 siblings, 1 reply; 16+ messages in thread
From: Alfred M. Szmidt @ 2021-09-29 17:08 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel, dgutov
The "technical hurdle" of finding a good binding
isn't the place to start. The place to start is
to wait for users to use and bind it, and then
see how much a default binding would make sense.
Here lies chaos.
For coherent design, and logical keybindings, one cannot wait until
users have bound a key. It is a good indication of what might be
used, but not what might make sense in the grand picture.
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [External] : Adding a binding for 'undo-redo'
2021-09-29 17:08 ` Alfred M. Szmidt
@ 2021-09-29 17:25 ` Drew Adams
2021-09-29 19:17 ` Dmitry Gutov
2021-09-30 7:13 ` Alfred M. Szmidt
0 siblings, 2 replies; 16+ messages in thread
From: Drew Adams @ 2021-09-29 17:25 UTC (permalink / raw)
To: Alfred M. Szmidt; +Cc: emacs-devel@gnu.org, dgutov@yandex.ru
> The "technical hurdle" of finding a good binding
> isn't the place to start. The place to start is
> to wait for users to use and bind it, and then
> see how much a default binding would make sense.
>
> Here lies chaos.
>
> For coherent design, and logical keybindings, one cannot wait until
> users have bound a key. It is a good indication of what might be
> used, but not what might make sense in the grand picture.
There may not be a reason to always wait - agreed.
("One cannot wait" ever is clearly wrong, though.)
It doesn't follow that every command should get a
default key binding. And how new the redo command
is isn't really the question, on its own.
The question really should be how useful the command
is, in practice: How much are users using it, and how
important would it be for it to have a default binding?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [External] : Adding a binding for 'undo-redo'
2021-09-29 17:25 ` Drew Adams
@ 2021-09-29 19:17 ` Dmitry Gutov
2021-09-29 19:29 ` Drew Adams
2021-09-30 7:13 ` Alfred M. Szmidt
1 sibling, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2021-09-29 19:17 UTC (permalink / raw)
To: Drew Adams, Alfred M. Szmidt; +Cc: emacs-devel@gnu.org
On 29.09.2021 20:25, Drew Adams wrote:
> It doesn't follow that every command should get a
> default key binding.
That's not what we're doing here.
> The question really should be how useful the command
> is, in practice: How much are users using it, and how
> important would it be for it to have a default binding?
Yes.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [External] : Adding a binding for 'undo-redo'
2021-09-29 17:25 ` Drew Adams
2021-09-29 19:17 ` Dmitry Gutov
@ 2021-09-30 7:13 ` Alfred M. Szmidt
1 sibling, 0 replies; 16+ messages in thread
From: Alfred M. Szmidt @ 2021-09-30 7:13 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel, dgutov
> The "technical hurdle" of finding a good binding
> isn't the place to start. The place to start is
> to wait for users to use and bind it, and then
> see how much a default binding would make sense.
>
> Here lies chaos.
>
> For coherent design, and logical keybindings, one cannot wait until
> users have bound a key. It is a good indication of what might be
> used, but not what might make sense in the grand picture.
There may not be a reason to always wait - agreed.
("One cannot wait" ever is clearly wrong, though.)
It doesn't follow that every command should get a
default key binding. And how new the redo command
is isn't really the question, on its own.
Nobody is suggesting that, and even if it was a suggestion it might
make sense -- if keyboards had more modifiers, more keys, that would
allow for a mapping of all commands to keybindings.
The question really should be how useful the command
is, in practice: How much are users using it, and how
important would it be for it to have a default binding?
That is always a call someone has to make, and ultimatley what you
find useful, I might not. There are many keybindings in Emacs that I
do not use.
The command and keybindings seem useful enough in my eyes, but I won't
use them.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2021-09-30 7:13 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-29 1:56 Adding a binding for 'undo-redo' Dmitry Gutov
2021-09-29 5:38 ` Lars Ingebrigtsen
2021-09-29 11:26 ` Dmitry Gutov
2021-09-29 12:21 ` Bozhidar Batsov
2021-09-29 15:50 ` Lars Ingebrigtsen
2021-09-29 19:37 ` Dmitry Gutov
2021-09-29 16:26 ` [External] : " Drew Adams
2021-09-29 13:02 ` Eli Zaretskii
2021-09-29 16:25 ` [External] : " Drew Adams
2021-09-29 16:34 ` Eli Zaretskii
2021-09-29 16:46 ` Manuel Uberti
2021-09-29 17:08 ` Alfred M. Szmidt
2021-09-29 17:25 ` Drew Adams
2021-09-29 19:17 ` Dmitry Gutov
2021-09-29 19:29 ` Drew Adams
2021-09-30 7:13 ` Alfred M. Szmidt
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.