aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorGregory Heytings2022-07-22 10:03:13 +0000
committerGregory Heytings2022-07-22 12:06:31 +0200
commit874e2525035d45efa6fa374a2ebec3740ecc1457 (patch)
tree059221aee889a88f558802014c5680017eaec1d0 /src/editfns.c
parent616da8fa8efa9023f56fa731072d877e2150afbc (diff)
downloademacs-874e2525035d45efa6fa374a2ebec3740ecc1457.tar.gz
emacs-874e2525035d45efa6fa374a2ebec3740ecc1457.zip
Improve font locking in buffers with long lines (bug#56682).
* src/dispextern.h (struct it): New 'narrowed_zv' field. * src/xdisp.c (init_iterator): Set the field. (get_narrowed_zv): New function to set the field. (handle_fontified_prop): Use the field, together with 'narrowed_begv', to narrow the portion of the buffer that 'Vfontification_functions' will see. Also bind 'inhibit-widen'. (get_narrowed_len): New function, factored out of 'get_narrowed_begv'. (unwind_narrowed_zv): New function. * src/editfns.c (syms_of_editfns): New variable and symbol 'inhibit-widen'. (Fwiden): Do nothing when 'inhibit-widen' is non-nil.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 4587b1132b1..6dec2d468c0 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2661,6 +2661,8 @@ DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
2661This allows the buffer's full text to be seen and edited. */) 2661This allows the buffer's full text to be seen and edited. */)
2662 (void) 2662 (void)
2663{ 2663{
2664 if (!NILP (Vinhibit_widen))
2665 return Qnil;
2664 if (BEG != BEGV || Z != ZV) 2666 if (BEG != BEGV || Z != ZV)
2665 current_buffer->clip_changed = 1; 2667 current_buffer->clip_changed = 1;
2666 BEGV = BEG; 2668 BEGV = BEG;
@@ -4457,6 +4459,7 @@ syms_of_editfns (void)
4457 DEFSYM (Qbuffer_access_fontify_functions, "buffer-access-fontify-functions"); 4459 DEFSYM (Qbuffer_access_fontify_functions, "buffer-access-fontify-functions");
4458 DEFSYM (Qwall, "wall"); 4460 DEFSYM (Qwall, "wall");
4459 DEFSYM (Qpropertize, "propertize"); 4461 DEFSYM (Qpropertize, "propertize");
4462 DEFSYM (Qinhibit_widen, "inhibit-widen");
4460 4463
4461 DEFVAR_LISP ("inhibit-field-text-motion", Vinhibit_field_text_motion, 4464 DEFVAR_LISP ("inhibit-field-text-motion", Vinhibit_field_text_motion,
4462 doc: /* Non-nil means text motion commands don't notice fields. */); 4465 doc: /* Non-nil means text motion commands don't notice fields. */);
@@ -4517,6 +4520,15 @@ This variable is experimental; email 32252@debbugs.gnu.org if you need
4517it to be non-nil. */); 4520it to be non-nil. */);
4518 binary_as_unsigned = false; 4521 binary_as_unsigned = false;
4519 4522
4523 DEFVAR_LISP ("inhibit-widen", Vinhibit_widen,
4524 doc: /* Non-nil inhibits the `widen' function.
4525
4526Do NOT set this globally to a non-nil value, as doing that will
4527disable the `widen' function everywhere, including the \\[widen\]
4528command. This variable is intended to be let-bound around code
4529that needs to disable `widen' temporarily. */);
4530 Vinhibit_widen = Qnil;
4531
4520 defsubr (&Spropertize); 4532 defsubr (&Spropertize);
4521 defsubr (&Schar_equal); 4533 defsubr (&Schar_equal);
4522 defsubr (&Sgoto_char); 4534 defsubr (&Sgoto_char);