aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c
index f9154d42b03..339175d9078 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -203,9 +203,9 @@ bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
203 b->INTERNAL_FIELD (buffer_file_coding_system) = val; 203 b->INTERNAL_FIELD (buffer_file_coding_system) = val;
204} 204}
205static void 205static void
206bset_cache_long_line_scans (struct buffer *b, Lisp_Object val) 206bset_cache_long_scans (struct buffer *b, Lisp_Object val)
207{ 207{
208 b->INTERNAL_FIELD (cache_long_line_scans) = val; 208 b->INTERNAL_FIELD (cache_long_scans) = val;
209} 209}
210static void 210static void
211bset_case_fold_search (struct buffer *b, Lisp_Object val) 211bset_case_fold_search (struct buffer *b, Lisp_Object val)
@@ -583,6 +583,7 @@ even if it is dead. The return value is never nil. */)
583 583
584 b->newline_cache = 0; 584 b->newline_cache = 0;
585 b->width_run_cache = 0; 585 b->width_run_cache = 0;
586 b->bidi_paragraph_cache = 0;
586 bset_width_table (b, Qnil); 587 bset_width_table (b, Qnil);
587 b->prevent_redisplay_optimizations_p = 1; 588 b->prevent_redisplay_optimizations_p = 1;
588 589
@@ -806,6 +807,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
806 807
807 b->newline_cache = 0; 808 b->newline_cache = 0;
808 b->width_run_cache = 0; 809 b->width_run_cache = 0;
810 b->bidi_paragraph_cache = 0;
809 bset_width_table (b, Qnil); 811 bset_width_table (b, Qnil);
810 812
811 name = Fcopy_sequence (name); 813 name = Fcopy_sequence (name);
@@ -1945,6 +1947,11 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1945 free_region_cache (b->width_run_cache); 1947 free_region_cache (b->width_run_cache);
1946 b->width_run_cache = 0; 1948 b->width_run_cache = 0;
1947 } 1949 }
1950 if (b->bidi_paragraph_cache)
1951 {
1952 free_region_cache (b->bidi_paragraph_cache);
1953 b->bidi_paragraph_cache = 0;
1954 }
1948 bset_width_table (b, Qnil); 1955 bset_width_table (b, Qnil);
1949 unblock_input (); 1956 unblock_input ();
1950 bset_undo_list (b, Qnil); 1957 bset_undo_list (b, Qnil);
@@ -2355,6 +2362,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2355 current_buffer->clip_changed = 1; other_buffer->clip_changed = 1; 2362 current_buffer->clip_changed = 1; other_buffer->clip_changed = 1;
2356 swapfield (newline_cache, struct region_cache *); 2363 swapfield (newline_cache, struct region_cache *);
2357 swapfield (width_run_cache, struct region_cache *); 2364 swapfield (width_run_cache, struct region_cache *);
2365 swapfield (bidi_paragraph_cache, struct region_cache *);
2358 current_buffer->prevent_redisplay_optimizations_p = 1; 2366 current_buffer->prevent_redisplay_optimizations_p = 1;
2359 other_buffer->prevent_redisplay_optimizations_p = 1; 2367 other_buffer->prevent_redisplay_optimizations_p = 1;
2360 swapfield (overlays_before, struct Lisp_Overlay *); 2368 swapfield (overlays_before, struct Lisp_Overlay *);
@@ -5169,7 +5177,7 @@ init_buffer_once (void)
5169 bset_buffer_file_coding_system (&buffer_defaults, Qnil); 5177 bset_buffer_file_coding_system (&buffer_defaults, Qnil);
5170 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); 5178 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
5171 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); 5179 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
5172 bset_cache_long_line_scans (&buffer_defaults, Qnil); 5180 bset_cache_long_scans (&buffer_defaults, Qnil);
5173 bset_file_truename (&buffer_defaults, Qnil); 5181 bset_file_truename (&buffer_defaults, Qnil);
5174 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); 5182 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
5175 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); 5183 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
@@ -5233,7 +5241,7 @@ init_buffer_once (void)
5233 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; 5241 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx;
5234 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; 5242 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx;
5235 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; 5243 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx;
5236 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; 5244 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx;
5237 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; 5245 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx;
5238 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; 5246 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx;
5239 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; 5247 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx;
@@ -6120,8 +6128,8 @@ If the value of the variable is t, undo information is not recorded. */);
6120 DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil, 6128 DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil,
6121 doc: /* Non-nil means the mark and region are currently active in this buffer. */); 6129 doc: /* Non-nil means the mark and region are currently active in this buffer. */);
6122 6130
6123 DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil, 6131 DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil,
6124 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. 6132 doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans.
6125 6133
6126Normally, the line-motion functions work by scanning the buffer for 6134Normally, the line-motion functions work by scanning the buffer for
6127newlines. Columnar operations (like `move-to-column' and 6135newlines. Columnar operations (like `move-to-column' and
@@ -6131,18 +6139,24 @@ buffer's lines are very long (say, more than 500 characters), these
6131motion functions will take longer to execute. Emacs may also take 6139motion functions will take longer to execute. Emacs may also take
6132longer to update the display. 6140longer to update the display.
6133 6141
6134If `cache-long-line-scans' is non-nil, these motion functions cache the 6142If `cache-long-scans' is non-nil, these motion functions cache the
6135results of their scans, and consult the cache to avoid rescanning 6143results of their scans, and consult the cache to avoid rescanning
6136regions of the buffer until the text is modified. The caches are most 6144regions of the buffer until the text is modified. The caches are most
6137beneficial when they prevent the most searching---that is, when the 6145beneficial when they prevent the most searching---that is, when the
6138buffer contains long lines and large regions of characters with the 6146buffer contains long lines and large regions of characters with the
6139same, fixed screen width. 6147same, fixed screen width.
6140 6148
6141When `cache-long-line-scans' is non-nil, processing short lines will 6149When `cache-long-scans' is non-nil, processing short lines will
6142become slightly slower (because of the overhead of consulting the 6150become slightly slower (because of the overhead of consulting the
6143cache), and the caches will use memory roughly proportional to the 6151cache), and the caches will use memory roughly proportional to the
6144number of newlines and characters whose screen width varies. 6152number of newlines and characters whose screen width varies.
6145 6153
6154Bidirectional editing also requires buffer scans to find paragraph
6155separators. If you have large paragraphs or no paragraph separators
6156at all, these scans may be slow. If `cache-long-scans' is non-nil,
6157results of these scans are cached. This doesn't help too much if
6158paragraphs are of the reasonable (few thousands of characters) size.
6159
6146The caches require no explicit maintenance; their accuracy is 6160The caches require no explicit maintenance; their accuracy is
6147maintained internally by the Emacs primitives. Enabling or disabling 6161maintained internally by the Emacs primitives. Enabling or disabling
6148the cache should not affect the behavior of any of the motion 6162the cache should not affect the behavior of any of the motion