emacs-devel
[Top][All Lists]
Advanced

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

Re: Distinguish between regional undo and undo to the beginning in undo-


From: Stefan Monnier
Subject: Re: Distinguish between regional undo and undo to the beginning in undo-equiv-table
Date: Wed, 03 Mar 2021 17:28:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Yes, that was supposed to be the one. Just to be sure I ran the test with
> the old version and it didn’t error. Oops! I fixed the test, now it errors
> on the old version and passes after applying my fix (in the first
> patch). The test first runs undo in region, then breaks the undo chain (my
> 2nd patch failed to do that), then runs undo in region again.

Perfect.

> I’m not sure how to write the comment for that test. Maybe I could
> write “test for commit xxx” but there is no commit number to refer to
> right now.

That would be fine.  Or just use some description of what the test does
like "check the case of interrupted+repeated undo-in-region".
Or just nothing at all and let the code speak for itself ;-)

> BTW, I can’t quite get what the comment at simple.el:2920 means:
>
> (puthash list
>                ;; Prevent identity mapping.  This can happen if
>                ;; consecutive nils are erroneously in undo list.
>                (if (or undo-in-region (eq list pending-undo-list))
>                    t
>                  pending-undo-list)
>              undo-equiv-table)

> Is it that if there is (nil nil nil) on the top of buffer-undo-list,
> the middle one will be considered an undo record and will be passed to
> primitive-undo?

I think so, yes.

> In that case nothing is done and nothing is added to buffer-undo-list?

Exactly.

> Then should we add a mapping for the buffer-undo-list to t at that
> point?  Or should we just do nothing?

Good question.  I think you have a better understanding of how the equiv
table should be filled than I do at this point, so I'd trust your judgment.


        Stefan




reply via email to

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