diff options
| author | Dmitry Antipov | 2012-08-13 07:39:07 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-08-13 07:39:07 +0400 |
| commit | 4c31be6153255dfe29a0231253263ea0d9011ac3 (patch) | |
| tree | cfd30617b9270436aad8cdf810a97721aaa20747 /src/buffer.c | |
| parent | 1439443be63a2b0d796df8ebca882cdaecb7269f (diff) | |
| download | emacs-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/buffer.c')
| -rw-r--r-- | src/buffer.c | 273 |
1 files changed, 138 insertions, 135 deletions
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) | |||
| 704 | void | 704 | void |
| 705 | reset_buffer (register struct buffer *b) | 705 | reset_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 | } |