aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-13 07:39:07 +0400
committerDmitry Antipov2012-08-13 07:39:07 +0400
commit4c31be6153255dfe29a0231253263ea0d9011ac3 (patch)
treecfd30617b9270436aad8cdf810a97721aaa20747 /src
parent1439443be63a2b0d796df8ebca882cdaecb7269f (diff)
downloademacs-4c31be6153255dfe29a0231253263ea0d9011ac3.tar.gz
emacs-4c31be6153255dfe29a0231253263ea0d9011ac3.zip
Use BSET for write access to Lisp_Object members of struct buffer.
* buffer.h (BSET): New macro. * buffer.c, casetab.c, cmds.c, coding.c, data.c, editfns.c: * fileio.c, frame.c, indent.c, insdel.c, intervals.c, keymap.c: * minibuf.c, print.c, process.c, syntax.c, undo.c, w32fns.c: * window.c, xdisp.c, xfns.c: Adjust users.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/buffer.c273
-rw-r--r--src/buffer.h1
-rw-r--r--src/casetab.c8
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c8
-rw-r--r--src/data.c14
-rw-r--r--src/editfns.c12
-rw-r--r--src/fileio.c34
-rw-r--r--src/frame.c2
-rw-r--r--src/indent.c4
-rw-r--r--src/insdel.c2
-rw-r--r--src/intervals.c2
-rw-r--r--src/keymap.c2
-rw-r--r--src/minibuf.c13
-rw-r--r--src/print.c12
-rw-r--r--src/process.c8
-rw-r--r--src/syntax.c2
-rw-r--r--src/undo.c38
-rw-r--r--src/w32fns.c4
-rw-r--r--src/window.c12
-rw-r--r--src/xdisp.c16
-rw-r--r--src/xfns.c4
23 files changed, 249 insertions, 233 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ce40a4c0baf..606b3fe64a3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12012-08-13 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Use BSET for write access to Lisp_Object members of struct buffer.
4 * buffer.h (BSET): New macro.
5 * buffer.c, casetab.c, cmds.c, coding.c, data.c, editfns.c:
6 * fileio.c, frame.c, indent.c, insdel.c, intervals.c, keymap.c:
7 * minibuf.c, print.c, process.c, syntax.c, undo.c, w32fns.c:
8 * window.c, xdisp.c, xfns.c: Adjust users.
9
12012-08-11 BT Templeton <bpt@hcoop.net> (tiny change) 102012-08-11 BT Templeton <bpt@hcoop.net> (tiny change)
2 11
3 * lread.c (syms_of_lread): Initialize Vlexical_binding. 12 * lread.c (syms_of_lread): Initialize Vlexical_binding.
diff --git a/src/buffer.c b/src/buffer.c
index 6b68f34bb15..ffc9daeb9a7 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -370,7 +370,7 @@ even if it is dead. The return value is never nil. */)
370 370
371 b->newline_cache = 0; 371 b->newline_cache = 0;
372 b->width_run_cache = 0; 372 b->width_run_cache = 0;
373 BVAR (b, width_table) = Qnil; 373 BSET (b, width_table, Qnil);
374 b->prevent_redisplay_optimizations_p = 1; 374 b->prevent_redisplay_optimizations_p = 1;
375 375
376 /* Put this on the chain of all buffers including killed ones. */ 376 /* Put this on the chain of all buffers including killed ones. */
@@ -379,20 +379,20 @@ even if it is dead. The return value is never nil. */)
379 379
380 /* An ordinary buffer normally doesn't need markers 380 /* An ordinary buffer normally doesn't need markers
381 to handle BEGV and ZV. */ 381 to handle BEGV and ZV. */
382 BVAR (b, pt_marker) = Qnil; 382 BSET (b, pt_marker, Qnil);
383 BVAR (b, begv_marker) = Qnil; 383 BSET (b, begv_marker, Qnil);
384 BVAR (b, zv_marker) = Qnil; 384 BSET (b, zv_marker, Qnil);
385 385
386 name = Fcopy_sequence (buffer_or_name); 386 name = Fcopy_sequence (buffer_or_name);
387 string_set_intervals (name, NULL); 387 string_set_intervals (name, NULL);
388 BVAR (b, name) = name; 388 BSET (b, name, name);
389 389
390 BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; 390 BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt);
391 391
392 reset_buffer (b); 392 reset_buffer (b);
393 reset_buffer_local_variables (b, 1); 393 reset_buffer_local_variables (b, 1);
394 394
395 BVAR (b, mark) = Fmake_marker (); 395 BSET (b, mark, Fmake_marker ());
396 BUF_MARKERS (b) = NULL; 396 BUF_MARKERS (b) = NULL;
397 397
398 /* Put this in the alist of all live buffers. */ 398 /* Put this in the alist of all live buffers. */
@@ -481,7 +481,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
481 481
482 /* Get (a copy of) the alist of Lisp-level local variables of FROM 482 /* Get (a copy of) the alist of Lisp-level local variables of FROM
483 and install that in TO. */ 483 and install that in TO. */
484 BVAR (to, local_var_alist) = buffer_lisp_local_variables (from, 1); 484 BSET (to, local_var_alist, buffer_lisp_local_variables (from, 1));
485} 485}
486 486
487 487
@@ -584,7 +584,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
584 584
585 b->newline_cache = 0; 585 b->newline_cache = 0;
586 b->width_run_cache = 0; 586 b->width_run_cache = 0;
587 BVAR (b, width_table) = Qnil; 587 BSET (b, width_table, Qnil);
588 588
589 /* Put this on the chain of all buffers including killed ones. */ 589 /* Put this on the chain of all buffers including killed ones. */
590 b->header.next.buffer = all_buffers; 590 b->header.next.buffer = all_buffers;
@@ -592,7 +592,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
592 592
593 name = Fcopy_sequence (name); 593 name = Fcopy_sequence (name);
594 string_set_intervals (name, NULL); 594 string_set_intervals (name, NULL);
595 BVAR (b, name) = name; 595 BSET (b, name, name);
596 596
597 reset_buffer (b); 597 reset_buffer (b);
598 reset_buffer_local_variables (b, 1); 598 reset_buffer_local_variables (b, 1);
@@ -601,10 +601,10 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
601 XSETBUFFER (buf, b); 601 XSETBUFFER (buf, b);
602 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 602 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
603 603
604 BVAR (b, mark) = Fmake_marker (); 604 BSET (b, mark, Fmake_marker ());
605 605
606 /* The multibyte status belongs to the base buffer. */ 606 /* The multibyte status belongs to the base buffer. */
607 BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters); 607 BSET (b, enable_multibyte_characters, BVAR (b->base_buffer, enable_multibyte_characters));
608 608
609 /* Make sure the base buffer has markers for its narrowing. */ 609 /* Make sure the base buffer has markers for its narrowing. */
610 if (NILP (BVAR (b->base_buffer, pt_marker))) 610 if (NILP (BVAR (b->base_buffer, pt_marker)))
@@ -612,14 +612,14 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
612 eassert (NILP (BVAR (b->base_buffer, begv_marker))); 612 eassert (NILP (BVAR (b->base_buffer, begv_marker)));
613 eassert (NILP (BVAR (b->base_buffer, zv_marker))); 613 eassert (NILP (BVAR (b->base_buffer, zv_marker)));
614 614
615 BVAR (b->base_buffer, pt_marker) 615 BSET (b->base_buffer, pt_marker,
616 = build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte); 616 build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte));
617 617
618 BVAR (b->base_buffer, begv_marker) 618 BSET (b->base_buffer, begv_marker,
619 = build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte); 619 build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte));
620 620
621 BVAR (b->base_buffer, zv_marker) 621 BSET (b->base_buffer, zv_marker,
622 = build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte); 622 build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte));
623 623
624 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; 624 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
625 } 625 }
@@ -627,9 +627,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
627 if (NILP (clone)) 627 if (NILP (clone))
628 { 628 {
629 /* Give the indirect buffer markers for its narrowing. */ 629 /* Give the indirect buffer markers for its narrowing. */
630 BVAR (b, pt_marker) = build_marker (b, b->pt, b->pt_byte); 630 BSET (b, pt_marker, build_marker (b, b->pt, b->pt_byte));
631 BVAR (b, begv_marker) = build_marker (b, b->begv, b->begv_byte); 631 BSET (b, begv_marker, build_marker (b, b->begv, b->begv_byte));
632 BVAR (b, zv_marker) = build_marker (b, b->zv, b->zv_byte); 632 BSET (b, zv_marker, build_marker (b, b->zv, b->zv_byte));
633 XMARKER (BVAR (b, zv_marker))->insertion_type = 1; 633 XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
634 } 634 }
635 else 635 else
@@ -637,11 +637,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
637 struct buffer *old_b = current_buffer; 637 struct buffer *old_b = current_buffer;
638 638
639 clone_per_buffer_values (b->base_buffer, b); 639 clone_per_buffer_values (b->base_buffer, b);
640 BVAR (b, filename) = Qnil; 640 BSET (b, filename, Qnil);
641 BVAR (b, file_truename) = Qnil; 641 BSET (b, file_truename, Qnil);
642 BVAR (b, display_count) = make_number (0); 642 BSET (b, display_count, make_number (0));
643 BVAR (b, backed_up) = Qnil; 643 BSET (b, backed_up, Qnil);
644 BVAR (b, auto_save_file_name) = Qnil; 644 BSET (b, auto_save_file_name, Qnil);
645 set_buffer_internal_1 (b); 645 set_buffer_internal_1 (b);
646 Fset (intern ("buffer-save-without-query"), Qnil); 646 Fset (intern ("buffer-save-without-query"), Qnil);
647 Fset (intern ("buffer-file-number"), Qnil); 647 Fset (intern ("buffer-file-number"), Qnil);
@@ -704,9 +704,10 @@ delete_all_overlays (struct buffer *b)
704void 704void
705reset_buffer (register struct buffer *b) 705reset_buffer (register struct buffer *b)
706{ 706{
707 BVAR (b, filename) = Qnil; 707 BSET (b, filename, Qnil);
708 BVAR (b, file_truename) = Qnil; 708 BSET (b, file_truename, Qnil);
709 BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil; 709 BSET (b, directory,
710 (current_buffer) ? BVAR (current_buffer, directory) : Qnil);
710 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); 711 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS);
711 b->modtime_size = -1; 712 b->modtime_size = -1;
712 XSETFASTINT (BVAR (b, save_length), 0); 713 XSETFASTINT (BVAR (b, save_length), 0);
@@ -714,24 +715,25 @@ reset_buffer (register struct buffer *b)
714 /* It is more conservative to start out "changed" than "unchanged". */ 715 /* It is more conservative to start out "changed" than "unchanged". */
715 b->clip_changed = 0; 716 b->clip_changed = 0;
716 b->prevent_redisplay_optimizations_p = 1; 717 b->prevent_redisplay_optimizations_p = 1;
717 BVAR (b, backed_up) = Qnil; 718 BSET (b, backed_up, Qnil);
718 BUF_AUTOSAVE_MODIFF (b) = 0; 719 BUF_AUTOSAVE_MODIFF (b) = 0;
719 b->auto_save_failure_time = 0; 720 b->auto_save_failure_time = 0;
720 BVAR (b, auto_save_file_name) = Qnil; 721 BSET (b, auto_save_file_name, Qnil);
721 BVAR (b, read_only) = Qnil; 722 BSET (b, read_only, Qnil);
722 buffer_set_overlays (b, NULL, OV_BEFORE); 723 buffer_set_overlays (b, NULL, OV_BEFORE);
723 buffer_set_overlays (b, NULL, OV_AFTER); 724 buffer_set_overlays (b, NULL, OV_AFTER);
724 b->overlay_center = BEG; 725 b->overlay_center = BEG;
725 BVAR (b, mark_active) = Qnil; 726 BSET (b, mark_active, Qnil);
726 BVAR (b, point_before_scroll) = Qnil; 727 BSET (b, point_before_scroll, Qnil);
727 BVAR (b, file_format) = Qnil; 728 BSET (b, file_format, Qnil);
728 BVAR (b, auto_save_file_format) = Qt; 729 BSET (b, auto_save_file_format, Qt);
729 BVAR (b, last_selected_window) = Qnil; 730 BSET (b, last_selected_window, Qnil);
730 XSETINT (BVAR (b, display_count), 0); 731 BSET (b, display_count, make_number (0));
731 BVAR (b, display_time) = Qnil; 732 BSET (b, display_time, Qnil);
732 BVAR (b, enable_multibyte_characters) = BVAR (&buffer_defaults, enable_multibyte_characters); 733 BSET (b, enable_multibyte_characters,
733 BVAR (b, cursor_type) = BVAR (&buffer_defaults, cursor_type); 734 BVAR (&buffer_defaults, enable_multibyte_characters));
734 BVAR (b, extra_line_spacing) = BVAR (&buffer_defaults, extra_line_spacing); 735 BSET (b, cursor_type, BVAR (&buffer_defaults, cursor_type));
736 BSET (b, extra_line_spacing, BVAR (&buffer_defaults, extra_line_spacing));
735 737
736 b->display_error_modiff = 0; 738 b->display_error_modiff = 0;
737} 739}
@@ -755,10 +757,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
755 things that depend on the major mode. 757 things that depend on the major mode.
756 default-major-mode is handled at a higher level. 758 default-major-mode is handled at a higher level.
757 We ignore it here. */ 759 We ignore it here. */
758 BVAR (b, major_mode) = Qfundamental_mode; 760 BSET (b, major_mode, Qfundamental_mode);
759 BVAR (b, keymap) = Qnil; 761 BSET (b, keymap, Qnil);
760 BVAR (b, mode_name) = QSFundamental; 762 BSET (b, mode_name, QSFundamental);
761 BVAR (b, minor_modes) = Qnil; 763 BSET (b, minor_modes, Qnil);
762 764
763 /* If the standard case table has been altered and invalidated, 765 /* If the standard case table has been altered and invalidated,
764 fix up its insides first. */ 766 fix up its insides first. */
@@ -767,15 +769,15 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
767 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) 769 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
768 Fset_standard_case_table (Vascii_downcase_table); 770 Fset_standard_case_table (Vascii_downcase_table);
769 771
770 BVAR (b, downcase_table) = Vascii_downcase_table; 772 BSET (b, downcase_table, Vascii_downcase_table);
771 BVAR (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; 773 BSET (b, upcase_table, XCHAR_TABLE (Vascii_downcase_table)->extras[0]);
772 BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; 774 BSET (b, case_canon_table, XCHAR_TABLE (Vascii_downcase_table)->extras[1]);
773 BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; 775 BSET (b, case_eqv_table, XCHAR_TABLE (Vascii_downcase_table)->extras[2]);
774 BVAR (b, invisibility_spec) = Qt; 776 BSET (b, invisibility_spec, Qt);
775 777
776 /* Reset all (or most) per-buffer variables to their defaults. */ 778 /* Reset all (or most) per-buffer variables to their defaults. */
777 if (permanent_too) 779 if (permanent_too)
778 BVAR (b, local_var_alist) = Qnil; 780 BSET (b, local_var_alist, Qnil);
779 else 781 else
780 { 782 {
781 Lisp_Object tmp, prop, last = Qnil; 783 Lisp_Object tmp, prop, last = Qnil;
@@ -809,7 +811,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
809 } 811 }
810 /* Delete this local variable. */ 812 /* Delete this local variable. */
811 else if (NILP (last)) 813 else if (NILP (last))
812 BVAR (b, local_var_alist) = XCDR (tmp); 814 BSET (b, local_var_alist, XCDR (tmp));
813 else 815 else
814 XSETCDR (last, XCDR (tmp)); 816 XSETCDR (last, XCDR (tmp));
815 } 817 }
@@ -1286,7 +1288,7 @@ This does not change the name of the visited file (if any). */)
1286 error ("Buffer name `%s' is in use", SDATA (newname)); 1288 error ("Buffer name `%s' is in use", SDATA (newname));
1287 } 1289 }
1288 1290
1289 BVAR (current_buffer, name) = newname; 1291 BSET (current_buffer, name, newname);
1290 1292
1291 /* Catch redisplay's attention. Unless we do this, the mode lines for 1293 /* Catch redisplay's attention. Unless we do this, the mode lines for
1292 any windows displaying current_buffer will stay unchanged. */ 1294 any windows displaying current_buffer will stay unchanged. */
@@ -1431,7 +1433,7 @@ No argument or nil as argument means do this for the current buffer. */)
1431 } 1433 }
1432 1434
1433 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) 1435 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt))
1434 BVAR (XBUFFER (real_buffer), undo_list) = Qnil; 1436 BSET (XBUFFER (real_buffer), undo_list, Qnil);
1435 1437
1436 return Qnil; 1438 return Qnil;
1437} 1439}
@@ -1703,7 +1705,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1703 swap_out_buffer_local_variables (b); 1705 swap_out_buffer_local_variables (b);
1704 reset_buffer_local_variables (b, 1); 1706 reset_buffer_local_variables (b, 1);
1705 1707
1706 BVAR (b, name) = Qnil; 1708 BSET (b, name, Qnil);
1707 1709
1708 BLOCK_INPUT; 1710 BLOCK_INPUT;
1709 if (b->base_buffer) 1711 if (b->base_buffer)
@@ -1727,9 +1729,9 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1727 free_region_cache (b->width_run_cache); 1729 free_region_cache (b->width_run_cache);
1728 b->width_run_cache = 0; 1730 b->width_run_cache = 0;
1729 } 1731 }
1730 BVAR (b, width_table) = Qnil; 1732 BSET (b, width_table, Qnil);
1731 UNBLOCK_INPUT; 1733 UNBLOCK_INPUT;
1732 BVAR (b, undo_list) = Qnil; 1734 BSET (b, undo_list, Qnil);
1733 1735
1734 /* Run buffer-list-update-hook. */ 1736 /* Run buffer-list-update-hook. */
1735 if (!NILP (Vrun_hooks)) 1737 if (!NILP (Vrun_hooks))
@@ -1910,7 +1912,7 @@ set_buffer_internal_1 (register struct buffer *b)
1910 /* Put the undo list back in the base buffer, so that it appears 1912 /* Put the undo list back in the base buffer, so that it appears
1911 that an indirect buffer shares the undo list of its base. */ 1913 that an indirect buffer shares the undo list of its base. */
1912 if (old_buf->base_buffer) 1914 if (old_buf->base_buffer)
1913 BVAR (old_buf->base_buffer, undo_list) = BVAR (old_buf, undo_list); 1915 BSET (old_buf->base_buffer, undo_list, BVAR (old_buf, undo_list));
1914 1916
1915 /* If the old current buffer has markers to record PT, BEGV and ZV 1917 /* If the old current buffer has markers to record PT, BEGV and ZV
1916 when it is not current, update them now. */ 1918 when it is not current, update them now. */
@@ -1920,7 +1922,7 @@ set_buffer_internal_1 (register struct buffer *b)
1920 /* Get the undo list from the base buffer, so that it appears 1922 /* Get the undo list from the base buffer, so that it appears
1921 that an indirect buffer shares the undo list of its base. */ 1923 that an indirect buffer shares the undo list of its base. */
1922 if (b->base_buffer) 1924 if (b->base_buffer)
1923 BVAR (b, undo_list) = BVAR (b->base_buffer, undo_list); 1925 BSET (b, undo_list, BVAR (b->base_buffer, undo_list));
1924 1926
1925 /* If the new current buffer has markers to record PT, BEGV and ZV 1927 /* If the new current buffer has markers to record PT, BEGV and ZV
1926 when it is not current, fetch them now. */ 1928 when it is not current, fetch them now. */
@@ -2118,8 +2120,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2118#define swapfield_(field, type) \ 2120#define swapfield_(field, type) \
2119 do { \ 2121 do { \
2120 type tmp##field = BVAR (other_buffer, field); \ 2122 type tmp##field = BVAR (other_buffer, field); \
2121 BVAR (other_buffer, field) = BVAR (current_buffer, field); \ 2123 BSET (other_buffer, field, BVAR (current_buffer, field)); \
2122 BVAR (current_buffer, field) = tmp##field; \ 2124 BSET (current_buffer, field, tmp##field); \
2123 } while (0) 2125 } while (0)
2124 2126
2125 swapfield (own_text, struct buffer_text); 2127 swapfield (own_text, struct buffer_text);
@@ -2159,8 +2161,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2159 swapfield_ (pt_marker, Lisp_Object); 2161 swapfield_ (pt_marker, Lisp_Object);
2160 swapfield_ (begv_marker, Lisp_Object); 2162 swapfield_ (begv_marker, Lisp_Object);
2161 swapfield_ (zv_marker, Lisp_Object); 2163 swapfield_ (zv_marker, Lisp_Object);
2162 BVAR (current_buffer, point_before_scroll) = Qnil; 2164 BSET (current_buffer, point_before_scroll, Qnil);
2163 BVAR (other_buffer, point_before_scroll) = Qnil; 2165 BSET (other_buffer, point_before_scroll, Qnil);
2164 2166
2165 current_buffer->text->modiff++; other_buffer->text->modiff++; 2167 current_buffer->text->modiff++; other_buffer->text->modiff++;
2166 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2168 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++;
@@ -2249,7 +2251,7 @@ current buffer is cleared. */)
2249 2251
2250 /* Don't record these buffer changes. We will put a special undo entry 2252 /* Don't record these buffer changes. We will put a special undo entry
2251 instead. */ 2253 instead. */
2252 BVAR (current_buffer, undo_list) = Qt; 2254 BSET (current_buffer, undo_list, Qt);
2253 2255
2254 /* If the cached position is for this buffer, clear it out. */ 2256 /* If the cached position is for this buffer, clear it out. */
2255 clear_charpos_cache (current_buffer); 2257 clear_charpos_cache (current_buffer);
@@ -2271,7 +2273,7 @@ current buffer is cleared. */)
2271 to calculate the old correspondences. */ 2273 to calculate the old correspondences. */
2272 set_intervals_multibyte (0); 2274 set_intervals_multibyte (0);
2273 2275
2274 BVAR (current_buffer, enable_multibyte_characters) = Qnil; 2276 BSET (current_buffer, enable_multibyte_characters, Qnil);
2275 2277
2276 Z = Z_BYTE; 2278 Z = Z_BYTE;
2277 BEGV = BEGV_BYTE; 2279 BEGV = BEGV_BYTE;
@@ -2409,7 +2411,7 @@ current buffer is cleared. */)
2409 2411
2410 /* Do this first, so that chars_in_text asks the right question. 2412 /* Do this first, so that chars_in_text asks the right question.
2411 set_intervals_multibyte needs it too. */ 2413 set_intervals_multibyte needs it too. */
2412 BVAR (current_buffer, enable_multibyte_characters) = Qt; 2414 BSET (current_buffer, enable_multibyte_characters, Qt);
2413 2415
2414 GPT_BYTE = advance_to_char_boundary (GPT_BYTE); 2416 GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
2415 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; 2417 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2467,10 +2469,11 @@ current buffer is cleared. */)
2467 if (!EQ (old_undo, Qt)) 2469 if (!EQ (old_undo, Qt))
2468 { 2470 {
2469 /* Represent all the above changes by a special undo entry. */ 2471 /* Represent all the above changes by a special undo entry. */
2470 BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply, 2472 BSET (current_buffer, undo_list,
2471 intern ("set-buffer-multibyte"), 2473 Fcons (list3 (Qapply,
2472 NILP (flag) ? Qt : Qnil), 2474 intern ("set-buffer-multibyte"),
2473 old_undo); 2475 NILP (flag) ? Qt : Qnil),
2476 old_undo));
2474 } 2477 }
2475 2478
2476 UNGCPRO; 2479 UNGCPRO;
@@ -4929,55 +4932,55 @@ init_buffer_once (void)
4929 /* Must do these before making the first buffer! */ 4932 /* Must do these before making the first buffer! */
4930 4933
4931 /* real setup is done in bindings.el */ 4934 /* real setup is done in bindings.el */
4932 BVAR (&buffer_defaults, mode_line_format) = build_pure_c_string ("%-"); 4935 BSET (&buffer_defaults, mode_line_format, build_pure_c_string ("%-"));
4933 BVAR (&buffer_defaults, header_line_format) = Qnil; 4936 BSET (&buffer_defaults, header_line_format, Qnil);
4934 BVAR (&buffer_defaults, abbrev_mode) = Qnil; 4937 BSET (&buffer_defaults, abbrev_mode, Qnil);
4935 BVAR (&buffer_defaults, overwrite_mode) = Qnil; 4938 BSET (&buffer_defaults, overwrite_mode, Qnil);
4936 BVAR (&buffer_defaults, case_fold_search) = Qt; 4939 BSET (&buffer_defaults, case_fold_search, Qt);
4937 BVAR (&buffer_defaults, auto_fill_function) = Qnil; 4940 BSET (&buffer_defaults, auto_fill_function, Qnil);
4938 BVAR (&buffer_defaults, selective_display) = Qnil; 4941 BSET (&buffer_defaults, selective_display, Qnil);
4939 BVAR (&buffer_defaults, selective_display_ellipses) = Qt; 4942 BSET (&buffer_defaults, selective_display_ellipses, Qt);
4940 BVAR (&buffer_defaults, abbrev_table) = Qnil; 4943 BSET (&buffer_defaults, abbrev_table, Qnil);
4941 BVAR (&buffer_defaults, display_table) = Qnil; 4944 BSET (&buffer_defaults, display_table, Qnil);
4942 BVAR (&buffer_defaults, undo_list) = Qnil; 4945 BSET (&buffer_defaults, undo_list, Qnil);
4943 BVAR (&buffer_defaults, mark_active) = Qnil; 4946 BSET (&buffer_defaults, mark_active, Qnil);
4944 BVAR (&buffer_defaults, file_format) = Qnil; 4947 BSET (&buffer_defaults, file_format, Qnil);
4945 BVAR (&buffer_defaults, auto_save_file_format) = Qt; 4948 BSET (&buffer_defaults, auto_save_file_format, Qt);
4946 buffer_defaults.overlays_before = NULL; 4949 buffer_defaults.overlays_before = NULL;
4947 buffer_defaults.overlays_after = NULL; 4950 buffer_defaults.overlays_after = NULL;
4948 buffer_defaults.overlay_center = BEG; 4951 buffer_defaults.overlay_center = BEG;
4949 4952
4950 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); 4953 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
4951 BVAR (&buffer_defaults, truncate_lines) = Qnil; 4954 BSET (&buffer_defaults, truncate_lines, Qnil);
4952 BVAR (&buffer_defaults, word_wrap) = Qnil; 4955 BSET (&buffer_defaults, word_wrap, Qnil);
4953 BVAR (&buffer_defaults, ctl_arrow) = Qt; 4956 BSET (&buffer_defaults, ctl_arrow, Qt);
4954 BVAR (&buffer_defaults, bidi_display_reordering) = Qt; 4957 BSET (&buffer_defaults, bidi_display_reordering, Qt);
4955 BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil; 4958 BSET (&buffer_defaults, bidi_paragraph_direction, Qnil);
4956 BVAR (&buffer_defaults, cursor_type) = Qt; 4959 BSET (&buffer_defaults, cursor_type, Qt);
4957 BVAR (&buffer_defaults, extra_line_spacing) = Qnil; 4960 BSET (&buffer_defaults, extra_line_spacing, Qnil);
4958 BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt; 4961 BSET (&buffer_defaults, cursor_in_non_selected_windows, Qt);
4959 4962
4960 BVAR (&buffer_defaults, enable_multibyte_characters) = Qt; 4963 BSET (&buffer_defaults, enable_multibyte_characters, Qt);
4961 BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil; 4964 BSET (&buffer_defaults, buffer_file_coding_system, Qnil);
4962 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); 4965 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
4963 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); 4966 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
4964 BVAR (&buffer_defaults, cache_long_line_scans) = Qnil; 4967 BSET (&buffer_defaults, cache_long_line_scans, Qnil);
4965 BVAR (&buffer_defaults, file_truename) = Qnil; 4968 BSET (&buffer_defaults, file_truename, Qnil);
4966 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); 4969 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
4967 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); 4970 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
4968 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); 4971 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
4969 BVAR (&buffer_defaults, left_fringe_width) = Qnil; 4972 BSET (&buffer_defaults, left_fringe_width, Qnil);
4970 BVAR (&buffer_defaults, right_fringe_width) = Qnil; 4973 BSET (&buffer_defaults, right_fringe_width, Qnil);
4971 BVAR (&buffer_defaults, fringes_outside_margins) = Qnil; 4974 BSET (&buffer_defaults, fringes_outside_margins, Qnil);
4972 BVAR (&buffer_defaults, scroll_bar_width) = Qnil; 4975 BSET (&buffer_defaults, scroll_bar_width, Qnil);
4973 BVAR (&buffer_defaults, vertical_scroll_bar_type) = Qt; 4976 BSET (&buffer_defaults, vertical_scroll_bar_type, Qt);
4974 BVAR (&buffer_defaults, indicate_empty_lines) = Qnil; 4977 BSET (&buffer_defaults, indicate_empty_lines, Qnil);
4975 BVAR (&buffer_defaults, indicate_buffer_boundaries) = Qnil; 4978 BSET (&buffer_defaults, indicate_buffer_boundaries, Qnil);
4976 BVAR (&buffer_defaults, fringe_indicator_alist) = Qnil; 4979 BSET (&buffer_defaults, fringe_indicator_alist, Qnil);
4977 BVAR (&buffer_defaults, fringe_cursor_alist) = Qnil; 4980 BSET (&buffer_defaults, fringe_cursor_alist, Qnil);
4978 BVAR (&buffer_defaults, scroll_up_aggressively) = Qnil; 4981 BSET (&buffer_defaults, scroll_up_aggressively, Qnil);
4979 BVAR (&buffer_defaults, scroll_down_aggressively) = Qnil; 4982 BSET (&buffer_defaults, scroll_down_aggressively, Qnil);
4980 BVAR (&buffer_defaults, display_time) = Qnil; 4983 BSET (&buffer_defaults, display_time, Qnil);
4981 4984
4982 /* Assign the local-flags to the slots that have default values. 4985 /* Assign the local-flags to the slots that have default values.
4983 The local flag is a bit that is used in the buffer 4986 The local flag is a bit that is used in the buffer
@@ -4989,24 +4992,24 @@ init_buffer_once (void)
4989 4992
4990 /* 0 means not a lisp var, -1 means always local, else mask */ 4993 /* 0 means not a lisp var, -1 means always local, else mask */
4991 memset (&buffer_local_flags, 0, sizeof buffer_local_flags); 4994 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
4992 XSETINT (BVAR (&buffer_local_flags, filename), -1); 4995 BSET (&buffer_local_flags, filename, make_number (-1));
4993 XSETINT (BVAR (&buffer_local_flags, directory), -1); 4996 BSET (&buffer_local_flags, directory, make_number (-1));
4994 XSETINT (BVAR (&buffer_local_flags, backed_up), -1); 4997 BSET (&buffer_local_flags, backed_up, make_number (-1));
4995 XSETINT (BVAR (&buffer_local_flags, save_length), -1); 4998 BSET (&buffer_local_flags, save_length, make_number (-1));
4996 XSETINT (BVAR (&buffer_local_flags, auto_save_file_name), -1); 4999 BSET (&buffer_local_flags, auto_save_file_name, make_number (-1));
4997 XSETINT (BVAR (&buffer_local_flags, read_only), -1); 5000 BSET (&buffer_local_flags, read_only, make_number (-1));
4998 XSETINT (BVAR (&buffer_local_flags, major_mode), -1); 5001 BSET (&buffer_local_flags, major_mode, make_number (-1));
4999 XSETINT (BVAR (&buffer_local_flags, mode_name), -1); 5002 BSET (&buffer_local_flags, mode_name, make_number (-1));
5000 XSETINT (BVAR (&buffer_local_flags, undo_list), -1); 5003 BSET (&buffer_local_flags, undo_list, make_number (-1));
5001 XSETINT (BVAR (&buffer_local_flags, mark_active), -1); 5004 BSET (&buffer_local_flags, mark_active, make_number (-1));
5002 XSETINT (BVAR (&buffer_local_flags, point_before_scroll), -1); 5005 BSET (&buffer_local_flags, point_before_scroll, make_number (-1));
5003 XSETINT (BVAR (&buffer_local_flags, file_truename), -1); 5006 BSET (&buffer_local_flags, file_truename, make_number (-1));
5004 XSETINT (BVAR (&buffer_local_flags, invisibility_spec), -1); 5007 BSET (&buffer_local_flags, invisibility_spec, make_number (-1));
5005 XSETINT (BVAR (&buffer_local_flags, file_format), -1); 5008 BSET (&buffer_local_flags, file_format, make_number (-1));
5006 XSETINT (BVAR (&buffer_local_flags, auto_save_file_format), -1); 5009 BSET (&buffer_local_flags, auto_save_file_format, make_number (-1));
5007 XSETINT (BVAR (&buffer_local_flags, display_count), -1); 5010 BSET (&buffer_local_flags, display_count, make_number (-1));
5008 XSETINT (BVAR (&buffer_local_flags, display_time), -1); 5011 BSET (&buffer_local_flags, display_time, make_number (-1));
5009 XSETINT (BVAR (&buffer_local_flags, enable_multibyte_characters), -1); 5012 BSET (&buffer_local_flags, enable_multibyte_characters, make_number (-1));
5010 5013
5011 idx = 1; 5014 idx = 1;
5012 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; 5015 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
@@ -5062,7 +5065,7 @@ init_buffer_once (void)
5062 QSFundamental = build_pure_c_string ("Fundamental"); 5065 QSFundamental = build_pure_c_string ("Fundamental");
5063 5066
5064 Qfundamental_mode = intern_c_string ("fundamental-mode"); 5067 Qfundamental_mode = intern_c_string ("fundamental-mode");
5065 BVAR (&buffer_defaults, major_mode) = Qfundamental_mode; 5068 BSET (&buffer_defaults, major_mode, Qfundamental_mode);
5066 5069
5067 Qmode_class = intern_c_string ("mode-class"); 5070 Qmode_class = intern_c_string ("mode-class");
5068 5071
@@ -5125,13 +5128,13 @@ init_buffer (void)
5125 len++; 5128 len++;
5126 } 5129 }
5127 5130
5128 BVAR (current_buffer, directory) = make_unibyte_string (pwd, len); 5131 BSET (current_buffer, directory, make_unibyte_string (pwd, len));
5129 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) 5132 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5130 /* At this moment, we still don't know how to decode the 5133 /* At this moment, we still don't know how to decode the
5131 directory name. So, we keep the bytes in multibyte form so 5134 directory name. So, we keep the bytes in multibyte form so
5132 that ENCODE_FILE correctly gets the original bytes. */ 5135 that ENCODE_FILE correctly gets the original bytes. */
5133 BVAR (current_buffer, directory) 5136 BSET (current_buffer, directory,
5134 = string_to_multibyte (BVAR (current_buffer, directory)); 5137 string_to_multibyte (BVAR (current_buffer, directory)));
5135 5138
5136 /* Add /: to the front of the name 5139 /* Add /: to the front of the name
5137 if it would otherwise be treated as magic. */ 5140 if it would otherwise be treated as magic. */
@@ -5142,11 +5145,11 @@ init_buffer (void)
5142 However, it is not necessary to turn / into /:/. 5145 However, it is not necessary to turn / into /:/.
5143 So avoid doing that. */ 5146 So avoid doing that. */
5144 && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) 5147 && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
5145 BVAR (current_buffer, directory) 5148 BSET (current_buffer, directory,
5146 = concat2 (build_string ("/:"), BVAR (current_buffer, directory)); 5149 concat2 (build_string ("/:"), BVAR (current_buffer, directory)));
5147 5150
5148 temp = get_minibuffer (0); 5151 temp = get_minibuffer (0);
5149 BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory); 5152 BSET (XBUFFER (temp), directory, BVAR (current_buffer, directory));
5150 5153
5151 free (pwd); 5154 free (pwd);
5152} 5155}
diff --git a/src/buffer.h b/src/buffer.h
index a52ca7193e4..286c20d9e9c 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -477,6 +477,7 @@ struct buffer_text
477/* Most code should use this macro to access Lisp fields in struct buffer. */ 477/* Most code should use this macro to access Lisp fields in struct buffer. */
478 478
479#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) 479#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field))
480#define BSET(buf, field, value) ((buf)->INTERNAL_FIELD (field) = (value))
480 481
481/* This is the structure that the buffer Lisp object points to. */ 482/* This is the structure that the buffer Lisp object points to. */
482 483
diff --git a/src/casetab.c b/src/casetab.c
index 86dbca4d026..4b29c091ca9 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -158,10 +158,10 @@ set_case_table (Lisp_Object table, int standard)
158 } 158 }
159 else 159 else
160 { 160 {
161 BVAR (current_buffer, downcase_table) = table; 161 BSET (current_buffer, downcase_table, table);
162 BVAR (current_buffer, upcase_table) = up; 162 BSET (current_buffer, upcase_table, up);
163 BVAR (current_buffer, case_canon_table) = canon; 163 BSET (current_buffer, case_canon_table, canon);
164 BVAR (current_buffer, case_eqv_table) = eqv; 164 BSET (current_buffer, case_eqv_table, eqv);
165 } 165 }
166 166
167 return table; 167 return table;
diff --git a/src/cmds.c b/src/cmds.c
index c06a9edd160..24778fae6e3 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -301,7 +301,7 @@ At the end, it runs `post-self-insert-hook'. */)
301 added be explicit calls to undo-boundary. */ 301 added be explicit calls to undo-boundary. */
302 && EQ (BVAR (current_buffer, undo_list), last_undo_boundary)) 302 && EQ (BVAR (current_buffer, undo_list), last_undo_boundary))
303 /* Remove the undo_boundary that was just pushed. */ 303 /* Remove the undo_boundary that was just pushed. */
304 BVAR (current_buffer, undo_list) = XCDR (BVAR (current_buffer, undo_list)); 304 BSET (current_buffer, undo_list, XCDR (BVAR (current_buffer, undo_list)));
305 305
306 /* Barf if the key that invoked this was not a character. */ 306 /* Barf if the key that invoked this was not a character. */
307 if (!CHARACTERP (last_command_event)) 307 if (!CHARACTERP (last_command_event))
diff --git a/src/coding.c b/src/coding.c
index 5bed11b8241..08633d8bcff 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7103,7 +7103,7 @@ decode_coding (struct coding_system *coding)
7103 if (GPT != PT) 7103 if (GPT != PT)
7104 move_gap_both (PT, PT_BYTE); 7104 move_gap_both (PT, PT_BYTE);
7105 undo_list = BVAR (current_buffer, undo_list); 7105 undo_list = BVAR (current_buffer, undo_list);
7106 BVAR (current_buffer, undo_list) = Qt; 7106 BSET (current_buffer, undo_list, Qt);
7107 } 7107 }
7108 7108
7109 coding->consumed = coding->consumed_char = 0; 7109 coding->consumed = coding->consumed_char = 0;
@@ -7200,7 +7200,7 @@ decode_coding (struct coding_system *coding)
7200 decode_eol (coding); 7200 decode_eol (coding);
7201 if (BUFFERP (coding->dst_object)) 7201 if (BUFFERP (coding->dst_object))
7202 { 7202 {
7203 BVAR (current_buffer, undo_list) = undo_list; 7203 BSET (current_buffer, undo_list, undo_list);
7204 record_insert (coding->dst_pos, coding->produced_char); 7204 record_insert (coding->dst_pos, coding->produced_char);
7205 } 7205 }
7206 return coding->result; 7206 return coding->result;
@@ -7568,8 +7568,8 @@ make_conversion_work_buffer (int multibyte)
7568 doesn't compile new regexps. */ 7568 doesn't compile new regexps. */
7569 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); 7569 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
7570 Ferase_buffer (); 7570 Ferase_buffer ();
7571 BVAR (current_buffer, undo_list) = Qt; 7571 BSET (current_buffer, undo_list, Qt);
7572 BVAR (current_buffer, enable_multibyte_characters) = multibyte ? Qt : Qnil; 7572 BSET (current_buffer, enable_multibyte_characters, multibyte ? Qt : Qnil);
7573 set_buffer_internal (current); 7573 set_buffer_internal (current);
7574 return workbuf; 7574 return workbuf;
7575} 7575}
diff --git a/src/data.c b/src/data.c
index c4519fc5e02..3e278e8bac3 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1211,8 +1211,8 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1211 bindings, not for frame-local bindings. */ 1211 bindings, not for frame-local bindings. */
1212 eassert (!blv->frame_local); 1212 eassert (!blv->frame_local);
1213 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1213 tem1 = Fcons (symbol, XCDR (blv->defcell));
1214 BVAR (XBUFFER (where), local_var_alist) 1214 BSET (XBUFFER (where), local_var_alist,
1215 = Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)); 1215 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)));
1216 } 1216 }
1217 } 1217 }
1218 1218
@@ -1651,9 +1651,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1651 default value. */ 1651 default value. */
1652 find_symbol_value (variable); 1652 find_symbol_value (variable);
1653 1653
1654 BVAR (current_buffer, local_var_alist) 1654 BSET (current_buffer, local_var_alist,
1655 = Fcons (Fcons (variable, XCDR (blv->defcell)), 1655 Fcons (Fcons (variable, XCDR (blv->defcell)),
1656 BVAR (current_buffer, local_var_alist)); 1656 BVAR (current_buffer, local_var_alist)));
1657 1657
1658 /* Make sure symbol does not think it is set up for this buffer; 1658 /* Make sure symbol does not think it is set up for this buffer;
1659 force it to look once again for this buffer's value. */ 1659 force it to look once again for this buffer's value. */
@@ -1721,8 +1721,8 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1721 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1721 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1722 tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); 1722 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1723 if (!NILP (tem)) 1723 if (!NILP (tem))
1724 BVAR (current_buffer, local_var_alist) 1724 BSET (current_buffer, local_var_alist,
1725 = Fdelq (tem, BVAR (current_buffer, local_var_alist)); 1725 Fdelq (tem, BVAR (current_buffer, local_var_alist)));
1726 1726
1727 /* If the symbol is set up with the current buffer's binding 1727 /* If the symbol is set up with the current buffer's binding
1728 loaded, recompute its value. We have to do it now, or else 1728 loaded, recompute its value. We have to do it now, or else
diff --git a/src/editfns.c b/src/editfns.c
index 246e51cb0d5..60f61d0b431 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -882,7 +882,7 @@ save_excursion_restore (Lisp_Object info)
882 info = XCDR (info); 882 info = XCDR (info);
883 tem = XCAR (info); 883 tem = XCAR (info);
884 tem1 = BVAR (current_buffer, mark_active); 884 tem1 = BVAR (current_buffer, mark_active);
885 BVAR (current_buffer, mark_active) = tem; 885 BSET (current_buffer, mark_active, tem);
886 886
887 /* If mark is active now, and either was not active 887 /* If mark is active now, and either was not active
888 or was at a different place, run the activate hook. */ 888 or was at a different place, run the activate hook. */
@@ -2816,13 +2816,13 @@ determines whether case is significant or ignored. */)
2816static Lisp_Object 2816static Lisp_Object
2817subst_char_in_region_unwind (Lisp_Object arg) 2817subst_char_in_region_unwind (Lisp_Object arg)
2818{ 2818{
2819 return BVAR (current_buffer, undo_list) = arg; 2819 return BSET (current_buffer, undo_list, arg);
2820} 2820}
2821 2821
2822static Lisp_Object 2822static Lisp_Object
2823subst_char_in_region_unwind_1 (Lisp_Object arg) 2823subst_char_in_region_unwind_1 (Lisp_Object arg)
2824{ 2824{
2825 return BVAR (current_buffer, filename) = arg; 2825 return BSET (current_buffer, filename, arg);
2826} 2826}
2827 2827
2828DEFUN ("subst-char-in-region", Fsubst_char_in_region, 2828DEFUN ("subst-char-in-region", Fsubst_char_in_region,
@@ -2896,11 +2896,11 @@ Both characters must have the same length of multi-byte form. */)
2896 { 2896 {
2897 record_unwind_protect (subst_char_in_region_unwind, 2897 record_unwind_protect (subst_char_in_region_unwind,
2898 BVAR (current_buffer, undo_list)); 2898 BVAR (current_buffer, undo_list));
2899 BVAR (current_buffer, undo_list) = Qt; 2899 BSET (current_buffer, undo_list, Qt);
2900 /* Don't do file-locking. */ 2900 /* Don't do file-locking. */
2901 record_unwind_protect (subst_char_in_region_unwind_1, 2901 record_unwind_protect (subst_char_in_region_unwind_1,
2902 BVAR (current_buffer, filename)); 2902 BVAR (current_buffer, filename));
2903 BVAR (current_buffer, filename) = Qnil; 2903 BSET (current_buffer, filename, Qnil);
2904 } 2904 }
2905 2905
2906 if (pos_byte < GPT_BYTE) 2906 if (pos_byte < GPT_BYTE)
@@ -2982,7 +2982,7 @@ Both characters must have the same length of multi-byte form. */)
2982 INC_POS (pos_byte_next); 2982 INC_POS (pos_byte_next);
2983 2983
2984 if (! NILP (noundo)) 2984 if (! NILP (noundo))
2985 BVAR (current_buffer, undo_list) = tem; 2985 BSET (current_buffer, undo_list, tem);
2986 2986
2987 UNGCPRO; 2987 UNGCPRO;
2988 } 2988 }
diff --git a/src/fileio.c b/src/fileio.c
index 886f9b9b103..4fdc902a9a2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3149,8 +3149,8 @@ decide_coding_unwind (Lisp_Object unwind_data)
3149 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3149 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
3150 3150
3151 /* Now we are safe to change the buffer's multibyteness directly. */ 3151 /* Now we are safe to change the buffer's multibyteness directly. */
3152 BVAR (current_buffer, enable_multibyte_characters) = multibyte; 3152 BSET (current_buffer, enable_multibyte_characters, multibyte);
3153 BVAR (current_buffer, undo_list) = undo_list; 3153 BSET (current_buffer, undo_list, undo_list);
3154 3154
3155 return Qnil; 3155 return Qnil;
3156} 3156}
@@ -3486,16 +3486,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
3486 buf = XBUFFER (workbuf); 3486 buf = XBUFFER (workbuf);
3487 3487
3488 delete_all_overlays (buf); 3488 delete_all_overlays (buf);
3489 BVAR (buf, directory) = BVAR (current_buffer, directory); 3489 BSET (buf, directory, BVAR (current_buffer, directory));
3490 BVAR (buf, read_only) = Qnil; 3490 BSET (buf, read_only, Qnil);
3491 BVAR (buf, filename) = Qnil; 3491 BSET (buf, filename, Qnil);
3492 BVAR (buf, undo_list) = Qt; 3492 BSET (buf, undo_list, Qt);
3493 eassert (buffer_get_overlays (buf, OV_BEFORE) == NULL); 3493 eassert (buffer_get_overlays (buf, OV_BEFORE) == NULL);
3494 eassert (buffer_get_overlays (buf, OV_AFTER) == NULL); 3494 eassert (buffer_get_overlays (buf, OV_AFTER) == NULL);
3495 3495
3496 set_buffer_internal (buf); 3496 set_buffer_internal (buf);
3497 Ferase_buffer (); 3497 Ferase_buffer ();
3498 BVAR (buf, enable_multibyte_characters) = Qnil; 3498 BSET (buf, enable_multibyte_characters, Qnil);
3499 3499
3500 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); 3500 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
3501 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3501 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -4104,8 +4104,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
4104 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), 4104 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
4105 Fcons (BVAR (current_buffer, undo_list), 4105 Fcons (BVAR (current_buffer, undo_list),
4106 Fcurrent_buffer ())); 4106 Fcurrent_buffer ()));
4107 BVAR (current_buffer, enable_multibyte_characters) = Qnil; 4107 BSET (current_buffer, enable_multibyte_characters, Qnil);
4108 BVAR (current_buffer, undo_list) = Qt; 4108 BSET (current_buffer, undo_list, Qt);
4109 record_unwind_protect (decide_coding_unwind, unwind_data); 4109 record_unwind_protect (decide_coding_unwind, unwind_data);
4110 4110
4111 if (inserted > 0 && ! NILP (Vset_auto_coding_function)) 4111 if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4153,7 +4153,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4153 && NILP (replace)) 4153 && NILP (replace))
4154 /* Visiting a file with these coding system makes the buffer 4154 /* Visiting a file with these coding system makes the buffer
4155 unibyte. */ 4155 unibyte. */
4156 BVAR (current_buffer, enable_multibyte_characters) = Qnil; 4156 BSET (current_buffer, enable_multibyte_characters, Qnil);
4157 } 4157 }
4158 4158
4159 coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 4159 coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
@@ -4196,13 +4196,13 @@ variable `last-coding-system-used' to the coding system actually used. */)
4196 if (!NILP (visit)) 4196 if (!NILP (visit))
4197 { 4197 {
4198 if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) 4198 if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
4199 BVAR (current_buffer, undo_list) = Qnil; 4199 BSET (current_buffer, undo_list, Qnil);
4200 4200
4201 if (NILP (handler)) 4201 if (NILP (handler))
4202 { 4202 {
4203 current_buffer->modtime = mtime; 4203 current_buffer->modtime = mtime;
4204 current_buffer->modtime_size = st.st_size; 4204 current_buffer->modtime_size = st.st_size;
4205 BVAR (current_buffer, filename) = orig_filename; 4205 BSET (current_buffer, filename, orig_filename);
4206 } 4206 }
4207 4207
4208 SAVE_MODIFF = MODIFF; 4208 SAVE_MODIFF = MODIFF;
@@ -4247,7 +4247,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4247 4247
4248 /* Save old undo list and don't record undo for decoding. */ 4248 /* Save old undo list and don't record undo for decoding. */
4249 old_undo = BVAR (current_buffer, undo_list); 4249 old_undo = BVAR (current_buffer, undo_list);
4250 BVAR (current_buffer, undo_list) = Qt; 4250 BSET (current_buffer, undo_list, Qt);
4251 4251
4252 if (NILP (replace)) 4252 if (NILP (replace))
4253 { 4253 {
@@ -4339,7 +4339,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4339 4339
4340 if (NILP (visit)) 4340 if (NILP (visit))
4341 { 4341 {
4342 BVAR (current_buffer, undo_list) = old_undo; 4342 BSET (current_buffer, undo_list, old_undo);
4343 if (CONSP (old_undo) && inserted != old_inserted) 4343 if (CONSP (old_undo) && inserted != old_inserted)
4344 { 4344 {
4345 /* Adjust the last undo record for the size change during 4345 /* Adjust the last undo record for the size change during
@@ -4354,7 +4354,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4354 else 4354 else
4355 /* If undo_list was Qt before, keep it that way. 4355 /* If undo_list was Qt before, keep it that way.
4356 Otherwise start with an empty undo_list. */ 4356 Otherwise start with an empty undo_list. */
4357 BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil; 4357 BSET (current_buffer, undo_list, EQ (old_undo, Qt) ? Qt : Qnil);
4358 4358
4359 unbind_to (count1, Qnil); 4359 unbind_to (count1, Qnil);
4360 } 4360 }
@@ -4594,7 +4594,7 @@ This calls `write-region-annotate-functions' at the start, and
4594 { 4594 {
4595 SAVE_MODIFF = MODIFF; 4595 SAVE_MODIFF = MODIFF;
4596 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 4596 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4597 BVAR (current_buffer, filename) = visit_file; 4597 BSET (current_buffer, filename, visit_file);
4598 } 4598 }
4599 UNGCPRO; 4599 UNGCPRO;
4600 return val; 4600 return val;
@@ -4810,7 +4810,7 @@ This calls `write-region-annotate-functions' at the start, and
4810 { 4810 {
4811 SAVE_MODIFF = MODIFF; 4811 SAVE_MODIFF = MODIFF;
4812 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 4812 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4813 BVAR (current_buffer, filename) = visit_file; 4813 BSET (current_buffer, filename, visit_file);
4814 update_mode_lines++; 4814 update_mode_lines++;
4815 } 4815 }
4816 else if (quietly) 4816 else if (quietly)
diff --git a/src/frame.c b/src/frame.c
index 09049ddae72..768cec4c7e7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1677,7 +1677,7 @@ make_frame_visible_1 (Lisp_Object window)
1677 w = XWINDOW (window); 1677 w = XWINDOW (window);
1678 1678
1679 if (!NILP (w->buffer)) 1679 if (!NILP (w->buffer))
1680 BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time (); 1680 BSET (XBUFFER (w->buffer), display_time, Fcurrent_time ());
1681 1681
1682 if (!NILP (w->vchild)) 1682 if (!NILP (w->vchild))
1683 make_frame_visible_1 (w->vchild); 1683 make_frame_visible_1 (w->vchild);
diff --git a/src/indent.c b/src/indent.c
index 597f05da990..881e5d7ddaf 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -141,7 +141,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
141 struct Lisp_Vector *widthtab; 141 struct Lisp_Vector *widthtab;
142 142
143 if (!VECTORP (BVAR (buf, width_table))) 143 if (!VECTORP (BVAR (buf, width_table)))
144 BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0)); 144 BSET (buf, width_table, Fmake_vector (make_number (256), make_number (0)));
145 widthtab = XVECTOR (BVAR (buf, width_table)); 145 widthtab = XVECTOR (BVAR (buf, width_table));
146 if (widthtab->header.size != 256) 146 if (widthtab->header.size != 256)
147 abort (); 147 abort ();
@@ -166,7 +166,7 @@ width_run_cache_on_off (void)
166 { 166 {
167 free_region_cache (current_buffer->width_run_cache); 167 free_region_cache (current_buffer->width_run_cache);
168 current_buffer->width_run_cache = 0; 168 current_buffer->width_run_cache = 0;
169 BVAR (current_buffer, width_table) = Qnil; 169 BSET (current_buffer, width_table, Qnil);
170 } 170 }
171 } 171 }
172 else 172 else
diff --git a/src/insdel.c b/src/insdel.c
index f058ffc2bda..14d2dab084d 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1792,7 +1792,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
1792 if (! preserve_chars_modiff) 1792 if (! preserve_chars_modiff)
1793 CHARS_MODIFF = MODIFF; 1793 CHARS_MODIFF = MODIFF;
1794 1794
1795 BVAR (buffer, point_before_scroll) = Qnil; 1795 BSET (buffer, point_before_scroll, Qnil);
1796 1796
1797 if (buffer != old_buffer) 1797 if (buffer != old_buffer)
1798 set_buffer_internal (old_buffer); 1798 set_buffer_internal (old_buffer);
diff --git a/src/intervals.c b/src/intervals.c
index c3bcdb1ae62..145882f6146 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1858,7 +1858,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1858 int have_overlays; 1858 int have_overlays;
1859 ptrdiff_t original_position; 1859 ptrdiff_t original_position;
1860 1860
1861 BVAR (current_buffer, point_before_scroll) = Qnil; 1861 BSET (current_buffer, point_before_scroll, Qnil);
1862 1862
1863 if (charpos == PT) 1863 if (charpos == PT)
1864 return; 1864 return;
diff --git a/src/keymap.c b/src/keymap.c
index e337147ad41..c550b37c1d6 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1854,7 +1854,7 @@ If KEYMAP is nil, that means no local keymap. */)
1854 if (!NILP (keymap)) 1854 if (!NILP (keymap))
1855 keymap = get_keymap (keymap, 1, 1); 1855 keymap = get_keymap (keymap, 1, 1);
1856 1856
1857 BVAR (current_buffer, keymap) = keymap; 1857 BSET (current_buffer, keymap, keymap);
1858 1858
1859 return Qnil; 1859 return Qnil;
1860} 1860}
diff --git a/src/minibuf.c b/src/minibuf.c
index 928bdadefc8..3a384bf57bb 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -562,11 +562,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
562 562
563 /* Defeat (setq-default truncate-lines t), since truncated lines do 563 /* Defeat (setq-default truncate-lines t), since truncated lines do
564 not work correctly in minibuffers. (Bug#5715, etc) */ 564 not work correctly in minibuffers. (Bug#5715, etc) */
565 BVAR (current_buffer, truncate_lines) = Qnil; 565 BSET (current_buffer, truncate_lines, Qnil);
566 566
567 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ 567 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
568 if (inherit_input_method) 568 if (inherit_input_method)
569 BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte; 569 BSET (current_buffer, enable_multibyte_characters, enable_multibyte);
570 570
571 /* The current buffer's default directory is usually the right thing 571 /* The current buffer's default directory is usually the right thing
572 for our minibuffer here. However, if you're typing a command at 572 for our minibuffer here. However, if you're typing a command at
@@ -577,7 +577,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
577 you think of something better to do? Find another buffer with a 577 you think of something better to do? Find another buffer with a
578 better directory, and use that one instead. */ 578 better directory, and use that one instead. */
579 if (STRINGP (ambient_dir)) 579 if (STRINGP (ambient_dir))
580 BVAR (current_buffer, directory) = ambient_dir; 580 BSET (current_buffer, directory, ambient_dir);
581 else 581 else
582 { 582 {
583 Lisp_Object buf_list; 583 Lisp_Object buf_list;
@@ -591,7 +591,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
591 other_buf = XCDR (XCAR (buf_list)); 591 other_buf = XCDR (XCAR (buf_list));
592 if (STRINGP (BVAR (XBUFFER (other_buf), directory))) 592 if (STRINGP (BVAR (XBUFFER (other_buf), directory)))
593 { 593 {
594 BVAR (current_buffer, directory) = BVAR (XBUFFER (other_buf), directory); 594 BSET (current_buffer, directory,
595 BVAR (XBUFFER (other_buf), directory));
595 break; 596 break;
596 } 597 }
597 } 598 }
@@ -664,7 +665,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
664 } 665 }
665 666
666 clear_message (1, 1); 667 clear_message (1, 1);
667 BVAR (current_buffer, keymap) = map; 668 BSET (current_buffer, keymap, map);
668 669
669 /* Turn on an input method stored in INPUT_METHOD if any. */ 670 /* Turn on an input method stored in INPUT_METHOD if any. */
670 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) 671 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
@@ -673,7 +674,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
673 Frun_hooks (1, &Qminibuffer_setup_hook); 674 Frun_hooks (1, &Qminibuffer_setup_hook);
674 675
675 /* Don't allow the user to undo past this point. */ 676 /* Don't allow the user to undo past this point. */
676 BVAR (current_buffer, undo_list) = Qnil; 677 BSET (current_buffer, undo_list, Qnil);
677 678
678 recursive_edit_1 (); 679 recursive_edit_1 ();
679 680
diff --git a/src/print.c b/src/print.c
index 718e6a96329..0938dd6e9ae 100644
--- a/src/print.c
+++ b/src/print.c
@@ -494,14 +494,14 @@ temp_output_buffer_setup (const char *bufname)
494 494
495 Fkill_all_local_variables (); 495 Fkill_all_local_variables ();
496 delete_all_overlays (current_buffer); 496 delete_all_overlays (current_buffer);
497 BVAR (current_buffer, directory) = BVAR (old, directory); 497 BSET (current_buffer, directory, BVAR (old, directory));
498 BVAR (current_buffer, read_only) = Qnil; 498 BSET (current_buffer, read_only, Qnil);
499 BVAR (current_buffer, filename) = Qnil; 499 BSET (current_buffer, filename, Qnil);
500 BVAR (current_buffer, undo_list) = Qt; 500 BSET (current_buffer, undo_list, Qt);
501 eassert (buffer_get_overlays (NULL, OV_BEFORE) == NULL); 501 eassert (buffer_get_overlays (NULL, OV_BEFORE) == NULL);
502 eassert (buffer_get_overlays (NULL, OV_AFTER) == NULL); 502 eassert (buffer_get_overlays (NULL, OV_AFTER) == NULL);
503 BVAR (current_buffer, enable_multibyte_characters) 503 BSET (current_buffer, enable_multibyte_characters,
504 = BVAR (&buffer_defaults, enable_multibyte_characters); 504 BVAR (&buffer_defaults, enable_multibyte_characters));
505 specbind (Qinhibit_read_only, Qt); 505 specbind (Qinhibit_read_only, Qt);
506 specbind (Qinhibit_modification_hooks, Qt); 506 specbind (Qinhibit_modification_hooks, Qt);
507 Ferase_buffer (); 507 Ferase_buffer ();
diff --git a/src/process.c b/src/process.c
index 0be624af0d2..a43655e4da8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5246,7 +5246,7 @@ read_process_output (Lisp_Object proc, register int channel)
5246 old_begv_byte = BEGV_BYTE; 5246 old_begv_byte = BEGV_BYTE;
5247 old_zv_byte = ZV_BYTE; 5247 old_zv_byte = ZV_BYTE;
5248 5248
5249 BVAR (current_buffer, read_only) = Qnil; 5249 BSET (current_buffer, read_only, Qnil);
5250 5250
5251 /* Insert new output into buffer 5251 /* Insert new output into buffer
5252 at the current end-of-output marker, 5252 at the current end-of-output marker,
@@ -5337,7 +5337,7 @@ read_process_output (Lisp_Object proc, register int channel)
5337 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5337 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5338 5338
5339 5339
5340 BVAR (current_buffer, read_only) = old_read_only; 5340 BSET (current_buffer, read_only, old_read_only);
5341 SET_PT_BOTH (opoint, opoint_byte); 5341 SET_PT_BOTH (opoint, opoint_byte);
5342 } 5342 }
5343 /* Handling the process output should not deactivate the mark. */ 5343 /* Handling the process output should not deactivate the mark. */
@@ -6671,13 +6671,13 @@ status_notify (struct Lisp_Process *deleting_process)
6671 before_byte = PT_BYTE; 6671 before_byte = PT_BYTE;
6672 6672
6673 tem = BVAR (current_buffer, read_only); 6673 tem = BVAR (current_buffer, read_only);
6674 BVAR (current_buffer, read_only) = Qnil; 6674 BSET (current_buffer, read_only, Qnil);
6675 insert_string ("\nProcess "); 6675 insert_string ("\nProcess ");
6676 { /* FIXME: temporary kludge */ 6676 { /* FIXME: temporary kludge */
6677 Lisp_Object tem2 = p->name; Finsert (1, &tem2); } 6677 Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
6678 insert_string (" "); 6678 insert_string (" ");
6679 Finsert (1, &msg); 6679 Finsert (1, &msg);
6680 BVAR (current_buffer, read_only) = tem; 6680 BSET (current_buffer, read_only, tem);
6681 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6681 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6682 6682
6683 if (opoint >= before) 6683 if (opoint >= before)
diff --git a/src/syntax.c b/src/syntax.c
index c031c2b07af..08a63e033b2 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -836,7 +836,7 @@ One argument, a syntax table. */)
836{ 836{
837 int idx; 837 int idx;
838 check_syntax_table (table); 838 check_syntax_table (table);
839 BVAR (current_buffer, syntax_table) = table; 839 BSET (current_buffer, syntax_table, table);
840 /* Indicate that this buffer now has a specified syntax table. */ 840 /* Indicate that this buffer now has a specified syntax table. */
841 idx = PER_BUFFER_VAR_IDX (syntax_table); 841 idx = PER_BUFFER_VAR_IDX (syntax_table);
842 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 842 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
diff --git a/src/undo.c b/src/undo.c
index c90e7b62405..cfb67ba5bc8 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -104,8 +104,9 @@ record_point (ptrdiff_t pt)
104 if (at_boundary 104 if (at_boundary
105 && current_buffer == last_boundary_buffer 105 && current_buffer == last_boundary_buffer
106 && last_boundary_position != pt) 106 && last_boundary_position != pt)
107 BVAR (current_buffer, undo_list) 107 BSET (current_buffer, undo_list,
108 = Fcons (make_number (last_boundary_position), BVAR (current_buffer, undo_list)); 108 Fcons (make_number (last_boundary_position),
109 BVAR (current_buffer, undo_list)));
109} 110}
110 111
111/* Record an insertion that just happened or is about to happen, 112/* Record an insertion that just happened or is about to happen,
@@ -141,8 +142,8 @@ record_insert (ptrdiff_t beg, ptrdiff_t length)
141 142
142 XSETFASTINT (lbeg, beg); 143 XSETFASTINT (lbeg, beg);
143 XSETINT (lend, beg + length); 144 XSETINT (lend, beg + length);
144 BVAR (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend), 145 BSET (current_buffer, undo_list,
145 BVAR (current_buffer, undo_list)); 146 Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list)));
146} 147}
147 148
148/* Record that a deletion is about to take place, 149/* Record that a deletion is about to take place,
@@ -167,8 +168,8 @@ record_delete (ptrdiff_t beg, Lisp_Object string)
167 record_point (beg); 168 record_point (beg);
168 } 169 }
169 170
170 BVAR (current_buffer, undo_list) 171 BSET (current_buffer, undo_list,
171 = Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list)); 172 Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list)));
172} 173}
173 174
174/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. 175/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -190,9 +191,9 @@ record_marker_adjustment (Lisp_Object marker, ptrdiff_t adjustment)
190 Fundo_boundary (); 191 Fundo_boundary ();
191 last_undo_buffer = current_buffer; 192 last_undo_buffer = current_buffer;
192 193
193 BVAR (current_buffer, undo_list) 194 BSET (current_buffer, undo_list,
194 = Fcons (Fcons (marker, make_number (adjustment)), 195 Fcons (Fcons (marker, make_number (adjustment)),
195 BVAR (current_buffer, undo_list)); 196 BVAR (current_buffer, undo_list)));
196} 197}
197 198
198/* Record that a replacement is about to take place, 199/* Record that a replacement is about to take place,
@@ -225,9 +226,9 @@ record_first_change (void)
225 if (base_buffer->base_buffer) 226 if (base_buffer->base_buffer)
226 base_buffer = base_buffer->base_buffer; 227 base_buffer = base_buffer->base_buffer;
227 228
228 BVAR (current_buffer, undo_list) = 229 BSET (current_buffer, undo_list,
229 Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), 230 Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)),
230 BVAR (current_buffer, undo_list)); 231 BVAR (current_buffer, undo_list)));
231} 232}
232 233
233/* Record a change in property PROP (whose old value was VAL) 234/* Record a change in property PROP (whose old value was VAL)
@@ -265,7 +266,8 @@ record_property_change (ptrdiff_t beg, ptrdiff_t length,
265 XSETINT (lbeg, beg); 266 XSETINT (lbeg, beg);
266 XSETINT (lend, beg + length); 267 XSETINT (lend, beg + length);
267 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); 268 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
268 BVAR (current_buffer, undo_list) = Fcons (entry, BVAR (current_buffer, undo_list)); 269 BSET (current_buffer, undo_list,
270 Fcons (entry, BVAR (current_buffer, undo_list)));
269 271
270 current_buffer = obuf; 272 current_buffer = obuf;
271} 273}
@@ -288,11 +290,11 @@ but another undo command will undo to the previous boundary. */)
288 /* If we have preallocated the cons cell to use here, 290 /* If we have preallocated the cons cell to use here,
289 use that one. */ 291 use that one. */
290 XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); 292 XSETCDR (pending_boundary, BVAR (current_buffer, undo_list));
291 BVAR (current_buffer, undo_list) = pending_boundary; 293 BSET (current_buffer, undo_list, pending_boundary);
292 pending_boundary = Qnil; 294 pending_boundary = Qnil;
293 } 295 }
294 else 296 else
295 BVAR (current_buffer, undo_list) = Fcons (Qnil, BVAR (current_buffer, undo_list)); 297 BSET (current_buffer, undo_list, Fcons (Qnil, BVAR (current_buffer, undo_list)));
296 } 298 }
297 last_boundary_position = PT; 299 last_boundary_position = PT;
298 last_boundary_buffer = current_buffer; 300 last_boundary_buffer = current_buffer;
@@ -433,7 +435,7 @@ truncate_undo_list (struct buffer *b)
433 XSETCDR (last_boundary, Qnil); 435 XSETCDR (last_boundary, Qnil);
434 /* There's nothing we decided to keep, so clear it out. */ 436 /* There's nothing we decided to keep, so clear it out. */
435 else 437 else
436 BVAR (b, undo_list) = Qnil; 438 BSET (b, undo_list, Qnil);
437 439
438 unbind_to (count, Qnil); 440 unbind_to (count, Qnil);
439} 441}
@@ -648,8 +650,8 @@ Return what remains of the list. */)
648 will work right. */ 650 will work right. */
649 if (did_apply 651 if (did_apply
650 && EQ (oldlist, BVAR (current_buffer, undo_list))) 652 && EQ (oldlist, BVAR (current_buffer, undo_list)))
651 BVAR (current_buffer, undo_list) 653 BSET (current_buffer, undo_list,
652 = Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)); 654 Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)));
653 655
654 UNGCPRO; 656 UNGCPRO;
655 return unbind_to (count, list); 657 return unbind_to (count, list);
diff --git a/src/w32fns.c b/src/w32fns.c
index 1464f867077..ebe382f75d2 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5240,7 +5240,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5240 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); 5240 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
5241 old_buffer = current_buffer; 5241 old_buffer = current_buffer;
5242 set_buffer_internal_1 (XBUFFER (buffer)); 5242 set_buffer_internal_1 (XBUFFER (buffer));
5243 BVAR (current_buffer, truncate_lines) = Qnil; 5243 BSET (current_buffer, truncate_lines, Qnil);
5244 specbind (Qinhibit_read_only, Qt); 5244 specbind (Qinhibit_read_only, Qt);
5245 specbind (Qinhibit_modification_hooks, Qt); 5245 specbind (Qinhibit_modification_hooks, Qt);
5246 Ferase_buffer (); 5246 Ferase_buffer ();
@@ -5670,7 +5670,7 @@ Text larger than the specified size is clipped. */)
5670 /* Display the tooltip text in a temporary buffer. */ 5670 /* Display the tooltip text in a temporary buffer. */
5671 old_buffer = current_buffer; 5671 old_buffer = current_buffer;
5672 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5672 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5673 BVAR (current_buffer, truncate_lines) = Qnil; 5673 BSET (current_buffer, truncate_lines, Qnil);
5674 clear_glyph_matrix (w->desired_matrix); 5674 clear_glyph_matrix (w->desired_matrix);
5675 clear_glyph_matrix (w->current_matrix); 5675 clear_glyph_matrix (w->current_matrix);
5676 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5676 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
diff --git a/src/window.c b/src/window.c
index 1348eab0ff6..f5622b217d7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -373,7 +373,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
373 373
374 Fset_buffer (w->buffer); 374 Fset_buffer (w->buffer);
375 375
376 BVAR (XBUFFER (w->buffer), last_selected_window) = window; 376 BSET (XBUFFER (w->buffer), last_selected_window, window);
377 377
378 /* Go to the point recorded in the window. 378 /* Go to the point recorded in the window.
379 This is important when the buffer is in more 379 This is important when the buffer is in more
@@ -1812,7 +1812,7 @@ unshow_buffer (register struct window *w)
1812 1812
1813 if (WINDOWP (BVAR (b, last_selected_window)) 1813 if (WINDOWP (BVAR (b, last_selected_window))
1814 && w == XWINDOW (BVAR (b, last_selected_window))) 1814 && w == XWINDOW (BVAR (b, last_selected_window)))
1815 BVAR (b, last_selected_window) = Qnil; 1815 BSET (b, last_selected_window, Qnil);
1816} 1816}
1817 1817
1818/* Put NEW into the window structure in place of OLD. SETFLAG zero 1818/* Put NEW into the window structure in place of OLD. SETFLAG zero
@@ -2990,15 +2990,15 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
2990 WSET (w, buffer, buffer); 2990 WSET (w, buffer, buffer);
2991 2991
2992 if (EQ (window, selected_window)) 2992 if (EQ (window, selected_window))
2993 BVAR (b, last_selected_window) = window; 2993 BSET (b, last_selected_window, window);
2994 2994
2995 /* Let redisplay errors through. */ 2995 /* Let redisplay errors through. */
2996 b->display_error_modiff = 0; 2996 b->display_error_modiff = 0;
2997 2997
2998 /* Update time stamps of buffer display. */ 2998 /* Update time stamps of buffer display. */
2999 if (INTEGERP (BVAR (b, display_count))) 2999 if (INTEGERP (BVAR (b, display_count)))
3000 XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1); 3000 BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1));
3001 BVAR (b, display_time) = Fcurrent_time (); 3001 BSET (b, display_time, Fcurrent_time ());
3002 3002
3003 WSET (w, window_end_pos, make_number (0)); 3003 WSET (w, window_end_pos, make_number (0));
3004 WSET (w, window_end_vpos, make_number (0)); 3004 WSET (w, window_end_vpos, make_number (0));
@@ -3189,7 +3189,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3189 register Lisp_Object window; 3189 register Lisp_Object window;
3190 register struct window *w; 3190 register struct window *w;
3191 3191
3192 BVAR (XBUFFER (buf), directory) = BVAR (current_buffer, directory); 3192 BSET (XBUFFER (buf), directory, BVAR (current_buffer, directory));
3193 3193
3194 Fset_buffer (buf); 3194 Fset_buffer (buf);
3195 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; 3195 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
diff --git a/src/xdisp.c b/src/xdisp.c
index 3f1c97e601f..58956842796 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9318,7 +9318,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9318 old_deactivate_mark = Vdeactivate_mark; 9318 old_deactivate_mark = Vdeactivate_mark;
9319 oldbuf = current_buffer; 9319 oldbuf = current_buffer;
9320 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); 9320 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
9321 BVAR (current_buffer, undo_list) = Qt; 9321 BSET (current_buffer, undo_list, Qt);
9322 9322
9323 oldpoint = message_dolog_marker1; 9323 oldpoint = message_dolog_marker1;
9324 set_marker_restricted (oldpoint, make_number (PT), Qnil); 9324 set_marker_restricted (oldpoint, make_number (PT), Qnil);
@@ -9880,7 +9880,7 @@ ensure_echo_area_buffers (void)
9880 old_buffer = echo_buffer[i]; 9880 old_buffer = echo_buffer[i];
9881 echo_buffer[i] = Fget_buffer_create 9881 echo_buffer[i] = Fget_buffer_create
9882 (make_formatted_string (name, " *Echo Area %d*", i)); 9882 (make_formatted_string (name, " *Echo Area %d*", i));
9883 BVAR (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil; 9883 BSET (XBUFFER (echo_buffer[i]), truncate_lines, Qnil);
9884 /* to force word wrap in echo area - 9884 /* to force word wrap in echo area -
9885 it was decided to postpone this*/ 9885 it was decided to postpone this*/
9886 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ 9886 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */
@@ -9973,8 +9973,8 @@ with_echo_area_buffer (struct window *w, int which,
9973 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); 9973 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
9974 } 9974 }
9975 9975
9976 BVAR (current_buffer, undo_list) = Qt; 9976 BSET (current_buffer, undo_list, Qt);
9977 BVAR (current_buffer, read_only) = Qnil; 9977 BSET (current_buffer, read_only, Qnil);
9978 specbind (Qinhibit_read_only, Qt); 9978 specbind (Qinhibit_read_only, Qt);
9979 specbind (Qinhibit_modification_hooks, Qt); 9979 specbind (Qinhibit_modification_hooks, Qt);
9980 9980
@@ -10087,7 +10087,7 @@ setup_echo_area_for_printing (int multibyte_p)
10087 10087
10088 /* Switch to that buffer and clear it. */ 10088 /* Switch to that buffer and clear it. */
10089 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 10089 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
10090 BVAR (current_buffer, truncate_lines) = Qnil; 10090 BSET (current_buffer, truncate_lines, Qnil);
10091 10091
10092 if (Z > BEG) 10092 if (Z > BEG)
10093 { 10093 {
@@ -10130,7 +10130,7 @@ setup_echo_area_for_printing (int multibyte_p)
10130 { 10130 {
10131 /* Someone switched buffers between print requests. */ 10131 /* Someone switched buffers between print requests. */
10132 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 10132 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
10133 BVAR (current_buffer, truncate_lines) = Qnil; 10133 BSET (current_buffer, truncate_lines, Qnil);
10134 } 10134 }
10135 } 10135 }
10136} 10136}
@@ -10582,9 +10582,9 @@ set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multiby
10582 != !NILP (BVAR (current_buffer, enable_multibyte_characters))) 10582 != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
10583 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); 10583 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
10584 10584
10585 BVAR (current_buffer, truncate_lines) = message_truncate_lines ? Qt : Qnil; 10585 BSET (current_buffer, truncate_lines, message_truncate_lines ? Qt : Qnil);
10586 if (!NILP (BVAR (current_buffer, bidi_display_reordering))) 10586 if (!NILP (BVAR (current_buffer, bidi_display_reordering)))
10587 BVAR (current_buffer, bidi_paragraph_direction) = Qleft_to_right; 10587 BSET (current_buffer, bidi_paragraph_direction, Qleft_to_right);
10588 10588
10589 /* Insert new message at BEG. */ 10589 /* Insert new message at BEG. */
10590 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 10590 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
diff --git a/src/xfns.c b/src/xfns.c
index 26c96e99c0f..9c9fcb16aba 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4594,7 +4594,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4594 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); 4594 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
4595 old_buffer = current_buffer; 4595 old_buffer = current_buffer;
4596 set_buffer_internal_1 (XBUFFER (buffer)); 4596 set_buffer_internal_1 (XBUFFER (buffer));
4597 BVAR (current_buffer, truncate_lines) = Qnil; 4597 BSET (current_buffer, truncate_lines, Qnil);
4598 specbind (Qinhibit_read_only, Qt); 4598 specbind (Qinhibit_read_only, Qt);
4599 specbind (Qinhibit_modification_hooks, Qt); 4599 specbind (Qinhibit_modification_hooks, Qt);
4600 Ferase_buffer (); 4600 Ferase_buffer ();
@@ -5091,7 +5091,7 @@ Text larger than the specified size is clipped. */)
5091 /* Display the tooltip text in a temporary buffer. */ 5091 /* Display the tooltip text in a temporary buffer. */
5092 old_buffer = current_buffer; 5092 old_buffer = current_buffer;
5093 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5093 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5094 BVAR (current_buffer, truncate_lines) = Qnil; 5094 BSET (current_buffer, truncate_lines, Qnil);
5095 clear_glyph_matrix (w->desired_matrix); 5095 clear_glyph_matrix (w->desired_matrix);
5096 clear_glyph_matrix (w->current_matrix); 5096 clear_glyph_matrix (w->current_matrix);
5097 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5097 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);