summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2022-07-22 10:03:13 +0000
committerGregory Heytings <gregory@heytings.org>2022-07-22 12:06:31 +0200
commit874e2525035d45efa6fa374a2ebec3740ecc1457 (patch)
tree059221aee889a88f558802014c5680017eaec1d0 /src/editfns.c
parent616da8fa8efa9023f56fa731072d877e2150afbc (diff)
downloademacs-874e2525035d45efa6fa374a2ebec3740ecc1457.tar.gz
emacs-874e2525035d45efa6fa374a2ebec3740ecc1457.tar.bz2
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, "",
This allows the buffer's full text to be seen and edited. */)
(void)
{
+ if (!NILP (Vinhibit_widen))
+ return Qnil;
if (BEG != BEGV || Z != ZV)
current_buffer->clip_changed = 1;
BEGV = BEG;
@@ -4457,6 +4459,7 @@ syms_of_editfns (void)
DEFSYM (Qbuffer_access_fontify_functions, "buffer-access-fontify-functions");
DEFSYM (Qwall, "wall");
DEFSYM (Qpropertize, "propertize");
+ DEFSYM (Qinhibit_widen, "inhibit-widen");
DEFVAR_LISP ("inhibit-field-text-motion", Vinhibit_field_text_motion,
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
it to be non-nil. */);
binary_as_unsigned = false;
+ DEFVAR_LISP ("inhibit-widen", Vinhibit_widen,
+ doc: /* Non-nil inhibits the `widen' function.
+
+Do NOT set this globally to a non-nil value, as doing that will
+disable the `widen' function everywhere, including the \\[widen\]
+command. This variable is intended to be let-bound around code
+that needs to disable `widen' temporarily. */);
+ Vinhibit_widen = Qnil;
+
defsubr (&Spropertize);
defsubr (&Schar_equal);
defsubr (&Sgoto_char);