emacs-devel
[Top][All Lists]
Advanced

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

Re: Support for undo-amalgamate in a version of the atomic-change-group


From: Stefan Monnier
Subject: Re: Support for undo-amalgamate in a version of the atomic-change-group macro (with patch)
Date: Mon, 01 Nov 2021 13:43:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Hi, there have been a handful of times I've needed to treat multiple
> actions as a single action,
> others too (see stackoverflow question [0]).
>
> While this is supported using change groups, the resulting macro ends
> up being nearly identical to the existing `atomic-change-group' macro.
> The only difference is a call to undo-amalgamate-change-group.

The other difference would be the call to `cancel-change-group` (you
may want to not undo the changes in case of errors).

> Attached a patch to add `atomic-change-group-undo-amalgamate' so
> packages don't need to use a modified copy of this macro.

I suspect that we'd be better off with a separate macro which only does
the amalgamation without the cancel-change-group-on-error.

But I wonder how often such a macro would be useful: undo boundaries are
normally added only by the command-loop (i.e. the loop which repeatedly
reads a key and calls the corresponding command), so unless your macro's
body calls `recursive-edit` it's very unlikely that you'll get any undo
entries that you would then want to remove.

(Re)reading your stackexchange question, it seems you want to amalgamate
undo entries from different commands.  So do you run those commands
within a `recursive-edit`?  If not, how do you manage to run those
commands from within your (new) macro?


        Stefan




reply via email to

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