aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c708
1 files changed, 343 insertions, 365 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 5229f899e65..1b413ccb8b0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -162,7 +162,7 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0,
162Value is nil if OBJECT is not a buffer or if it has been killed. */) 162Value is nil if OBJECT is not a buffer or if it has been killed. */)
163 (Lisp_Object object) 163 (Lisp_Object object)
164{ 164{
165 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) 165 return ((BUFFERP (object) && ! NILP (BVAR (XBUFFER (object), name)))
166 ? Qt : Qnil); 166 ? Qt : Qnil);
167} 167}
168 168
@@ -266,8 +266,8 @@ See also `find-buffer-visiting'. */)
266 { 266 {
267 buf = Fcdr (XCAR (tail)); 267 buf = Fcdr (XCAR (tail));
268 if (!BUFFERP (buf)) continue; 268 if (!BUFFERP (buf)) continue;
269 if (!STRINGP (XBUFFER (buf)->filename)) continue; 269 if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue;
270 tem = Fstring_equal (XBUFFER (buf)->filename, filename); 270 tem = Fstring_equal (BVAR (XBUFFER (buf), filename), filename);
271 if (!NILP (tem)) 271 if (!NILP (tem))
272 return buf; 272 return buf;
273 } 273 }
@@ -283,8 +283,8 @@ get_truename_buffer (register Lisp_Object filename)
283 { 283 {
284 buf = Fcdr (XCAR (tail)); 284 buf = Fcdr (XCAR (tail));
285 if (!BUFFERP (buf)) continue; 285 if (!BUFFERP (buf)) continue;
286 if (!STRINGP (XBUFFER (buf)->file_truename)) continue; 286 if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue;
287 tem = Fstring_equal (XBUFFER (buf)->file_truename, filename); 287 tem = Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename);
288 if (!NILP (tem)) 288 if (!NILP (tem))
289 return buf; 289 return buf;
290 } 290 }
@@ -353,7 +353,7 @@ even if it is dead. The return value is never nil. */)
353 353
354 b->newline_cache = 0; 354 b->newline_cache = 0;
355 b->width_run_cache = 0; 355 b->width_run_cache = 0;
356 b->width_table = Qnil; 356 BVAR (b, width_table) = Qnil;
357 b->prevent_redisplay_optimizations_p = 1; 357 b->prevent_redisplay_optimizations_p = 1;
358 358
359 /* Put this on the chain of all buffers including killed ones. */ 359 /* Put this on the chain of all buffers including killed ones. */
@@ -362,22 +362,22 @@ even if it is dead. The return value is never nil. */)
362 362
363 /* An ordinary buffer normally doesn't need markers 363 /* An ordinary buffer normally doesn't need markers
364 to handle BEGV and ZV. */ 364 to handle BEGV and ZV. */
365 b->pt_marker = Qnil; 365 BVAR (b, pt_marker) = Qnil;
366 b->begv_marker = Qnil; 366 BVAR (b, begv_marker) = Qnil;
367 b->zv_marker = Qnil; 367 BVAR (b, zv_marker) = Qnil;
368 368
369 name = Fcopy_sequence (buffer_or_name); 369 name = Fcopy_sequence (buffer_or_name);
370 STRING_SET_INTERVALS (name, NULL_INTERVAL); 370 STRING_SET_INTERVALS (name, NULL_INTERVAL);
371 b->name = name; 371 BVAR (b, name) = name;
372 372
373 b->undo_list = (SREF (name, 0) != ' ') ? Qnil : Qt; 373 BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt;
374 374
375 reset_buffer (b); 375 reset_buffer (b);
376 reset_buffer_local_variables (b, 1); 376 reset_buffer_local_variables (b, 1);
377 377
378 b->mark = Fmake_marker (); 378 BVAR (b, mark) = Fmake_marker ();
379 BUF_MARKERS (b) = NULL; 379 BUF_MARKERS (b) = NULL;
380 b->name = name; 380 BVAR (b, name) = name;
381 381
382 /* Put this in the alist of all live buffers. */ 382 /* Put this in the alist of all live buffers. */
383 XSETBUFFER (buffer, b); 383 XSETBUFFER (buffer, b);
@@ -486,7 +486,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
486 486
487 /* Get (a copy of) the alist of Lisp-level local variables of FROM 487 /* Get (a copy of) the alist of Lisp-level local variables of FROM
488 and install that in TO. */ 488 and install that in TO. */
489 to->local_var_alist = buffer_lisp_local_variables (from); 489 BVAR (to, local_var_alist) = buffer_lisp_local_variables (from);
490} 490}
491 491
492DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 492DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer,
@@ -512,7 +512,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
512 base_buffer = Fget_buffer (base_buffer); 512 base_buffer = Fget_buffer (base_buffer);
513 if (NILP (base_buffer)) 513 if (NILP (base_buffer))
514 error ("No such buffer: `%s'", SDATA (tem)); 514 error ("No such buffer: `%s'", SDATA (tem));
515 if (NILP (XBUFFER (base_buffer)->name)) 515 if (NILP (BVAR (XBUFFER (base_buffer), name)))
516 error ("Base buffer has been killed"); 516 error ("Base buffer has been killed");
517 517
518 if (SCHARS (name) == 0) 518 if (SCHARS (name) == 0)
@@ -536,7 +536,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
536 536
537 b->newline_cache = 0; 537 b->newline_cache = 0;
538 b->width_run_cache = 0; 538 b->width_run_cache = 0;
539 b->width_table = Qnil; 539 BVAR (b, width_table) = Qnil;
540 540
541 /* Put this on the chain of all buffers including killed ones. */ 541 /* Put this on the chain of all buffers including killed ones. */
542 b->next = all_buffers; 542 b->next = all_buffers;
@@ -544,7 +544,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
544 544
545 name = Fcopy_sequence (name); 545 name = Fcopy_sequence (name);
546 STRING_SET_INTERVALS (name, NULL_INTERVAL); 546 STRING_SET_INTERVALS (name, NULL_INTERVAL);
547 b->name = name; 547 BVAR (b, name) = name;
548 548
549 reset_buffer (b); 549 reset_buffer (b);
550 reset_buffer_local_variables (b, 1); 550 reset_buffer_local_variables (b, 1);
@@ -553,57 +553,57 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
553 XSETBUFFER (buf, b); 553 XSETBUFFER (buf, b);
554 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 554 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
555 555
556 b->mark = Fmake_marker (); 556 BVAR (b, mark) = Fmake_marker ();
557 b->name = name; 557 BVAR (b, name) = name;
558 558
559 /* The multibyte status belongs to the base buffer. */ 559 /* The multibyte status belongs to the base buffer. */
560 b->enable_multibyte_characters = b->base_buffer->enable_multibyte_characters; 560 BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters);
561 561
562 /* Make sure the base buffer has markers for its narrowing. */ 562 /* Make sure the base buffer has markers for its narrowing. */
563 if (NILP (b->base_buffer->pt_marker)) 563 if (NILP (BVAR (b->base_buffer, pt_marker)))
564 { 564 {
565 b->base_buffer->pt_marker = Fmake_marker (); 565 BVAR (b->base_buffer, pt_marker) = Fmake_marker ();
566 set_marker_both (b->base_buffer->pt_marker, base_buffer, 566 set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer,
567 BUF_PT (b->base_buffer), 567 BUF_PT (b->base_buffer),
568 BUF_PT_BYTE (b->base_buffer)); 568 BUF_PT_BYTE (b->base_buffer));
569 } 569 }
570 if (NILP (b->base_buffer->begv_marker)) 570 if (NILP (BVAR (b->base_buffer, begv_marker)))
571 { 571 {
572 b->base_buffer->begv_marker = Fmake_marker (); 572 BVAR (b->base_buffer, begv_marker) = Fmake_marker ();
573 set_marker_both (b->base_buffer->begv_marker, base_buffer, 573 set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer,
574 BUF_BEGV (b->base_buffer), 574 BUF_BEGV (b->base_buffer),
575 BUF_BEGV_BYTE (b->base_buffer)); 575 BUF_BEGV_BYTE (b->base_buffer));
576 } 576 }
577 if (NILP (b->base_buffer->zv_marker)) 577 if (NILP (BVAR (b->base_buffer, zv_marker)))
578 { 578 {
579 b->base_buffer->zv_marker = Fmake_marker (); 579 BVAR (b->base_buffer, zv_marker) = Fmake_marker ();
580 set_marker_both (b->base_buffer->zv_marker, base_buffer, 580 set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer,
581 BUF_ZV (b->base_buffer), 581 BUF_ZV (b->base_buffer),
582 BUF_ZV_BYTE (b->base_buffer)); 582 BUF_ZV_BYTE (b->base_buffer));
583 XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; 583 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
584 } 584 }
585 585
586 if (NILP (clone)) 586 if (NILP (clone))
587 { 587 {
588 /* Give the indirect buffer markers for its narrowing. */ 588 /* Give the indirect buffer markers for its narrowing. */
589 b->pt_marker = Fmake_marker (); 589 BVAR (b, pt_marker) = Fmake_marker ();
590 set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); 590 set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b));
591 b->begv_marker = Fmake_marker (); 591 BVAR (b, begv_marker) = Fmake_marker ();
592 set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); 592 set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b));
593 b->zv_marker = Fmake_marker (); 593 BVAR (b, zv_marker) = Fmake_marker ();
594 set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); 594 set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b));
595 XMARKER (b->zv_marker)->insertion_type = 1; 595 XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
596 } 596 }
597 else 597 else
598 { 598 {
599 struct buffer *old_b = current_buffer; 599 struct buffer *old_b = current_buffer;
600 600
601 clone_per_buffer_values (b->base_buffer, b); 601 clone_per_buffer_values (b->base_buffer, b);
602 b->filename = Qnil; 602 BVAR (b, filename) = Qnil;
603 b->file_truename = Qnil; 603 BVAR (b, file_truename) = Qnil;
604 b->display_count = make_number (0); 604 BVAR (b, display_count) = make_number (0);
605 b->backed_up = Qnil; 605 BVAR (b, backed_up) = Qnil;
606 b->auto_save_file_name = Qnil; 606 BVAR (b, auto_save_file_name) = Qnil;
607 set_buffer_internal_1 (b); 607 set_buffer_internal_1 (b);
608 Fset (intern ("buffer-save-without-query"), Qnil); 608 Fset (intern ("buffer-save-without-query"), Qnil);
609 Fset (intern ("buffer-file-number"), Qnil); 609 Fset (intern ("buffer-file-number"), Qnil);
@@ -647,34 +647,34 @@ delete_all_overlays (struct buffer *b)
647void 647void
648reset_buffer (register struct buffer *b) 648reset_buffer (register struct buffer *b)
649{ 649{
650 b->filename = Qnil; 650 BVAR (b, filename) = Qnil;
651 b->file_truename = Qnil; 651 BVAR (b, file_truename) = Qnil;
652 b->directory = (current_buffer) ? current_buffer->directory : Qnil; 652 BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil;
653 b->modtime = 0; 653 b->modtime = 0;
654 b->modtime_size = -1; 654 b->modtime_size = -1;
655 XSETFASTINT (b->save_length, 0); 655 XSETFASTINT (BVAR (b, save_length), 0);
656 b->last_window_start = 1; 656 b->last_window_start = 1;
657 /* It is more conservative to start out "changed" than "unchanged". */ 657 /* It is more conservative to start out "changed" than "unchanged". */
658 b->clip_changed = 0; 658 b->clip_changed = 0;
659 b->prevent_redisplay_optimizations_p = 1; 659 b->prevent_redisplay_optimizations_p = 1;
660 b->backed_up = Qnil; 660 BVAR (b, backed_up) = Qnil;
661 BUF_AUTOSAVE_MODIFF (b) = 0; 661 BUF_AUTOSAVE_MODIFF (b) = 0;
662 b->auto_save_failure_time = -1; 662 b->auto_save_failure_time = -1;
663 b->auto_save_file_name = Qnil; 663 BVAR (b, auto_save_file_name) = Qnil;
664 b->read_only = Qnil; 664 BVAR (b, read_only) = Qnil;
665 b->overlays_before = NULL; 665 b->overlays_before = NULL;
666 b->overlays_after = NULL; 666 b->overlays_after = NULL;
667 b->overlay_center = BEG; 667 b->overlay_center = BEG;
668 b->mark_active = Qnil; 668 BVAR (b, mark_active) = Qnil;
669 b->point_before_scroll = Qnil; 669 BVAR (b, point_before_scroll) = Qnil;
670 b->file_format = Qnil; 670 BVAR (b, file_format) = Qnil;
671 b->auto_save_file_format = Qt; 671 BVAR (b, auto_save_file_format) = Qt;
672 b->last_selected_window = Qnil; 672 BVAR (b, last_selected_window) = Qnil;
673 XSETINT (b->display_count, 0); 673 XSETINT (BVAR (b, display_count), 0);
674 b->display_time = Qnil; 674 BVAR (b, display_time) = Qnil;
675 b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters; 675 BVAR (b, enable_multibyte_characters) = BVAR (&buffer_defaults, enable_multibyte_characters);
676 b->cursor_type = buffer_defaults.cursor_type; 676 BVAR (b, cursor_type) = BVAR (&buffer_defaults, cursor_type);
677 b->extra_line_spacing = buffer_defaults.extra_line_spacing; 677 BVAR (b, extra_line_spacing) = BVAR (&buffer_defaults, extra_line_spacing);
678 678
679 b->display_error_modiff = 0; 679 b->display_error_modiff = 0;
680} 680}
@@ -698,10 +698,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
698 things that depend on the major mode. 698 things that depend on the major mode.
699 default-major-mode is handled at a higher level. 699 default-major-mode is handled at a higher level.
700 We ignore it here. */ 700 We ignore it here. */
701 b->major_mode = Qfundamental_mode; 701 BVAR (b, major_mode) = Qfundamental_mode;
702 b->keymap = Qnil; 702 BVAR (b, keymap) = Qnil;
703 b->mode_name = QSFundamental; 703 BVAR (b, mode_name) = QSFundamental;
704 b->minor_modes = Qnil; 704 BVAR (b, minor_modes) = Qnil;
705 705
706 /* If the standard case table has been altered and invalidated, 706 /* If the standard case table has been altered and invalidated,
707 fix up its insides first. */ 707 fix up its insides first. */
@@ -710,22 +710,19 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
710 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) 710 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
711 Fset_standard_case_table (Vascii_downcase_table); 711 Fset_standard_case_table (Vascii_downcase_table);
712 712
713 b->downcase_table = Vascii_downcase_table; 713 BVAR (b, downcase_table) = Vascii_downcase_table;
714 b->upcase_table = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; 714 BVAR (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0];
715 b->case_canon_table = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; 715 BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1];
716 b->case_eqv_table = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; 716 BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2];
717 b->invisibility_spec = Qt; 717 BVAR (b, invisibility_spec) = Qt;
718#ifndef DOS_NT
719 b->buffer_file_type = Qnil;
720#endif
721 718
722 /* Reset all (or most) per-buffer variables to their defaults. */ 719 /* Reset all (or most) per-buffer variables to their defaults. */
723 if (permanent_too) 720 if (permanent_too)
724 b->local_var_alist = Qnil; 721 BVAR (b, local_var_alist) = Qnil;
725 else 722 else
726 { 723 {
727 Lisp_Object tmp, prop, last = Qnil; 724 Lisp_Object tmp, prop, last = Qnil;
728 for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) 725 for (tmp = BVAR (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp))
729 if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) 726 if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
730 { 727 {
731 /* If permanent-local, keep it. */ 728 /* If permanent-local, keep it. */
@@ -755,7 +752,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
755 } 752 }
756 /* Delete this local variable. */ 753 /* Delete this local variable. */
757 else if (NILP (last)) 754 else if (NILP (last))
758 b->local_var_alist = XCDR (tmp); 755 BVAR (b, local_var_alist) = XCDR (tmp);
759 else 756 else
760 XSETCDR (last, XCDR (tmp)); 757 XSETCDR (last, XCDR (tmp));
761 } 758 }
@@ -830,9 +827,9 @@ Return nil if BUFFER has been killed. */)
830 (register Lisp_Object buffer) 827 (register Lisp_Object buffer)
831{ 828{
832 if (NILP (buffer)) 829 if (NILP (buffer))
833 return current_buffer->name; 830 return BVAR (current_buffer, name);
834 CHECK_BUFFER (buffer); 831 CHECK_BUFFER (buffer);
835 return XBUFFER (buffer)->name; 832 return BVAR (XBUFFER (buffer), name);
836} 833}
837 834
838DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, 835DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
@@ -841,9 +838,9 @@ No argument or nil as argument means use the current buffer. */)
841 (register Lisp_Object buffer) 838 (register Lisp_Object buffer)
842{ 839{
843 if (NILP (buffer)) 840 if (NILP (buffer))
844 return current_buffer->filename; 841 return BVAR (current_buffer, filename);
845 CHECK_BUFFER (buffer); 842 CHECK_BUFFER (buffer);
846 return XBUFFER (buffer)->filename; 843 return BVAR (XBUFFER (buffer), filename);
847} 844}
848 845
849DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, 846DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
@@ -895,7 +892,7 @@ is the default binding of the variable. */)
895 { /* Look in local_var_alist. */ 892 { /* Look in local_var_alist. */
896 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 893 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
897 XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ 894 XSETSYMBOL (variable, sym); /* Update In case of aliasing. */
898 result = Fassoc (variable, buf->local_var_alist); 895 result = Fassoc (variable, BVAR (buf, local_var_alist));
899 if (!NILP (result)) 896 if (!NILP (result))
900 { 897 {
901 if (blv->fwd) 898 if (blv->fwd)
@@ -944,7 +941,7 @@ buffer_lisp_local_variables (struct buffer *buf)
944{ 941{
945 Lisp_Object result = Qnil; 942 Lisp_Object result = Qnil;
946 register Lisp_Object tail; 943 register Lisp_Object tail;
947 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 944 for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
948 { 945 {
949 Lisp_Object val, elt; 946 Lisp_Object val, elt;
950 947
@@ -1043,9 +1040,9 @@ A non-nil FLAG means mark the buffer modified. */)
1043 /* If buffer becoming modified, lock the file. 1040 /* If buffer becoming modified, lock the file.
1044 If buffer becoming unmodified, unlock the file. */ 1041 If buffer becoming unmodified, unlock the file. */
1045 1042
1046 fn = current_buffer->file_truename; 1043 fn = BVAR (current_buffer, file_truename);
1047 /* Test buffer-file-name so that binding it to nil is effective. */ 1044 /* Test buffer-file-name so that binding it to nil is effective. */
1048 if (!NILP (fn) && ! NILP (current_buffer->filename)) 1045 if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
1049 { 1046 {
1050 already = SAVE_MODIFF < MODIFF; 1047 already = SAVE_MODIFF < MODIFF;
1051 if (!already && !NILP (flag)) 1048 if (!already && !NILP (flag))
@@ -1110,9 +1107,9 @@ state of the current buffer. Use with care. */)
1110 /* If buffer becoming modified, lock the file. 1107 /* If buffer becoming modified, lock the file.
1111 If buffer becoming unmodified, unlock the file. */ 1108 If buffer becoming unmodified, unlock the file. */
1112 1109
1113 fn = current_buffer->file_truename; 1110 fn = BVAR (current_buffer, file_truename);
1114 /* Test buffer-file-name so that binding it to nil is effective. */ 1111 /* Test buffer-file-name so that binding it to nil is effective. */
1115 if (!NILP (fn) && ! NILP (current_buffer->filename)) 1112 if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
1116 { 1113 {
1117 int already = SAVE_MODIFF < MODIFF; 1114 int already = SAVE_MODIFF < MODIFF;
1118 if (!already && !NILP (flag)) 1115 if (!already && !NILP (flag))
@@ -1199,14 +1196,14 @@ This does not change the name of the visited file (if any). */)
1199 with the original name. It makes UNIQUE equivalent to 1196 with the original name. It makes UNIQUE equivalent to
1200 (rename-buffer (generate-new-buffer-name NEWNAME)). */ 1197 (rename-buffer (generate-new-buffer-name NEWNAME)). */
1201 if (NILP (unique) && XBUFFER (tem) == current_buffer) 1198 if (NILP (unique) && XBUFFER (tem) == current_buffer)
1202 return current_buffer->name; 1199 return BVAR (current_buffer, name);
1203 if (!NILP (unique)) 1200 if (!NILP (unique))
1204 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); 1201 newname = Fgenerate_new_buffer_name (newname, BVAR (current_buffer, name));
1205 else 1202 else
1206 error ("Buffer name `%s' is in use", SDATA (newname)); 1203 error ("Buffer name `%s' is in use", SDATA (newname));
1207 } 1204 }
1208 1205
1209 current_buffer->name = newname; 1206 BVAR (current_buffer, name) = newname;
1210 1207
1211 /* Catch redisplay's attention. Unless we do this, the mode lines for 1208 /* Catch redisplay's attention. Unless we do this, the mode lines for
1212 any windows displaying current_buffer will stay unchanged. */ 1209 any windows displaying current_buffer will stay unchanged. */
@@ -1214,11 +1211,11 @@ This does not change the name of the visited file (if any). */)
1214 1211
1215 XSETBUFFER (buf, current_buffer); 1212 XSETBUFFER (buf, current_buffer);
1216 Fsetcar (Frassq (buf, Vbuffer_alist), newname); 1213 Fsetcar (Frassq (buf, Vbuffer_alist), newname);
1217 if (NILP (current_buffer->filename) 1214 if (NILP (BVAR (current_buffer, filename))
1218 && !NILP (current_buffer->auto_save_file_name)) 1215 && !NILP (BVAR (current_buffer, auto_save_file_name)))
1219 call0 (intern ("rename-auto-save-file")); 1216 call0 (intern ("rename-auto-save-file"));
1220 /* Refetch since that last call may have done GC. */ 1217 /* Refetch since that last call may have done GC. */
1221 return current_buffer->name; 1218 return BVAR (current_buffer, name);
1222} 1219}
1223 1220
1224DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, 1221DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
@@ -1263,9 +1260,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */)
1263 continue; 1260 continue;
1264 if (NILP (buf)) 1261 if (NILP (buf))
1265 continue; 1262 continue;
1266 if (NILP (XBUFFER (buf)->name)) 1263 if (NILP (BVAR (XBUFFER (buf), name)))
1267 continue; 1264 continue;
1268 if (SREF (XBUFFER (buf)->name, 0) == ' ') 1265 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
1269 continue; 1266 continue;
1270 /* If the selected frame has a buffer_predicate, 1267 /* If the selected frame has a buffer_predicate,
1271 disregard buffers that don't fit the predicate. */ 1268 disregard buffers that don't fit the predicate. */
@@ -1313,8 +1310,8 @@ No argument or nil as argument means do this for the current buffer. */)
1313 nsberror (buffer); 1310 nsberror (buffer);
1314 } 1311 }
1315 1312
1316 if (EQ (XBUFFER (real_buffer)->undo_list, Qt)) 1313 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt))
1317 XBUFFER (real_buffer)->undo_list = Qnil; 1314 BVAR (XBUFFER (real_buffer), undo_list) = Qnil;
1318 1315
1319 return Qnil; 1316 return Qnil;
1320} 1317}
@@ -1359,16 +1356,16 @@ with SIGHUP. */)
1359 b = XBUFFER (buffer); 1356 b = XBUFFER (buffer);
1360 1357
1361 /* Avoid trouble for buffer already dead. */ 1358 /* Avoid trouble for buffer already dead. */
1362 if (NILP (b->name)) 1359 if (NILP (BVAR (b, name)))
1363 return Qnil; 1360 return Qnil;
1364 1361
1365 /* Query if the buffer is still modified. */ 1362 /* Query if the buffer is still modified. */
1366 if (INTERACTIVE && !NILP (b->filename) 1363 if (INTERACTIVE && !NILP (BVAR (b, filename))
1367 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 1364 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
1368 { 1365 {
1369 GCPRO1 (buffer); 1366 GCPRO1 (buffer);
1370 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", 1367 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ",
1371 b->name, make_number (0))); 1368 BVAR (b, name), make_number (0)));
1372 UNGCPRO; 1369 UNGCPRO;
1373 if (NILP (tem)) 1370 if (NILP (tem))
1374 return Qnil; 1371 return Qnil;
@@ -1402,7 +1399,7 @@ with SIGHUP. */)
1402 if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) 1399 if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
1403 return Qnil; 1400 return Qnil;
1404 1401
1405 if (NILP (b->name)) 1402 if (NILP (BVAR (b, name)))
1406 return Qnil; 1403 return Qnil;
1407 1404
1408 /* When we kill a base buffer, kill all its indirect buffers. 1405 /* When we kill a base buffer, kill all its indirect buffers.
@@ -1417,7 +1414,7 @@ with SIGHUP. */)
1417 for (other = all_buffers; other; other = other->next) 1414 for (other = all_buffers; other; other = other->next)
1418 /* all_buffers contains dead buffers too; 1415 /* all_buffers contains dead buffers too;
1419 don't re-kill them. */ 1416 don't re-kill them. */
1420 if (other->base_buffer == b && !NILP (other->name)) 1417 if (other->base_buffer == b && !NILP (BVAR (other, name)))
1421 { 1418 {
1422 Lisp_Object buffer; 1419 Lisp_Object buffer;
1423 XSETBUFFER (buffer, other); 1420 XSETBUFFER (buffer, other);
@@ -1462,7 +1459,7 @@ with SIGHUP. */)
1462 /* Killing buffer processes may run sentinels which may 1459 /* Killing buffer processes may run sentinels which may
1463 have called kill-buffer. */ 1460 have called kill-buffer. */
1464 1461
1465 if (NILP (b->name)) 1462 if (NILP (BVAR (b, name)))
1466 return Qnil; 1463 return Qnil;
1467 1464
1468 clear_charpos_cache (b); 1465 clear_charpos_cache (b);
@@ -1476,7 +1473,7 @@ with SIGHUP. */)
1476 1473
1477 /* Delete any auto-save file, if we saved it in this session. 1474 /* Delete any auto-save file, if we saved it in this session.
1478 But not if the buffer is modified. */ 1475 But not if the buffer is modified. */
1479 if (STRINGP (b->auto_save_file_name) 1476 if (STRINGP (BVAR (b, auto_save_file_name))
1480 && BUF_AUTOSAVE_MODIFF (b) != 0 1477 && BUF_AUTOSAVE_MODIFF (b) != 0
1481 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) 1478 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b)
1482 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 1479 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
@@ -1485,7 +1482,7 @@ with SIGHUP. */)
1485 Lisp_Object tem; 1482 Lisp_Object tem;
1486 tem = Fsymbol_value (intern ("delete-auto-save-files")); 1483 tem = Fsymbol_value (intern ("delete-auto-save-files"));
1487 if (! NILP (tem)) 1484 if (! NILP (tem))
1488 internal_delete_file (b->auto_save_file_name); 1485 internal_delete_file (BVAR (b, auto_save_file_name));
1489 } 1486 }
1490 1487
1491 if (b->base_buffer) 1488 if (b->base_buffer)
@@ -1525,7 +1522,7 @@ with SIGHUP. */)
1525 swap_out_buffer_local_variables (b); 1522 swap_out_buffer_local_variables (b);
1526 reset_buffer_local_variables (b, 1); 1523 reset_buffer_local_variables (b, 1);
1527 1524
1528 b->name = Qnil; 1525 BVAR (b, name) = Qnil;
1529 1526
1530 BLOCK_INPUT; 1527 BLOCK_INPUT;
1531 if (! b->base_buffer) 1528 if (! b->base_buffer)
@@ -1541,9 +1538,9 @@ with SIGHUP. */)
1541 free_region_cache (b->width_run_cache); 1538 free_region_cache (b->width_run_cache);
1542 b->width_run_cache = 0; 1539 b->width_run_cache = 0;
1543 } 1540 }
1544 b->width_table = Qnil; 1541 BVAR (b, width_table) = Qnil;
1545 UNBLOCK_INPUT; 1542 UNBLOCK_INPUT;
1546 b->undo_list = Qnil; 1543 BVAR (b, undo_list) = Qnil;
1547 1544
1548 return Qt; 1545 return Qt;
1549} 1546}
@@ -1637,15 +1634,15 @@ the current buffer's major mode. */)
1637 1634
1638 CHECK_BUFFER (buffer); 1635 CHECK_BUFFER (buffer);
1639 1636
1640 if (STRINGP (XBUFFER (buffer)->name) 1637 if (STRINGP (BVAR (XBUFFER (buffer), name))
1641 && strcmp (SSDATA (XBUFFER (buffer)->name), "*scratch*") == 0) 1638 && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
1642 function = find_symbol_value (intern ("initial-major-mode")); 1639 function = find_symbol_value (intern ("initial-major-mode"));
1643 else 1640 else
1644 { 1641 {
1645 function = buffer_defaults.major_mode; 1642 function = BVAR (&buffer_defaults, major_mode);
1646 if (NILP (function) 1643 if (NILP (function)
1647 && NILP (Fget (current_buffer->major_mode, Qmode_class))) 1644 && NILP (Fget (BVAR (current_buffer, major_mode), Qmode_class)))
1648 function = current_buffer->major_mode; 1645 function = BVAR (current_buffer, major_mode);
1649 } 1646 }
1650 1647
1651 if (NILP (function) || EQ (function, Qfundamental_mode)) 1648 if (NILP (function) || EQ (function, Qfundamental_mode))
@@ -1795,29 +1792,29 @@ set_buffer_internal_1 (register struct buffer *b)
1795 /* Put the undo list back in the base buffer, so that it appears 1792 /* Put the undo list back in the base buffer, so that it appears
1796 that an indirect buffer shares the undo list of its base. */ 1793 that an indirect buffer shares the undo list of its base. */
1797 if (old_buf->base_buffer) 1794 if (old_buf->base_buffer)
1798 old_buf->base_buffer->undo_list = old_buf->undo_list; 1795 BVAR (old_buf->base_buffer, undo_list) = BVAR (old_buf, undo_list);
1799 1796
1800 /* If the old current buffer has markers to record PT, BEGV and ZV 1797 /* If the old current buffer has markers to record PT, BEGV and ZV
1801 when it is not current, update them now. */ 1798 when it is not current, update them now. */
1802 if (! NILP (old_buf->pt_marker)) 1799 if (! NILP (BVAR (old_buf, pt_marker)))
1803 { 1800 {
1804 Lisp_Object obuf; 1801 Lisp_Object obuf;
1805 XSETBUFFER (obuf, old_buf); 1802 XSETBUFFER (obuf, old_buf);
1806 set_marker_both (old_buf->pt_marker, obuf, 1803 set_marker_both (BVAR (old_buf, pt_marker), obuf,
1807 BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); 1804 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1808 } 1805 }
1809 if (! NILP (old_buf->begv_marker)) 1806 if (! NILP (BVAR (old_buf, begv_marker)))
1810 { 1807 {
1811 Lisp_Object obuf; 1808 Lisp_Object obuf;
1812 XSETBUFFER (obuf, old_buf); 1809 XSETBUFFER (obuf, old_buf);
1813 set_marker_both (old_buf->begv_marker, obuf, 1810 set_marker_both (BVAR (old_buf, begv_marker), obuf,
1814 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); 1811 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1815 } 1812 }
1816 if (! NILP (old_buf->zv_marker)) 1813 if (! NILP (BVAR (old_buf, zv_marker)))
1817 { 1814 {
1818 Lisp_Object obuf; 1815 Lisp_Object obuf;
1819 XSETBUFFER (obuf, old_buf); 1816 XSETBUFFER (obuf, old_buf);
1820 set_marker_both (old_buf->zv_marker, obuf, 1817 set_marker_both (BVAR (old_buf, zv_marker), obuf,
1821 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); 1818 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1822 } 1819 }
1823 } 1820 }
@@ -1825,24 +1822,24 @@ set_buffer_internal_1 (register struct buffer *b)
1825 /* Get the undo list from the base buffer, so that it appears 1822 /* Get the undo list from the base buffer, so that it appears
1826 that an indirect buffer shares the undo list of its base. */ 1823 that an indirect buffer shares the undo list of its base. */
1827 if (b->base_buffer) 1824 if (b->base_buffer)
1828 b->undo_list = b->base_buffer->undo_list; 1825 BVAR (b, undo_list) = BVAR (b->base_buffer, undo_list);
1829 1826
1830 /* If the new current buffer has markers to record PT, BEGV and ZV 1827 /* If the new current buffer has markers to record PT, BEGV and ZV
1831 when it is not current, fetch them now. */ 1828 when it is not current, fetch them now. */
1832 if (! NILP (b->pt_marker)) 1829 if (! NILP (BVAR (b, pt_marker)))
1833 { 1830 {
1834 BUF_PT (b) = marker_position (b->pt_marker); 1831 BUF_PT (b) = marker_position (BVAR (b, pt_marker));
1835 BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); 1832 BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
1836 } 1833 }
1837 if (! NILP (b->begv_marker)) 1834 if (! NILP (BVAR (b, begv_marker)))
1838 { 1835 {
1839 BUF_BEGV (b) = marker_position (b->begv_marker); 1836 BUF_BEGV (b) = marker_position (BVAR (b, begv_marker));
1840 BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); 1837 BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
1841 } 1838 }
1842 if (! NILP (b->zv_marker)) 1839 if (! NILP (BVAR (b, zv_marker)))
1843 { 1840 {
1844 BUF_ZV (b) = marker_position (b->zv_marker); 1841 BUF_ZV (b) = marker_position (BVAR (b, zv_marker));
1845 BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); 1842 BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker));
1846 } 1843 }
1847 1844
1848 /* Look down buffer's list of local Lisp variables 1845 /* Look down buffer's list of local Lisp variables
@@ -1850,7 +1847,7 @@ set_buffer_internal_1 (register struct buffer *b)
1850 1847
1851 do 1848 do
1852 { 1849 {
1853 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1850 for (tail = BVAR (b, local_var_alist); CONSP (tail); tail = XCDR (tail))
1854 { 1851 {
1855 Lisp_Object var = XCAR (XCAR (tail)); 1852 Lisp_Object var = XCAR (XCAR (tail));
1856 struct Lisp_Symbol *sym = XSYMBOL (var); 1853 struct Lisp_Symbol *sym = XSYMBOL (var);
@@ -1883,45 +1880,45 @@ set_buffer_temp (struct buffer *b)
1883 { 1880 {
1884 /* If the old current buffer has markers to record PT, BEGV and ZV 1881 /* If the old current buffer has markers to record PT, BEGV and ZV
1885 when it is not current, update them now. */ 1882 when it is not current, update them now. */
1886 if (! NILP (old_buf->pt_marker)) 1883 if (! NILP (BVAR (old_buf, pt_marker)))
1887 { 1884 {
1888 Lisp_Object obuf; 1885 Lisp_Object obuf;
1889 XSETBUFFER (obuf, old_buf); 1886 XSETBUFFER (obuf, old_buf);
1890 set_marker_both (old_buf->pt_marker, obuf, 1887 set_marker_both (BVAR (old_buf, pt_marker), obuf,
1891 BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); 1888 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1892 } 1889 }
1893 if (! NILP (old_buf->begv_marker)) 1890 if (! NILP (BVAR (old_buf, begv_marker)))
1894 { 1891 {
1895 Lisp_Object obuf; 1892 Lisp_Object obuf;
1896 XSETBUFFER (obuf, old_buf); 1893 XSETBUFFER (obuf, old_buf);
1897 set_marker_both (old_buf->begv_marker, obuf, 1894 set_marker_both (BVAR (old_buf, begv_marker), obuf,
1898 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); 1895 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1899 } 1896 }
1900 if (! NILP (old_buf->zv_marker)) 1897 if (! NILP (BVAR (old_buf, zv_marker)))
1901 { 1898 {
1902 Lisp_Object obuf; 1899 Lisp_Object obuf;
1903 XSETBUFFER (obuf, old_buf); 1900 XSETBUFFER (obuf, old_buf);
1904 set_marker_both (old_buf->zv_marker, obuf, 1901 set_marker_both (BVAR (old_buf, zv_marker), obuf,
1905 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); 1902 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1906 } 1903 }
1907 } 1904 }
1908 1905
1909 /* If the new current buffer has markers to record PT, BEGV and ZV 1906 /* If the new current buffer has markers to record PT, BEGV and ZV
1910 when it is not current, fetch them now. */ 1907 when it is not current, fetch them now. */
1911 if (! NILP (b->pt_marker)) 1908 if (! NILP (BVAR (b, pt_marker)))
1912 { 1909 {
1913 BUF_PT (b) = marker_position (b->pt_marker); 1910 BUF_PT (b) = marker_position (BVAR (b, pt_marker));
1914 BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); 1911 BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
1915 } 1912 }
1916 if (! NILP (b->begv_marker)) 1913 if (! NILP (BVAR (b, begv_marker)))
1917 { 1914 {
1918 BUF_BEGV (b) = marker_position (b->begv_marker); 1915 BUF_BEGV (b) = marker_position (BVAR (b, begv_marker));
1919 BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); 1916 BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
1920 } 1917 }
1921 if (! NILP (b->zv_marker)) 1918 if (! NILP (BVAR (b, zv_marker)))
1922 { 1919 {
1923 BUF_ZV (b) = marker_position (b->zv_marker); 1920 BUF_ZV (b) = marker_position (BVAR (b, zv_marker));
1924 BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); 1921 BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker));
1925 } 1922 }
1926} 1923}
1927 1924
@@ -1938,7 +1935,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
1938 buffer = Fget_buffer (buffer_or_name); 1935 buffer = Fget_buffer (buffer_or_name);
1939 if (NILP (buffer)) 1936 if (NILP (buffer))
1940 nsberror (buffer_or_name); 1937 nsberror (buffer_or_name);
1941 if (NILP (XBUFFER (buffer)->name)) 1938 if (NILP (BVAR (XBUFFER (buffer), name)))
1942 error ("Selecting deleted buffer"); 1939 error ("Selecting deleted buffer");
1943 set_buffer_internal (XBUFFER (buffer)); 1940 set_buffer_internal (XBUFFER (buffer));
1944 return buffer; 1941 return buffer;
@@ -1949,7 +1946,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
1949Lisp_Object 1946Lisp_Object
1950set_buffer_if_live (Lisp_Object buffer) 1947set_buffer_if_live (Lisp_Object buffer)
1951{ 1948{
1952 if (! NILP (XBUFFER (buffer)->name)) 1949 if (! NILP (BVAR (XBUFFER (buffer), name)))
1953 Fset_buffer (buffer); 1950 Fset_buffer (buffer);
1954 return Qnil; 1951 return Qnil;
1955} 1952}
@@ -1959,7 +1956,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
1959 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) 1956 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */)
1960 (void) 1957 (void)
1961{ 1958{
1962 if (!NILP (current_buffer->read_only) 1959 if (!NILP (BVAR (current_buffer, read_only))
1963 && NILP (Vinhibit_read_only)) 1960 && NILP (Vinhibit_read_only))
1964 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); 1961 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
1965 return Qnil; 1962 return Qnil;
@@ -2008,7 +2005,7 @@ its frame, iconify that frame. */)
2008 2005
2009 /* Move buffer to the end of the buffer list. Do nothing if the 2006 /* Move buffer to the end of the buffer list. Do nothing if the
2010 buffer is killed. */ 2007 buffer is killed. */
2011 if (!NILP (XBUFFER (buffer)->name)) 2008 if (!NILP (BVAR (XBUFFER (buffer), name)))
2012 { 2009 {
2013 Lisp_Object aelt, link; 2010 Lisp_Object aelt, link;
2014 2011
@@ -2041,7 +2038,7 @@ so the buffer is truly empty after this. */)
2041 /* Prevent warnings, or suspension of auto saving, that would happen 2038 /* Prevent warnings, or suspension of auto saving, that would happen
2042 if future size is less than past size. Use of erase-buffer 2039 if future size is less than past size. Use of erase-buffer
2043 implies that the future text is not really related to the past text. */ 2040 implies that the future text is not really related to the past text. */
2044 XSETFASTINT (current_buffer->save_length, 0); 2041 XSETFASTINT (BVAR (current_buffer, save_length), 0);
2045 return Qnil; 2042 return Qnil;
2046} 2043}
2047 2044
@@ -2111,7 +2108,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2111 CHECK_BUFFER (buffer); 2108 CHECK_BUFFER (buffer);
2112 other_buffer = XBUFFER (buffer); 2109 other_buffer = XBUFFER (buffer);
2113 2110
2114 if (NILP (other_buffer->name)) 2111 if (NILP (BVAR (other_buffer, name)))
2115 error ("Cannot swap a dead buffer's text"); 2112 error ("Cannot swap a dead buffer's text");
2116 2113
2117 /* Actually, it probably works just fine. 2114 /* Actually, it probably works just fine.
@@ -2138,6 +2135,12 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2138 other_buffer->field = current_buffer->field; \ 2135 other_buffer->field = current_buffer->field; \
2139 current_buffer->field = tmp##field; \ 2136 current_buffer->field = tmp##field; \
2140 } while (0) 2137 } while (0)
2138#define swapfield_(field, type) \
2139 do { \
2140 type tmp##field = BVAR (other_buffer, field); \
2141 BVAR (other_buffer, field) = BVAR (current_buffer, field); \
2142 BVAR (current_buffer, field) = tmp##field; \
2143 } while (0)
2141 2144
2142 swapfield (own_text, struct buffer_text); 2145 swapfield (own_text, struct buffer_text);
2143 eassert (current_buffer->text == &current_buffer->own_text); 2146 eassert (current_buffer->text == &current_buffer->own_text);
@@ -2165,18 +2168,18 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2165 swapfield (overlays_before, struct Lisp_Overlay *); 2168 swapfield (overlays_before, struct Lisp_Overlay *);
2166 swapfield (overlays_after, struct Lisp_Overlay *); 2169 swapfield (overlays_after, struct Lisp_Overlay *);
2167 swapfield (overlay_center, EMACS_INT); 2170 swapfield (overlay_center, EMACS_INT);
2168 swapfield (undo_list, Lisp_Object); 2171 swapfield_ (undo_list, Lisp_Object);
2169 swapfield (mark, Lisp_Object); 2172 swapfield_ (mark, Lisp_Object);
2170 swapfield (enable_multibyte_characters, Lisp_Object); 2173 swapfield_ (enable_multibyte_characters, Lisp_Object);
2171 swapfield (bidi_display_reordering, Lisp_Object); 2174 swapfield_ (bidi_display_reordering, Lisp_Object);
2172 swapfield (bidi_paragraph_direction, Lisp_Object); 2175 swapfield_ (bidi_paragraph_direction, Lisp_Object);
2173 /* FIXME: Not sure what we should do with these *_marker fields. 2176 /* FIXME: Not sure what we should do with these *_marker fields.
2174 Hopefully they're just nil anyway. */ 2177 Hopefully they're just nil anyway. */
2175 swapfield (pt_marker, Lisp_Object); 2178 swapfield_ (pt_marker, Lisp_Object);
2176 swapfield (begv_marker, Lisp_Object); 2179 swapfield_ (begv_marker, Lisp_Object);
2177 swapfield (zv_marker, Lisp_Object); 2180 swapfield_ (zv_marker, Lisp_Object);
2178 current_buffer->point_before_scroll = Qnil; 2181 BVAR (current_buffer, point_before_scroll) = Qnil;
2179 other_buffer->point_before_scroll = Qnil; 2182 BVAR (other_buffer, point_before_scroll) = Qnil;
2180 2183
2181 current_buffer->text->modiff++; other_buffer->text->modiff++; 2184 current_buffer->text->modiff++; other_buffer->text->modiff++;
2182 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2185 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++;
@@ -2250,21 +2253,21 @@ current buffer is cleared. */)
2250 EMACS_INT begv, zv; 2253 EMACS_INT begv, zv;
2251 int narrowed = (BEG != BEGV || Z != ZV); 2254 int narrowed = (BEG != BEGV || Z != ZV);
2252 int modified_p = !NILP (Fbuffer_modified_p (Qnil)); 2255 int modified_p = !NILP (Fbuffer_modified_p (Qnil));
2253 Lisp_Object old_undo = current_buffer->undo_list; 2256 Lisp_Object old_undo = BVAR (current_buffer, undo_list);
2254 struct gcpro gcpro1; 2257 struct gcpro gcpro1;
2255 2258
2256 if (current_buffer->base_buffer) 2259 if (current_buffer->base_buffer)
2257 error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); 2260 error ("Cannot do `set-buffer-multibyte' on an indirect buffer");
2258 2261
2259 /* Do nothing if nothing actually changes. */ 2262 /* Do nothing if nothing actually changes. */
2260 if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) 2263 if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters)))
2261 return flag; 2264 return flag;
2262 2265
2263 GCPRO1 (old_undo); 2266 GCPRO1 (old_undo);
2264 2267
2265 /* Don't record these buffer changes. We will put a special undo entry 2268 /* Don't record these buffer changes. We will put a special undo entry
2266 instead. */ 2269 instead. */
2267 current_buffer->undo_list = Qt; 2270 BVAR (current_buffer, undo_list) = Qt;
2268 2271
2269 /* If the cached position is for this buffer, clear it out. */ 2272 /* If the cached position is for this buffer, clear it out. */
2270 clear_charpos_cache (current_buffer); 2273 clear_charpos_cache (current_buffer);
@@ -2286,7 +2289,7 @@ current buffer is cleared. */)
2286 to calculate the old correspondences. */ 2289 to calculate the old correspondences. */
2287 set_intervals_multibyte (0); 2290 set_intervals_multibyte (0);
2288 2291
2289 current_buffer->enable_multibyte_characters = Qnil; 2292 BVAR (current_buffer, enable_multibyte_characters) = Qnil;
2290 2293
2291 Z = Z_BYTE; 2294 Z = Z_BYTE;
2292 BEGV = BEGV_BYTE; 2295 BEGV = BEGV_BYTE;
@@ -2424,7 +2427,7 @@ current buffer is cleared. */)
2424 2427
2425 /* Do this first, so that chars_in_text asks the right question. 2428 /* Do this first, so that chars_in_text asks the right question.
2426 set_intervals_multibyte needs it too. */ 2429 set_intervals_multibyte needs it too. */
2427 current_buffer->enable_multibyte_characters = Qt; 2430 BVAR (current_buffer, enable_multibyte_characters) = Qt;
2428 2431
2429 GPT_BYTE = advance_to_char_boundary (GPT_BYTE); 2432 GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
2430 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; 2433 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2482,7 +2485,7 @@ current buffer is cleared. */)
2482 if (!EQ (old_undo, Qt)) 2485 if (!EQ (old_undo, Qt))
2483 { 2486 {
2484 /* Represent all the above changes by a special undo entry. */ 2487 /* Represent all the above changes by a special undo entry. */
2485 current_buffer->undo_list = Fcons (list3 (Qapply, 2488 BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply,
2486 intern ("set-buffer-multibyte"), 2489 intern ("set-buffer-multibyte"),
2487 NILP (flag) ? Qt : Qnil), 2490 NILP (flag) ? Qt : Qnil),
2488 old_undo); 2491 old_undo);
@@ -2498,10 +2501,10 @@ current buffer is cleared. */)
2498 /* Copy this buffer's new multibyte status 2501 /* Copy this buffer's new multibyte status
2499 into all of its indirect buffers. */ 2502 into all of its indirect buffers. */
2500 for (other = all_buffers; other; other = other->next) 2503 for (other = all_buffers; other; other = other->next)
2501 if (other->base_buffer == current_buffer && !NILP (other->name)) 2504 if (other->base_buffer == current_buffer && !NILP (BVAR (other, name)))
2502 { 2505 {
2503 other->enable_multibyte_characters 2506 BVAR (other, enable_multibyte_characters)
2504 = current_buffer->enable_multibyte_characters; 2507 = BVAR (current_buffer, enable_multibyte_characters);
2505 other->prevent_redisplay_optimizations_p = 1; 2508 other->prevent_redisplay_optimizations_p = 1;
2506 } 2509 }
2507 2510
@@ -2568,7 +2571,7 @@ swap_out_buffer_local_variables (struct buffer *b)
2568 Lisp_Object oalist, alist, buffer; 2571 Lisp_Object oalist, alist, buffer;
2569 2572
2570 XSETBUFFER (buffer, b); 2573 XSETBUFFER (buffer, b);
2571 oalist = b->local_var_alist; 2574 oalist = BVAR (b, local_var_alist);
2572 2575
2573 for (alist = oalist; CONSP (alist); alist = XCDR (alist)) 2576 for (alist = oalist; CONSP (alist); alist = XCDR (alist))
2574 { 2577 {
@@ -3072,7 +3075,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str
3072 ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); 3075 ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0);
3073 ssl->used++; 3076 ssl->used++;
3074 3077
3075 if (NILP (current_buffer->enable_multibyte_characters)) 3078 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
3076 nbytes = SCHARS (str); 3079 nbytes = SCHARS (str);
3077 else if (! STRING_MULTIBYTE (str)) 3080 else if (! STRING_MULTIBYTE (str))
3078 nbytes = count_size_as_multibyte (SDATA (str), 3081 nbytes = count_size_as_multibyte (SDATA (str),
@@ -3084,7 +3087,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str
3084 3087
3085 if (STRINGP (str2)) 3088 if (STRINGP (str2))
3086 { 3089 {
3087 if (NILP (current_buffer->enable_multibyte_characters)) 3090 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
3088 nbytes = SCHARS (str2); 3091 nbytes = SCHARS (str2);
3089 else if (! STRING_MULTIBYTE (str2)) 3092 else if (! STRING_MULTIBYTE (str2))
3090 nbytes = count_size_as_multibyte (SDATA (str2), 3093 nbytes = count_size_as_multibyte (SDATA (str2),
@@ -3114,7 +3117,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
3114 Lisp_Object overlay, window, str; 3117 Lisp_Object overlay, window, str;
3115 struct Lisp_Overlay *ov; 3118 struct Lisp_Overlay *ov;
3116 EMACS_INT startpos, endpos; 3119 EMACS_INT startpos, endpos;
3117 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3120 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
3118 3121
3119 overlay_heads.used = overlay_heads.bytes = 0; 3122 overlay_heads.used = overlay_heads.bytes = 0;
3120 overlay_tails.used = overlay_tails.bytes = 0; 3123 overlay_tails.used = overlay_tails.bytes = 0;
@@ -4985,9 +4988,9 @@ init_buffer_once (void)
4985 /* Make sure all markable slots in buffer_defaults 4988 /* Make sure all markable slots in buffer_defaults
4986 are initialized reasonably, so mark_buffer won't choke. */ 4989 are initialized reasonably, so mark_buffer won't choke. */
4987 reset_buffer (&buffer_defaults); 4990 reset_buffer (&buffer_defaults);
4988 eassert (EQ (buffer_defaults.name, make_number (0))); 4991 eassert (EQ (BVAR (&buffer_defaults, name), make_number (0)));
4989 reset_buffer_local_variables (&buffer_defaults, 1); 4992 reset_buffer_local_variables (&buffer_defaults, 1);
4990 eassert (EQ (buffer_local_symbols.name, make_number (0))); 4993 eassert (EQ (BVAR (&buffer_local_symbols, name), make_number (0)));
4991 reset_buffer (&buffer_local_symbols); 4994 reset_buffer (&buffer_local_symbols);
4992 reset_buffer_local_variables (&buffer_local_symbols, 1); 4995 reset_buffer_local_variables (&buffer_local_symbols, 1);
4993 /* Prevent GC from getting confused. */ 4996 /* Prevent GC from getting confused. */
@@ -5004,60 +5007,57 @@ init_buffer_once (void)
5004 /* Must do these before making the first buffer! */ 5007 /* Must do these before making the first buffer! */
5005 5008
5006 /* real setup is done in bindings.el */ 5009 /* real setup is done in bindings.el */
5007 buffer_defaults.mode_line_format = make_pure_c_string ("%-"); 5010 BVAR (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-");
5008 buffer_defaults.header_line_format = Qnil; 5011 BVAR (&buffer_defaults, header_line_format) = Qnil;
5009 buffer_defaults.abbrev_mode = Qnil; 5012 BVAR (&buffer_defaults, abbrev_mode) = Qnil;
5010 buffer_defaults.overwrite_mode = Qnil; 5013 BVAR (&buffer_defaults, overwrite_mode) = Qnil;
5011 buffer_defaults.case_fold_search = Qt; 5014 BVAR (&buffer_defaults, case_fold_search) = Qt;
5012 buffer_defaults.auto_fill_function = Qnil; 5015 BVAR (&buffer_defaults, auto_fill_function) = Qnil;
5013 buffer_defaults.selective_display = Qnil; 5016 BVAR (&buffer_defaults, selective_display) = Qnil;
5014#ifndef old 5017#ifndef old
5015 buffer_defaults.selective_display_ellipses = Qt; 5018 BVAR (&buffer_defaults, selective_display_ellipses) = Qt;
5016#endif 5019#endif
5017 buffer_defaults.abbrev_table = Qnil; 5020 BVAR (&buffer_defaults, abbrev_table) = Qnil;
5018 buffer_defaults.display_table = Qnil; 5021 BVAR (&buffer_defaults, display_table) = Qnil;
5019 buffer_defaults.undo_list = Qnil; 5022 BVAR (&buffer_defaults, undo_list) = Qnil;
5020 buffer_defaults.mark_active = Qnil; 5023 BVAR (&buffer_defaults, mark_active) = Qnil;
5021 buffer_defaults.file_format = Qnil; 5024 BVAR (&buffer_defaults, file_format) = Qnil;
5022 buffer_defaults.auto_save_file_format = Qt; 5025 BVAR (&buffer_defaults, auto_save_file_format) = Qt;
5023 buffer_defaults.overlays_before = NULL; 5026 buffer_defaults.overlays_before = NULL;
5024 buffer_defaults.overlays_after = NULL; 5027 buffer_defaults.overlays_after = NULL;
5025 buffer_defaults.overlay_center = BEG; 5028 buffer_defaults.overlay_center = BEG;
5026 5029
5027 XSETFASTINT (buffer_defaults.tab_width, 8); 5030 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
5028 buffer_defaults.truncate_lines = Qnil; 5031 BVAR (&buffer_defaults, truncate_lines) = Qnil;
5029 buffer_defaults.word_wrap = Qnil; 5032 BVAR (&buffer_defaults, word_wrap) = Qnil;
5030 buffer_defaults.ctl_arrow = Qt; 5033 BVAR (&buffer_defaults, ctl_arrow) = Qt;
5031 buffer_defaults.bidi_display_reordering = Qnil; 5034 BVAR (&buffer_defaults, bidi_display_reordering) = Qnil;
5032 buffer_defaults.bidi_paragraph_direction = Qnil; 5035 BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil;
5033 buffer_defaults.cursor_type = Qt; 5036 BVAR (&buffer_defaults, cursor_type) = Qt;
5034 buffer_defaults.extra_line_spacing = Qnil; 5037 BVAR (&buffer_defaults, extra_line_spacing) = Qnil;
5035 buffer_defaults.cursor_in_non_selected_windows = Qt; 5038 BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt;
5036 5039
5037#ifdef DOS_NT 5040 BVAR (&buffer_defaults, enable_multibyte_characters) = Qt;
5038 buffer_defaults.buffer_file_type = Qnil; /* TEXT */ 5041 BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil;
5039#endif 5042 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
5040 buffer_defaults.enable_multibyte_characters = Qt; 5043 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
5041 buffer_defaults.buffer_file_coding_system = Qnil; 5044 BVAR (&buffer_defaults, cache_long_line_scans) = Qnil;
5042 XSETFASTINT (buffer_defaults.fill_column, 70); 5045 BVAR (&buffer_defaults, file_truename) = Qnil;
5043 XSETFASTINT (buffer_defaults.left_margin, 0); 5046 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
5044 buffer_defaults.cache_long_line_scans = Qnil; 5047 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
5045 buffer_defaults.file_truename = Qnil; 5048 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
5046 XSETFASTINT (buffer_defaults.display_count, 0); 5049 BVAR (&buffer_defaults, left_fringe_width) = Qnil;
5047 XSETFASTINT (buffer_defaults.left_margin_cols, 0); 5050 BVAR (&buffer_defaults, right_fringe_width) = Qnil;
5048 XSETFASTINT (buffer_defaults.right_margin_cols, 0); 5051 BVAR (&buffer_defaults, fringes_outside_margins) = Qnil;
5049 buffer_defaults.left_fringe_width = Qnil; 5052 BVAR (&buffer_defaults, scroll_bar_width) = Qnil;
5050 buffer_defaults.right_fringe_width = Qnil; 5053 BVAR (&buffer_defaults, vertical_scroll_bar_type) = Qt;
5051 buffer_defaults.fringes_outside_margins = Qnil; 5054 BVAR (&buffer_defaults, indicate_empty_lines) = Qnil;
5052 buffer_defaults.scroll_bar_width = Qnil; 5055 BVAR (&buffer_defaults, indicate_buffer_boundaries) = Qnil;
5053 buffer_defaults.vertical_scroll_bar_type = Qt; 5056 BVAR (&buffer_defaults, fringe_indicator_alist) = Qnil;
5054 buffer_defaults.indicate_empty_lines = Qnil; 5057 BVAR (&buffer_defaults, fringe_cursor_alist) = Qnil;
5055 buffer_defaults.indicate_buffer_boundaries = Qnil; 5058 BVAR (&buffer_defaults, scroll_up_aggressively) = Qnil;
5056 buffer_defaults.fringe_indicator_alist = Qnil; 5059 BVAR (&buffer_defaults, scroll_down_aggressively) = Qnil;
5057 buffer_defaults.fringe_cursor_alist = Qnil; 5060 BVAR (&buffer_defaults, display_time) = Qnil;
5058 buffer_defaults.scroll_up_aggressively = Qnil;
5059 buffer_defaults.scroll_down_aggressively = Qnil;
5060 buffer_defaults.display_time = Qnil;
5061 5061
5062 /* Assign the local-flags to the slots that have default values. 5062 /* Assign the local-flags to the slots that have default values.
5063 The local flag is a bit that is used in the buffer 5063 The local flag is a bit that is used in the buffer
@@ -5069,73 +5069,68 @@ init_buffer_once (void)
5069 5069
5070 /* 0 means not a lisp var, -1 means always local, else mask */ 5070 /* 0 means not a lisp var, -1 means always local, else mask */
5071 memset (&buffer_local_flags, 0, sizeof buffer_local_flags); 5071 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5072 XSETINT (buffer_local_flags.filename, -1); 5072 XSETINT (BVAR (&buffer_local_flags, filename), -1);
5073 XSETINT (buffer_local_flags.directory, -1); 5073 XSETINT (BVAR (&buffer_local_flags, directory), -1);
5074 XSETINT (buffer_local_flags.backed_up, -1); 5074 XSETINT (BVAR (&buffer_local_flags, backed_up), -1);
5075 XSETINT (buffer_local_flags.save_length, -1); 5075 XSETINT (BVAR (&buffer_local_flags, save_length), -1);
5076 XSETINT (buffer_local_flags.auto_save_file_name, -1); 5076 XSETINT (BVAR (&buffer_local_flags, auto_save_file_name), -1);
5077 XSETINT (buffer_local_flags.read_only, -1); 5077 XSETINT (BVAR (&buffer_local_flags, read_only), -1);
5078 XSETINT (buffer_local_flags.major_mode, -1); 5078 XSETINT (BVAR (&buffer_local_flags, major_mode), -1);
5079 XSETINT (buffer_local_flags.mode_name, -1); 5079 XSETINT (BVAR (&buffer_local_flags, mode_name), -1);
5080 XSETINT (buffer_local_flags.undo_list, -1); 5080 XSETINT (BVAR (&buffer_local_flags, undo_list), -1);
5081 XSETINT (buffer_local_flags.mark_active, -1); 5081 XSETINT (BVAR (&buffer_local_flags, mark_active), -1);
5082 XSETINT (buffer_local_flags.point_before_scroll, -1); 5082 XSETINT (BVAR (&buffer_local_flags, point_before_scroll), -1);
5083 XSETINT (buffer_local_flags.file_truename, -1); 5083 XSETINT (BVAR (&buffer_local_flags, file_truename), -1);
5084 XSETINT (buffer_local_flags.invisibility_spec, -1); 5084 XSETINT (BVAR (&buffer_local_flags, invisibility_spec), -1);
5085 XSETINT (buffer_local_flags.file_format, -1); 5085 XSETINT (BVAR (&buffer_local_flags, file_format), -1);
5086 XSETINT (buffer_local_flags.auto_save_file_format, -1); 5086 XSETINT (BVAR (&buffer_local_flags, auto_save_file_format), -1);
5087 XSETINT (buffer_local_flags.display_count, -1); 5087 XSETINT (BVAR (&buffer_local_flags, display_count), -1);
5088 XSETINT (buffer_local_flags.display_time, -1); 5088 XSETINT (BVAR (&buffer_local_flags, display_time), -1);
5089 XSETINT (buffer_local_flags.enable_multibyte_characters, -1); 5089 XSETINT (BVAR (&buffer_local_flags, enable_multibyte_characters), -1);
5090 5090
5091 idx = 1; 5091 idx = 1;
5092 XSETFASTINT (buffer_local_flags.mode_line_format, idx); ++idx; 5092 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
5093 XSETFASTINT (buffer_local_flags.abbrev_mode, idx); ++idx; 5093 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx;
5094 XSETFASTINT (buffer_local_flags.overwrite_mode, idx); ++idx; 5094 XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx;
5095 XSETFASTINT (buffer_local_flags.case_fold_search, idx); ++idx; 5095 XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx;
5096 XSETFASTINT (buffer_local_flags.auto_fill_function, idx); ++idx; 5096 XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx;
5097 XSETFASTINT (buffer_local_flags.selective_display, idx); ++idx; 5097 XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx;
5098#ifndef old 5098#ifndef old
5099 XSETFASTINT (buffer_local_flags.selective_display_ellipses, idx); ++idx; 5099 XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
5100#endif
5101 XSETFASTINT (buffer_local_flags.tab_width, idx); ++idx;
5102 XSETFASTINT (buffer_local_flags.truncate_lines, idx); ++idx;
5103 XSETFASTINT (buffer_local_flags.word_wrap, idx); ++idx;
5104 XSETFASTINT (buffer_local_flags.ctl_arrow, idx); ++idx;
5105 XSETFASTINT (buffer_local_flags.fill_column, idx); ++idx;
5106 XSETFASTINT (buffer_local_flags.left_margin, idx); ++idx;
5107 XSETFASTINT (buffer_local_flags.abbrev_table, idx); ++idx;
5108 XSETFASTINT (buffer_local_flags.display_table, idx); ++idx;
5109#ifdef DOS_NT
5110 XSETFASTINT (buffer_local_flags.buffer_file_type, idx);
5111 /* Make this one a permanent local. */
5112 buffer_permanent_local_flags[idx++] = 1;
5113#endif 5100#endif
5114 XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; 5101 XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx;
5115 XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; 5102 XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx;
5116 XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; 5103 XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
5117 XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; 5104 XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx;
5118 XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; 5105 XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx;
5119 XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); 5106 XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx;
5107 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx;
5108 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx;
5109 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx;
5110 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx;
5111 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx;
5112 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx;
5113 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx;
5114 XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx);
5120 /* Make this one a permanent local. */ 5115 /* Make this one a permanent local. */
5121 buffer_permanent_local_flags[idx++] = 1; 5116 buffer_permanent_local_flags[idx++] = 1;
5122 XSETFASTINT (buffer_local_flags.left_margin_cols, idx); ++idx; 5117 XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx;
5123 XSETFASTINT (buffer_local_flags.right_margin_cols, idx); ++idx; 5118 XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx;
5124 XSETFASTINT (buffer_local_flags.left_fringe_width, idx); ++idx; 5119 XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx;
5125 XSETFASTINT (buffer_local_flags.right_fringe_width, idx); ++idx; 5120 XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx;
5126 XSETFASTINT (buffer_local_flags.fringes_outside_margins, idx); ++idx; 5121 XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx;
5127 XSETFASTINT (buffer_local_flags.scroll_bar_width, idx); ++idx; 5122 XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx;
5128 XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; 5123 XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx;
5129 XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; 5124 XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx;
5130 XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; 5125 XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx;
5131 XSETFASTINT (buffer_local_flags.fringe_indicator_alist, idx); ++idx; 5126 XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx;
5132 XSETFASTINT (buffer_local_flags.fringe_cursor_alist, idx); ++idx; 5127 XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx;
5133 XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; 5128 XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx;
5134 XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; 5129 XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx;
5135 XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; 5130 XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx;
5136 XSETFASTINT (buffer_local_flags.cursor_type, idx); ++idx; 5131 XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx;
5137 XSETFASTINT (buffer_local_flags.extra_line_spacing, idx); ++idx; 5132 XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
5138 XSETFASTINT (buffer_local_flags.cursor_in_non_selected_windows, idx); ++idx; 5133 XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
5139 5134
5140 /* Need more room? */ 5135 /* Need more room? */
5141 if (idx >= MAX_PER_BUFFER_VARS) 5136 if (idx >= MAX_PER_BUFFER_VARS)
@@ -5149,7 +5144,7 @@ init_buffer_once (void)
5149 QSFundamental = make_pure_c_string ("Fundamental"); 5144 QSFundamental = make_pure_c_string ("Fundamental");
5150 5145
5151 Qfundamental_mode = intern_c_string ("fundamental-mode"); 5146 Qfundamental_mode = intern_c_string ("fundamental-mode");
5152 buffer_defaults.major_mode = Qfundamental_mode; 5147 BVAR (&buffer_defaults, major_mode) = Qfundamental_mode;
5153 5148
5154 Qmode_class = intern_c_string ("mode-class"); 5149 Qmode_class = intern_c_string ("mode-class");
5155 5150
@@ -5192,7 +5187,7 @@ init_buffer (void)
5192#endif /* USE_MMAP_FOR_BUFFERS */ 5187#endif /* USE_MMAP_FOR_BUFFERS */
5193 5188
5194 Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); 5189 Fset_buffer (Fget_buffer_create (build_string ("*scratch*")));
5195 if (NILP (buffer_defaults.enable_multibyte_characters)) 5190 if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5196 Fset_buffer_multibyte (Qnil); 5191 Fset_buffer_multibyte (Qnil);
5197 5192
5198 pwd = get_current_dir_name (); 5193 pwd = get_current_dir_name ();
@@ -5213,28 +5208,28 @@ init_buffer (void)
5213 pwd[len + 1] = '\0'; 5208 pwd[len + 1] = '\0';
5214 } 5209 }
5215 5210
5216 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); 5211 BVAR (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd));
5217 if (! NILP (buffer_defaults.enable_multibyte_characters)) 5212 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5218 /* At this moment, we still don't know how to decode the 5213 /* At this moment, we still don't know how to decode the
5219 directory name. So, we keep the bytes in multibyte form so 5214 directory name. So, we keep the bytes in multibyte form so
5220 that ENCODE_FILE correctly gets the original bytes. */ 5215 that ENCODE_FILE correctly gets the original bytes. */
5221 current_buffer->directory 5216 BVAR (current_buffer, directory)
5222 = string_to_multibyte (current_buffer->directory); 5217 = string_to_multibyte (BVAR (current_buffer, directory));
5223 5218
5224 /* Add /: to the front of the name 5219 /* Add /: to the front of the name
5225 if it would otherwise be treated as magic. */ 5220 if it would otherwise be treated as magic. */
5226 temp = Ffind_file_name_handler (current_buffer->directory, Qt); 5221 temp = Ffind_file_name_handler (BVAR (current_buffer, directory), Qt);
5227 if (! NILP (temp) 5222 if (! NILP (temp)
5228 /* If the default dir is just /, TEMP is non-nil 5223 /* If the default dir is just /, TEMP is non-nil
5229 because of the ange-ftp completion handler. 5224 because of the ange-ftp completion handler.
5230 However, it is not necessary to turn / into /:/. 5225 However, it is not necessary to turn / into /:/.
5231 So avoid doing that. */ 5226 So avoid doing that. */
5232 && strcmp ("/", SSDATA (current_buffer->directory))) 5227 && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
5233 current_buffer->directory 5228 BVAR (current_buffer, directory)
5234 = concat2 (build_string ("/:"), current_buffer->directory); 5229 = concat2 (build_string ("/:"), BVAR (current_buffer, directory));
5235 5230
5236 temp = get_minibuffer (0); 5231 temp = get_minibuffer (0);
5237 XBUFFER (temp)->directory = current_buffer->directory; 5232 BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory);
5238 5233
5239 free (pwd); 5234 free (pwd);
5240} 5235}
@@ -5410,14 +5405,6 @@ This is the same as (default-value 'tab-width). */);
5410 doc: /* Default value of `case-fold-search' for buffers that don't override it. 5405 doc: /* Default value of `case-fold-search' for buffers that don't override it.
5411This is the same as (default-value 'case-fold-search). */); 5406This is the same as (default-value 'case-fold-search). */);
5412 5407
5413#ifdef DOS_NT
5414 DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-type",
5415 buffer_file_type,
5416 doc: /* Default file type for buffers that do not override it.
5417This is the same as (default-value 'buffer-file-type).
5418The file type is nil for text, t for binary. */);
5419#endif
5420
5421 DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", 5408 DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width",
5422 left_margin_cols, 5409 left_margin_cols,
5423 doc: /* Default value of `left-margin-width' for buffers that don't override it. 5410 doc: /* Default value of `left-margin-width' for buffers that don't override it.
@@ -5486,13 +5473,13 @@ This value applies in buffers that don't have their own local values.
5486This is the same as (default-value 'scroll-down-aggressively). */); 5473This is the same as (default-value 'scroll-down-aggressively). */);
5487 5474
5488 DEFVAR_PER_BUFFER ("header-line-format", 5475 DEFVAR_PER_BUFFER ("header-line-format",
5489 &current_buffer->header_line_format, 5476 &BVAR (current_buffer, header_line_format),
5490 Qnil, 5477 Qnil,
5491 doc: /* Analogous to `mode-line-format', but controls the header line. 5478 doc: /* Analogous to `mode-line-format', but controls the header line.
5492The header line appears, optionally, at the top of a window; 5479The header line appears, optionally, at the top of a window;
5493the mode line appears at the bottom. */); 5480the mode line appears at the bottom. */);
5494 5481
5495 DEFVAR_PER_BUFFER ("mode-line-format", &current_buffer->mode_line_format, 5482 DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format),
5496 Qnil, 5483 Qnil,
5497 doc: /* Template for displaying mode line for current buffer. 5484 doc: /* Template for displaying mode line for current buffer.
5498Each buffer has its own value of this variable. 5485Each buffer has its own value of this variable.
@@ -5549,7 +5536,7 @@ Decimal digits after the % specify field width to which to pad. */);
5549 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, 5536 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode,
5550 doc: /* *Value of `major-mode' for new buffers. */); 5537 doc: /* *Value of `major-mode' for new buffers. */);
5551 5538
5552 DEFVAR_PER_BUFFER ("major-mode", &current_buffer->major_mode, 5539 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode),
5553 make_number (Lisp_Symbol), 5540 make_number (Lisp_Symbol),
5554 doc: /* Symbol for current buffer's major mode. 5541 doc: /* Symbol for current buffer's major mode.
5555The default value (normally `fundamental-mode') affects new buffers. 5542The default value (normally `fundamental-mode') affects new buffers.
@@ -5562,46 +5549,46 @@ the buffer. Thus, the mode and its hooks should not expect certain
5562variables such as `buffer-read-only' and `buffer-file-coding-system' 5549variables such as `buffer-read-only' and `buffer-file-coding-system'
5563to be set up. */); 5550to be set up. */);
5564 5551
5565 DEFVAR_PER_BUFFER ("mode-name", &current_buffer->mode_name, 5552 DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name),
5566 Qnil, 5553 Qnil,
5567 doc: /* Pretty name of current buffer's major mode. 5554 doc: /* Pretty name of current buffer's major mode.
5568Usually a string, but can use any of the constructs for `mode-line-format', 5555Usually a string, but can use any of the constructs for `mode-line-format',
5569which see. 5556which see.
5570Format with `format-mode-line' to produce a string value. */); 5557Format with `format-mode-line' to produce a string value. */);
5571 5558
5572 DEFVAR_PER_BUFFER ("local-abbrev-table", &current_buffer->abbrev_table, Qnil, 5559 DEFVAR_PER_BUFFER ("local-abbrev-table", &BVAR (current_buffer, abbrev_table), Qnil,
5573 doc: /* Local (mode-specific) abbrev table of current buffer. */); 5560 doc: /* Local (mode-specific) abbrev table of current buffer. */);
5574 5561
5575 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil, 5562 DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR (current_buffer, abbrev_mode), Qnil,
5576 doc: /* Non-nil if Abbrev mode is enabled. 5563 doc: /* Non-nil if Abbrev mode is enabled.
5577Use the command `abbrev-mode' to change this variable. */); 5564Use the command `abbrev-mode' to change this variable. */);
5578 5565
5579 DEFVAR_PER_BUFFER ("case-fold-search", &current_buffer->case_fold_search, 5566 DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search),
5580 Qnil, 5567 Qnil,
5581 doc: /* *Non-nil if searches and matches should ignore case. */); 5568 doc: /* *Non-nil if searches and matches should ignore case. */);
5582 5569
5583 DEFVAR_PER_BUFFER ("fill-column", &current_buffer->fill_column, 5570 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
5584 make_number (LISP_INT_TAG), 5571 make_number (LISP_INT_TAG),
5585 doc: /* *Column beyond which automatic line-wrapping should happen. 5572 doc: /* *Column beyond which automatic line-wrapping should happen.
5586Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5573Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5587 5574
5588 DEFVAR_PER_BUFFER ("left-margin", &current_buffer->left_margin, 5575 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
5589 make_number (LISP_INT_TAG), 5576 make_number (LISP_INT_TAG),
5590 doc: /* *Column for the default `indent-line-function' to indent to. 5577 doc: /* *Column for the default `indent-line-function' to indent to.
5591Linefeed indents to this column in Fundamental mode. */); 5578Linefeed indents to this column in Fundamental mode. */);
5592 5579
5593 DEFVAR_PER_BUFFER ("tab-width", &current_buffer->tab_width, 5580 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
5594 make_number (LISP_INT_TAG), 5581 make_number (LISP_INT_TAG),
5595 doc: /* *Distance between tab stops (for display of tab characters), in columns. */); 5582 doc: /* *Distance between tab stops (for display of tab characters), in columns. */);
5596 5583
5597 DEFVAR_PER_BUFFER ("ctl-arrow", &current_buffer->ctl_arrow, Qnil, 5584 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil,
5598 doc: /* *Non-nil means display control chars with uparrow. 5585 doc: /* *Non-nil means display control chars with uparrow.
5599A value of nil means use backslash and octal digits. 5586A value of nil means use backslash and octal digits.
5600This variable does not apply to characters whose display is specified 5587This variable does not apply to characters whose display is specified
5601in the current display table (if there is one). */); 5588in the current display table (if there is one). */);
5602 5589
5603 DEFVAR_PER_BUFFER ("enable-multibyte-characters", 5590 DEFVAR_PER_BUFFER ("enable-multibyte-characters",
5604 &current_buffer->enable_multibyte_characters, 5591 &BVAR (current_buffer, enable_multibyte_characters),
5605 Qnil, 5592 Qnil,
5606 doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. 5593 doc: /* Non-nil means the buffer contents are regarded as multi-byte characters.
5607Otherwise they are regarded as unibyte. This affects the display, 5594Otherwise they are regarded as unibyte. This affects the display,
@@ -5615,7 +5602,7 @@ See also variable `default-enable-multibyte-characters' and Info node
5615 XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; 5602 XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1;
5616 5603
5617 DEFVAR_PER_BUFFER ("buffer-file-coding-system", 5604 DEFVAR_PER_BUFFER ("buffer-file-coding-system",
5618 &current_buffer->buffer_file_coding_system, Qnil, 5605 &BVAR (current_buffer, buffer_file_coding_system), Qnil,
5619 doc: /* Coding system to be used for encoding the buffer contents on saving. 5606 doc: /* Coding system to be used for encoding the buffer contents on saving.
5620This variable applies to saving the buffer, and also to `write-region' 5607This variable applies to saving the buffer, and also to `write-region'
5621and other functions that use `write-region'. 5608and other functions that use `write-region'.
@@ -5633,11 +5620,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable.
5633This variable is never applied to a way of decoding a file while reading it. */); 5620This variable is never applied to a way of decoding a file while reading it. */);
5634 5621
5635 DEFVAR_PER_BUFFER ("bidi-display-reordering", 5622 DEFVAR_PER_BUFFER ("bidi-display-reordering",
5636 &current_buffer->bidi_display_reordering, Qnil, 5623 &BVAR (current_buffer, bidi_display_reordering), Qnil,
5637 doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); 5624 doc: /* Non-nil means reorder bidirectional text for display in the visual order. */);
5638 5625
5639 DEFVAR_PER_BUFFER ("bidi-paragraph-direction", 5626 DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
5640 &current_buffer->bidi_paragraph_direction, Qnil, 5627 &BVAR (current_buffer, bidi_paragraph_direction), Qnil,
5641 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. 5628 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer.
5642 5629
5643If this is nil (the default), the direction of each paragraph is 5630If this is nil (the default), the direction of each paragraph is
@@ -5648,7 +5635,7 @@ Any other value is treated as nil.
5648This variable has no effect unless the buffer's value of 5635This variable has no effect unless the buffer's value of
5649\`bidi-display-reordering' is non-nil. */); 5636\`bidi-display-reordering' is non-nil. */);
5650 5637
5651 DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines, Qnil, 5638 DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil,
5652 doc: /* *Non-nil means do not display continuation lines. 5639 doc: /* *Non-nil means do not display continuation lines.
5653Instead, give each line of text just one screen line. 5640Instead, give each line of text just one screen line.
5654 5641
@@ -5656,7 +5643,7 @@ Note that this is overridden by the variable
5656`truncate-partial-width-windows' if that variable is non-nil 5643`truncate-partial-width-windows' if that variable is non-nil
5657and this buffer is not full-frame width. */); 5644and this buffer is not full-frame width. */);
5658 5645
5659 DEFVAR_PER_BUFFER ("word-wrap", &current_buffer->word_wrap, Qnil, 5646 DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil,
5660 doc: /* *Non-nil means to use word-wrapping for continuation lines. 5647 doc: /* *Non-nil means to use word-wrapping for continuation lines.
5661When word-wrapping is on, continuation lines are wrapped at the space 5648When word-wrapping is on, continuation lines are wrapped at the space
5662or tab character nearest to the right window edge. 5649or tab character nearest to the right window edge.
@@ -5668,21 +5655,12 @@ word-wrapping, you might want to reduce the value of
5668`truncate-partial-width-windows', since wrapping can make text readable 5655`truncate-partial-width-windows', since wrapping can make text readable
5669in narrower windows. */); 5656in narrower windows. */);
5670 5657
5671#ifdef DOS_NT 5658 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
5672 DEFVAR_PER_BUFFER ("buffer-file-type", &current_buffer->buffer_file_type,
5673 Qnil,
5674 doc: /* Non-nil if the visited file is a binary file.
5675This variable is meaningful on MS-DOG and Windows NT.
5676On those systems, it is automatically local in every buffer.
5677On other systems, this variable is normally always nil. */);
5678#endif
5679
5680 DEFVAR_PER_BUFFER ("default-directory", &current_buffer->directory,
5681 make_number (Lisp_String), 5659 make_number (Lisp_String),
5682 doc: /* Name of default directory of current buffer. Should end with slash. 5660 doc: /* Name of default directory of current buffer. Should end with slash.
5683To interactively change the default directory, use command `cd'. */); 5661To interactively change the default directory, use command `cd'. */);
5684 5662
5685 DEFVAR_PER_BUFFER ("auto-fill-function", &current_buffer->auto_fill_function, 5663 DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function),
5686 Qnil, 5664 Qnil,
5687 doc: /* Function called (if non-nil) to perform auto-fill. 5665 doc: /* Function called (if non-nil) to perform auto-fill.
5688It is called after self-inserting any character specified in 5666It is called after self-inserting any character specified in
@@ -5690,30 +5668,30 @@ the `auto-fill-chars' table.
5690NOTE: This variable is not a hook; 5668NOTE: This variable is not a hook;
5691its value may not be a list of functions. */); 5669its value may not be a list of functions. */);
5692 5670
5693 DEFVAR_PER_BUFFER ("buffer-file-name", &current_buffer->filename, 5671 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename),
5694 make_number (Lisp_String), 5672 make_number (Lisp_String),
5695 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); 5673 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */);
5696 5674
5697 DEFVAR_PER_BUFFER ("buffer-file-truename", &current_buffer->file_truename, 5675 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename),
5698 make_number (Lisp_String), 5676 make_number (Lisp_String),
5699 doc: /* Abbreviated truename of file visited in current buffer, or nil if none. 5677 doc: /* Abbreviated truename of file visited in current buffer, or nil if none.
5700The truename of a file is calculated by `file-truename' 5678The truename of a file is calculated by `file-truename'
5701and then abbreviated with `abbreviate-file-name'. */); 5679and then abbreviated with `abbreviate-file-name'. */);
5702 5680
5703 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", 5681 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name",
5704 &current_buffer->auto_save_file_name, 5682 &BVAR (current_buffer, auto_save_file_name),
5705 make_number (Lisp_String), 5683 make_number (Lisp_String),
5706 doc: /* Name of file for auto-saving current buffer. 5684 doc: /* Name of file for auto-saving current buffer.
5707If it is nil, that means don't auto-save this buffer. */); 5685If it is nil, that means don't auto-save this buffer. */);
5708 5686
5709 DEFVAR_PER_BUFFER ("buffer-read-only", &current_buffer->read_only, Qnil, 5687 DEFVAR_PER_BUFFER ("buffer-read-only", &BVAR (current_buffer, read_only), Qnil,
5710 doc: /* Non-nil if this buffer is read-only. */); 5688 doc: /* Non-nil if this buffer is read-only. */);
5711 5689
5712 DEFVAR_PER_BUFFER ("buffer-backed-up", &current_buffer->backed_up, Qnil, 5690 DEFVAR_PER_BUFFER ("buffer-backed-up", &BVAR (current_buffer, backed_up), Qnil,
5713 doc: /* Non-nil if this buffer's file has been backed up. 5691 doc: /* Non-nil if this buffer's file has been backed up.
5714Backing up is done before the first time the file is saved. */); 5692Backing up is done before the first time the file is saved. */);
5715 5693
5716 DEFVAR_PER_BUFFER ("buffer-saved-size", &current_buffer->save_length, 5694 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
5717 make_number (LISP_INT_TAG), 5695 make_number (LISP_INT_TAG),
5718 doc: /* Length of current buffer when last read in, saved or auto-saved. 5696 doc: /* Length of current buffer when last read in, saved or auto-saved.
57190 initially. 56970 initially.
@@ -5723,7 +5701,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer
5723if its text size shrinks. If you use `buffer-swap-text' on a buffer, 5701if its text size shrinks. If you use `buffer-swap-text' on a buffer,
5724you probably should set this to -2 in that buffer. */); 5702you probably should set this to -2 in that buffer. */);
5725 5703
5726 DEFVAR_PER_BUFFER ("selective-display", &current_buffer->selective_display, 5704 DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display),
5727 Qnil, 5705 Qnil,
5728 doc: /* Non-nil enables selective display. 5706 doc: /* Non-nil enables selective display.
5729An integer N as value means display only lines 5707An integer N as value means display only lines
@@ -5734,12 +5712,12 @@ in a file, save the ^M as a newline. */);
5734 5712
5735#ifndef old 5713#ifndef old
5736 DEFVAR_PER_BUFFER ("selective-display-ellipses", 5714 DEFVAR_PER_BUFFER ("selective-display-ellipses",
5737 &current_buffer->selective_display_ellipses, 5715 &BVAR (current_buffer, selective_display_ellipses),
5738 Qnil, 5716 Qnil,
5739 doc: /* Non-nil means display ... on previous line when a line is invisible. */); 5717 doc: /* Non-nil means display ... on previous line when a line is invisible. */);
5740#endif 5718#endif
5741 5719
5742 DEFVAR_PER_BUFFER ("overwrite-mode", &current_buffer->overwrite_mode, Qnil, 5720 DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil,
5743 doc: /* Non-nil if self-insertion should replace existing text. 5721 doc: /* Non-nil if self-insertion should replace existing text.
5744The value should be one of `overwrite-mode-textual', 5722The value should be one of `overwrite-mode-textual',
5745`overwrite-mode-binary', or nil. 5723`overwrite-mode-binary', or nil.
@@ -5748,7 +5726,7 @@ inserts at the end of a line, and inserts when point is before a tab,
5748until the tab is filled in. 5726until the tab is filled in.
5749If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); 5727If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */);
5750 5728
5751 DEFVAR_PER_BUFFER ("buffer-display-table", &current_buffer->display_table, 5729 DEFVAR_PER_BUFFER ("buffer-display-table", &BVAR (current_buffer, display_table),
5752 Qnil, 5730 Qnil,
5753 doc: /* Display table that controls display of the contents of current buffer. 5731 doc: /* Display table that controls display of the contents of current buffer.
5754 5732
@@ -5785,39 +5763,39 @@ In addition, a char-table has six extra slots to control the display of:
5785 5763
5786See also the functions `display-table-slot' and `set-display-table-slot'. */); 5764See also the functions `display-table-slot' and `set-display-table-slot'. */);
5787 5765
5788 DEFVAR_PER_BUFFER ("left-margin-width", &current_buffer->left_margin_cols, 5766 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols),
5789 Qnil, 5767 Qnil,
5790 doc: /* *Width of left marginal area for display of a buffer. 5768 doc: /* *Width of left marginal area for display of a buffer.
5791A value of nil means no marginal area. */); 5769A value of nil means no marginal area. */);
5792 5770
5793 DEFVAR_PER_BUFFER ("right-margin-width", &current_buffer->right_margin_cols, 5771 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols),
5794 Qnil, 5772 Qnil,
5795 doc: /* *Width of right marginal area for display of a buffer. 5773 doc: /* *Width of right marginal area for display of a buffer.
5796A value of nil means no marginal area. */); 5774A value of nil means no marginal area. */);
5797 5775
5798 DEFVAR_PER_BUFFER ("left-fringe-width", &current_buffer->left_fringe_width, 5776 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width),
5799 Qnil, 5777 Qnil,
5800 doc: /* *Width of this buffer's left fringe (in pixels). 5778 doc: /* *Width of this buffer's left fringe (in pixels).
5801A value of 0 means no left fringe is shown in this buffer's window. 5779A value of 0 means no left fringe is shown in this buffer's window.
5802A value of nil means to use the left fringe width from the window's frame. */); 5780A value of nil means to use the left fringe width from the window's frame. */);
5803 5781
5804 DEFVAR_PER_BUFFER ("right-fringe-width", &current_buffer->right_fringe_width, 5782 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width),
5805 Qnil, 5783 Qnil,
5806 doc: /* *Width of this buffer's right fringe (in pixels). 5784 doc: /* *Width of this buffer's right fringe (in pixels).
5807A value of 0 means no right fringe is shown in this buffer's window. 5785A value of 0 means no right fringe is shown in this buffer's window.
5808A value of nil means to use the right fringe width from the window's frame. */); 5786A value of nil means to use the right fringe width from the window's frame. */);
5809 5787
5810 DEFVAR_PER_BUFFER ("fringes-outside-margins", &current_buffer->fringes_outside_margins, 5788 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins),
5811 Qnil, 5789 Qnil,
5812 doc: /* *Non-nil means to display fringes outside display margins. 5790 doc: /* *Non-nil means to display fringes outside display margins.
5813A value of nil means to display fringes between margins and buffer text. */); 5791A value of nil means to display fringes between margins and buffer text. */);
5814 5792
5815 DEFVAR_PER_BUFFER ("scroll-bar-width", &current_buffer->scroll_bar_width, 5793 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
5816 Qnil, 5794 Qnil,
5817 doc: /* *Width of this buffer's scroll bars in pixels. 5795 doc: /* *Width of this buffer's scroll bars in pixels.
5818A value of nil means to use the scroll bar width from the window's frame. */); 5796A value of nil means to use the scroll bar width from the window's frame. */);
5819 5797
5820 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &current_buffer->vertical_scroll_bar_type, 5798 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
5821 Qnil, 5799 Qnil,
5822 doc: /* *Position of this buffer's vertical scroll bar. 5800 doc: /* *Position of this buffer's vertical scroll bar.
5823The value takes effect whenever you tell a window to display this buffer; 5801The value takes effect whenever you tell a window to display this buffer;
@@ -5828,13 +5806,13 @@ of the window; a value of nil means don't show any vertical scroll bars.
5828A value of t (the default) means do whatever the window's frame specifies. */); 5806A value of t (the default) means do whatever the window's frame specifies. */);
5829 5807
5830 DEFVAR_PER_BUFFER ("indicate-empty-lines", 5808 DEFVAR_PER_BUFFER ("indicate-empty-lines",
5831 &current_buffer->indicate_empty_lines, Qnil, 5809 &BVAR (current_buffer, indicate_empty_lines), Qnil,
5832 doc: /* *Visually indicate empty lines after the buffer end. 5810 doc: /* *Visually indicate empty lines after the buffer end.
5833If non-nil, a bitmap is displayed in the left fringe of a window on 5811If non-nil, a bitmap is displayed in the left fringe of a window on
5834window-systems. */); 5812window-systems. */);
5835 5813
5836 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", 5814 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
5837 &current_buffer->indicate_buffer_boundaries, Qnil, 5815 &BVAR (current_buffer, indicate_buffer_boundaries), Qnil,
5838 doc: /* *Visually indicate buffer boundaries and scrolling. 5816 doc: /* *Visually indicate buffer boundaries and scrolling.
5839If non-nil, the first and last line of the buffer are marked in the fringe 5817If non-nil, the first and last line of the buffer are marked in the fringe
5840of a window on window-systems with angle bitmaps, or if the window can be 5818of a window on window-systems with angle bitmaps, or if the window can be
@@ -5859,7 +5837,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left
5859fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); 5837fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */);
5860 5838
5861 DEFVAR_PER_BUFFER ("fringe-indicator-alist", 5839 DEFVAR_PER_BUFFER ("fringe-indicator-alist",
5862 &current_buffer->fringe_indicator_alist, Qnil, 5840 &BVAR (current_buffer, fringe_indicator_alist), Qnil,
5863 doc: /* *Mapping from logical to physical fringe indicator bitmaps. 5841 doc: /* *Mapping from logical to physical fringe indicator bitmaps.
5864The value is an alist where each element (INDICATOR . BITMAPS) 5842The value is an alist where each element (INDICATOR . BITMAPS)
5865specifies the fringe bitmaps used to display a specific logical 5843specifies the fringe bitmaps used to display a specific logical
@@ -5878,7 +5856,7 @@ last (only) line has no final newline. BITMAPS may also be a single
5878symbol which is used in both left and right fringes. */); 5856symbol which is used in both left and right fringes. */);
5879 5857
5880 DEFVAR_PER_BUFFER ("fringe-cursor-alist", 5858 DEFVAR_PER_BUFFER ("fringe-cursor-alist",
5881 &current_buffer->fringe_cursor_alist, Qnil, 5859 &BVAR (current_buffer, fringe_cursor_alist), Qnil,
5882 doc: /* *Mapping from logical to physical fringe cursor bitmaps. 5860 doc: /* *Mapping from logical to physical fringe cursor bitmaps.
5883The value is an alist where each element (CURSOR . BITMAP) 5861The value is an alist where each element (CURSOR . BITMAP)
5884specifies the fringe bitmaps used to display a specific logical 5862specifies the fringe bitmaps used to display a specific logical
@@ -5893,7 +5871,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical
5893cursor type. */); 5871cursor type. */);
5894 5872
5895 DEFVAR_PER_BUFFER ("scroll-up-aggressively", 5873 DEFVAR_PER_BUFFER ("scroll-up-aggressively",
5896 &current_buffer->scroll_up_aggressively, Qnil, 5874 &BVAR (current_buffer, scroll_up_aggressively), Qnil,
5897 doc: /* How far to scroll windows upward. 5875 doc: /* How far to scroll windows upward.
5898If you move point off the bottom, the window scrolls automatically. 5876If you move point off the bottom, the window scrolls automatically.
5899This variable controls how far it scrolls. The value nil, the default, 5877This variable controls how far it scrolls. The value nil, the default,
@@ -5906,7 +5884,7 @@ window scrolls by a full window height. Meaningful values are
5906between 0.0 and 1.0, inclusive. */); 5884between 0.0 and 1.0, inclusive. */);
5907 5885
5908 DEFVAR_PER_BUFFER ("scroll-down-aggressively", 5886 DEFVAR_PER_BUFFER ("scroll-down-aggressively",
5909 &current_buffer->scroll_down_aggressively, Qnil, 5887 &BVAR (current_buffer, scroll_down_aggressively), Qnil,
5910 doc: /* How far to scroll windows downward. 5888 doc: /* How far to scroll windows downward.
5911If you move point off the top, the window scrolls automatically. 5889If you move point off the top, the window scrolls automatically.
5912This variable controls how far it scrolls. The value nil, the default, 5890This variable controls how far it scrolls. The value nil, the default,
@@ -5961,7 +5939,7 @@ from happening repeatedly and making Emacs nonfunctional. */);
5961The functions are run using the `run-hooks' function. */); 5939The functions are run using the `run-hooks' function. */);
5962 Vfirst_change_hook = Qnil; 5940 Vfirst_change_hook = Qnil;
5963 5941
5964 DEFVAR_PER_BUFFER ("buffer-undo-list", &current_buffer->undo_list, Qnil, 5942 DEFVAR_PER_BUFFER ("buffer-undo-list", &BVAR (current_buffer, undo_list), Qnil,
5965 doc: /* List of undo entries in current buffer. 5943 doc: /* List of undo entries in current buffer.
5966Recent changes come first; older changes follow newer. 5944Recent changes come first; older changes follow newer.
5967 5945
@@ -6002,10 +5980,10 @@ the changes between two undo boundaries as a single step to be undone.
6002 5980
6003If the value of the variable is t, undo information is not recorded. */); 5981If the value of the variable is t, undo information is not recorded. */);
6004 5982
6005 DEFVAR_PER_BUFFER ("mark-active", &current_buffer->mark_active, Qnil, 5983 DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil,
6006 doc: /* Non-nil means the mark and region are currently active in this buffer. */); 5984 doc: /* Non-nil means the mark and region are currently active in this buffer. */);
6007 5985
6008 DEFVAR_PER_BUFFER ("cache-long-line-scans", &current_buffer->cache_long_line_scans, Qnil, 5986 DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil,
6009 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. 5987 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly.
6010 5988
6011Normally, the line-motion functions work by scanning the buffer for 5989Normally, the line-motion functions work by scanning the buffer for
@@ -6033,23 +6011,23 @@ maintained internally by the Emacs primitives. Enabling or disabling
6033the cache should not affect the behavior of any of the motion 6011the cache should not affect the behavior of any of the motion
6034functions; it should only affect their performance. */); 6012functions; it should only affect their performance. */);
6035 6013
6036 DEFVAR_PER_BUFFER ("point-before-scroll", &current_buffer->point_before_scroll, Qnil, 6014 DEFVAR_PER_BUFFER ("point-before-scroll", &BVAR (current_buffer, point_before_scroll), Qnil,
6037 doc: /* Value of point before the last series of scroll operations, or nil. */); 6015 doc: /* Value of point before the last series of scroll operations, or nil. */);
6038 6016
6039 DEFVAR_PER_BUFFER ("buffer-file-format", &current_buffer->file_format, Qnil, 6017 DEFVAR_PER_BUFFER ("buffer-file-format", &BVAR (current_buffer, file_format), Qnil,
6040 doc: /* List of formats to use when saving this buffer. 6018 doc: /* List of formats to use when saving this buffer.
6041Formats are defined by `format-alist'. This variable is 6019Formats are defined by `format-alist'. This variable is
6042set when a file is visited. */); 6020set when a file is visited. */);
6043 6021
6044 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", 6022 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format",
6045 &current_buffer->auto_save_file_format, Qnil, 6023 &BVAR (current_buffer, auto_save_file_format), Qnil,
6046 doc: /* *Format in which to write auto-save files. 6024 doc: /* *Format in which to write auto-save files.
6047Should be a list of symbols naming formats that are defined in `format-alist'. 6025Should be a list of symbols naming formats that are defined in `format-alist'.
6048If it is t, which is the default, auto-save files are written in the 6026If it is t, which is the default, auto-save files are written in the
6049same format as a regular save would use. */); 6027same format as a regular save would use. */);
6050 6028
6051 DEFVAR_PER_BUFFER ("buffer-invisibility-spec", 6029 DEFVAR_PER_BUFFER ("buffer-invisibility-spec",
6052 &current_buffer->invisibility_spec, Qnil, 6030 &BVAR (current_buffer, invisibility_spec), Qnil,
6053 doc: /* Invisibility spec of this buffer. 6031 doc: /* Invisibility spec of this buffer.
6054The default is t, which means that text is invisible 6032The default is t, which means that text is invisible
6055if it has a non-nil `invisible' property. 6033if it has a non-nil `invisible' property.
@@ -6060,12 +6038,12 @@ then characters with property value PROP are invisible,
6060and they have an ellipsis as well if ELLIPSIS is non-nil. */); 6038and they have an ellipsis as well if ELLIPSIS is non-nil. */);
6061 6039
6062 DEFVAR_PER_BUFFER ("buffer-display-count", 6040 DEFVAR_PER_BUFFER ("buffer-display-count",
6063 &current_buffer->display_count, Qnil, 6041 &BVAR (current_buffer, display_count), Qnil,
6064 doc: /* A number incremented each time this buffer is displayed in a window. 6042 doc: /* A number incremented each time this buffer is displayed in a window.
6065The function `set-window-buffer' increments it. */); 6043The function `set-window-buffer' increments it. */);
6066 6044
6067 DEFVAR_PER_BUFFER ("buffer-display-time", 6045 DEFVAR_PER_BUFFER ("buffer-display-time",
6068 &current_buffer->display_time, Qnil, 6046 &BVAR (current_buffer, display_time), Qnil,
6069 doc: /* Time stamp updated each time this buffer is displayed in a window. 6047 doc: /* Time stamp updated each time this buffer is displayed in a window.
6070The function `set-window-buffer' updates this variable 6048The function `set-window-buffer' updates this variable
6071to the value obtained by calling `current-time'. 6049to the value obtained by calling `current-time'.
@@ -6100,7 +6078,7 @@ and disregard a `read-only' text property if the property value
6100is a member of the list. */); 6078is a member of the list. */);
6101 Vinhibit_read_only = Qnil; 6079 Vinhibit_read_only = Qnil;
6102 6080
6103 DEFVAR_PER_BUFFER ("cursor-type", &current_buffer->cursor_type, Qnil, 6081 DEFVAR_PER_BUFFER ("cursor-type", &BVAR (current_buffer, cursor_type), Qnil,
6104 doc: /* Cursor to use when this buffer is in the selected window. 6082 doc: /* Cursor to use when this buffer is in the selected window.
6105Values are interpreted as follows: 6083Values are interpreted as follows:
6106 6084
@@ -6119,7 +6097,7 @@ cursor's appearance is instead controlled by the variable
6119`cursor-in-non-selected-windows'. */); 6097`cursor-in-non-selected-windows'. */);
6120 6098
6121 DEFVAR_PER_BUFFER ("line-spacing", 6099 DEFVAR_PER_BUFFER ("line-spacing",
6122 &current_buffer->extra_line_spacing, Qnil, 6100 &BVAR (current_buffer, extra_line_spacing), Qnil,
6123 doc: /* Additional space to put between lines when displaying a buffer. 6101 doc: /* Additional space to put between lines when displaying a buffer.
6124The space is measured in pixels, and put below lines on graphic displays, 6102The space is measured in pixels, and put below lines on graphic displays,
6125see `display-graphic-p'. 6103see `display-graphic-p'.
@@ -6127,7 +6105,7 @@ If value is a floating point number, it specifies the spacing relative
6127to the default frame line height. A value of nil means add no extra space. */); 6105to the default frame line height. A value of nil means add no extra space. */);
6128 6106
6129 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", 6107 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
6130 &current_buffer->cursor_in_non_selected_windows, Qnil, 6108 &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil,
6131 doc: /* *Non-nil means show a cursor in non-selected windows. 6109 doc: /* *Non-nil means show a cursor in non-selected windows.
6132If nil, only shows a cursor in the selected window. 6110If nil, only shows a cursor in the selected window.
6133If t, displays a cursor related to the usual cursor type 6111If t, displays a cursor related to the usual cursor type