aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorXue Fuqiao2013-09-04 08:39:34 +0800
committerXue Fuqiao2013-09-04 08:39:34 +0800
commitadf2fc4a01efe77d73cd52bc9173914ed56ff531 (patch)
treea5a280a5554a7bffeaf94fccae29fa3ac1a5d066 /src/buffer.c
parent63191d9f2043d2e67657e85a7b3842805dd1dad6 (diff)
parent38726039b77db432989fed106c88e9f1aa463281 (diff)
downloademacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.tar.gz
emacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.zip
Merge from mainline.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c136
1 files changed, 72 insertions, 64 deletions
diff --git a/src/buffer.c b/src/buffer.c
index dfc6b8bcc02..0bcb608dbd3 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -108,9 +108,9 @@ static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
108static void swap_out_buffer_local_variables (struct buffer *b); 108static void swap_out_buffer_local_variables (struct buffer *b);
109static void reset_buffer_local_variables (struct buffer *, bool); 109static void reset_buffer_local_variables (struct buffer *, bool);
110 110
111/* Alist of all buffer names vs the buffers. */ 111/* Alist of all buffer names vs the buffers. This used to be
112/* This used to be a variable, but is no longer, 112 a Lisp-visible variable, but is no longer, to prevent lossage
113 to prevent lossage due to user rplac'ing this alist or its elements. */ 113 due to user rplac'ing this alist or its elements. */
114Lisp_Object Vbuffer_alist; 114Lisp_Object Vbuffer_alist;
115 115
116static Lisp_Object Qkill_buffer_query_functions; 116static Lisp_Object Qkill_buffer_query_functions;
@@ -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)
@@ -478,8 +478,7 @@ If there is no such live buffer, return nil.
478See also `find-buffer-visiting'. */) 478See also `find-buffer-visiting'. */)
479 (register Lisp_Object filename) 479 (register Lisp_Object filename)
480{ 480{
481 register Lisp_Object tail, buf, tem; 481 register Lisp_Object tail, buf, handler;
482 Lisp_Object handler;
483 482
484 CHECK_STRING (filename); 483 CHECK_STRING (filename);
485 filename = Fexpand_file_name (filename, Qnil); 484 filename = Fexpand_file_name (filename, Qnil);
@@ -494,13 +493,10 @@ See also `find-buffer-visiting'. */)
494 return BUFFERP (handled_buf) ? handled_buf : Qnil; 493 return BUFFERP (handled_buf) ? handled_buf : Qnil;
495 } 494 }
496 495
497 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 496 FOR_EACH_LIVE_BUFFER (tail, buf)
498 { 497 {
499 buf = Fcdr (XCAR (tail));
500 if (!BUFFERP (buf)) continue;
501 if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue; 498 if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue;
502 tem = Fstring_equal (BVAR (XBUFFER (buf), filename), filename); 499 if (!NILP (Fstring_equal (BVAR (XBUFFER (buf), filename), filename)))
503 if (!NILP (tem))
504 return buf; 500 return buf;
505 } 501 }
506 return Qnil; 502 return Qnil;
@@ -509,15 +505,12 @@ See also `find-buffer-visiting'. */)
509Lisp_Object 505Lisp_Object
510get_truename_buffer (register Lisp_Object filename) 506get_truename_buffer (register Lisp_Object filename)
511{ 507{
512 register Lisp_Object tail, buf, tem; 508 register Lisp_Object tail, buf;
513 509
514 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 510 FOR_EACH_LIVE_BUFFER (tail, buf)
515 { 511 {
516 buf = Fcdr (XCAR (tail));
517 if (!BUFFERP (buf)) continue;
518 if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue; 512 if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue;
519 tem = Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename); 513 if (!NILP (Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename)))
520 if (!NILP (tem))
521 return buf; 514 return buf;
522 } 515 }
523 return Qnil; 516 return Qnil;
@@ -590,6 +583,7 @@ even if it is dead. The return value is never nil. */)
590 583
591 b->newline_cache = 0; 584 b->newline_cache = 0;
592 b->width_run_cache = 0; 585 b->width_run_cache = 0;
586 b->bidi_paragraph_cache = 0;
593 bset_width_table (b, Qnil); 587 bset_width_table (b, Qnil);
594 b->prevent_redisplay_optimizations_p = 1; 588 b->prevent_redisplay_optimizations_p = 1;
595 589
@@ -813,6 +807,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
813 807
814 b->newline_cache = 0; 808 b->newline_cache = 0;
815 b->width_run_cache = 0; 809 b->width_run_cache = 0;
810 b->bidi_paragraph_cache = 0;
816 bset_width_table (b, Qnil); 811 bset_width_table (b, Qnil);
817 812
818 name = Fcopy_sequence (name); 813 name = Fcopy_sequence (name);
@@ -893,8 +888,8 @@ drop_overlay (struct buffer *b, struct Lisp_Overlay *ov)
893 eassert (b == XBUFFER (Fmarker_buffer (ov->start))); 888 eassert (b == XBUFFER (Fmarker_buffer (ov->start)));
894 modify_overlay (b, marker_position (ov->start), 889 modify_overlay (b, marker_position (ov->start),
895 marker_position (ov->end)); 890 marker_position (ov->end));
896 Fset_marker (ov->start, Qnil, Qnil); 891 unchain_marker (XMARKER (ov->start));
897 Fset_marker (ov->end, Qnil, Qnil); 892 unchain_marker (XMARKER (ov->end));
898 893
899} 894}
900 895
@@ -938,7 +933,7 @@ reset_buffer (register struct buffer *b)
938 bset_filename (b, Qnil); 933 bset_filename (b, Qnil);
939 bset_file_truename (b, Qnil); 934 bset_file_truename (b, Qnil);
940 bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil); 935 bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil);
941 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); 936 b->modtime = make_timespec (0, UNKNOWN_MODTIME_NSECS);
942 b->modtime_size = -1; 937 b->modtime_size = -1;
943 XSETFASTINT (BVAR (b, save_length), 0); 938 XSETFASTINT (BVAR (b, save_length), 0);
944 b->last_window_start = 1; 939 b->last_window_start = 1;
@@ -1581,10 +1576,8 @@ exists, return the buffer `*scratch*' (creating it if necessary). */)
1581 } 1576 }
1582 1577
1583 /* Consider alist of all buffers next. */ 1578 /* Consider alist of all buffers next. */
1584 tail = Vbuffer_alist; 1579 FOR_EACH_LIVE_BUFFER (tail, buf)
1585 for (; CONSP (tail); tail = XCDR (tail))
1586 { 1580 {
1587 buf = Fcdr (XCAR (tail));
1588 if (candidate_buffer (buf, buffer) 1581 if (candidate_buffer (buf, buffer)
1589 /* If the frame has a buffer_predicate, disregard buffers that 1582 /* If the frame has a buffer_predicate, disregard buffers that
1590 don't fit the predicate. */ 1583 don't fit the predicate. */
@@ -1621,12 +1614,9 @@ other_buffer_safely (Lisp_Object buffer)
1621{ 1614{
1622 Lisp_Object tail, buf; 1615 Lisp_Object tail, buf;
1623 1616
1624 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 1617 FOR_EACH_LIVE_BUFFER (tail, buf)
1625 { 1618 if (candidate_buffer (buf, buffer))
1626 buf = Fcdr (XCAR (tail)); 1619 return buf;
1627 if (candidate_buffer (buf, buffer))
1628 return buf;
1629 }
1630 1620
1631 buf = Fget_buffer (build_string ("*scratch*")); 1621 buf = Fget_buffer (build_string ("*scratch*"));
1632 if (NILP (buf)) 1622 if (NILP (buf))
@@ -1957,6 +1947,11 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1957 free_region_cache (b->width_run_cache); 1947 free_region_cache (b->width_run_cache);
1958 b->width_run_cache = 0; 1948 b->width_run_cache = 0;
1959 } 1949 }
1950 if (b->bidi_paragraph_cache)
1951 {
1952 free_region_cache (b->bidi_paragraph_cache);
1953 b->bidi_paragraph_cache = 0;
1954 }
1960 bset_width_table (b, Qnil); 1955 bset_width_table (b, Qnil);
1961 unblock_input (); 1956 unblock_input ();
1962 bset_undo_list (b, Qnil); 1957 bset_undo_list (b, Qnil);
@@ -2367,6 +2362,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2367 current_buffer->clip_changed = 1; other_buffer->clip_changed = 1; 2362 current_buffer->clip_changed = 1; other_buffer->clip_changed = 1;
2368 swapfield (newline_cache, struct region_cache *); 2363 swapfield (newline_cache, struct region_cache *);
2369 swapfield (width_run_cache, struct region_cache *); 2364 swapfield (width_run_cache, struct region_cache *);
2365 swapfield (bidi_paragraph_cache, struct region_cache *);
2370 current_buffer->prevent_redisplay_optimizations_p = 1; 2366 current_buffer->prevent_redisplay_optimizations_p = 1;
2371 other_buffer->prevent_redisplay_optimizations_p = 1; 2367 other_buffer->prevent_redisplay_optimizations_p = 1;
2372 swapfield (overlays_before, struct Lisp_Overlay *); 2368 swapfield (overlays_before, struct Lisp_Overlay *);
@@ -2413,7 +2409,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2413 live window points to that window's buffer. So since we 2409 live window points to that window's buffer. So since we
2414 just swapped the markers between the two buffers, we need 2410 just swapped the markers between the two buffers, we need
2415 to undo the effect of this swap for window markers. */ 2411 to undo the effect of this swap for window markers. */
2416 Lisp_Object w = Fselected_window (), ws = Qnil; 2412 Lisp_Object w = selected_window, ws = Qnil;
2417 Lisp_Object buf1, buf2; 2413 Lisp_Object buf1, buf2;
2418 XSETBUFFER (buf1, current_buffer); XSETBUFFER (buf2, other_buffer); 2414 XSETBUFFER (buf1, current_buffer); XSETBUFFER (buf2, other_buffer);
2419 2415
@@ -3150,8 +3146,8 @@ struct sortvec
3150static int 3146static int
3151compare_overlays (const void *v1, const void *v2) 3147compare_overlays (const void *v1, const void *v2)
3152{ 3148{
3153 const struct sortvec *s1 = (const struct sortvec *) v1; 3149 const struct sortvec *s1 = v1;
3154 const struct sortvec *s2 = (const struct sortvec *) v2; 3150 const struct sortvec *s2 = v2;
3155 if (s1->priority != s2->priority) 3151 if (s1->priority != s2->priority)
3156 return s1->priority < s2->priority ? -1 : 1; 3152 return s1->priority < s2->priority ? -1 : 1;
3157 if (s1->beg != s2->beg) 3153 if (s1->beg != s2->beg)
@@ -3257,8 +3253,8 @@ static ptrdiff_t overlay_str_len;
3257static int 3253static int
3258cmp_for_strings (const void *as1, const void *as2) 3254cmp_for_strings (const void *as1, const void *as2)
3259{ 3255{
3260 struct sortstr *s1 = (struct sortstr *)as1; 3256 struct sortstr const *s1 = as1;
3261 struct sortstr *s2 = (struct sortstr *)as2; 3257 struct sortstr const *s2 = as2;
3262 if (s1->size != s2->size) 3258 if (s1->size != s2->size)
3263 return s2->size < s1->size ? -1 : 1; 3259 return s2->size < s1->size ? -1 : 1;
3264 if (s1->priority != s2->priority) 3260 if (s1->priority != s2->priority)
@@ -3838,7 +3834,8 @@ for the front of the overlay advance when text is inserted there
3838The fifth arg REAR-ADVANCE, if non-nil, makes the marker 3834The fifth arg REAR-ADVANCE, if non-nil, makes the marker
3839for the rear of the overlay advance when text is inserted there 3835for the rear of the overlay advance when text is inserted there
3840\(which means the text *is* included in the overlay). */) 3836\(which means the text *is* included in the overlay). */)
3841 (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, Lisp_Object front_advance, Lisp_Object rear_advance) 3837 (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer,
3838 Lisp_Object front_advance, Lisp_Object rear_advance)
3842{ 3839{
3843 Lisp_Object overlay; 3840 Lisp_Object overlay;
3844 struct buffer *b; 3841 struct buffer *b;
@@ -3847,12 +3844,11 @@ for the rear of the overlay advance when text is inserted there
3847 XSETBUFFER (buffer, current_buffer); 3844 XSETBUFFER (buffer, current_buffer);
3848 else 3845 else
3849 CHECK_BUFFER (buffer); 3846 CHECK_BUFFER (buffer);
3850 if (MARKERP (beg) 3847
3851 && ! EQ (Fmarker_buffer (beg), buffer)) 3848 if (MARKERP (beg) && !EQ (Fmarker_buffer (beg), buffer))
3852 error ("Marker points into wrong buffer"); 3849 signal_error ("Marker points into wrong buffer", beg);
3853 if (MARKERP (end) 3850 if (MARKERP (end) && !EQ (Fmarker_buffer (end), buffer))
3854 && ! EQ (Fmarker_buffer (end), buffer)) 3851 signal_error ("Marker points into wrong buffer", end);
3855 error ("Marker points into wrong buffer");
3856 3852
3857 CHECK_NUMBER_COERCE_MARKER (beg); 3853 CHECK_NUMBER_COERCE_MARKER (beg);
3858 CHECK_NUMBER_COERCE_MARKER (end); 3854 CHECK_NUMBER_COERCE_MARKER (end);
@@ -3978,12 +3974,10 @@ buffer. */)
3978 if (NILP (Fbuffer_live_p (buffer))) 3974 if (NILP (Fbuffer_live_p (buffer)))
3979 error ("Attempt to move overlay to a dead buffer"); 3975 error ("Attempt to move overlay to a dead buffer");
3980 3976
3981 if (MARKERP (beg) 3977 if (MARKERP (beg) && !EQ (Fmarker_buffer (beg), buffer))
3982 && ! EQ (Fmarker_buffer (beg), buffer)) 3978 signal_error ("Marker points into wrong buffer", beg);
3983 error ("Marker points into wrong buffer"); 3979 if (MARKERP (end) && !EQ (Fmarker_buffer (end), buffer))
3984 if (MARKERP (end) 3980 signal_error ("Marker points into wrong buffer", end);
3985 && ! EQ (Fmarker_buffer (end), buffer))
3986 error ("Marker points into wrong buffer");
3987 3981
3988 CHECK_NUMBER_COERCE_MARKER (beg); 3982 CHECK_NUMBER_COERCE_MARKER (beg);
3989 CHECK_NUMBER_COERCE_MARKER (end); 3983 CHECK_NUMBER_COERCE_MARKER (end);
@@ -4165,6 +4159,9 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
4165 4159
4166 CHECK_NUMBER_COERCE_MARKER (pos); 4160 CHECK_NUMBER_COERCE_MARKER (pos);
4167 4161
4162 if (!buffer_has_overlays ())
4163 return Qnil;
4164
4168 len = 10; 4165 len = 10;
4169 /* We can't use alloca here because overlays_at can call xrealloc. */ 4166 /* We can't use alloca here because overlays_at can call xrealloc. */
4170 overlay_vec = xmalloc (len * sizeof *overlay_vec); 4167 overlay_vec = xmalloc (len * sizeof *overlay_vec);
@@ -4197,6 +4194,9 @@ end of the buffer. */)
4197 CHECK_NUMBER_COERCE_MARKER (beg); 4194 CHECK_NUMBER_COERCE_MARKER (beg);
4198 CHECK_NUMBER_COERCE_MARKER (end); 4195 CHECK_NUMBER_COERCE_MARKER (end);
4199 4196
4197 if (!buffer_has_overlays ())
4198 return Qnil;
4199
4200 len = 10; 4200 len = 10;
4201 overlay_vec = xmalloc (len * sizeof *overlay_vec); 4201 overlay_vec = xmalloc (len * sizeof *overlay_vec);
4202 4202
@@ -4225,6 +4225,9 @@ the value is (point-max). */)
4225 4225
4226 CHECK_NUMBER_COERCE_MARKER (pos); 4226 CHECK_NUMBER_COERCE_MARKER (pos);
4227 4227
4228 if (!buffer_has_overlays ())
4229 return make_number (ZV);
4230
4228 len = 10; 4231 len = 10;
4229 overlay_vec = xmalloc (len * sizeof *overlay_vec); 4232 overlay_vec = xmalloc (len * sizeof *overlay_vec);
4230 4233
@@ -4264,6 +4267,9 @@ the value is (point-min). */)
4264 4267
4265 CHECK_NUMBER_COERCE_MARKER (pos); 4268 CHECK_NUMBER_COERCE_MARKER (pos);
4266 4269
4270 if (!buffer_has_overlays ())
4271 return make_number (BEGV);
4272
4267 /* At beginning of buffer, we know the answer; 4273 /* At beginning of buffer, we know the answer;
4268 avoid bug subtracting 1 below. */ 4274 avoid bug subtracting 1 below. */
4269 if (XINT (pos) == BEGV) 4275 if (XINT (pos) == BEGV)
@@ -4756,7 +4762,7 @@ static struct mmap_region *
4756mmap_find (void *start, void *end) 4762mmap_find (void *start, void *end)
4757{ 4763{
4758 struct mmap_region *r; 4764 struct mmap_region *r;
4759 char *s = (char *) start, *e = (char *) end; 4765 char *s = start, *e = end;
4760 4766
4761 for (r = mmap_regions; r; r = r->next) 4767 for (r = mmap_regions; r; r = r->next)
4762 { 4768 {
@@ -4915,7 +4921,7 @@ mmap_alloc (void **var, size_t nbytes)
4915 } 4921 }
4916 else 4922 else
4917 { 4923 {
4918 struct mmap_region *r = (struct mmap_region *) p; 4924 struct mmap_region *r = p;
4919 4925
4920 r->nbytes_specified = nbytes; 4926 r->nbytes_specified = nbytes;
4921 r->nbytes_mapped = map; 4927 r->nbytes_mapped = map;
@@ -5055,7 +5061,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
5055 memory_full (nbytes); 5061 memory_full (nbytes);
5056 } 5062 }
5057 5063
5058 b->text->beg = (unsigned char *) p; 5064 b->text->beg = p;
5059 unblock_input (); 5065 unblock_input ();
5060} 5066}
5061 5067
@@ -5083,7 +5089,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
5083 memory_full (nbytes); 5089 memory_full (nbytes);
5084 } 5090 }
5085 5091
5086 BUF_BEG_ADDR (b) = (unsigned char *) p; 5092 BUF_BEG_ADDR (b) = p;
5087 unblock_input (); 5093 unblock_input ();
5088} 5094}
5089 5095
@@ -5181,7 +5187,7 @@ init_buffer_once (void)
5181 bset_buffer_file_coding_system (&buffer_defaults, Qnil); 5187 bset_buffer_file_coding_system (&buffer_defaults, Qnil);
5182 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); 5188 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
5183 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); 5189 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
5184 bset_cache_long_line_scans (&buffer_defaults, Qnil); 5190 bset_cache_long_scans (&buffer_defaults, Qnil);
5185 bset_file_truename (&buffer_defaults, Qnil); 5191 bset_file_truename (&buffer_defaults, Qnil);
5186 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); 5192 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
5187 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); 5193 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
@@ -5245,7 +5251,7 @@ init_buffer_once (void)
5245 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; 5251 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx;
5246 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx; 5252 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx;
5247 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx; 5253 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx;
5248 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx; 5254 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx;
5249 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx; 5255 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx;
5250 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx; 5256 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx;
5251 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx; 5257 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx;
@@ -5401,11 +5407,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5401 bo_fwd->predicate = predicate; 5407 bo_fwd->predicate = predicate;
5402 sym->declared_special = 1; 5408 sym->declared_special = 1;
5403 sym->redirect = SYMBOL_FORWARDED; 5409 sym->redirect = SYMBOL_FORWARDED;
5404 { 5410 SET_SYMBOL_FWD (sym, (union Lisp_Fwd *) bo_fwd);
5405 /* I tried to do the job without a cast, but it seems impossible.
5406 union Lisp_Fwd *fwd; &(fwd->u_buffer_objfwd) = bo_fwd; */
5407 SET_SYMBOL_FWD (sym, (union Lisp_Fwd *)bo_fwd);
5408 }
5409 XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym); 5411 XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym);
5410 5412
5411 if (PER_BUFFER_IDX (offset) == 0) 5413 if (PER_BUFFER_IDX (offset) == 0)
@@ -6114,7 +6116,7 @@ An entry (apply FUN-NAME . ARGS) means undo the change with
6114 6116
6115An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo 6117An entry (apply DELTA BEG END FUN-NAME . ARGS) supports selective undo
6116in the active region. BEG and END is the range affected by this entry 6118in the active region. BEG and END is the range affected by this entry
6117and DELTA is the number of bytes added or deleted in that range by 6119and DELTA is the number of characters added or deleted in that range by
6118this change. 6120this change.
6119 6121
6120An entry (MARKER . DISTANCE) indicates that the marker MARKER 6122An entry (MARKER . DISTANCE) indicates that the marker MARKER
@@ -6132,8 +6134,8 @@ If the value of the variable is t, undo information is not recorded. */);
6132 DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil, 6134 DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil,
6133 doc: /* Non-nil means the mark and region are currently active in this buffer. */); 6135 doc: /* Non-nil means the mark and region are currently active in this buffer. */);
6134 6136
6135 DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil, 6137 DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil,
6136 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. 6138 doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans.
6137 6139
6138Normally, the line-motion functions work by scanning the buffer for 6140Normally, the line-motion functions work by scanning the buffer for
6139newlines. Columnar operations (like `move-to-column' and 6141newlines. Columnar operations (like `move-to-column' and
@@ -6143,18 +6145,24 @@ buffer's lines are very long (say, more than 500 characters), these
6143motion functions will take longer to execute. Emacs may also take 6145motion functions will take longer to execute. Emacs may also take
6144longer to update the display. 6146longer to update the display.
6145 6147
6146If `cache-long-line-scans' is non-nil, these motion functions cache the 6148If `cache-long-scans' is non-nil, these motion functions cache the
6147results of their scans, and consult the cache to avoid rescanning 6149results of their scans, and consult the cache to avoid rescanning
6148regions of the buffer until the text is modified. The caches are most 6150regions of the buffer until the text is modified. The caches are most
6149beneficial when they prevent the most searching---that is, when the 6151beneficial when they prevent the most searching---that is, when the
6150buffer contains long lines and large regions of characters with the 6152buffer contains long lines and large regions of characters with the
6151same, fixed screen width. 6153same, fixed screen width.
6152 6154
6153When `cache-long-line-scans' is non-nil, processing short lines will 6155When `cache-long-scans' is non-nil, processing short lines will
6154become slightly slower (because of the overhead of consulting the 6156become slightly slower (because of the overhead of consulting the
6155cache), and the caches will use memory roughly proportional to the 6157cache), and the caches will use memory roughly proportional to the
6156number of newlines and characters whose screen width varies. 6158number of newlines and characters whose screen width varies.
6157 6159
6160Bidirectional editing also requires buffer scans to find paragraph
6161separators. If you have large paragraphs or no paragraph separators
6162at all, these scans may be slow. If `cache-long-scans' is non-nil,
6163results of these scans are cached. This doesn't help too much if
6164paragraphs are of the reasonable (few thousands of characters) size.
6165
6158The caches require no explicit maintenance; their accuracy is 6166The caches require no explicit maintenance; their accuracy is
6159maintained internally by the Emacs primitives. Enabling or disabling 6167maintained internally by the Emacs primitives. Enabling or disabling
6160the cache should not affect the behavior of any of the motion 6168the cache should not affect the behavior of any of the motion