GNU bug report logs - #60467
30.0.50; primitive-undo: Changes to be undone by function different from announced

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Sun, 1 Jan 2023 13:40:01 UTC

Severity: normal

Found in version 30.0.50

Done: Gregory Heytings <gregory <at> heytings.org>

Bug is archived. No further changes may be made.

Full log


Message #62 received at 60467 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 60467 <at> debbugs.gnu.org, Alan Mackenzie <acm <at> muc.de>,
 Eli Zaretskii <eliz <at> gnu.org>, yantar92 <at> posteo.net
Subject: Re: bug#60467: 30.0.50; primitive-undo: Changes to be undone by
 function different from announced
Date: Tue, 03 Jan 2023 21:49:01 -0500
>>>> I don't even understand what this is supposed to do.
>>> Yet you happily threw it away :-(
>>
>> Because there are no such precautions elsewhere in the code, and the
>> comment above ("In case garbage collection has removed OLD-BUL") does not
>> explain what its purpose is.  A few lines below, old-bul is used without
>> such a precaution.  Of course, if it has a purpose, it's okay to keep it.
>>
>
> I didn't remember the main reason why I removed that (cdr ptr).  The reason
> is not only that the comment above it is wrong, but also that this (cdr ptr)
> condition itself is wrong: it makes that loop stop when the last element of
> the buffer-undo-list is reached.  When buffer-undo-list is initially nil,
> (funcall body) adds a number of entries in buffer-undo-list, and there is no
> reason to exit that loop without processing its last element.

I think for your loop you'd need to check `ptr` instead of (cdr
ptr), indeed.  For the loop currently in `subr.el` I think the (cdr ptr)
is OK because we use the `setcdr` to truncate the list, so that last
cons (whose `cdr` may be nil) will be in the list included in the
(apply ....) entry.


        Stefan





This bug report was last modified 1 year and 335 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.