diff options
| author | Gregory Heytings | 2022-07-16 19:06:38 +0000 |
|---|---|---|
| committer | Gregory Heytings | 2022-07-16 21:13:33 +0200 |
| commit | e7b5912b235936b304701ba6b1e808d9b197fd4f (patch) | |
| tree | 78cfbd3ab9c032e45a6ba0f1e763807a01a9a3ec /src/buffer.c | |
| parent | 9de00e5fda2e04316357bd8cf0d8094c63ff171b (diff) | |
| download | emacs-e7b5912b235936b304701ba6b1e808d9b197fd4f.tar.gz emacs-e7b5912b235936b304701ba6b1e808d9b197fd4f.zip | |
Improvements to long lines handling.
* src/buffer.h (struct buffer): New field 'long_line_optimizations_p'.
* src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'.
(reset_buffer): Initialize the 'long_line_optimizations_p' field.
(Fbuffer_swap_text): Handle it.
* src/xdisp.c (redisplay_window): Set 'long_line_optimizations_p' when
a buffer contains long lines.
(init_iterator): Use 'long_line_optimizations_p'.
(get_narrowed_begv): Update.
(SET_WITH_NARROWED_BEGV): New macro.
(unwind_narrowed_begv): New internal function used by the new macro.
(back_to_previous_line_start, get_visually_first_element,
move_it_vertically_backward): Use the new macro.
* src/search.c (find_newline1): Make it externally visible.
* src/lisp.h: Make 'find_newline1' externally visible.
* src/dispextern.h (struct it): Update comment. Remove the
'WITH_NARROWED_BEGV' macro.
* etc/NEWS: Mention the 'long-line-threshold' variable.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 509ce51b55e..a777668e44b 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -984,6 +984,7 @@ reset_buffer (register struct buffer *b) | |||
| 984 | /* It is more conservative to start out "changed" than "unchanged". */ | 984 | /* It is more conservative to start out "changed" than "unchanged". */ |
| 985 | b->clip_changed = 0; | 985 | b->clip_changed = 0; |
| 986 | b->prevent_redisplay_optimizations_p = 1; | 986 | b->prevent_redisplay_optimizations_p = 1; |
| 987 | b->long_line_optimizations_p = 0; | ||
| 987 | bset_backed_up (b, Qnil); | 988 | bset_backed_up (b, Qnil); |
| 988 | bset_local_minor_modes (b, Qnil); | 989 | bset_local_minor_modes (b, Qnil); |
| 989 | BUF_AUTOSAVE_MODIFF (b) = 0; | 990 | BUF_AUTOSAVE_MODIFF (b) = 0; |
| @@ -2445,6 +2446,7 @@ results, see Info node `(elisp)Swapping Text'. */) | |||
| 2445 | swapfield (bidi_paragraph_cache, struct region_cache *); | 2446 | swapfield (bidi_paragraph_cache, struct region_cache *); |
| 2446 | current_buffer->prevent_redisplay_optimizations_p = 1; | 2447 | current_buffer->prevent_redisplay_optimizations_p = 1; |
| 2447 | other_buffer->prevent_redisplay_optimizations_p = 1; | 2448 | other_buffer->prevent_redisplay_optimizations_p = 1; |
| 2449 | swapfield (long_line_optimizations_p, bool_bf); | ||
| 2448 | swapfield (overlays_before, struct Lisp_Overlay *); | 2450 | swapfield (overlays_before, struct Lisp_Overlay *); |
| 2449 | swapfield (overlays_after, struct Lisp_Overlay *); | 2451 | swapfield (overlays_after, struct Lisp_Overlay *); |
| 2450 | swapfield (overlay_center, ptrdiff_t); | 2452 | swapfield (overlay_center, ptrdiff_t); |
| @@ -6423,6 +6425,14 @@ Since `clone-indirect-buffer' calls `make-indirect-buffer', this hook | |||
| 6423 | will run for `clone-indirect-buffer' calls as well. */); | 6425 | will run for `clone-indirect-buffer' calls as well. */); |
| 6424 | Vclone_indirect_buffer_hook = Qnil; | 6426 | Vclone_indirect_buffer_hook = Qnil; |
| 6425 | 6427 | ||
| 6428 | DEFVAR_LISP ("long-line-threshold", Vlong_line_threshold, | ||
| 6429 | doc: /* Line length above which specific display optimizations are used. | ||
| 6430 | Display optimizations for long lines will automatically be enabled in | ||
| 6431 | buffers which contain one or more lines whose length is above that | ||
| 6432 | threshold. | ||
| 6433 | When nil, these display optimizations are disabled. */); | ||
| 6434 | XSETFASTINT (Vlong_line_threshold, 10000); | ||
| 6435 | |||
| 6426 | defsubr (&Sbuffer_live_p); | 6436 | defsubr (&Sbuffer_live_p); |
| 6427 | defsubr (&Sbuffer_list); | 6437 | defsubr (&Sbuffer_list); |
| 6428 | defsubr (&Sget_buffer); | 6438 | defsubr (&Sget_buffer); |