From 0d73e4aa261d1d751a7469a6274b2e1b9fa210e6 Mon Sep 17 00:00:00 2001 From: Gregory Heytings Date: Thu, 9 Feb 2023 01:09:10 +0000 Subject: [PATCH] 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. --- src/keyboard.c | 5 ++++- src/xdisp.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 6f0f075e54e..243767aff53 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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"); diff --git a/src/xdisp.c b/src/xdisp.c index a19c9908616..f777d2899b4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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. */ -- 2.39.2