From: David Reitter <david.reitter@gmail.com>
To: 18412@debbugs.gnu.org
Subject: bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA)
Date: Fri, 5 Sep 2014 12:37:06 -0400 [thread overview]
Message-ID: <DD830153-3AE7-4539-8935-1975B856DE03@gmail.com> (raw)
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)
next reply other threads:[~2014-09-05 16:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 16:37 David Reitter [this message]
2014-09-08 2:04 ` bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA) Stefan Monnier
2020-09-09 9:50 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DD830153-3AE7-4539-8935-1975B856DE03@gmail.com \
--to=david.reitter@gmail.com \
--cc=18412@debbugs.gnu.org \
/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 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.