]> git.eshelyaron.com Git - emacs.git/commit
Add `redisplay_counter` to catch nested redisplays and abort outer one
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 26 Dec 2023 03:40:02 +0000 (22:40 -0500)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 09:47:33 +0000 (11:47 +0200)
commitff5dfd55821a2e024f6a3c3a6d184c2ee2c411d3
treef39993c9c5944c559cf9666297af20a8c0183636
parente089ad76fc7e5dd417905e115a7a8425210a0d7f
Add `redisplay_counter` to catch nested redisplays and abort outer one

The redisplay code is not re-entrant.  To allow running ELisp code
from within redisplay, we have some hacks (e.g. `inhibit-redisplay`)
that try to avoid the resulting breakage.
This commit adds another one of those hacks, which tries
to get closer to the core of the problem, thereby making it "safe"
to override `inhibit-redisplay`, e.g. to debug jit-lock code.

* src/dispextern.h (redisplay_counter): Declare.
* src/xdisp.c (redisplay_counter): Define.
(redisplay_internal) Increment it.
(dsafe__call): Use it, in case `inhibit-redisplay` is overridden.
* src/eval.c (call_debugger): Use it as well to refine the test
we already had.

(cherry picked from commit c3f3fe136cefc4c3aed960b175053e7c048aa979)
src/dispextern.h
src/eval.c
src/xdisp.c