GNU bug report logs -
#23785
Emacs 25: "Undo" overdoes things.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Fri, 17 Jun 2016 15:03:01 UTC
Severity: normal
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:
>> + /*
>> + Temporarily enable the undo-buffer to ensure that the change
>> + is marked as an undoable one. Bug #23785.
>> + */
>> + bset_undo_list(current_buffer,Qnil);
>
> Additionally to Eli's remark about the shape of your comments, please
> also put spaces before open parens and after commas.
Oh, dear, I took Eli's okay and commited. I always was over
enthusiastic. I think I better revert.
>
>> insert_from_buffer (XBUFFER (conversion_buffer),
>> same_at_start_charpos, inserted_chars, 0);
>> + bset_undo_list(current_buffer,Qt);
>
> Instead of two bset_undo_list, you could use a single specbind since the
> above code is almost immediately followed by unbind_to.
I tried that
specbind (intern("buffer-undo-list"), Qnil);
> But more seriously, I'm wondering: where is undo-list set to t (and
> hence causing the problem we're seeing)?
> Searching for "undo" in that function gives m the impression that
> undo-0list won't be set to t during the call to insert_from_buffer.
> What am I missing?
It's set in several places to Qt, then restored at the end here.
if (!empty_undo_list_p)
{
bset_undo_list (current_buffer, old_undo);
if (CONSP (old_undo) && inserted != old_inserted)
{
/* Adjust the last undo record for the size change during
the format conversion. */
Lisp_Object tem = XCAR (old_undo);
if (CONSP (tem) && INTEGERP (XCAR (tem))
&& INTEGERP (XCDR (tem))
&& XFASTINT (XCDR (tem)) == PT + old_inserted)
XSETCDR (tem, make_number (PT + inserted));
}
}
At least that was my theory; I tested it by adding print statements to
run_undoable_change which running, but returning before the call0.
run_undoable_change (void)
{
if (EQ (BVAR (current_buffer, undo_list), Qt))
return;
call0 (Qundo_auto__undoable_change);
}
The code is convoluted enough, though, that I am worried that I may have
got this wrong.
Anyway, I've just testing emacs-25 after my change, the patch seems to
be doing very bad things -- i.e. leaving buffer-undo-list as Qt. So, I
think I really sure revert, then worry about it tomorrow.
Phil
This bug report was last modified 4 years and 261 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.