[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18412: 24.3.93 regression: undo boundary inserted by delete-selectio
From: |
Stefan Monnier |
Subject: |
bug#18412: 24.3.93 regression: undo boundary inserted by delete-selection-mode (CUA) |
Date: |
Sun, 07 Sep 2014 22:04:29 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> 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