bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37700: 27.0.50; undo mouse-drag-and-drop-region ineffective


From: Mattias Engdegård
Subject: bug#37700: 27.0.50; undo mouse-drag-and-drop-region ineffective
Date: Wed, 30 Oct 2019 20:09:40 +0100

28 okt. 2019 kl. 21.01 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

> Indeed, that's also my experience [ and as a result I stay away from
> text's drag-and-drop since I find C-w ... C-y to be easier since it
> avoids this trial-and-error problem ;-) ]

Thanks for taking a look. It seems that the only happy users are those that use 
redo+.el or similar packages that do not restrict undo to region.

Unfortunately, even with the patch, undoing a drag-and-drop does not leave the 
region active the way it was before the undo, so the user has to reselect the 
text in order to try again. Reactivating the region automatically on undo is 
tempting but incompatible with undo-in-region (the same problem but in the 
other direction). Partly because of this, I believe that providing an option to 
disable undo-in-region altogether is a better solution.

> Rather than add a special new kind of entry you can use some version of
> (apply DELTA BEG END FUN-NAME . ARGS), presumably with DELTA=0 and
> BEG=END, so you don't need to modify the docstring of `buffer-undo-list`
> nor the implementation of primitive-undo.

I'm not sure how that would be done in practice since 'undo-elt-in-region' is 
nil for any (apply ...) element. This could be remedied, of course, but that 
would entail undo machinery changes which we wanted to avoid in the first 
place. In addition, it is unclear how the 'apply' mechanism could be used in a 
way that is sensitive to whether it's the first record to be undone.

> As a user of undo-in-region, I think I'd be surprised if my undo started
> to modify parts of the buffer outside the region, so I think a better
> approach would be to only pay attention to the `unconfined' marker when
> it appears at the top of the `buffer-undo-list` (i.e. only if the
> drag-and-drop was the very last operation).

The patch has now been modified to that effect. (I'm still not sure it's the 
right solution.)

>  Also I think it would
> deserve a message in the minibuffer explaining that the undo is not
> confined to the region.

It was tricky to do that cleanly, given the structure of the undo code, so it 
went into a separate patch.

Attachment: 0001-Don-t-confine-undo-of-mouse-drag-and-drop-to-the-reg.patch
Description: Binary data

Attachment: 0002-Adapt-undo-message-when-undoing-unconfined-actions-i.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]