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.
Full log
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)
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.