aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorPaul Eggert2012-08-17 23:06:39 -0700
committerPaul Eggert2012-08-17 23:06:39 -0700
commit39eb03f1b023ae3d94e311f6f5d9f913f75c42c4 (patch)
tree454b784e6ccc782a6f3c16d67e01cc8a1e5051be /src/buffer.c
parent2170b1bdd500484349deec2d946119e6a653e198 (diff)
downloademacs-39eb03f1b023ae3d94e311f6f5d9f913f75c42c4.tar.gz
emacs-39eb03f1b023ae3d94e311f6f5d9f913f75c42c4.zip
* buffer.h (BSET): Remove.
Replace all uses with calls to new setter functions. (bset_bidi_paragraph_direction, bset_case_canon_table) (bset_case_eqv_table, bset_directory, bset_display_count) (bset_display_time, bset_downcase_table) (bset_enable_multibyte_characters, bset_filename, bset_keymap) (bset_last_selected_window, bset_local_var_alist) (bset_mark_active, bset_point_before_scroll, bset_read_only) (bset_truncate_lines, bset_undo_list, bset_upcase_table) (bset_width_table): * buffer.c (bset_abbrev_mode, bset_abbrev_table) (bset_auto_fill_function, bset_auto_save_file_format) (bset_auto_save_file_name, bset_backed_up, bset_begv_marker) (bset_bidi_display_reordering, bset_buffer_file_coding_system) (bset_cache_long_line_scans, bset_case_fold_search) (bset_ctl_arrow, bset_cursor_in_non_selected_windows) (bset_cursor_type, bset_display_table, bset_extra_line_spacing) (bset_file_format, bset_file_truename, bset_fringe_cursor_alist) (bset_fringe_indicator_alist, bset_fringes_outside_margins) (bset_header_line_format, bset_indicate_buffer_boundaries) (bset_indicate_empty_lines, bset_invisibility_spec) (bset_left_fringe_width, bset_major_mode, bset_mark) (bset_minor_modes, bset_mode_line_format, bset_mode_name) (bset_name, bset_overwrite_mode, bset_pt_marker) (bset_right_fringe_width, bset_save_length) (bset_scroll_bar_width, bset_scroll_down_aggressively) (bset_scroll_up_aggressively, bset_selective_display) (bset_selective_display_ellipses, bset_vertical_scroll_bar_type) (bset_word_wrap, bset_zv_marker): * category.c (bset_category_table): * syntax.c (bset_syntax_table): New setter functions. Fixes: debbugs:12215
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c502
1 files changed, 364 insertions, 138 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 476f2e363b9..9373e3cd363 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -157,6 +157,228 @@ static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay
157static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); 157static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
158static Lisp_Object buffer_lisp_local_variables (struct buffer *, int); 158static Lisp_Object buffer_lisp_local_variables (struct buffer *, int);
159 159
160/* These setters are used only in this file, so they can be private. */
161static inline void
162bset_abbrev_mode (struct buffer *b, Lisp_Object val)
163{
164 b->INTERNAL_FIELD (abbrev_mode) = val;
165}
166static inline void
167bset_abbrev_table (struct buffer *b, Lisp_Object val)
168{
169 b->INTERNAL_FIELD (abbrev_table) = val;
170}
171static inline void
172bset_auto_fill_function (struct buffer *b, Lisp_Object val)
173{
174 b->INTERNAL_FIELD (auto_fill_function) = val;
175}
176static inline void
177bset_auto_save_file_format (struct buffer *b, Lisp_Object val)
178{
179 b->INTERNAL_FIELD (auto_save_file_format) = val;
180}
181static inline void
182bset_auto_save_file_name (struct buffer *b, Lisp_Object val)
183{
184 b->INTERNAL_FIELD (auto_save_file_name) = val;
185}
186static inline void
187bset_backed_up (struct buffer *b, Lisp_Object val)
188{
189 b->INTERNAL_FIELD (backed_up) = val;
190}
191static inline void
192bset_begv_marker (struct buffer *b, Lisp_Object val)
193{
194 b->INTERNAL_FIELD (begv_marker) = val;
195}
196static inline void
197bset_bidi_display_reordering (struct buffer *b, Lisp_Object val)
198{
199 b->INTERNAL_FIELD (bidi_display_reordering) = val;
200}
201static inline void
202bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
203{
204 b->INTERNAL_FIELD (buffer_file_coding_system) = val;
205}
206static inline void
207bset_cache_long_line_scans (struct buffer *b, Lisp_Object val)
208{
209 b->INTERNAL_FIELD (cache_long_line_scans) = val;
210}
211static inline void
212bset_case_fold_search (struct buffer *b, Lisp_Object val)
213{
214 b->INTERNAL_FIELD (case_fold_search) = val;
215}
216static inline void
217bset_ctl_arrow (struct buffer *b, Lisp_Object val)
218{
219 b->INTERNAL_FIELD (ctl_arrow) = val;
220}
221static inline void
222bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val)
223{
224 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val;
225}
226static inline void
227bset_cursor_type (struct buffer *b, Lisp_Object val)
228{
229 b->INTERNAL_FIELD (cursor_type) = val;
230}
231static inline void
232bset_display_table (struct buffer *b, Lisp_Object val)
233{
234 b->INTERNAL_FIELD (display_table) = val;
235}
236static inline void
237bset_extra_line_spacing (struct buffer *b, Lisp_Object val)
238{
239 b->INTERNAL_FIELD (extra_line_spacing) = val;
240}
241static inline void
242bset_file_format (struct buffer *b, Lisp_Object val)
243{
244 b->INTERNAL_FIELD (file_format) = val;
245}
246static inline void
247bset_file_truename (struct buffer *b, Lisp_Object val)
248{
249 b->INTERNAL_FIELD (file_truename) = val;
250}
251static inline void
252bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val)
253{
254 b->INTERNAL_FIELD (fringe_cursor_alist) = val;
255}
256static inline void
257bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val)
258{
259 b->INTERNAL_FIELD (fringe_indicator_alist) = val;
260}
261static inline void
262bset_fringes_outside_margins (struct buffer *b, Lisp_Object val)
263{
264 b->INTERNAL_FIELD (fringes_outside_margins) = val;
265}
266static inline void
267bset_header_line_format (struct buffer *b, Lisp_Object val)
268{
269 b->INTERNAL_FIELD (header_line_format) = val;
270}
271static inline void
272bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
273{
274 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val;
275}
276static inline void
277bset_indicate_empty_lines (struct buffer *b, Lisp_Object val)
278{
279 b->INTERNAL_FIELD (indicate_empty_lines) = val;
280}
281static inline void
282bset_invisibility_spec (struct buffer *b, Lisp_Object val)
283{
284 b->INTERNAL_FIELD (invisibility_spec) = val;
285}
286static inline void
287bset_left_fringe_width (struct buffer *b, Lisp_Object val)
288{
289 b->INTERNAL_FIELD (left_fringe_width) = val;
290}
291static inline void
292bset_major_mode (struct buffer *b, Lisp_Object val)
293{
294 b->INTERNAL_FIELD (major_mode) = val;
295}
296static inline void
297bset_mark (struct buffer *b, Lisp_Object val)
298{
299 b->INTERNAL_FIELD (mark) = val;
300}
301static inline void
302bset_minor_modes (struct buffer *b, Lisp_Object val)
303{
304 b->INTERNAL_FIELD (minor_modes) = val;
305}
306static inline void
307bset_mode_line_format (struct buffer *b, Lisp_Object val)
308{
309 b->INTERNAL_FIELD (mode_line_format) = val;
310}
311static inline void
312bset_mode_name (struct buffer *b, Lisp_Object val)
313{
314 b->INTERNAL_FIELD (mode_name) = val;
315}
316static inline void
317bset_name (struct buffer *b, Lisp_Object val)
318{
319 b->INTERNAL_FIELD (name) = val;
320}
321static inline void
322bset_overwrite_mode (struct buffer *b, Lisp_Object val)
323{
324 b->INTERNAL_FIELD (overwrite_mode) = val;
325}
326static inline void
327bset_pt_marker (struct buffer *b, Lisp_Object val)
328{
329 b->INTERNAL_FIELD (pt_marker) = val;
330}
331static inline void
332bset_right_fringe_width (struct buffer *b, Lisp_Object val)
333{
334 b->INTERNAL_FIELD (right_fringe_width) = val;
335}
336static inline void
337bset_save_length (struct buffer *b, Lisp_Object val)
338{
339 b->INTERNAL_FIELD (save_length) = val;
340}
341static inline void
342bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
343{
344 b->INTERNAL_FIELD (scroll_bar_width) = val;
345}
346static inline void
347bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val)
348{
349 b->INTERNAL_FIELD (scroll_down_aggressively) = val;
350}
351static inline void
352bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val)
353{
354 b->INTERNAL_FIELD (scroll_up_aggressively) = val;
355}
356static inline void
357bset_selective_display (struct buffer *b, Lisp_Object val)
358{
359 b->INTERNAL_FIELD (selective_display) = val;
360}
361static inline void
362bset_selective_display_ellipses (struct buffer *b, Lisp_Object val)
363{
364 b->INTERNAL_FIELD (selective_display_ellipses) = val;
365}
366static inline void
367bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val)
368{
369 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val;
370}
371static inline void
372bset_word_wrap (struct buffer *b, Lisp_Object val)
373{
374 b->INTERNAL_FIELD (word_wrap) = val;
375}
376static inline void
377bset_zv_marker (struct buffer *b, Lisp_Object val)
378{
379 b->INTERNAL_FIELD (zv_marker) = val;
380}
381
160/* For debugging; temporary. See set_buffer_internal. */ 382/* For debugging; temporary. See set_buffer_internal. */
161/* Lisp_Object Qlisp_mode, Vcheck_symbol; */ 383/* Lisp_Object Qlisp_mode, Vcheck_symbol; */
162 384
@@ -370,7 +592,7 @@ even if it is dead. The return value is never nil. */)
370 592
371 b->newline_cache = 0; 593 b->newline_cache = 0;
372 b->width_run_cache = 0; 594 b->width_run_cache = 0;
373 BSET (b, width_table, Qnil); 595 bset_width_table (b, Qnil);
374 b->prevent_redisplay_optimizations_p = 1; 596 b->prevent_redisplay_optimizations_p = 1;
375 597
376 /* Put this on the chain of all buffers including killed ones. */ 598 /* Put this on the chain of all buffers including killed ones. */
@@ -379,20 +601,20 @@ even if it is dead. The return value is never nil. */)
379 601
380 /* An ordinary buffer normally doesn't need markers 602 /* An ordinary buffer normally doesn't need markers
381 to handle BEGV and ZV. */ 603 to handle BEGV and ZV. */
382 BSET (b, pt_marker, Qnil); 604 bset_pt_marker (b, Qnil);
383 BSET (b, begv_marker, Qnil); 605 bset_begv_marker (b, Qnil);
384 BSET (b, zv_marker, Qnil); 606 bset_zv_marker (b, Qnil);
385 607
386 name = Fcopy_sequence (buffer_or_name); 608 name = Fcopy_sequence (buffer_or_name);
387 set_string_intervals (name, NULL); 609 set_string_intervals (name, NULL);
388 BSET (b, name, name); 610 bset_name (b, name);
389 611
390 BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt); 612 bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt);
391 613
392 reset_buffer (b); 614 reset_buffer (b);
393 reset_buffer_local_variables (b, 1); 615 reset_buffer_local_variables (b, 1);
394 616
395 BSET (b, mark, Fmake_marker ()); 617 bset_mark (b, Fmake_marker ());
396 BUF_MARKERS (b) = NULL; 618 BUF_MARKERS (b) = NULL;
397 619
398 /* Put this in the alist of all live buffers. */ 620 /* Put this in the alist of all live buffers. */
@@ -492,7 +714,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
492 714
493 /* Get (a copy of) the alist of Lisp-level local variables of FROM 715 /* Get (a copy of) the alist of Lisp-level local variables of FROM
494 and install that in TO. */ 716 and install that in TO. */
495 BSET (to, local_var_alist, buffer_lisp_local_variables (from, 1)); 717 bset_local_var_alist (to, buffer_lisp_local_variables (from, 1));
496} 718}
497 719
498 720
@@ -595,7 +817,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
595 817
596 b->newline_cache = 0; 818 b->newline_cache = 0;
597 b->width_run_cache = 0; 819 b->width_run_cache = 0;
598 BSET (b, width_table, Qnil); 820 bset_width_table (b, Qnil);
599 821
600 /* Put this on the chain of all buffers including killed ones. */ 822 /* Put this on the chain of all buffers including killed ones. */
601 b->header.next.buffer = all_buffers; 823 b->header.next.buffer = all_buffers;
@@ -603,7 +825,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
603 825
604 name = Fcopy_sequence (name); 826 name = Fcopy_sequence (name);
605 set_string_intervals (name, NULL); 827 set_string_intervals (name, NULL);
606 BSET (b, name, name); 828 bset_name (b, name);
607 829
608 reset_buffer (b); 830 reset_buffer (b);
609 reset_buffer_local_variables (b, 1); 831 reset_buffer_local_variables (b, 1);
@@ -612,10 +834,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
612 XSETBUFFER (buf, b); 834 XSETBUFFER (buf, b);
613 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 835 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
614 836
615 BSET (b, mark, Fmake_marker ()); 837 bset_mark (b, Fmake_marker ());
616 838
617 /* The multibyte status belongs to the base buffer. */ 839 /* The multibyte status belongs to the base buffer. */
618 BSET (b, enable_multibyte_characters, BVAR (b->base_buffer, enable_multibyte_characters)); 840 bset_enable_multibyte_characters
841 (b, BVAR (b->base_buffer, enable_multibyte_characters));
619 842
620 /* Make sure the base buffer has markers for its narrowing. */ 843 /* Make sure the base buffer has markers for its narrowing. */
621 if (NILP (BVAR (b->base_buffer, pt_marker))) 844 if (NILP (BVAR (b->base_buffer, pt_marker)))
@@ -623,14 +846,17 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
623 eassert (NILP (BVAR (b->base_buffer, begv_marker))); 846 eassert (NILP (BVAR (b->base_buffer, begv_marker)));
624 eassert (NILP (BVAR (b->base_buffer, zv_marker))); 847 eassert (NILP (BVAR (b->base_buffer, zv_marker)));
625 848
626 BSET (b->base_buffer, pt_marker, 849 bset_pt_marker (b->base_buffer,
627 build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte)); 850 build_marker (b->base_buffer, b->base_buffer->pt,
851 b->base_buffer->pt_byte));
628 852
629 BSET (b->base_buffer, begv_marker, 853 bset_begv_marker (b->base_buffer,
630 build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte)); 854 build_marker (b->base_buffer, b->base_buffer->begv,
855 b->base_buffer->begv_byte));
631 856
632 BSET (b->base_buffer, zv_marker, 857 bset_zv_marker (b->base_buffer,
633 build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte)); 858 build_marker (b->base_buffer, b->base_buffer->zv,
859 b->base_buffer->zv_byte));
634 860
635 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; 861 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
636 } 862 }
@@ -638,9 +864,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
638 if (NILP (clone)) 864 if (NILP (clone))
639 { 865 {
640 /* Give the indirect buffer markers for its narrowing. */ 866 /* Give the indirect buffer markers for its narrowing. */
641 BSET (b, pt_marker, build_marker (b, b->pt, b->pt_byte)); 867 bset_pt_marker (b, build_marker (b, b->pt, b->pt_byte));
642 BSET (b, begv_marker, build_marker (b, b->begv, b->begv_byte)); 868 bset_begv_marker (b, build_marker (b, b->begv, b->begv_byte));
643 BSET (b, zv_marker, build_marker (b, b->zv, b->zv_byte)); 869 bset_zv_marker (b, build_marker (b, b->zv, b->zv_byte));
644 XMARKER (BVAR (b, zv_marker))->insertion_type = 1; 870 XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
645 } 871 }
646 else 872 else
@@ -648,11 +874,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
648 struct buffer *old_b = current_buffer; 874 struct buffer *old_b = current_buffer;
649 875
650 clone_per_buffer_values (b->base_buffer, b); 876 clone_per_buffer_values (b->base_buffer, b);
651 BSET (b, filename, Qnil); 877 bset_filename (b, Qnil);
652 BSET (b, file_truename, Qnil); 878 bset_file_truename (b, Qnil);
653 BSET (b, display_count, make_number (0)); 879 bset_display_count (b, make_number (0));
654 BSET (b, backed_up, Qnil); 880 bset_backed_up (b, Qnil);
655 BSET (b, auto_save_file_name, Qnil); 881 bset_auto_save_file_name (b, Qnil);
656 set_buffer_internal_1 (b); 882 set_buffer_internal_1 (b);
657 Fset (intern ("buffer-save-without-query"), Qnil); 883 Fset (intern ("buffer-save-without-query"), Qnil);
658 Fset (intern ("buffer-file-number"), Qnil); 884 Fset (intern ("buffer-file-number"), Qnil);
@@ -715,10 +941,9 @@ delete_all_overlays (struct buffer *b)
715void 941void
716reset_buffer (register struct buffer *b) 942reset_buffer (register struct buffer *b)
717{ 943{
718 BSET (b, filename, Qnil); 944 bset_filename (b, Qnil);
719 BSET (b, file_truename, Qnil); 945 bset_file_truename (b, Qnil);
720 BSET (b, directory, 946 bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil);
721 (current_buffer) ? BVAR (current_buffer, directory) : Qnil);
722 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); 947 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS);
723 b->modtime_size = -1; 948 b->modtime_size = -1;
724 XSETFASTINT (BVAR (b, save_length), 0); 949 XSETFASTINT (BVAR (b, save_length), 0);
@@ -726,25 +951,25 @@ reset_buffer (register struct buffer *b)
726 /* It is more conservative to start out "changed" than "unchanged". */ 951 /* It is more conservative to start out "changed" than "unchanged". */
727 b->clip_changed = 0; 952 b->clip_changed = 0;
728 b->prevent_redisplay_optimizations_p = 1; 953 b->prevent_redisplay_optimizations_p = 1;
729 BSET (b, backed_up, Qnil); 954 bset_backed_up (b, Qnil);
730 BUF_AUTOSAVE_MODIFF (b) = 0; 955 BUF_AUTOSAVE_MODIFF (b) = 0;
731 b->auto_save_failure_time = 0; 956 b->auto_save_failure_time = 0;
732 BSET (b, auto_save_file_name, Qnil); 957 bset_auto_save_file_name (b, Qnil);
733 BSET (b, read_only, Qnil); 958 bset_read_only (b, Qnil);
734 set_buffer_overlays_before (b, NULL); 959 set_buffer_overlays_before (b, NULL);
735 set_buffer_overlays_after (b, NULL); 960 set_buffer_overlays_after (b, NULL);
736 b->overlay_center = BEG; 961 b->overlay_center = BEG;
737 BSET (b, mark_active, Qnil); 962 bset_mark_active (b, Qnil);
738 BSET (b, point_before_scroll, Qnil); 963 bset_point_before_scroll (b, Qnil);
739 BSET (b, file_format, Qnil); 964 bset_file_format (b, Qnil);
740 BSET (b, auto_save_file_format, Qt); 965 bset_auto_save_file_format (b, Qt);
741 BSET (b, last_selected_window, Qnil); 966 bset_last_selected_window (b, Qnil);
742 BSET (b, display_count, make_number (0)); 967 bset_display_count (b, make_number (0));
743 BSET (b, display_time, Qnil); 968 bset_display_time (b, Qnil);
744 BSET (b, enable_multibyte_characters, 969 bset_enable_multibyte_characters
745 BVAR (&buffer_defaults, enable_multibyte_characters)); 970 (b, BVAR (&buffer_defaults, enable_multibyte_characters));
746 BSET (b, cursor_type, BVAR (&buffer_defaults, cursor_type)); 971 bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type));
747 BSET (b, extra_line_spacing, BVAR (&buffer_defaults, extra_line_spacing)); 972 bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing));
748 973
749 b->display_error_modiff = 0; 974 b->display_error_modiff = 0;
750} 975}
@@ -768,10 +993,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
768 things that depend on the major mode. 993 things that depend on the major mode.
769 default-major-mode is handled at a higher level. 994 default-major-mode is handled at a higher level.
770 We ignore it here. */ 995 We ignore it here. */
771 BSET (b, major_mode, Qfundamental_mode); 996 bset_major_mode (b, Qfundamental_mode);
772 BSET (b, keymap, Qnil); 997 bset_keymap (b, Qnil);
773 BSET (b, mode_name, QSFundamental); 998 bset_mode_name (b, QSFundamental);
774 BSET (b, minor_modes, Qnil); 999 bset_minor_modes (b, Qnil);
775 1000
776 /* If the standard case table has been altered and invalidated, 1001 /* If the standard case table has been altered and invalidated,
777 fix up its insides first. */ 1002 fix up its insides first. */
@@ -780,15 +1005,15 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
780 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) 1005 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
781 Fset_standard_case_table (Vascii_downcase_table); 1006 Fset_standard_case_table (Vascii_downcase_table);
782 1007
783 BSET (b, downcase_table, Vascii_downcase_table); 1008 bset_downcase_table (b, Vascii_downcase_table);
784 BSET (b, upcase_table, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); 1009 bset_upcase_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[0]);
785 BSET (b, case_canon_table, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); 1010 bset_case_canon_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[1]);
786 BSET (b, case_eqv_table, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); 1011 bset_case_eqv_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[2]);
787 BSET (b, invisibility_spec, Qt); 1012 bset_invisibility_spec (b, Qt);
788 1013
789 /* Reset all (or most) per-buffer variables to their defaults. */ 1014 /* Reset all (or most) per-buffer variables to their defaults. */
790 if (permanent_too) 1015 if (permanent_too)
791 BSET (b, local_var_alist, Qnil); 1016 bset_local_var_alist (b, Qnil);
792 else 1017 else
793 { 1018 {
794 Lisp_Object tmp, prop, last = Qnil; 1019 Lisp_Object tmp, prop, last = Qnil;
@@ -822,7 +1047,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
822 } 1047 }
823 /* Delete this local variable. */ 1048 /* Delete this local variable. */
824 else if (NILP (last)) 1049 else if (NILP (last))
825 BSET (b, local_var_alist, XCDR (tmp)); 1050 bset_local_var_alist (b, XCDR (tmp));
826 else 1051 else
827 XSETCDR (last, XCDR (tmp)); 1052 XSETCDR (last, XCDR (tmp));
828 } 1053 }
@@ -1299,7 +1524,7 @@ This does not change the name of the visited file (if any). */)
1299 error ("Buffer name `%s' is in use", SDATA (newname)); 1524 error ("Buffer name `%s' is in use", SDATA (newname));
1300 } 1525 }
1301 1526
1302 BSET (current_buffer, name, newname); 1527 bset_name (current_buffer, newname);
1303 1528
1304 /* Catch redisplay's attention. Unless we do this, the mode lines for 1529 /* Catch redisplay's attention. Unless we do this, the mode lines for
1305 any windows displaying current_buffer will stay unchanged. */ 1530 any windows displaying current_buffer will stay unchanged. */
@@ -1444,7 +1669,7 @@ No argument or nil as argument means do this for the current buffer. */)
1444 } 1669 }
1445 1670
1446 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) 1671 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt))
1447 BSET (XBUFFER (real_buffer), undo_list, Qnil); 1672 bset_undo_list (XBUFFER (real_buffer), Qnil);
1448 1673
1449 return Qnil; 1674 return Qnil;
1450} 1675}
@@ -1716,7 +1941,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1716 swap_out_buffer_local_variables (b); 1941 swap_out_buffer_local_variables (b);
1717 reset_buffer_local_variables (b, 1); 1942 reset_buffer_local_variables (b, 1);
1718 1943
1719 BSET (b, name, Qnil); 1944 bset_name (b, Qnil);
1720 1945
1721 BLOCK_INPUT; 1946 BLOCK_INPUT;
1722 if (b->base_buffer) 1947 if (b->base_buffer)
@@ -1740,9 +1965,9 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1740 free_region_cache (b->width_run_cache); 1965 free_region_cache (b->width_run_cache);
1741 b->width_run_cache = 0; 1966 b->width_run_cache = 0;
1742 } 1967 }
1743 BSET (b, width_table, Qnil); 1968 bset_width_table (b, Qnil);
1744 UNBLOCK_INPUT; 1969 UNBLOCK_INPUT;
1745 BSET (b, undo_list, Qnil); 1970 bset_undo_list (b, Qnil);
1746 1971
1747 /* Run buffer-list-update-hook. */ 1972 /* Run buffer-list-update-hook. */
1748 if (!NILP (Vrun_hooks)) 1973 if (!NILP (Vrun_hooks))
@@ -1923,7 +2148,7 @@ set_buffer_internal_1 (register struct buffer *b)
1923 /* Put the undo list back in the base buffer, so that it appears 2148 /* Put the undo list back in the base buffer, so that it appears
1924 that an indirect buffer shares the undo list of its base. */ 2149 that an indirect buffer shares the undo list of its base. */
1925 if (old_buf->base_buffer) 2150 if (old_buf->base_buffer)
1926 BSET (old_buf->base_buffer, undo_list, BVAR (old_buf, undo_list)); 2151 bset_undo_list (old_buf->base_buffer, BVAR (old_buf, undo_list));
1927 2152
1928 /* If the old current buffer has markers to record PT, BEGV and ZV 2153 /* If the old current buffer has markers to record PT, BEGV and ZV
1929 when it is not current, update them now. */ 2154 when it is not current, update them now. */
@@ -1933,7 +2158,7 @@ set_buffer_internal_1 (register struct buffer *b)
1933 /* Get the undo list from the base buffer, so that it appears 2158 /* Get the undo list from the base buffer, so that it appears
1934 that an indirect buffer shares the undo list of its base. */ 2159 that an indirect buffer shares the undo list of its base. */
1935 if (b->base_buffer) 2160 if (b->base_buffer)
1936 BSET (b, undo_list, BVAR (b->base_buffer, undo_list)); 2161 bset_undo_list (b, BVAR (b->base_buffer, undo_list));
1937 2162
1938 /* If the new current buffer has markers to record PT, BEGV and ZV 2163 /* If the new current buffer has markers to record PT, BEGV and ZV
1939 when it is not current, fetch them now. */ 2164 when it is not current, fetch them now. */
@@ -2131,8 +2356,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2131#define swapfield_(field, type) \ 2356#define swapfield_(field, type) \
2132 do { \ 2357 do { \
2133 type tmp##field = BVAR (other_buffer, field); \ 2358 type tmp##field = BVAR (other_buffer, field); \
2134 BSET (other_buffer, field, BVAR (current_buffer, field)); \ 2359 bset_##field (other_buffer, BVAR (current_buffer, field)); \
2135 BSET (current_buffer, field, tmp##field); \ 2360 bset_##field (current_buffer, tmp##field); \
2136 } while (0) 2361 } while (0)
2137 2362
2138 swapfield (own_text, struct buffer_text); 2363 swapfield (own_text, struct buffer_text);
@@ -2172,8 +2397,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2172 swapfield_ (pt_marker, Lisp_Object); 2397 swapfield_ (pt_marker, Lisp_Object);
2173 swapfield_ (begv_marker, Lisp_Object); 2398 swapfield_ (begv_marker, Lisp_Object);
2174 swapfield_ (zv_marker, Lisp_Object); 2399 swapfield_ (zv_marker, Lisp_Object);
2175 BSET (current_buffer, point_before_scroll, Qnil); 2400 bset_point_before_scroll (current_buffer, Qnil);
2176 BSET (other_buffer, point_before_scroll, Qnil); 2401 bset_point_before_scroll (other_buffer, Qnil);
2177 2402
2178 current_buffer->text->modiff++; other_buffer->text->modiff++; 2403 current_buffer->text->modiff++; other_buffer->text->modiff++;
2179 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2404 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++;
@@ -2262,7 +2487,7 @@ current buffer is cleared. */)
2262 2487
2263 /* Don't record these buffer changes. We will put a special undo entry 2488 /* Don't record these buffer changes. We will put a special undo entry
2264 instead. */ 2489 instead. */
2265 BSET (current_buffer, undo_list, Qt); 2490 bset_undo_list (current_buffer, Qt);
2266 2491
2267 /* If the cached position is for this buffer, clear it out. */ 2492 /* If the cached position is for this buffer, clear it out. */
2268 clear_charpos_cache (current_buffer); 2493 clear_charpos_cache (current_buffer);
@@ -2284,7 +2509,7 @@ current buffer is cleared. */)
2284 to calculate the old correspondences. */ 2509 to calculate the old correspondences. */
2285 set_intervals_multibyte (0); 2510 set_intervals_multibyte (0);
2286 2511
2287 BSET (current_buffer, enable_multibyte_characters, Qnil); 2512 bset_enable_multibyte_characters (current_buffer, Qnil);
2288 2513
2289 Z = Z_BYTE; 2514 Z = Z_BYTE;
2290 BEGV = BEGV_BYTE; 2515 BEGV = BEGV_BYTE;
@@ -2422,7 +2647,7 @@ current buffer is cleared. */)
2422 2647
2423 /* Do this first, so that chars_in_text asks the right question. 2648 /* Do this first, so that chars_in_text asks the right question.
2424 set_intervals_multibyte needs it too. */ 2649 set_intervals_multibyte needs it too. */
2425 BSET (current_buffer, enable_multibyte_characters, Qt); 2650 bset_enable_multibyte_characters (current_buffer, Qt);
2426 2651
2427 GPT_BYTE = advance_to_char_boundary (GPT_BYTE); 2652 GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
2428 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; 2653 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2480,11 +2705,11 @@ current buffer is cleared. */)
2480 if (!EQ (old_undo, Qt)) 2705 if (!EQ (old_undo, Qt))
2481 { 2706 {
2482 /* Represent all the above changes by a special undo entry. */ 2707 /* Represent all the above changes by a special undo entry. */
2483 BSET (current_buffer, undo_list, 2708 bset_undo_list (current_buffer,
2484 Fcons (list3 (Qapply, 2709 Fcons (list3 (Qapply,
2485 intern ("set-buffer-multibyte"), 2710 intern ("set-buffer-multibyte"),
2486 NILP (flag) ? Qt : Qnil), 2711 NILP (flag) ? Qt : Qnil),
2487 old_undo)); 2712 old_undo));
2488 } 2713 }
2489 2714
2490 UNGCPRO; 2715 UNGCPRO;
@@ -4937,55 +5162,55 @@ init_buffer_once (void)
4937 /* Must do these before making the first buffer! */ 5162 /* Must do these before making the first buffer! */
4938 5163
4939 /* real setup is done in bindings.el */ 5164 /* real setup is done in bindings.el */
4940 BSET (&buffer_defaults, mode_line_format, build_pure_c_string ("%-")); 5165 bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-"));
4941 BSET (&buffer_defaults, header_line_format, Qnil); 5166 bset_header_line_format (&buffer_defaults, Qnil);
4942 BSET (&buffer_defaults, abbrev_mode, Qnil); 5167 bset_abbrev_mode (&buffer_defaults, Qnil);
4943 BSET (&buffer_defaults, overwrite_mode, Qnil); 5168 bset_overwrite_mode (&buffer_defaults, Qnil);
4944 BSET (&buffer_defaults, case_fold_search, Qt); 5169 bset_case_fold_search (&buffer_defaults, Qt);
4945 BSET (&buffer_defaults, auto_fill_function, Qnil); 5170 bset_auto_fill_function (&buffer_defaults, Qnil);
4946 BSET (&buffer_defaults, selective_display, Qnil); 5171 bset_selective_display (&buffer_defaults, Qnil);
4947 BSET (&buffer_defaults, selective_display_ellipses, Qt); 5172 bset_selective_display_ellipses (&buffer_defaults, Qt);
4948 BSET (&buffer_defaults, abbrev_table, Qnil); 5173 bset_abbrev_table (&buffer_defaults, Qnil);
4949 BSET (&buffer_defaults, display_table, Qnil); 5174 bset_display_table (&buffer_defaults, Qnil);
4950 BSET (&buffer_defaults, undo_list, Qnil); 5175 bset_undo_list (&buffer_defaults, Qnil);
4951 BSET (&buffer_defaults, mark_active, Qnil); 5176 bset_mark_active (&buffer_defaults, Qnil);
4952 BSET (&buffer_defaults, file_format, Qnil); 5177 bset_file_format (&buffer_defaults, Qnil);
4953 BSET (&buffer_defaults, auto_save_file_format, Qt); 5178 bset_auto_save_file_format (&buffer_defaults, Qt);
4954 set_buffer_overlays_before (&buffer_defaults, NULL); 5179 set_buffer_overlays_before (&buffer_defaults, NULL);
4955 set_buffer_overlays_after (&buffer_defaults, NULL); 5180 set_buffer_overlays_after (&buffer_defaults, NULL);
4956 buffer_defaults.overlay_center = BEG; 5181 buffer_defaults.overlay_center = BEG;
4957 5182
4958 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); 5183 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
4959 BSET (&buffer_defaults, truncate_lines, Qnil); 5184 bset_truncate_lines (&buffer_defaults, Qnil);
4960 BSET (&buffer_defaults, word_wrap, Qnil); 5185 bset_word_wrap (&buffer_defaults, Qnil);
4961 BSET (&buffer_defaults, ctl_arrow, Qt); 5186 bset_ctl_arrow (&buffer_defaults, Qt);
4962 BSET (&buffer_defaults, bidi_display_reordering, Qt); 5187 bset_bidi_display_reordering (&buffer_defaults, Qt);
4963 BSET (&buffer_defaults, bidi_paragraph_direction, Qnil); 5188 bset_bidi_paragraph_direction (&buffer_defaults, Qnil);
4964 BSET (&buffer_defaults, cursor_type, Qt); 5189 bset_cursor_type (&buffer_defaults, Qt);
4965 BSET (&buffer_defaults, extra_line_spacing, Qnil); 5190 bset_extra_line_spacing (&buffer_defaults, Qnil);
4966 BSET (&buffer_defaults, cursor_in_non_selected_windows, Qt); 5191 bset_cursor_in_non_selected_windows (&buffer_defaults, Qt);
4967 5192
4968 BSET (&buffer_defaults, enable_multibyte_characters, Qt); 5193 bset_enable_multibyte_characters (&buffer_defaults, Qt);
4969 BSET (&buffer_defaults, buffer_file_coding_system, Qnil); 5194 bset_buffer_file_coding_system (&buffer_defaults, Qnil);
4970 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); 5195 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
4971 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); 5196 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
4972 BSET (&buffer_defaults, cache_long_line_scans, Qnil); 5197 bset_cache_long_line_scans (&buffer_defaults, Qnil);
4973 BSET (&buffer_defaults, file_truename, Qnil); 5198 bset_file_truename (&buffer_defaults, Qnil);
4974 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); 5199 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
4975 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); 5200 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
4976 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); 5201 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
4977 BSET (&buffer_defaults, left_fringe_width, Qnil); 5202 bset_left_fringe_width (&buffer_defaults, Qnil);
4978 BSET (&buffer_defaults, right_fringe_width, Qnil); 5203 bset_right_fringe_width (&buffer_defaults, Qnil);
4979 BSET (&buffer_defaults, fringes_outside_margins, Qnil); 5204 bset_fringes_outside_margins (&buffer_defaults, Qnil);
4980 BSET (&buffer_defaults, scroll_bar_width, Qnil); 5205 bset_scroll_bar_width (&buffer_defaults, Qnil);
4981 BSET (&buffer_defaults, vertical_scroll_bar_type, Qt); 5206 bset_vertical_scroll_bar_type (&buffer_defaults, Qt);
4982 BSET (&buffer_defaults, indicate_empty_lines, Qnil); 5207 bset_indicate_empty_lines (&buffer_defaults, Qnil);
4983 BSET (&buffer_defaults, indicate_buffer_boundaries, Qnil); 5208 bset_indicate_buffer_boundaries (&buffer_defaults, Qnil);
4984 BSET (&buffer_defaults, fringe_indicator_alist, Qnil); 5209 bset_fringe_indicator_alist (&buffer_defaults, Qnil);
4985 BSET (&buffer_defaults, fringe_cursor_alist, Qnil); 5210 bset_fringe_cursor_alist (&buffer_defaults, Qnil);
4986 BSET (&buffer_defaults, scroll_up_aggressively, Qnil); 5211 bset_scroll_up_aggressively (&buffer_defaults, Qnil);
4987 BSET (&buffer_defaults, scroll_down_aggressively, Qnil); 5212 bset_scroll_down_aggressively (&buffer_defaults, Qnil);
4988 BSET (&buffer_defaults, display_time, Qnil); 5213 bset_display_time (&buffer_defaults, Qnil);
4989 5214
4990 /* Assign the local-flags to the slots that have default values. 5215 /* Assign the local-flags to the slots that have default values.
4991 The local flag is a bit that is used in the buffer 5216 The local flag is a bit that is used in the buffer
@@ -4997,24 +5222,24 @@ init_buffer_once (void)
4997 5222
4998 /* 0 means not a lisp var, -1 means always local, else mask */ 5223 /* 0 means not a lisp var, -1 means always local, else mask */
4999 memset (&buffer_local_flags, 0, sizeof buffer_local_flags); 5224 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5000 BSET (&buffer_local_flags, filename, make_number (-1)); 5225 bset_filename (&buffer_local_flags, make_number (-1));
5001 BSET (&buffer_local_flags, directory, make_number (-1)); 5226 bset_directory (&buffer_local_flags, make_number (-1));
5002 BSET (&buffer_local_flags, backed_up, make_number (-1)); 5227 bset_backed_up (&buffer_local_flags, make_number (-1));
5003 BSET (&buffer_local_flags, save_length, make_number (-1)); 5228 bset_save_length (&buffer_local_flags, make_number (-1));
5004 BSET (&buffer_local_flags, auto_save_file_name, make_number (-1)); 5229 bset_auto_save_file_name (&buffer_local_flags, make_number (-1));
5005 BSET (&buffer_local_flags, read_only, make_number (-1)); 5230 bset_read_only (&buffer_local_flags, make_number (-1));
5006 BSET (&buffer_local_flags, major_mode, make_number (-1)); 5231 bset_major_mode (&buffer_local_flags, make_number (-1));
5007 BSET (&buffer_local_flags, mode_name, make_number (-1)); 5232 bset_mode_name (&buffer_local_flags, make_number (-1));
5008 BSET (&buffer_local_flags, undo_list, make_number (-1)); 5233 bset_undo_list (&buffer_local_flags, make_number (-1));
5009 BSET (&buffer_local_flags, mark_active, make_number (-1)); 5234 bset_mark_active (&buffer_local_flags, make_number (-1));
5010 BSET (&buffer_local_flags, point_before_scroll, make_number (-1)); 5235 bset_point_before_scroll (&buffer_local_flags, make_number (-1));
5011 BSET (&buffer_local_flags, file_truename, make_number (-1)); 5236 bset_file_truename (&buffer_local_flags, make_number (-1));
5012 BSET (&buffer_local_flags, invisibility_spec, make_number (-1)); 5237 bset_invisibility_spec (&buffer_local_flags, make_number (-1));
5013 BSET (&buffer_local_flags, file_format, make_number (-1)); 5238 bset_file_format (&buffer_local_flags, make_number (-1));
5014 BSET (&buffer_local_flags, auto_save_file_format, make_number (-1)); 5239 bset_auto_save_file_format (&buffer_local_flags, make_number (-1));
5015 BSET (&buffer_local_flags, display_count, make_number (-1)); 5240 bset_display_count (&buffer_local_flags, make_number (-1));
5016 BSET (&buffer_local_flags, display_time, make_number (-1)); 5241 bset_display_time (&buffer_local_flags, make_number (-1));
5017 BSET (&buffer_local_flags, enable_multibyte_characters, make_number (-1)); 5242 bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1));
5018 5243
5019 idx = 1; 5244 idx = 1;
5020 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; 5245 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
@@ -5070,7 +5295,7 @@ init_buffer_once (void)
5070 QSFundamental = build_pure_c_string ("Fundamental"); 5295 QSFundamental = build_pure_c_string ("Fundamental");
5071 5296
5072 Qfundamental_mode = intern_c_string ("fundamental-mode"); 5297 Qfundamental_mode = intern_c_string ("fundamental-mode");
5073 BSET (&buffer_defaults, major_mode, Qfundamental_mode); 5298 bset_major_mode (&buffer_defaults, Qfundamental_mode);
5074 5299
5075 Qmode_class = intern_c_string ("mode-class"); 5300 Qmode_class = intern_c_string ("mode-class");
5076 5301
@@ -5133,13 +5358,13 @@ init_buffer (void)
5133 len++; 5358 len++;
5134 } 5359 }
5135 5360
5136 BSET (current_buffer, directory, make_unibyte_string (pwd, len)); 5361 bset_directory (current_buffer, make_unibyte_string (pwd, len));
5137 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) 5362 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5138 /* At this moment, we still don't know how to decode the 5363 /* At this moment, we still don't know how to decode the
5139 directory name. So, we keep the bytes in multibyte form so 5364 directory name. So, we keep the bytes in multibyte form so
5140 that ENCODE_FILE correctly gets the original bytes. */ 5365 that ENCODE_FILE correctly gets the original bytes. */
5141 BSET (current_buffer, directory, 5366 bset_directory
5142 string_to_multibyte (BVAR (current_buffer, directory))); 5367 (current_buffer, string_to_multibyte (BVAR (current_buffer, directory)));
5143 5368
5144 /* Add /: to the front of the name 5369 /* Add /: to the front of the name
5145 if it would otherwise be treated as magic. */ 5370 if it would otherwise be treated as magic. */
@@ -5150,11 +5375,12 @@ init_buffer (void)
5150 However, it is not necessary to turn / into /:/. 5375 However, it is not necessary to turn / into /:/.
5151 So avoid doing that. */ 5376 So avoid doing that. */
5152 && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) 5377 && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
5153 BSET (current_buffer, directory, 5378 bset_directory
5154 concat2 (build_string ("/:"), BVAR (current_buffer, directory))); 5379 (current_buffer,
5380 concat2 (build_string ("/:"), BVAR (current_buffer, directory)));
5155 5381
5156 temp = get_minibuffer (0); 5382 temp = get_minibuffer (0);
5157 BSET (XBUFFER (temp), directory, BVAR (current_buffer, directory)); 5383 bset_directory (XBUFFER (temp), BVAR (current_buffer, directory));
5158 5384
5159 free (pwd); 5385 free (pwd);
5160} 5386}