aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorStephen Berman2013-06-14 22:07:55 +0200
committerStephen Berman2013-06-14 22:07:55 +0200
commitbd358779861f265a7acff31ead40172735af693e (patch)
tree345217a9889dbd29b09bdc80a94265c17719d41f /src/buffer.c
parent2a97b47f0878cbda86cb6ba0e7e744924810b70e (diff)
parentf7394b12358ae453a0c8b85fc307afc1b740010d (diff)
downloademacs-bd358779861f265a7acff31ead40172735af693e.tar.gz
emacs-bd358779861f265a7acff31ead40172735af693e.zip
Merge from trunk.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c474
1 files changed, 242 insertions, 232 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d512547d34e..abebdf21135 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,6 +1,7 @@
1/* Buffer manipulation primitives for GNU Emacs. 1/* Buffer manipulation primitives for GNU Emacs.
2 2
3Copyright (C) 1985-1989, 1993-1995, 1997-2012 Free Software Foundation, Inc. 3Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation,
4Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -26,7 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include <sys/param.h> 27#include <sys/param.h>
27#include <errno.h> 28#include <errno.h>
28#include <stdio.h> 29#include <stdio.h>
29#include <setjmp.h>
30#include <unistd.h> 30#include <unistd.h>
31 31
32#include <verify.h> 32#include <verify.h>
@@ -151,230 +151,227 @@ static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
151static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); 151static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool);
152 152
153/* These setters are used only in this file, so they can be private. */ 153/* These setters are used only in this file, so they can be private. */
154static inline void 154static void
155bset_abbrev_mode (struct buffer *b, Lisp_Object val) 155bset_abbrev_mode (struct buffer *b, Lisp_Object val)
156{ 156{
157 b->INTERNAL_FIELD (abbrev_mode) = val; 157 b->INTERNAL_FIELD (abbrev_mode) = val;
158} 158}
159static inline void 159static void
160bset_abbrev_table (struct buffer *b, Lisp_Object val) 160bset_abbrev_table (struct buffer *b, Lisp_Object val)
161{ 161{
162 b->INTERNAL_FIELD (abbrev_table) = val; 162 b->INTERNAL_FIELD (abbrev_table) = val;
163} 163}
164static inline void 164static void
165bset_auto_fill_function (struct buffer *b, Lisp_Object val) 165bset_auto_fill_function (struct buffer *b, Lisp_Object val)
166{ 166{
167 b->INTERNAL_FIELD (auto_fill_function) = val; 167 b->INTERNAL_FIELD (auto_fill_function) = val;
168} 168}
169static inline void 169static void
170bset_auto_save_file_format (struct buffer *b, Lisp_Object val) 170bset_auto_save_file_format (struct buffer *b, Lisp_Object val)
171{ 171{
172 b->INTERNAL_FIELD (auto_save_file_format) = val; 172 b->INTERNAL_FIELD (auto_save_file_format) = val;
173} 173}
174static inline void 174static void
175bset_auto_save_file_name (struct buffer *b, Lisp_Object val) 175bset_auto_save_file_name (struct buffer *b, Lisp_Object val)
176{ 176{
177 b->INTERNAL_FIELD (auto_save_file_name) = val; 177 b->INTERNAL_FIELD (auto_save_file_name) = val;
178} 178}
179static inline void 179static void
180bset_backed_up (struct buffer *b, Lisp_Object val) 180bset_backed_up (struct buffer *b, Lisp_Object val)
181{ 181{
182 b->INTERNAL_FIELD (backed_up) = val; 182 b->INTERNAL_FIELD (backed_up) = val;
183} 183}
184static inline void 184static void
185bset_begv_marker (struct buffer *b, Lisp_Object val) 185bset_begv_marker (struct buffer *b, Lisp_Object val)
186{ 186{
187 b->INTERNAL_FIELD (begv_marker) = val; 187 b->INTERNAL_FIELD (begv_marker) = val;
188} 188}
189static inline void 189static void
190bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) 190bset_bidi_display_reordering (struct buffer *b, Lisp_Object val)
191{ 191{
192 b->INTERNAL_FIELD (bidi_display_reordering) = val; 192 b->INTERNAL_FIELD (bidi_display_reordering) = val;
193} 193}
194static inline void 194static void
195bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) 195bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
196{ 196{
197 b->INTERNAL_FIELD (buffer_file_coding_system) = val; 197 b->INTERNAL_FIELD (buffer_file_coding_system) = val;
198} 198}
199static inline void 199static void
200bset_cache_long_line_scans (struct buffer *b, Lisp_Object val) 200bset_cache_long_line_scans (struct buffer *b, Lisp_Object val)
201{ 201{
202 b->INTERNAL_FIELD (cache_long_line_scans) = val; 202 b->INTERNAL_FIELD (cache_long_line_scans) = val;
203} 203}
204static inline void 204static void
205bset_case_fold_search (struct buffer *b, Lisp_Object val) 205bset_case_fold_search (struct buffer *b, Lisp_Object val)
206{ 206{
207 b->INTERNAL_FIELD (case_fold_search) = val; 207 b->INTERNAL_FIELD (case_fold_search) = val;
208} 208}
209static inline void 209static void
210bset_ctl_arrow (struct buffer *b, Lisp_Object val) 210bset_ctl_arrow (struct buffer *b, Lisp_Object val)
211{ 211{
212 b->INTERNAL_FIELD (ctl_arrow) = val; 212 b->INTERNAL_FIELD (ctl_arrow) = val;
213} 213}
214static inline void 214static void
215bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) 215bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val)
216{ 216{
217 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val; 217 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val;
218} 218}
219static inline void 219static void
220bset_cursor_type (struct buffer *b, Lisp_Object val) 220bset_cursor_type (struct buffer *b, Lisp_Object val)
221{ 221{
222 b->INTERNAL_FIELD (cursor_type) = val; 222 b->INTERNAL_FIELD (cursor_type) = val;
223} 223}
224static inline void 224static void
225bset_display_table (struct buffer *b, Lisp_Object val) 225bset_display_table (struct buffer *b, Lisp_Object val)
226{ 226{
227 b->INTERNAL_FIELD (display_table) = val; 227 b->INTERNAL_FIELD (display_table) = val;
228} 228}
229static inline void 229static void
230bset_extra_line_spacing (struct buffer *b, Lisp_Object val) 230bset_extra_line_spacing (struct buffer *b, Lisp_Object val)
231{ 231{
232 b->INTERNAL_FIELD (extra_line_spacing) = val; 232 b->INTERNAL_FIELD (extra_line_spacing) = val;
233} 233}
234static inline void 234static void
235bset_file_format (struct buffer *b, Lisp_Object val) 235bset_file_format (struct buffer *b, Lisp_Object val)
236{ 236{
237 b->INTERNAL_FIELD (file_format) = val; 237 b->INTERNAL_FIELD (file_format) = val;
238} 238}
239static inline void 239static void
240bset_file_truename (struct buffer *b, Lisp_Object val) 240bset_file_truename (struct buffer *b, Lisp_Object val)
241{ 241{
242 b->INTERNAL_FIELD (file_truename) = val; 242 b->INTERNAL_FIELD (file_truename) = val;
243} 243}
244static inline void 244static void
245bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) 245bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val)
246{ 246{
247 b->INTERNAL_FIELD (fringe_cursor_alist) = val; 247 b->INTERNAL_FIELD (fringe_cursor_alist) = val;
248} 248}
249static inline void 249static void
250bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) 250bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val)
251{ 251{
252 b->INTERNAL_FIELD (fringe_indicator_alist) = val; 252 b->INTERNAL_FIELD (fringe_indicator_alist) = val;
253} 253}
254static inline void 254static void
255bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) 255bset_fringes_outside_margins (struct buffer *b, Lisp_Object val)
256{ 256{
257 b->INTERNAL_FIELD (fringes_outside_margins) = val; 257 b->INTERNAL_FIELD (fringes_outside_margins) = val;
258} 258}
259static inline void 259static void
260bset_header_line_format (struct buffer *b, Lisp_Object val) 260bset_header_line_format (struct buffer *b, Lisp_Object val)
261{ 261{
262 b->INTERNAL_FIELD (header_line_format) = val; 262 b->INTERNAL_FIELD (header_line_format) = val;
263} 263}
264static inline void 264static void
265bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) 265bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
266{ 266{
267 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val; 267 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val;
268} 268}
269static inline void 269static void
270bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) 270bset_indicate_empty_lines (struct buffer *b, Lisp_Object val)
271{ 271{
272 b->INTERNAL_FIELD (indicate_empty_lines) = val; 272 b->INTERNAL_FIELD (indicate_empty_lines) = val;
273} 273}
274static inline void 274static void
275bset_invisibility_spec (struct buffer *b, Lisp_Object val) 275bset_invisibility_spec (struct buffer *b, Lisp_Object val)
276{ 276{
277 b->INTERNAL_FIELD (invisibility_spec) = val; 277 b->INTERNAL_FIELD (invisibility_spec) = val;
278} 278}
279static inline void 279static void
280bset_left_fringe_width (struct buffer *b, Lisp_Object val) 280bset_left_fringe_width (struct buffer *b, Lisp_Object val)
281{ 281{
282 b->INTERNAL_FIELD (left_fringe_width) = val; 282 b->INTERNAL_FIELD (left_fringe_width) = val;
283} 283}
284static inline void 284static void
285bset_major_mode (struct buffer *b, Lisp_Object val) 285bset_major_mode (struct buffer *b, Lisp_Object val)
286{ 286{
287 b->INTERNAL_FIELD (major_mode) = val; 287 b->INTERNAL_FIELD (major_mode) = val;
288} 288}
289static inline void 289static void
290bset_mark (struct buffer *b, Lisp_Object val) 290bset_mark (struct buffer *b, Lisp_Object val)
291{ 291{
292 b->INTERNAL_FIELD (mark) = val; 292 b->INTERNAL_FIELD (mark) = val;
293} 293}
294static inline void 294static void
295bset_minor_modes (struct buffer *b, Lisp_Object val) 295bset_minor_modes (struct buffer *b, Lisp_Object val)
296{ 296{
297 b->INTERNAL_FIELD (minor_modes) = val; 297 b->INTERNAL_FIELD (minor_modes) = val;
298} 298}
299static inline void 299static void
300bset_mode_line_format (struct buffer *b, Lisp_Object val) 300bset_mode_line_format (struct buffer *b, Lisp_Object val)
301{ 301{
302 b->INTERNAL_FIELD (mode_line_format) = val; 302 b->INTERNAL_FIELD (mode_line_format) = val;
303} 303}
304static inline void 304static void
305bset_mode_name (struct buffer *b, Lisp_Object val) 305bset_mode_name (struct buffer *b, Lisp_Object val)
306{ 306{
307 b->INTERNAL_FIELD (mode_name) = val; 307 b->INTERNAL_FIELD (mode_name) = val;
308} 308}
309static inline void 309static void
310bset_name (struct buffer *b, Lisp_Object val) 310bset_name (struct buffer *b, Lisp_Object val)
311{ 311{
312 b->INTERNAL_FIELD (name) = val; 312 b->INTERNAL_FIELD (name) = val;
313} 313}
314static inline void 314static void
315bset_overwrite_mode (struct buffer *b, Lisp_Object val) 315bset_overwrite_mode (struct buffer *b, Lisp_Object val)
316{ 316{
317 b->INTERNAL_FIELD (overwrite_mode) = val; 317 b->INTERNAL_FIELD (overwrite_mode) = val;
318} 318}
319static inline void 319static void
320bset_pt_marker (struct buffer *b, Lisp_Object val) 320bset_pt_marker (struct buffer *b, Lisp_Object val)
321{ 321{
322 b->INTERNAL_FIELD (pt_marker) = val; 322 b->INTERNAL_FIELD (pt_marker) = val;
323} 323}
324static inline void 324static void
325bset_right_fringe_width (struct buffer *b, Lisp_Object val) 325bset_right_fringe_width (struct buffer *b, Lisp_Object val)
326{ 326{
327 b->INTERNAL_FIELD (right_fringe_width) = val; 327 b->INTERNAL_FIELD (right_fringe_width) = val;
328} 328}
329static inline void 329static void
330bset_save_length (struct buffer *b, Lisp_Object val) 330bset_save_length (struct buffer *b, Lisp_Object val)
331{ 331{
332 b->INTERNAL_FIELD (save_length) = val; 332 b->INTERNAL_FIELD (save_length) = val;
333} 333}
334static inline void 334static void
335bset_scroll_bar_width (struct buffer *b, Lisp_Object val) 335bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
336{ 336{
337 b->INTERNAL_FIELD (scroll_bar_width) = val; 337 b->INTERNAL_FIELD (scroll_bar_width) = val;
338} 338}
339static inline void 339static void
340bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) 340bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val)
341{ 341{
342 b->INTERNAL_FIELD (scroll_down_aggressively) = val; 342 b->INTERNAL_FIELD (scroll_down_aggressively) = val;
343} 343}
344static inline void 344static void
345bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) 345bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val)
346{ 346{
347 b->INTERNAL_FIELD (scroll_up_aggressively) = val; 347 b->INTERNAL_FIELD (scroll_up_aggressively) = val;
348} 348}
349static inline void 349static void
350bset_selective_display (struct buffer *b, Lisp_Object val) 350bset_selective_display (struct buffer *b, Lisp_Object val)
351{ 351{
352 b->INTERNAL_FIELD (selective_display) = val; 352 b->INTERNAL_FIELD (selective_display) = val;
353} 353}
354static inline void 354static void
355bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) 355bset_selective_display_ellipses (struct buffer *b, Lisp_Object val)
356{ 356{
357 b->INTERNAL_FIELD (selective_display_ellipses) = val; 357 b->INTERNAL_FIELD (selective_display_ellipses) = val;
358} 358}
359static inline void 359static void
360bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) 360bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val)
361{ 361{
362 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val; 362 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val;
363} 363}
364static inline void 364static void
365bset_word_wrap (struct buffer *b, Lisp_Object val) 365bset_word_wrap (struct buffer *b, Lisp_Object val)
366{ 366{
367 b->INTERNAL_FIELD (word_wrap) = val; 367 b->INTERNAL_FIELD (word_wrap) = val;
368} 368}
369static inline void 369static void
370bset_zv_marker (struct buffer *b, Lisp_Object val) 370bset_zv_marker (struct buffer *b, Lisp_Object val)
371{ 371{
372 b->INTERNAL_FIELD (zv_marker) = val; 372 b->INTERNAL_FIELD (zv_marker) = val;
373} 373}
374 374
375/* For debugging; temporary. See set_buffer_internal. */
376/* Lisp_Object Qlisp_mode, Vcheck_symbol; */
377
378void 375void
379nsberror (Lisp_Object spec) 376nsberror (Lisp_Object spec)
380{ 377{
@@ -407,7 +404,6 @@ followed by the rest of the buffers. */)
407 Lisp_Object framelist, prevlist, tail; 404 Lisp_Object framelist, prevlist, tail;
408 Lisp_Object args[3]; 405 Lisp_Object args[3];
409 406
410 CHECK_FRAME (frame);
411 framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); 407 framelist = Fcopy_sequence (XFRAME (frame)->buffer_list);
412 prevlist = Fnreverse (Fcopy_sequence 408 prevlist = Fnreverse (Fcopy_sequence
413 (XFRAME (frame)->buried_buffer_list)); 409 (XFRAME (frame)->buried_buffer_list));
@@ -549,13 +545,15 @@ even if it is dead. The return value is never nil. */)
549 b->base_buffer = NULL; 545 b->base_buffer = NULL;
550 /* No one shares the text with us now. */ 546 /* No one shares the text with us now. */
551 b->indirections = 0; 547 b->indirections = 0;
548 /* No one shows us now. */
549 b->window_count = 0;
552 550
553 BUF_GAP_SIZE (b) = 20; 551 BUF_GAP_SIZE (b) = 20;
554 BLOCK_INPUT; 552 block_input ();
555 /* We allocate extra 1-byte at the tail and keep it always '\0' for 553 /* We allocate extra 1-byte at the tail and keep it always '\0' for
556 anchoring a search. */ 554 anchoring a search. */
557 alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); 555 alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1);
558 UNBLOCK_INPUT; 556 unblock_input ();
559 if (! BUF_BEG_ADDR (b)) 557 if (! BUF_BEG_ADDR (b))
560 buffer_memory_full (BUF_GAP_SIZE (b) + 1); 558 buffer_memory_full (BUF_GAP_SIZE (b) + 1);
561 559
@@ -575,6 +573,7 @@ even if it is dead. The return value is never nil. */)
575 BUF_CHARS_MODIFF (b) = 1; 573 BUF_CHARS_MODIFF (b) = 1;
576 BUF_OVERLAY_MODIFF (b) = 1; 574 BUF_OVERLAY_MODIFF (b) = 1;
577 BUF_SAVE_MODIFF (b) = 1; 575 BUF_SAVE_MODIFF (b) = 1;
576 BUF_COMPACT (b) = 1;
578 set_buffer_intervals (b, NULL); 577 set_buffer_intervals (b, NULL);
579 BUF_UNCHANGED_MODIFIED (b) = 1; 578 BUF_UNCHANGED_MODIFIED (b) = 1;
580 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1; 579 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
@@ -652,13 +651,13 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
652 651
653/* Set an appropriate overlay of B. */ 652/* Set an appropriate overlay of B. */
654 653
655static inline void 654static void
656set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o) 655set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
657{ 656{
658 b->overlays_before = o; 657 b->overlays_before = o;
659} 658}
660 659
661static inline void 660static void
662set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o) 661set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
663{ 662{
664 b->overlays_after = o; 663 b->overlays_after = o;
@@ -796,6 +795,8 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
796 b->indirections = -1; 795 b->indirections = -1;
797 /* Notify base buffer that we share the text now. */ 796 /* Notify base buffer that we share the text now. */
798 b->base_buffer->indirections++; 797 b->base_buffer->indirections++;
798 /* Always -1 for an indirect buffer. */
799 b->window_count = -1;
799 800
800 b->pt = b->base_buffer->pt; 801 b->pt = b->base_buffer->pt;
801 b->begv = b->base_buffer->begv; 802 b->begv = b->base_buffer->begv;
@@ -898,6 +899,8 @@ delete_all_overlays (struct buffer *b)
898{ 899{
899 struct Lisp_Overlay *ov, *next; 900 struct Lisp_Overlay *ov, *next;
900 901
902 /* FIXME: Since each drop_overlay will scan BUF_MARKERS to unlink its
903 markers, we have an unneeded O(N^2) behavior here. */
901 for (ov = b->overlays_before; ov; ov = next) 904 for (ov = b->overlays_before; ov; ov = next)
902 { 905 {
903 drop_overlay (b, ov); 906 drop_overlay (b, ov);
@@ -1336,15 +1339,19 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
1336A non-nil FLAG means mark the buffer modified. */) 1339A non-nil FLAG means mark the buffer modified. */)
1337 (Lisp_Object flag) 1340 (Lisp_Object flag)
1338{ 1341{
1339 Lisp_Object fn, buffer, window; 1342 Lisp_Object fn;
1340 1343
1341#ifdef CLASH_DETECTION 1344#ifdef CLASH_DETECTION
1342 /* If buffer becoming modified, lock the file. 1345 /* If buffer becoming modified, lock the file.
1343 If buffer becoming unmodified, unlock the file. */ 1346 If buffer becoming unmodified, unlock the file. */
1344 1347
1345 fn = BVAR (current_buffer, file_truename); 1348 struct buffer *b = current_buffer->base_buffer
1349 ? current_buffer->base_buffer
1350 : current_buffer;
1351
1352 fn = BVAR (b, file_truename);
1346 /* Test buffer-file-name so that binding it to nil is effective. */ 1353 /* Test buffer-file-name so that binding it to nil is effective. */
1347 if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) 1354 if (!NILP (fn) && ! NILP (BVAR (b, filename)))
1348 { 1355 {
1349 bool already = SAVE_MODIFF < MODIFF; 1356 bool already = SAVE_MODIFF < MODIFF;
1350 if (!already && !NILP (flag)) 1357 if (!already && !NILP (flag))
@@ -1385,9 +1392,7 @@ A non-nil FLAG means mark the buffer modified. */)
1385 Ideally, I think there should be another mechanism for fontifying 1392 Ideally, I think there should be another mechanism for fontifying
1386 buffers without "modifying" buffers, or redisplay should be 1393 buffers without "modifying" buffers, or redisplay should be
1387 smarter about updating the `*' in mode lines. --gerd */ 1394 smarter about updating the `*' in mode lines. --gerd */
1388 XSETBUFFER (buffer, current_buffer); 1395 if (buffer_window_count (current_buffer))
1389 window = Fget_buffer_window (buffer, Qt);
1390 if (WINDOWP (window))
1391 { 1396 {
1392 ++update_mode_lines; 1397 ++update_mode_lines;
1393 current_buffer->prevent_redisplay_optimizations_p = 1; 1398 current_buffer->prevent_redisplay_optimizations_p = 1;
@@ -1525,6 +1530,16 @@ This does not change the name of the visited file (if any). */)
1525 return BVAR (current_buffer, name); 1530 return BVAR (current_buffer, name);
1526} 1531}
1527 1532
1533/* True if B can be used as 'other-than-BUFFER' buffer. */
1534
1535static bool
1536candidate_buffer (Lisp_Object b, Lisp_Object buffer)
1537{
1538 return (BUFFERP (b) && !EQ (b, buffer)
1539 && BUFFER_LIVE_P (XBUFFER (b))
1540 && !BUFFER_HIDDEN_P (XBUFFER (b)));
1541}
1542
1528DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, 1543DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
1529 doc: /* Return most recently selected buffer other than BUFFER. 1544 doc: /* Return most recently selected buffer other than BUFFER.
1530Buffers not visible in windows are preferred to visible buffers, unless 1545Buffers not visible in windows are preferred to visible buffers, unless
@@ -1538,23 +1553,15 @@ list first, followed by the list of all buffers. If no other buffer
1538exists, return the buffer `*scratch*' (creating it if necessary). */) 1553exists, return the buffer `*scratch*' (creating it if necessary). */)
1539 (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) 1554 (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
1540{ 1555{
1541 Lisp_Object tail, buf, pred; 1556 struct frame *f = decode_any_frame (frame);
1542 Lisp_Object notsogood = Qnil; 1557 Lisp_Object tail = f->buffer_list, pred = f->buffer_predicate;
1543 1558 Lisp_Object buf, notsogood = Qnil;
1544 if (NILP (frame))
1545 frame = selected_frame;
1546 1559
1547 CHECK_FRAME (frame);
1548
1549 pred = frame_buffer_predicate (frame);
1550 /* Consider buffers that have been seen in the frame first. */ 1560 /* Consider buffers that have been seen in the frame first. */
1551 tail = XFRAME (frame)->buffer_list;
1552 for (; CONSP (tail); tail = XCDR (tail)) 1561 for (; CONSP (tail); tail = XCDR (tail))
1553 { 1562 {
1554 buf = XCAR (tail); 1563 buf = XCAR (tail);
1555 if (BUFFERP (buf) && !EQ (buf, buffer) 1564 if (candidate_buffer (buf, buffer)
1556 && BUFFER_LIVE_P (XBUFFER (buf))
1557 && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')
1558 /* If the frame has a buffer_predicate, disregard buffers that 1565 /* If the frame has a buffer_predicate, disregard buffers that
1559 don't fit the predicate. */ 1566 don't fit the predicate. */
1560 && (NILP (pred) || !NILP (call1 (pred, buf)))) 1567 && (NILP (pred) || !NILP (call1 (pred, buf))))
@@ -1572,9 +1579,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */)
1572 for (; CONSP (tail); tail = XCDR (tail)) 1579 for (; CONSP (tail); tail = XCDR (tail))
1573 { 1580 {
1574 buf = Fcdr (XCAR (tail)); 1581 buf = Fcdr (XCAR (tail));
1575 if (BUFFERP (buf) && !EQ (buf, buffer) 1582 if (candidate_buffer (buf, buffer)
1576 && BUFFER_LIVE_P (XBUFFER (buf))
1577 && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')
1578 /* If the frame has a buffer_predicate, disregard buffers that 1583 /* If the frame has a buffer_predicate, disregard buffers that
1579 don't fit the predicate. */ 1584 don't fit the predicate. */
1580 && (NILP (pred) || !NILP (call1 (pred, buf)))) 1585 && (NILP (pred) || !NILP (call1 (pred, buf))))
@@ -1610,13 +1615,10 @@ other_buffer_safely (Lisp_Object buffer)
1610{ 1615{
1611 Lisp_Object tail, buf; 1616 Lisp_Object tail, buf;
1612 1617
1613 tail = Vbuffer_alist; 1618 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
1614 for (; CONSP (tail); tail = XCDR (tail))
1615 { 1619 {
1616 buf = Fcdr (XCAR (tail)); 1620 buf = Fcdr (XCAR (tail));
1617 if (BUFFERP (buf) && !EQ (buf, buffer) 1621 if (candidate_buffer (buf, buffer))
1618 && BUFFER_LIVE_P (XBUFFER (buf))
1619 && (SREF (BVAR (XBUFFER (buf), name), 0) != ' '))
1620 return buf; 1622 return buf;
1621 } 1623 }
1622 1624
@@ -1658,20 +1660,13 @@ No argument or nil as argument means do this for the current buffer. */)
1658void 1660void
1659compact_buffer (struct buffer *buffer) 1661compact_buffer (struct buffer *buffer)
1660{ 1662{
1661 /* Verify indirection counters. */ 1663 BUFFER_CHECK_INDIRECTION (buffer);
1662 if (buffer->base_buffer)
1663 {
1664 eassert (buffer->indirections == -1);
1665 eassert (buffer->base_buffer->indirections > 0);
1666 }
1667 else
1668 eassert (buffer->indirections >= 0);
1669 1664
1670 /* Skip dead buffers, indirect buffers and buffers 1665 /* Skip dead buffers, indirect buffers and buffers
1671 which aren't changed since last compaction. */ 1666 which aren't changed since last compaction. */
1672 if (!NILP (buffer->INTERNAL_FIELD (name)) 1667 if (BUFFER_LIVE_P (buffer)
1673 && (buffer->base_buffer == NULL) 1668 && (buffer->base_buffer == NULL)
1674 && (buffer->text->compact != buffer->text->modiff)) 1669 && (BUF_COMPACT (buffer) != BUF_MODIFF (buffer)))
1675 { 1670 {
1676 /* If a buffer's undo list is Qt, that means that undo is 1671 /* If a buffer's undo list is Qt, that means that undo is
1677 turned off in that buffer. Calling truncate_undo_list on 1672 turned off in that buffer. Calling truncate_undo_list on
@@ -1684,19 +1679,15 @@ compact_buffer (struct buffer *buffer)
1684 if (!buffer->text->inhibit_shrinking) 1679 if (!buffer->text->inhibit_shrinking)
1685 { 1680 {
1686 /* If a buffer's gap size is more than 10% of the buffer 1681 /* If a buffer's gap size is more than 10% of the buffer
1687 size, or larger than 2000 bytes, then shrink it 1682 size, or larger than GAP_BYTES_DFL bytes, then shrink it
1688 accordingly. Keep a minimum size of 20 bytes. */ 1683 accordingly. Keep a minimum size of GAP_BYTES_MIN bytes. */
1689 int size = min (2000, max (20, (buffer->text->z_byte / 10))); 1684 ptrdiff_t size = clip_to_bounds (GAP_BYTES_MIN,
1690 1685 BUF_Z_BYTE (buffer) / 10,
1691 if (buffer->text->gap_size > size) 1686 GAP_BYTES_DFL);
1692 { 1687 if (BUF_GAP_SIZE (buffer) > size)
1693 struct buffer *save_current = current_buffer; 1688 make_gap_1 (buffer, -(BUF_GAP_SIZE (buffer) - size));
1694 current_buffer = buffer;
1695 make_gap (-(buffer->text->gap_size - size));
1696 current_buffer = save_current;
1697 }
1698 } 1689 }
1699 buffer->text->compact = buffer->text->modiff; 1690 BUF_COMPACT (buffer) = BUF_MODIFF (buffer);
1700 } 1691 }
1701} 1692}
1702 1693
@@ -1778,7 +1769,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1778 since anything can happen within do_yes_or_no_p. */ 1769 since anything can happen within do_yes_or_no_p. */
1779 1770
1780 /* Don't kill the minibuffer now current. */ 1771 /* Don't kill the minibuffer now current. */
1781 if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) 1772 if (EQ (buffer, XWINDOW (minibuf_window)->contents))
1782 return Qnil; 1773 return Qnil;
1783 1774
1784 /* When we kill an ordinary buffer which shares it's buffer text 1775 /* When we kill an ordinary buffer which shares it's buffer text
@@ -1829,7 +1820,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1829 /* If the buffer now current is shown in the minibuffer and our buffer 1820 /* If the buffer now current is shown in the minibuffer and our buffer
1830 is the sole other buffer give up. */ 1821 is the sole other buffer give up. */
1831 XSETBUFFER (tem, current_buffer); 1822 XSETBUFFER (tem, current_buffer);
1832 if (EQ (tem, XWINDOW (minibuf_window)->buffer) 1823 if (EQ (tem, XWINDOW (minibuf_window)->contents)
1833 && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) 1824 && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil)))
1834 return Qnil; 1825 return Qnil;
1835 1826
@@ -1886,12 +1877,16 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1886 /* Unchain all markers that belong to this indirect buffer. 1877 /* Unchain all markers that belong to this indirect buffer.
1887 Don't unchain the markers that belong to the base buffer 1878 Don't unchain the markers that belong to the base buffer
1888 or its other indirect buffers. */ 1879 or its other indirect buffers. */
1889 for (m = BUF_MARKERS (b); m; ) 1880 struct Lisp_Marker **mp = &BUF_MARKERS (b);
1881 while ((m = *mp))
1890 { 1882 {
1891 struct Lisp_Marker *next = m->next;
1892 if (m->buffer == b) 1883 if (m->buffer == b)
1893 unchain_marker (m); 1884 {
1894 m = next; 1885 m->buffer = NULL;
1886 *mp = m->next;
1887 }
1888 else
1889 mp = &m->next;
1895 } 1890 }
1896 } 1891 }
1897 else 1892 else
@@ -1908,8 +1903,12 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1908 BUF_MARKERS (b) = NULL; 1903 BUF_MARKERS (b) = NULL;
1909 set_buffer_intervals (b, NULL); 1904 set_buffer_intervals (b, NULL);
1910 1905
1911 /* Perhaps we should explicitly free the interval tree here... */ 1906 /* Perhaps we should explicitly free the interval tree here... */
1912 } 1907 }
1908 /* Since we've unlinked the markers, the overlays can't be here any more
1909 either. */
1910 b->overlays_before = NULL;
1911 b->overlays_after = NULL;
1913 1912
1914 /* Reset the local variables, so that this buffer's local values 1913 /* Reset the local variables, so that this buffer's local values
1915 won't be protected from GC. They would be protected 1914 won't be protected from GC. They would be protected
@@ -1920,17 +1919,23 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1920 1919
1921 bset_name (b, Qnil); 1920 bset_name (b, Qnil);
1922 1921
1923 BLOCK_INPUT; 1922 block_input ();
1924 if (b->base_buffer) 1923 if (b->base_buffer)
1925 { 1924 {
1926 /* Notify our base buffer that we don't share the text anymore. */ 1925 /* Notify our base buffer that we don't share the text anymore. */
1927 eassert (b->indirections == -1); 1926 eassert (b->indirections == -1);
1928 b->base_buffer->indirections--; 1927 b->base_buffer->indirections--;
1929 eassert (b->base_buffer->indirections >= 0); 1928 eassert (b->base_buffer->indirections >= 0);
1929 /* Make sure that we wasn't confused. */
1930 eassert (b->window_count == -1);
1930 } 1931 }
1931 else 1932 else
1932 /* No one shares our buffer text, can free it. */ 1933 {
1933 free_buffer_text (b); 1934 /* Make sure that no one shows us. */
1935 eassert (b->window_count == 0);
1936 /* No one shares our buffer text, can free it. */
1937 free_buffer_text (b);
1938 }
1934 1939
1935 if (b->newline_cache) 1940 if (b->newline_cache)
1936 { 1941 {
@@ -1943,7 +1948,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1943 b->width_run_cache = 0; 1948 b->width_run_cache = 0;
1944 } 1949 }
1945 bset_width_table (b, Qnil); 1950 bset_width_table (b, Qnil);
1946 UNBLOCK_INPUT; 1951 unblock_input ();
1947 bset_undo_list (b, Qnil); 1952 bset_undo_list (b, Qnil);
1948 1953
1949 /* Run buffer-list-update-hook. */ 1954 /* Run buffer-list-update-hook. */
@@ -2037,7 +2042,7 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal,
2037DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, 2042DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0,
2038 doc: /* Set an appropriate major mode for BUFFER. 2043 doc: /* Set an appropriate major mode for BUFFER.
2039For the *scratch* buffer, use `initial-major-mode', otherwise choose a mode 2044For the *scratch* buffer, use `initial-major-mode', otherwise choose a mode
2040according to `default-major-mode'. 2045according to the default value of `major-mode'.
2041Use this function before selecting the buffer, since it may need to inspect 2046Use this function before selecting the buffer, since it may need to inspect
2042the current buffer's major mode. */) 2047the current buffer's major mode. */)
2043 (Lisp_Object buffer) 2048 (Lisp_Object buffer)
@@ -2102,6 +2107,8 @@ set_buffer_internal_1 (register struct buffer *b)
2102 if (current_buffer == b) 2107 if (current_buffer == b)
2103 return; 2108 return;
2104 2109
2110 BUFFER_CHECK_INDIRECTION (b);
2111
2105 old_buf = current_buffer; 2112 old_buf = current_buffer;
2106 current_buffer = b; 2113 current_buffer = b;
2107 last_known_column_point = -1; /* invalidate indentation cache */ 2114 last_known_column_point = -1; /* invalidate indentation cache */
@@ -2173,7 +2180,7 @@ set_buffer_temp (struct buffer *b)
2173DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, 2180DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0,
2174 doc: /* Make buffer BUFFER-OR-NAME current for editing operations. 2181 doc: /* Make buffer BUFFER-OR-NAME current for editing operations.
2175BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See 2182BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See
2176also `save-excursion' when you want to make a buffer current 2183also `with-current-buffer' when you want to make a buffer current
2177temporarily. This function does not display the buffer, so its effect 2184temporarily. This function does not display the buffer, so its effect
2178ends when the current command terminates. Use `switch-to-buffer' or 2185ends when the current command terminates. Use `switch-to-buffer' or
2179`pop-to-buffer' to switch buffers permanently. */) 2186`pop-to-buffer' to switch buffers permanently. */)
@@ -2387,8 +2394,9 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2387 BUF_MARKERS(buf) should either be for `buf' or dead. */ 2394 BUF_MARKERS(buf) should either be for `buf' or dead. */
2388 eassert (!m->buffer); 2395 eassert (!m->buffer);
2389 } 2396 }
2390 { /* Some of the C code expects that w->buffer == w->pointm->buffer. 2397 { /* Some of the C code expects that both window markers of a
2391 So since we just swapped the markers between the two buffers, we need 2398 live window points to that window's buffer. So since we
2399 just swapped the markers between the two buffers, we need
2392 to undo the effect of this swap for window markers. */ 2400 to undo the effect of this swap for window markers. */
2393 Lisp_Object w = Fselected_window (), ws = Qnil; 2401 Lisp_Object w = Fselected_window (), ws = Qnil;
2394 Lisp_Object buf1, buf2; 2402 Lisp_Object buf1, buf2;
@@ -2398,12 +2406,19 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2398 { 2406 {
2399 ws = Fcons (w, ws); 2407 ws = Fcons (w, ws);
2400 if (MARKERP (XWINDOW (w)->pointm) 2408 if (MARKERP (XWINDOW (w)->pointm)
2401 && (EQ (XWINDOW (w)->buffer, buf1) 2409 && (EQ (XWINDOW (w)->contents, buf1)
2402 || EQ (XWINDOW (w)->buffer, buf2))) 2410 || EQ (XWINDOW (w)->contents, buf2)))
2403 Fset_marker (XWINDOW (w)->pointm, 2411 Fset_marker (XWINDOW (w)->pointm,
2404 make_number 2412 make_number
2405 (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), 2413 (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))),
2406 XWINDOW (w)->buffer); 2414 XWINDOW (w)->contents);
2415 if (MARKERP (XWINDOW (w)->start)
2416 && (EQ (XWINDOW (w)->contents, buf1)
2417 || EQ (XWINDOW (w)->contents, buf2)))
2418 Fset_marker (XWINDOW (w)->start,
2419 make_number
2420 (XBUFFER (XWINDOW (w)->contents)->last_window_start),
2421 XWINDOW (w)->contents);
2407 w = Fnext_window (w, Qt, Qt); 2422 w = Fnext_window (w, Qt, Qt);
2408 } 2423 }
2409 } 2424 }
@@ -2461,7 +2476,7 @@ current buffer is cleared. */)
2461 begv = BEGV, zv = ZV; 2476 begv = BEGV, zv = ZV;
2462 2477
2463 if (narrowed) 2478 if (narrowed)
2464 Fwiden (); 2479 error ("Changing multibyteness in a narrowed buffer");
2465 2480
2466 if (NILP (flag)) 2481 if (NILP (flag))
2467 { 2482 {
@@ -2677,10 +2692,11 @@ current buffer is cleared. */)
2677 2692
2678 UNGCPRO; 2693 UNGCPRO;
2679 2694
2680 /* Changing the multibyteness of a buffer means that all windows
2681 showing that buffer must be updated thoroughly. */
2682 current_buffer->prevent_redisplay_optimizations_p = 1; 2695 current_buffer->prevent_redisplay_optimizations_p = 1;
2683 ++windows_or_buffers_changed; 2696
2697 /* If buffer is shown in a window, let redisplay consider other windows. */
2698 if (buffer_window_count (current_buffer))
2699 ++windows_or_buffers_changed;
2684 2700
2685 /* Copy this buffer's new multibyte status 2701 /* Copy this buffer's new multibyte status
2686 into all of its indirect buffers. */ 2702 into all of its indirect buffers. */
@@ -3131,8 +3147,8 @@ compare_overlays (const void *v1, const void *v2)
3131 between "equal" overlays. The result can still change between 3147 between "equal" overlays. The result can still change between
3132 invocations of Emacs, but it won't change in the middle of 3148 invocations of Emacs, but it won't change in the middle of
3133 `find_field' (bug#6830). */ 3149 `find_field' (bug#6830). */
3134 if (XHASH (s1->overlay) != XHASH (s2->overlay)) 3150 if (!EQ (s1->overlay, s2->overlay))
3135 return XHASH (s1->overlay) < XHASH (s2->overlay) ? -1 : 1; 3151 return XLI (s1->overlay) < XLI (s2->overlay) ? -1 : 1;
3136 return 0; 3152 return 0;
3137} 3153}
3138 3154
@@ -3143,7 +3159,10 @@ ptrdiff_t
3143sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w) 3159sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w)
3144{ 3160{
3145 ptrdiff_t i, j; 3161 ptrdiff_t i, j;
3146 struct sortvec *sortvec = alloca (noverlays * sizeof *sortvec); 3162 USE_SAFE_ALLOCA;
3163 struct sortvec *sortvec;
3164
3165 SAFE_NALLOCA (sortvec, 1, noverlays);
3147 3166
3148 /* Put the valid and relevant overlays into sortvec. */ 3167 /* Put the valid and relevant overlays into sortvec. */
3149 3168
@@ -3189,6 +3208,8 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w)
3189 3208
3190 for (i = 0; i < noverlays; i++) 3209 for (i = 0; i < noverlays; i++)
3191 overlay_vec[i] = sortvec[i].overlay; 3210 overlay_vec[i] = sortvec[i].overlay;
3211
3212 SAFE_FREE ();
3192 return (noverlays); 3213 return (noverlays);
3193} 3214}
3194 3215
@@ -3686,7 +3707,6 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3686 beforep->next = current_buffer->overlays_before; 3707 beforep->next = current_buffer->overlays_before;
3687 set_buffer_overlays_before (current_buffer, before_list); 3708 set_buffer_overlays_before (current_buffer, before_list);
3688 } 3709 }
3689 recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
3690 3710
3691 if (afterp) 3711 if (afterp)
3692 { 3712 {
@@ -3844,17 +3864,16 @@ for the rear of the overlay advance when text is inserted there
3844 end = OVERLAY_END (overlay); 3864 end = OVERLAY_END (overlay);
3845 if (OVERLAY_POSITION (end) < b->overlay_center) 3865 if (OVERLAY_POSITION (end) < b->overlay_center)
3846 { 3866 {
3847 if (b->overlays_after) 3867 eassert (b->overlays_after || (XOVERLAY (overlay)->next == NULL));
3848 XOVERLAY (overlay)->next = b->overlays_after; 3868 XOVERLAY (overlay)->next = b->overlays_after;
3849 set_buffer_overlays_after (b, XOVERLAY (overlay)); 3869 set_buffer_overlays_after (b, XOVERLAY (overlay));
3850 } 3870 }
3851 else 3871 else
3852 { 3872 {
3853 if (b->overlays_before) 3873 eassert (b->overlays_before || (XOVERLAY (overlay)->next == NULL));
3854 XOVERLAY (overlay)->next = b->overlays_before; 3874 XOVERLAY (overlay)->next = b->overlays_before;
3855 set_buffer_overlays_before (b, XOVERLAY (overlay)); 3875 set_buffer_overlays_before (b, XOVERLAY (overlay));
3856 } 3876 }
3857
3858 /* This puts it in the right list, and in the right order. */ 3877 /* This puts it in the right list, and in the right order. */
3859 recenter_overlay_lists (b, b->overlay_center); 3878 recenter_overlay_lists (b, b->overlay_center);
3860 3879
@@ -3878,17 +3897,17 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
3878 3897
3879 BUF_COMPUTE_UNCHANGED (buf, start, end); 3898 BUF_COMPUTE_UNCHANGED (buf, start, end);
3880 3899
3881 /* If this is a buffer not in the selected window, 3900 /* If BUF is visible, consider updating the display if ... */
3882 we must do other windows. */ 3901 if (buffer_window_count (buf) > 0)
3883 if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) 3902 {
3884 windows_or_buffers_changed = 1; 3903 /* ... it's visible in other window than selected, */
3885 /* If multiple windows show this buffer, we must do other windows. */ 3904 if (buf != XBUFFER (XWINDOW (selected_window)->contents))
3886 else if (buffer_shared > 1) 3905 windows_or_buffers_changed = 1;
3887 windows_or_buffers_changed = 1; 3906 /* ... or if we modify an overlay at the end of the buffer
3888 /* If we modify an overlay at the end of the buffer, we cannot 3907 and so we cannot be sure that window end is still valid. */
3889 be sure that window end is still valid. */ 3908 else if (end >= ZV && start <= ZV)
3890 else if (end >= ZV && start <= ZV) 3909 windows_or_buffers_changed = 1;
3891 windows_or_buffers_changed = 1; 3910 }
3892 3911
3893 ++BUF_OVERLAY_MODIFF (buf); 3912 ++BUF_OVERLAY_MODIFF (buf);
3894} 3913}
@@ -4138,7 +4157,7 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
4138 /* Put all the overlays we want in a vector in overlay_vec. 4157 /* Put all the overlays we want in a vector in overlay_vec.
4139 Store the length in len. */ 4158 Store the length in len. */
4140 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, 4159 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
4141 0, 0, 0); 4160 NULL, NULL, 0);
4142 4161
4143 /* Make a list of them all. */ 4162 /* Make a list of them all. */
4144 result = Flist (noverlays, overlay_vec); 4163 result = Flist (noverlays, overlay_vec);
@@ -4567,27 +4586,7 @@ evaporate_overlays (ptrdiff_t pos)
4567 for (; CONSP (hit_list); hit_list = XCDR (hit_list)) 4586 for (; CONSP (hit_list); hit_list = XCDR (hit_list))
4568 Fdelete_overlay (XCAR (hit_list)); 4587 Fdelete_overlay (XCAR (hit_list));
4569} 4588}
4570
4571/* Somebody has tried to store a value with an unacceptable type
4572 in the slot with offset OFFSET. */
4573
4574void
4575buffer_slot_type_mismatch (Lisp_Object newval, int type)
4576{
4577 Lisp_Object predicate;
4578
4579 switch (type)
4580 {
4581 case_Lisp_Int: predicate = Qintegerp; break;
4582 case Lisp_String: predicate = Qstringp; break;
4583 case Lisp_Symbol: predicate = Qsymbolp; break;
4584 default: emacs_abort ();
4585 }
4586
4587 wrong_type_argument (predicate, newval);
4588}
4589 4589
4590
4591/*********************************************************************** 4590/***********************************************************************
4592 Allocation with mmap 4591 Allocation with mmap
4593 ***********************************************************************/ 4592 ***********************************************************************/
@@ -5029,7 +5028,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
5029{ 5028{
5030 void *p; 5029 void *p;
5031 5030
5032 BLOCK_INPUT; 5031 block_input ();
5033#if defined USE_MMAP_FOR_BUFFERS 5032#if defined USE_MMAP_FOR_BUFFERS
5034 p = mmap_alloc ((void **) &b->text->beg, nbytes); 5033 p = mmap_alloc ((void **) &b->text->beg, nbytes);
5035#elif defined REL_ALLOC 5034#elif defined REL_ALLOC
@@ -5040,12 +5039,12 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
5040 5039
5041 if (p == NULL) 5040 if (p == NULL)
5042 { 5041 {
5043 UNBLOCK_INPUT; 5042 unblock_input ();
5044 memory_full (nbytes); 5043 memory_full (nbytes);
5045 } 5044 }
5046 5045
5047 b->text->beg = (unsigned char *) p; 5046 b->text->beg = (unsigned char *) p;
5048 UNBLOCK_INPUT; 5047 unblock_input ();
5049} 5048}
5050 5049
5051/* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means 5050/* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means
@@ -5057,7 +5056,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
5057 void *p; 5056 void *p;
5058 ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 5057 ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1
5059 + delta); 5058 + delta);
5060 BLOCK_INPUT; 5059 block_input ();
5061#if defined USE_MMAP_FOR_BUFFERS 5060#if defined USE_MMAP_FOR_BUFFERS
5062 p = mmap_realloc ((void **) &b->text->beg, nbytes); 5061 p = mmap_realloc ((void **) &b->text->beg, nbytes);
5063#elif defined REL_ALLOC 5062#elif defined REL_ALLOC
@@ -5068,12 +5067,12 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
5068 5067
5069 if (p == NULL) 5068 if (p == NULL)
5070 { 5069 {
5071 UNBLOCK_INPUT; 5070 unblock_input ();
5072 memory_full (nbytes); 5071 memory_full (nbytes);
5073 } 5072 }
5074 5073
5075 BUF_BEG_ADDR (b) = (unsigned char *) p; 5074 BUF_BEG_ADDR (b) = (unsigned char *) p;
5076 UNBLOCK_INPUT; 5075 unblock_input ();
5077} 5076}
5078 5077
5079 5078
@@ -5082,7 +5081,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
5082static void 5081static void
5083free_buffer_text (struct buffer *b) 5082free_buffer_text (struct buffer *b)
5084{ 5083{
5085 BLOCK_INPUT; 5084 block_input ();
5086 5085
5087#if defined USE_MMAP_FOR_BUFFERS 5086#if defined USE_MMAP_FOR_BUFFERS
5088 mmap_free ((void **) &b->text->beg); 5087 mmap_free ((void **) &b->text->beg);
@@ -5093,7 +5092,7 @@ free_buffer_text (struct buffer *b)
5093#endif 5092#endif
5094 5093
5095 BUF_BEG_ADDR (b) = NULL; 5094 BUF_BEG_ADDR (b) = NULL;
5096 UNBLOCK_INPUT; 5095 unblock_input ();
5097} 5096}
5098 5097
5099 5098
@@ -5106,11 +5105,6 @@ void
5106init_buffer_once (void) 5105init_buffer_once (void)
5107{ 5106{
5108 int idx; 5107 int idx;
5109 /* If you add, remove, or reorder Lisp_Objects in a struct buffer, make
5110 sure that this is still correct. Otherwise, mark_vectorlike may not
5111 trace all Lisp_Objects in buffer_defaults and buffer_local_symbols. */
5112 const int pvecsize
5113 = (offsetof (struct buffer, own_text) - header_size) / word_size;
5114 5108
5115 memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags); 5109 memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
5116 5110
@@ -5128,13 +5122,16 @@ init_buffer_once (void)
5128 /* No one will share the text with these buffers, but let's play it safe. */ 5122 /* No one will share the text with these buffers, but let's play it safe. */
5129 buffer_defaults.indirections = 0; 5123 buffer_defaults.indirections = 0;
5130 buffer_local_symbols.indirections = 0; 5124 buffer_local_symbols.indirections = 0;
5125 /* Likewise no one will display them. */
5126 buffer_defaults.window_count = 0;
5127 buffer_local_symbols.window_count = 0;
5131 set_buffer_intervals (&buffer_defaults, NULL); 5128 set_buffer_intervals (&buffer_defaults, NULL);
5132 set_buffer_intervals (&buffer_local_symbols, NULL); 5129 set_buffer_intervals (&buffer_local_symbols, NULL);
5133 /* This is not strictly necessary, but let's make them initialized. */ 5130 /* This is not strictly necessary, but let's make them initialized. */
5134 bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*")); 5131 bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*"));
5135 bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*")); 5132 bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*"));
5136 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); 5133 BUFFER_PVEC_INIT (&buffer_defaults);
5137 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); 5134 BUFFER_PVEC_INIT (&buffer_local_symbols);
5138 5135
5139 /* Set up the default values of various buffer slots. */ 5136 /* Set up the default values of various buffer slots. */
5140 /* Must do these before making the first buffer! */ 5137 /* Must do these before making the first buffer! */
@@ -5363,25 +5360,23 @@ init_buffer (void)
5363 free (pwd); 5360 free (pwd);
5364} 5361}
5365 5362
5366/* Similar to defvar_lisp but define a variable whose value is the Lisp 5363/* Similar to defvar_lisp but define a variable whose value is the
5367 Object stored in the current buffer. address is the address of the slot 5364 Lisp_Object stored in the current buffer. LNAME is the Lisp-level
5368 in the buffer that is current now. */ 5365 variable name. VNAME is the name of the buffer slot. PREDICATE
5369 5366 is nil for a general Lisp variable. If PREDICATE is non-nil, then
5370/* TYPE is nil for a general Lisp variable. 5367 only Lisp values that satisfies the PREDICATE are allowed (except
5371 An integer specifies a type; then only Lisp values 5368 that nil is allowed too). DOC is a dummy where you write the doc
5372 with that type code are allowed (except that nil is allowed too). 5369 string as a comment. */
5373 LNAME is the Lisp-level variable name. 5370
5374 VNAME is the name of the buffer slot. 5371#define DEFVAR_PER_BUFFER(lname, vname, predicate, doc) \
5375 DOC is a dummy where you write the doc string as a comment. */ 5372 do { \
5376#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ 5373 static struct Lisp_Buffer_Objfwd bo_fwd; \
5377 do { \ 5374 defvar_per_buffer (&bo_fwd, lname, vname, predicate); \
5378 static struct Lisp_Buffer_Objfwd bo_fwd; \
5379 defvar_per_buffer (&bo_fwd, lname, vname, type); \
5380 } while (0) 5375 } while (0)
5381 5376
5382static void 5377static void
5383defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, 5378defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5384 Lisp_Object *address, Lisp_Object type) 5379 Lisp_Object *address, Lisp_Object predicate)
5385{ 5380{
5386 struct Lisp_Symbol *sym; 5381 struct Lisp_Symbol *sym;
5387 int offset; 5382 int offset;
@@ -5391,7 +5386,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5391 5386
5392 bo_fwd->type = Lisp_Fwd_Buffer_Obj; 5387 bo_fwd->type = Lisp_Fwd_Buffer_Obj;
5393 bo_fwd->offset = offset; 5388 bo_fwd->offset = offset;
5394 bo_fwd->slottype = type; 5389 bo_fwd->predicate = predicate;
5395 sym->declared_special = 1; 5390 sym->declared_special = 1;
5396 sym->redirect = SYMBOL_FORWARDED; 5391 sym->redirect = SYMBOL_FORWARDED;
5397 { 5392 {
@@ -5506,6 +5501,8 @@ This is the same as (default-value 'left-margin). */);
5506 DEFVAR_BUFFER_DEFAULTS ("default-tab-width", 5501 DEFVAR_BUFFER_DEFAULTS ("default-tab-width",
5507 tab_width, 5502 tab_width,
5508 doc: /* Default value of `tab-width' for buffers that do not override it. 5503 doc: /* Default value of `tab-width' for buffers that do not override it.
5504NOTE: This controls the display width of a TAB character, and not
5505the size of an indentation step.
5509This is the same as (default-value 'tab-width). */); 5506This is the same as (default-value 'tab-width). */);
5510 5507
5511 DEFVAR_BUFFER_DEFAULTS ("default-case-fold-search", 5508 DEFVAR_BUFFER_DEFAULTS ("default-case-fold-search",
@@ -5654,7 +5651,7 @@ Decimal digits after the % specify field width to which to pad. */);
5654 doc: /* Value of `major-mode' for new buffers. */); 5651 doc: /* Value of `major-mode' for new buffers. */);
5655 5652
5656 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), 5653 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode),
5657 make_number (Lisp_Symbol), 5654 Qsymbolp,
5658 doc: /* Symbol for current buffer's major mode. 5655 doc: /* Symbol for current buffer's major mode.
5659The default value (normally `fundamental-mode') affects new buffers. 5656The default value (normally `fundamental-mode') affects new buffers.
5660A value of nil means to use the current buffer's major mode, provided 5657A value of nil means to use the current buffer's major mode, provided
@@ -5685,18 +5682,20 @@ Use the command `abbrev-mode' to change this variable. */);
5685 doc: /* Non-nil if searches and matches should ignore case. */); 5682 doc: /* Non-nil if searches and matches should ignore case. */);
5686 5683
5687 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), 5684 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
5688 make_number (Lisp_Int0), 5685 Qintegerp,
5689 doc: /* Column beyond which automatic line-wrapping should happen. 5686 doc: /* Column beyond which automatic line-wrapping should happen.
5690Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5687Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5691 5688
5692 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), 5689 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
5693 make_number (Lisp_Int0), 5690 Qintegerp,
5694 doc: /* Column for the default `indent-line-function' to indent to. 5691 doc: /* Column for the default `indent-line-function' to indent to.
5695Linefeed indents to this column in Fundamental mode. */); 5692Linefeed indents to this column in Fundamental mode. */);
5696 5693
5697 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), 5694 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
5698 make_number (Lisp_Int0), 5695 Qintegerp,
5699 doc: /* Distance between tab stops (for display of tab characters), in columns. 5696 doc: /* Distance between tab stops (for display of tab characters), in columns.
5697NOTE: This controls the display width of a TAB character, and not
5698the size of an indentation step.
5700This should be an integer greater than zero. */); 5699This should be an integer greater than zero. */);
5701 5700
5702 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil, 5701 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil,
@@ -5780,7 +5779,7 @@ visual lines rather than logical lines. See the documentation of
5780`visual-line-mode'. */); 5779`visual-line-mode'. */);
5781 5780
5782 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), 5781 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
5783 make_number (Lisp_String), 5782 Qstringp,
5784 doc: /* Name of default directory of current buffer. Should end with slash. 5783 doc: /* Name of default directory of current buffer. Should end with slash.
5785To interactively change the default directory, use command `cd'. */); 5784To interactively change the default directory, use command `cd'. */);
5786 5785
@@ -5793,18 +5792,18 @@ NOTE: This variable is not a hook;
5793its value may not be a list of functions. */); 5792its value may not be a list of functions. */);
5794 5793
5795 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), 5794 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename),
5796 make_number (Lisp_String), 5795 Qstringp,
5797 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); 5796 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */);
5798 5797
5799 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), 5798 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename),
5800 make_number (Lisp_String), 5799 Qstringp,
5801 doc: /* Abbreviated truename of file visited in current buffer, or nil if none. 5800 doc: /* Abbreviated truename of file visited in current buffer, or nil if none.
5802The truename of a file is calculated by `file-truename' 5801The truename of a file is calculated by `file-truename'
5803and then abbreviated with `abbreviate-file-name'. */); 5802and then abbreviated with `abbreviate-file-name'. */);
5804 5803
5805 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", 5804 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name",
5806 &BVAR (current_buffer, auto_save_file_name), 5805 &BVAR (current_buffer, auto_save_file_name),
5807 make_number (Lisp_String), 5806 Qstringp,
5808 doc: /* Name of file for auto-saving current buffer. 5807 doc: /* Name of file for auto-saving current buffer.
5809If it is nil, that means don't auto-save this buffer. */); 5808If it is nil, that means don't auto-save this buffer. */);
5810 5809
@@ -5816,7 +5815,7 @@ If it is nil, that means don't auto-save this buffer. */);
5816Backing up is done before the first time the file is saved. */); 5815Backing up is done before the first time the file is saved. */);
5817 5816
5818 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), 5817 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
5819 make_number (Lisp_Int0), 5818 Qintegerp,
5820 doc: /* Length of current buffer when last read in, saved or auto-saved. 5819 doc: /* Length of current buffer when last read in, saved or auto-saved.
58210 initially. 58200 initially.
5822-1 means auto-saving turned off until next real save. 5821-1 means auto-saving turned off until next real save.
@@ -5886,34 +5885,49 @@ In addition, a char-table has six extra slots to control the display of:
5886See also the functions `display-table-slot' and `set-display-table-slot'. */); 5885See also the functions `display-table-slot' and `set-display-table-slot'. */);
5887 5886
5888 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), 5887 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols),
5889 Qnil, 5888 Qintegerp,
5890 doc: /* Width of left marginal area for display of a buffer. 5889 doc: /* Width of left marginal area for display of a buffer.
5891A value of nil means no marginal area. */); 5890A value of nil means no marginal area.
5891
5892Setting this variable does not take effect until a new buffer is displayed
5893in a window. To make the change take effect, call `set-window-buffer'. */);
5892 5894
5893 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), 5895 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols),
5894 Qnil, 5896 Qintegerp,
5895 doc: /* Width of right marginal area for display of a buffer. 5897 doc: /* Width of right marginal area for display of a buffer.
5896A value of nil means no marginal area. */); 5898A value of nil means no marginal area.
5899
5900Setting this variable does not take effect until a new buffer is displayed
5901in a window. To make the change take effect, call `set-window-buffer'. */);
5897 5902
5898 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), 5903 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width),
5899 Qnil, 5904 Qintegerp,
5900 doc: /* Width of this buffer's left fringe (in pixels). 5905 doc: /* Width of this buffer's left fringe (in pixels).
5901A value of 0 means no left fringe is shown in this buffer's window. 5906A value of 0 means no left fringe is shown in this buffer's window.
5902A value of nil means to use the left fringe width from the window's frame. */); 5907A value of nil means to use the left fringe width from the window's frame.
5908
5909Setting this variable does not take effect until a new buffer is displayed
5910in a window. To make the change take effect, call `set-window-buffer'. */);
5903 5911
5904 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), 5912 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width),
5905 Qnil, 5913 Qintegerp,
5906 doc: /* Width of this buffer's right fringe (in pixels). 5914 doc: /* Width of this buffer's right fringe (in pixels).
5907A value of 0 means no right fringe is shown in this buffer's window. 5915A value of 0 means no right fringe is shown in this buffer's window.
5908A value of nil means to use the right fringe width from the window's frame. */); 5916A value of nil means to use the right fringe width from the window's frame.
5917
5918Setting this variable does not take effect until a new buffer is displayed
5919in a window. To make the change take effect, call `set-window-buffer'. */);
5909 5920
5910 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), 5921 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins),
5911 Qnil, 5922 Qnil,
5912 doc: /* Non-nil means to display fringes outside display margins. 5923 doc: /* Non-nil means to display fringes outside display margins.
5913A value of nil means to display fringes between margins and buffer text. */); 5924A value of nil means to display fringes between margins and buffer text.
5925
5926Setting this variable does not take effect until a new buffer is displayed
5927in a window. To make the change take effect, call `set-window-buffer'. */);
5914 5928
5915 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), 5929 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
5916 Qnil, 5930 Qintegerp,
5917 doc: /* Width of this buffer's scroll bars in pixels. 5931 doc: /* Width of this buffer's scroll bars in pixels.
5918A value of nil means to use the scroll bar width from the window's frame. */); 5932A value of nil means to use the scroll bar width from the window's frame. */);
5919 5933
@@ -5993,7 +6007,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical
5993cursor type. */); 6007cursor type. */);
5994 6008
5995 DEFVAR_PER_BUFFER ("scroll-up-aggressively", 6009 DEFVAR_PER_BUFFER ("scroll-up-aggressively",
5996 &BVAR (current_buffer, scroll_up_aggressively), Qnil, 6010 &BVAR (current_buffer, scroll_up_aggressively), Qfloatp,
5997 doc: /* How far to scroll windows upward. 6011 doc: /* How far to scroll windows upward.
5998If you move point off the bottom, the window scrolls automatically. 6012If you move point off the bottom, the window scrolls automatically.
5999This variable controls how far it scrolls. The value nil, the default, 6013This variable controls how far it scrolls. The value nil, the default,
@@ -6006,7 +6020,7 @@ window scrolls by a full window height. Meaningful values are
6006between 0.0 and 1.0, inclusive. */); 6020between 0.0 and 1.0, inclusive. */);
6007 6021
6008 DEFVAR_PER_BUFFER ("scroll-down-aggressively", 6022 DEFVAR_PER_BUFFER ("scroll-down-aggressively",
6009 &BVAR (current_buffer, scroll_down_aggressively), Qnil, 6023 &BVAR (current_buffer, scroll_down_aggressively), Qfloatp,
6010 doc: /* How far to scroll windows downward. 6024 doc: /* How far to scroll windows downward.
6011If you move point off the top, the window scrolls automatically. 6025If you move point off the top, the window scrolls automatically.
6012This variable controls how far it scrolls. The value nil, the default, 6026This variable controls how far it scrolls. The value nil, the default,
@@ -6018,10 +6032,6 @@ simple case that you moved off with C-b means scrolling just one line.
6018window scrolls by a full window height. Meaningful values are 6032window scrolls by a full window height. Meaningful values are
6019between 0.0 and 1.0, inclusive. */); 6033between 0.0 and 1.0, inclusive. */);
6020 6034
6021/*DEFVAR_LISP ("debug-check-symbol", &Vcheck_symbol,
6022 "Don't ask.");
6023*/
6024
6025 DEFVAR_LISP ("before-change-functions", Vbefore_change_functions, 6035 DEFVAR_LISP ("before-change-functions", Vbefore_change_functions,
6026 doc: /* List of functions to call before each text change. 6036 doc: /* List of functions to call before each text change.
6027Two arguments are passed to each function: the positions of 6037Two arguments are passed to each function: the positions of
@@ -6160,7 +6170,7 @@ then characters with property value PROP are invisible,
6160and they have an ellipsis as well if ELLIPSIS is non-nil. */); 6170and they have an ellipsis as well if ELLIPSIS is non-nil. */);
6161 6171
6162 DEFVAR_PER_BUFFER ("buffer-display-count", 6172 DEFVAR_PER_BUFFER ("buffer-display-count",
6163 &BVAR (current_buffer, display_count), Qnil, 6173 &BVAR (current_buffer, display_count), Qintegerp,
6164 doc: /* A number incremented each time this buffer is displayed in a window. 6174 doc: /* A number incremented each time this buffer is displayed in a window.
6165The function `set-window-buffer' increments it. */); 6175The function `set-window-buffer' increments it. */);
6166 6176
@@ -6204,22 +6214,22 @@ is a member of the list. */);
6204 doc: /* Cursor to use when this buffer is in the selected window. 6214 doc: /* Cursor to use when this buffer is in the selected window.
6205Values are interpreted as follows: 6215Values are interpreted as follows:
6206 6216
6207 t use the cursor specified for the frame 6217 t use the cursor specified for the frame
6208 nil don't display a cursor 6218 nil don't display a cursor
6209 box display a filled box cursor 6219 box display a filled box cursor
6210 hollow display a hollow box cursor 6220 hollow display a hollow box cursor
6211 bar display a vertical bar cursor with default width 6221 bar display a vertical bar cursor with default width
6212 (bar . WIDTH) display a vertical bar cursor with width WIDTH 6222 (bar . WIDTH) display a vertical bar cursor with width WIDTH
6213 hbar display a horizontal bar cursor with default height 6223 hbar display a horizontal bar cursor with default height
6214 (hbar . HEIGHT) display a horizontal bar cursor with height HEIGHT 6224 (hbar . HEIGHT) display a horizontal bar cursor with height HEIGHT
6215 ANYTHING ELSE display a hollow box cursor 6225 ANYTHING ELSE display a hollow box cursor
6216 6226
6217When the buffer is displayed in a non-selected window, the 6227When the buffer is displayed in a non-selected window, the
6218cursor's appearance is instead controlled by the variable 6228cursor's appearance is instead controlled by the variable
6219`cursor-in-non-selected-windows'. */); 6229`cursor-in-non-selected-windows'. */);
6220 6230
6221 DEFVAR_PER_BUFFER ("line-spacing", 6231 DEFVAR_PER_BUFFER ("line-spacing",
6222 &BVAR (current_buffer, extra_line_spacing), Qnil, 6232 &BVAR (current_buffer, extra_line_spacing), Qnumberp,
6223 doc: /* Additional space to put between lines when displaying a buffer. 6233 doc: /* Additional space to put between lines when displaying a buffer.
6224The space is measured in pixels, and put below lines on graphic displays, 6234The space is measured in pixels, and put below lines on graphic displays,
6225see `display-graphic-p'. 6235see `display-graphic-p'.