diff options
| author | Gregory Heytings <gregory@heytings.org> | 2022-11-26 14:09:41 +0000 |
|---|---|---|
| committer | Gregory Heytings <gregory@heytings.org> | 2022-11-26 15:10:17 +0100 |
| commit | 558084c7f736bebcb3cffc2bf4f617158d92357f (patch) | |
| tree | 5e05c5a457fe09073321b6b6543f1bbc00e766ed /src/buffer.c | |
| parent | 16b8b0d1e07d394e01f76d9eed6006219b4d745b (diff) | |
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.c | 35 |
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. If nil, these display shortcuts will always remain disabled. There is no reason to change that value except for debugging purposes. */); - XSETFASTINT (Vlong_line_threshold, 10000); + XSETFASTINT (Vlong_line_threshold, 50000); + + DEFVAR_INT ("long-line-locked-narrowing-region-size", + long_line_locked_narrowing_region_size, + doc: /* Region size for locked narrowing in buffers with long lines. + +This variable has effect only in buffers which contain one or more +lines whose length is above `long-line-threshold', which see. For +performance reasons, in such buffers, low-level hooks such as +`fontification-functions' or `post-command-hook' are executed on a +narrowed buffer, with a narrowing locked with `narrowing-lock'. This +variable specifies the size of the narrowed region around point. + +To disable that narrowing, set this variable to 0. + +There is no reason to change that value except for debugging purposes. */); + long_line_locked_narrowing_region_size = 500000; + + DEFVAR_INT ("long-line-locked-narrowing-bol-search-limit", + long_line_locked_narrowing_bol_search_limit, + doc: /* Limit for beginning of line search in buffers with long lines. + +This variable has effect only in buffers which contain one or more +lines whose length is above `long-line-threshold', which see. For +performance reasons, in such buffers, low-level hooks such as +`fontification-functions' or `post-command-hook' are executed on a +narrowed buffer, with a narrowing locked with `narrowing-lock'. The +variable `long-line-locked-narrowing-region-size' specifies the size +of the narrowed region around point. This variable, which should be a +small integer, specifies the number of characters by which that region +can be extended backwards to start it at the beginning of a line. + +There is no reason to change that value except for debugging purposes. */); + long_line_locked_narrowing_bol_search_limit = 128; DEFVAR_INT ("large-hscroll-threshold", large_hscroll_threshold, doc: /* Horizontal scroll of truncated lines above which to use redisplay shortcuts. |
