* bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA)
@ 2014-09-05 16:37 David Reitter
2014-09-08 2:04 ` Stefan Monnier
2020-09-09 9:50 ` Lars Ingebrigtsen
0 siblings, 2 replies; 3+ messages in thread
From: David Reitter @ 2014-09-05 16:37 UTC (permalink / raw)
To: 18412
This is a regression in the 24.4 pretest compared to 24.3.
M-x cua-mode
(enter and) select a word “hello", e.g., via double-click
enter single char, e.g., “x”
C-_ (undo)
In Emacs 24.3, the undo will restore “hello”.
In Emacs 24.3.93 pretest, the undo will only delete “x”, but not restore “hello”.
An undo boundary is present in buffer-undo-list between the delete-selection step and the insertion of “x”.
The relevant change, I think, were changes to CUA on Dec 8 and 11, 2013:
commit f38bbfce43b11667ee1a09acf4f4f932bf7c9043
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Sun Dec 8 01:24:54 2013 -0500
Use delete-selection-mode in cya-mode.
As a fix...
Looking at how self-insert-command deletes the undo boundary to merge itself, we can either prevent the undo boundary from being inserted (I couldn’t figure out where that happens), or pretend that the delete-selection action was a self-insert-command. The patch below is a proof of concept.
I think the right fix would be not to insert the undo boundary in the first place, if this is reasonably doable.
commit abf13771ad1b3dbc542a35393230eb43baa55d1c
Author: David Reitter <david.reitter@gmail.com>
Date: Fri Sep 5 12:26:11 2014 -0400
delsel: delete-active-region: avoid undo boundary
Set last-command so that self-insert-command removes any
undo boundary.
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 1ada027..c1b1eba 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -80,6 +80,8 @@ If KILLP in not-nil, the active region is killed instead of deleted."
(let (this-command)
(kill-region (point) (mark) t))
(funcall region-extract-function 'delete-only))
+ ;; do not add undo-boundary in self-insert-command:
+ (setq last-command this-command)
t)
(defun delete-selection-helper (type)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA)
2014-09-05 16:37 bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA) David Reitter
@ 2014-09-08 2:04 ` Stefan Monnier
2020-09-09 9:50 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2014-09-08 2:04 UTC (permalink / raw)
To: David Reitter; +Cc: 18412
> This is a regression in the 24.4 pretest compared to 24.3.
> M-x cua-mode
> (enter and) select a word “hello", e.g., via double-click
> enter single char, e.g., “x”
> C-_ (undo)
> In Emacs 24.3, the undo will restore “hello”.
> In Emacs 24.3.93 pretest, the undo will only delete “x”, but not
> restore “hello”.
> An undo boundary is present in buffer-undo-list between the
> delete-selection step and the insertion of “x”.
Indeed, that's a difference between delete-selection-mode and cua's
earlier reimplementation of the feature.
To the extent that noone complained about it for delete-selection-mode,
I think this bug is not super-urgent to fix. IOW, we should take the
time to think how to fix it right.
> Looking at how self-insert-command deletes the undo boundary to merge
> itself, we can either prevent the undo boundary from being inserted (I
> couldn’t figure out where that happens), or pretend that the
> delete-selection action was a self-insert-command. The patch below is
> a proof of concept.
The undo-boundary is added by command_loop_1 in keyboard.c just before
calling command_execute. Maybe the right fix is to change it so it's
push before running pre-command-hook?
Of course, maybe an even better fix is to change delete-selection-mode
so it doesn't rely on pre-command-hook.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA)
2014-09-05 16:37 bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA) David Reitter
2014-09-08 2:04 ` Stefan Monnier
@ 2020-09-09 9:50 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-09 9:50 UTC (permalink / raw)
To: David Reitter; +Cc: 18412
David Reitter <david.reitter@gmail.com> writes:
> This is a regression in the 24.4 pretest compared to 24.3.
>
> M-x cua-mode
> (enter and) select a word “hello", e.g., via double-click
> enter single char, e.g., “x”
> C-_ (undo)
>
> In Emacs 24.3, the undo will restore “hello”.
>
> In Emacs 24.3.93 pretest, the undo will only delete “x”, but not restore “hello”.
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Indeed, that's a difference between delete-selection-mode and cua's
> earlier reimplementation of the feature.
>
> To the extent that noone complained about it for delete-selection-mode,
> I think this bug is not super-urgent to fix. IOW, we should take the
> time to think how to fix it right.
This was six years ago, and cua-mode still works the same way, so at
this point, I think changing the behaviour now would probably be a
regression?
So I'm closing this bug as a "wontfix".
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-09 9:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-05 16:37 bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA) David Reitter
2014-09-08 2:04 ` Stefan Monnier
2020-09-09 9:50 ` Lars Ingebrigtsen
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).