[Top][All Lists]

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

Re: Calling Lisp from undo.c's record_* functions

From: Stefan Monnier
Subject: Re: Calling Lisp from undo.c's record_* functions
Date: Tue, 17 Nov 2015 08:46:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>>> Debugging uncovered the following sequence of calls:
>>> . bottom line: the gap was shrunk behind the back of
>>> insert_from_string_1, which totally doesn't expect that, and
>>> proceeds doing silly things, like setting the gap size to a large
>>> negative value, and from there we are on a certain and very short
>>> path to a crash
>> Duh!
>>> My dilemma is: how to fix this cleanly and correctly?
>> Not sure what's the best solution, but the precise moment when
>> run_undoable_change is executed is not terribly important, so if we
>> could just move it to either before or after the "critical section",
>> then that would be a good solution.
> I'm not sure how I would identify the "critical section".

The "critical section" is the span of code during which the buffer is
"being worked on" by the insertion function, so during this time, the
buffer shouldn't be modified by anyone else in any way: no Elisp code
should be run, no GC should take place.

> At one point, this function call was actually a hook
> (after-undoable-change-hook). Would this solve the problem?

Nope, makes no difference.


reply via email to

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