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: Michael Heerdegen
Subject: Re: A strange issue with buffer-undo-list
Date: Wed, 24 Feb 2021 03:11:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

>   (let ((position-in-line (current-column)))
>     (push (point) buffer-undo-list)

I wonder if it is legitimate to do this.

>     (line-move 1)
>     (transpose-lines count)
>     (line-move -1)
>     (move-to-column position-in-line)))
>
>
> which triggers an error.

Sometimes it helps in such situations to add an explicit
`undo-boundary'.


> 1. Why did my code confuse the change group mechanism?

I can't answer that, I dunno if it is legal.  Don't have enough
knowledge about that (mine is also only from reading code).

> 2. How do I use `undo-amalgamate-change-group'?  The manual does not
> provide any examples, and I only found one occurrence in the Emacs
> source, and frankly, it didn't help a lot.

Well, it seems very simple: you have the handle, you call
`undo-amalgamate-change-group' with it, typically directly before
accepting the group, and that's it...?

The only example use I found is in viper-cmd.el.  Seems the code never
closes the opened change groups.  AFAIU that's not ok.


Regards,

Michael.




reply via email to

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