Add specific symbols for narrowings

* src/xdisp.c (syms_of_xdisp): Define symbol.
(handle_fontified_prop): Use it.

* src/keyboard.c (syms_of_keyboard): Define symbol.
(safe_run_hooks_maybe_narrowed): Use it.
This commit is contained in:
Gregory Heytings 2023-02-09 01:09:10 +00:00
parent d8438e2bb4
commit 0d73e4aa26
2 changed files with 7 additions and 2 deletions

View file

@ -1915,7 +1915,8 @@ safe_run_hooks_maybe_narrowed (Lisp_Object hook, struct window *w)
ptrdiff_t begv = get_locked_narrowing_begv (PT);
ptrdiff_t zv = get_locked_narrowing_zv (PT);
if (begv != BEG || zv != Z)
narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv), hook);
narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv),
Qlong_line_optimizations_in_command_hooks);
}
run_hook_with_args (2, ((Lisp_Object []) {hook, hook}),
@ -12168,6 +12169,8 @@ syms_of_keyboard (void)
/* Hooks to run before and after each command. */
DEFSYM (Qpre_command_hook, "pre-command-hook");
DEFSYM (Qpost_command_hook, "post-command-hook");
DEFSYM (Qlong_line_optimizations_in_command_hooks,
"long-line-optimizations-in-command-hooks");
/* Hook run after the region is selected. */
DEFSYM (Qpost_select_region_hook, "post-select-region-hook");

View file

@ -4406,7 +4406,7 @@ handle_fontified_prop (struct it *it)
}
if (begv != BEG || zv != Z)
narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv),
Qfontification_functions);
Qlong_line_optimizations_in_fontification_functions);
}
/* Don't allow Lisp that runs from 'fontification-functions'
@ -36266,6 +36266,8 @@ be let-bound around code that needs to disable messages temporarily. */);
DEFSYM (QCfile, ":file");
DEFSYM (Qfontified, "fontified");
DEFSYM (Qfontification_functions, "fontification-functions");
DEFSYM (Qlong_line_optimizations_in_fontification_functions,
"long-line-optimizations-in-fontification-functions");
/* Name of the symbol which disables Lisp evaluation in 'display'
properties. This is used by enriched.el. */