[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: Phillip Lord
Subject: Re: Calling Lisp from undo.c's record_* functions
Date: Tue, 17 Nov 2015 14:42:44 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Stefan Monnier <address@hidden> writes:
>>>> 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.

Assuming the documentation of undo.c is rigourously followed, then this
should only be a problem for insert. All the others say "at the
beginning of the command" or "about to happen". Only insertion says
"before or after". Although, record_insert calls record_point which
rather confuses me -- surely in record_insert can be after, so can

In theory, therefore, we should already be safe? Or can the critical
section be longer than a single function call to undo.c? Could the
unsafe period cover several calls?

There are only 7 calls to record_insert so changing the so record_insert
is *always* before would be possible. Big change to make at this point
in the release cycle.

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


I'll finish my patch off this evening, hopefully.


reply via email to

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