GNU bug report logs -
#18412
24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA)
Previous Next
Reported by: David Reitter <david.reitter <at> gmail.com>
Date: Fri, 5 Sep 2014 16:38:02 UTC
Severity: normal
Tags: wontfix
Found in version 24.3.93
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18412 in the body.
You can then email your comments to 18412 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18412
; Package
emacs
.
(Fri, 05 Sep 2014 16:38:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
David Reitter <david.reitter <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 05 Sep 2014 16:38:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <at> 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 <at> 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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18412
; Package
emacs
.
(Mon, 08 Sep 2014 02:05:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 18412 <at> debbugs.gnu.org (full text, mbox):
> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18412
; Package
emacs
.
(Wed, 09 Sep 2020 09:52:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 18412 <at> debbugs.gnu.org (full text, mbox):
David Reitter <david.reitter <at> 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 <at> 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
Added tag(s) wontfix.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 09 Sep 2020 09:52:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
18412 <at> debbugs.gnu.org and David Reitter <david.reitter <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 09 Sep 2020 09:52:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 07 Oct 2020 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 256 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.