aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorGregory Heytings2022-11-26 14:09:41 +0000
committerGregory Heytings2022-11-26 15:10:17 +0100
commit558084c7f736bebcb3cffc2bf4f617158d92357f (patch)
tree5e05c5a457fe09073321b6b6543f1bbc00e766ed /src/buffer.c
parent16b8b0d1e07d394e01f76d9eed6006219b4d745b (diff)
downloademacs-558084c7f736bebcb3cffc2bf4f617158d92357f.tar.gz
emacs-558084c7f736bebcb3cffc2bf4f617158d92357f.zip
Improve locked narrowing around low-level hooks.
* src/buffer.c (syms_of_buffer): Two new variables, 'long-line-locked-narrowing-region-size' and 'long-line-locked-narrowing-bol-search-limit', to make the locked narrowing around low-level hooks configurable. Increase the default value of 'long-line-threshold'. After carefully considering the (few) bug reports about long line optimizations, I concluded that the previous default value was too low. * src/xdisp.c (get_locked_narrowing_begv) (get_locked_narrowing_zv): Two new functions. (handle_fontified_prop, reseat): Use them. * src/keyboard.c (safe_run_hooks_maybe_narrowed): Use them. * src/dispextern.h (struct it): Add two new fields to store the values returned by these functions. Make them externally visible. * src/editfns.c: (Fsave_restriction): Update docstring.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d948aaa2662..ef7e6f18340 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5882,7 +5882,40 @@ this threshold.
5882If nil, these display shortcuts will always remain disabled. 5882If nil, these display shortcuts will always remain disabled.
5883 5883
5884There is no reason to change that value except for debugging purposes. */); 5884There is no reason to change that value except for debugging purposes. */);
5885 XSETFASTINT (Vlong_line_threshold, 10000); 5885 XSETFASTINT (Vlong_line_threshold, 50000);
5886
5887 DEFVAR_INT ("long-line-locked-narrowing-region-size",
5888 long_line_locked_narrowing_region_size,
5889 doc: /* Region size for locked narrowing in buffers with long lines.
5890
5891This variable has effect only in buffers which contain one or more
5892lines whose length is above `long-line-threshold', which see. For
5893performance reasons, in such buffers, low-level hooks such as
5894`fontification-functions' or `post-command-hook' are executed on a
5895narrowed buffer, with a narrowing locked with `narrowing-lock'. This
5896variable specifies the size of the narrowed region around point.
5897
5898To disable that narrowing, set this variable to 0.
5899
5900There is no reason to change that value except for debugging purposes. */);
5901 long_line_locked_narrowing_region_size = 500000;
5902
5903 DEFVAR_INT ("long-line-locked-narrowing-bol-search-limit",
5904 long_line_locked_narrowing_bol_search_limit,
5905 doc: /* Limit for beginning of line search in buffers with long lines.
5906
5907This variable has effect only in buffers which contain one or more
5908lines whose length is above `long-line-threshold', which see. For
5909performance reasons, in such buffers, low-level hooks such as
5910`fontification-functions' or `post-command-hook' are executed on a
5911narrowed buffer, with a narrowing locked with `narrowing-lock'. The
5912variable `long-line-locked-narrowing-region-size' specifies the size
5913of the narrowed region around point. This variable, which should be a
5914small integer, specifies the number of characters by which that region
5915can be extended backwards to start it at the beginning of a line.
5916
5917There is no reason to change that value except for debugging purposes. */);
5918 long_line_locked_narrowing_bol_search_limit = 128;
5886 5919
5887 DEFVAR_INT ("large-hscroll-threshold", large_hscroll_threshold, 5920 DEFVAR_INT ("large-hscroll-threshold", large_hscroll_threshold,
5888 doc: /* Horizontal scroll of truncated lines above which to use redisplay shortcuts. 5921 doc: /* Horizontal scroll of truncated lines above which to use redisplay shortcuts.