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

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

Re: A strange issue with buffer-undo-list


From: Emanuel Berg
Subject: Re: A strange issue with buffer-undo-list
Date: Thu, 25 Feb 2021 06:28:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Marcin Borkowski wrote:

>>> Is there a way to get the "state" of the change group to
>>> only cancel it if it was not finished?
>>
>> I think yes, it's called `atomic-change-group' - see how
>> that macro is implemented.
>
> Ah, that's simple and clever. Thank you.
>
> Still, these "change groups" seem a strange feature to me -
> they are hardly ever used in Emacs itself, right?

Maybe people just don't understand the docstring:

  Like ‘progn’ but perform BODY as an atomic change group.
  This means that if BODY exits abnormally, all of its changes
  to the current buffer are undone. This works regardless of
  whether undo is enabled in the buffer.

  This mechanism is transparent to ordinary use of undo;
  if undo is enabled in the buffer and BODY succeeds, the
  user can undo the change normally.

How about:

  1. Do BODY
  2. On error: redo all

But if they are to drop buzzwords, isn't this a transaction?
Maybe that's something else...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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