aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorStefan Monnier2015-01-11 17:38:04 -0500
committerStefan Monnier2015-01-11 17:38:04 -0500
commit23ffeb9015ca3669995b9a5d47cfc09b7643d9b9 (patch)
treeb17fd8e3e14a34e12625ec3b4cd504624464092e /src/buffer.c
parent509257822ca20ea170ba810b8b679a6dc800dd44 (diff)
downloademacs-23ffeb9015ca3669995b9a5d47cfc09b7643d9b9.tar.gz
emacs-23ffeb9015ca3669995b9a5d47cfc09b7643d9b9.zip
* src/buffer.c (init_buffer_once): Initialize buffer_local_flags early.
* src/buffer.c (init_buffer_once): Initialize buffer_local_flags before calling reset_buffer_local_variables, and make sure we initialize it completely.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c161
1 files changed, 89 insertions, 72 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e0843723232..d0ffe67d954 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5027,6 +5027,93 @@ init_buffer_once (void)
5027 5027
5028 memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags); 5028 memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
5029 5029
5030 /* 0 means not a lisp var, -1 means always local, else mask. */
5031 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5032 bset_filename (&buffer_local_flags, make_number (-1));
5033 bset_directory (&buffer_local_flags, make_number (-1));
5034 bset_backed_up (&buffer_local_flags, make_number (-1));
5035 bset_save_length (&buffer_local_flags, make_number (-1));
5036 bset_auto_save_file_name (&buffer_local_flags, make_number (-1));
5037 bset_read_only (&buffer_local_flags, make_number (-1));
5038 bset_major_mode (&buffer_local_flags, make_number (-1));
5039 bset_mode_name (&buffer_local_flags, make_number (-1));
5040 bset_undo_list (&buffer_local_flags, make_number (-1));
5041 bset_mark_active (&buffer_local_flags, make_number (-1));
5042 bset_point_before_scroll (&buffer_local_flags, make_number (-1));
5043 bset_file_truename (&buffer_local_flags, make_number (-1));
5044 bset_invisibility_spec (&buffer_local_flags, make_number (-1));
5045 bset_file_format (&buffer_local_flags, make_number (-1));
5046 bset_auto_save_file_format (&buffer_local_flags, make_number (-1));
5047 bset_display_count (&buffer_local_flags, make_number (-1));
5048 bset_display_time (&buffer_local_flags, make_number (-1));
5049 bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1));
5050
5051 /* These used to be stuck at 0 by default, but now that the all-zero value
5052 means Qnil, we have to initialize them explicitly. */
5053 bset_name (&buffer_local_flags, make_number (0));
5054 bset_mark (&buffer_local_flags, make_number (0));
5055 bset_local_var_alist (&buffer_local_flags, make_number (0));
5056 bset_keymap (&buffer_local_flags, make_number (0));
5057 bset_downcase_table (&buffer_local_flags, make_number (0));
5058 bset_upcase_table (&buffer_local_flags, make_number (0));
5059 bset_case_canon_table (&buffer_local_flags, make_number (0));
5060 bset_case_eqv_table (&buffer_local_flags, make_number (0));
5061 bset_minor_modes (&buffer_local_flags, make_number (0));
5062 bset_width_table (&buffer_local_flags, make_number (0));
5063 bset_pt_marker (&buffer_local_flags, make_number (0));
5064 bset_begv_marker (&buffer_local_flags, make_number (0));
5065 bset_zv_marker (&buffer_local_flags, make_number (0));
5066 bset_last_selected_window (&buffer_local_flags, make_number (0));
5067
5068 idx = 1;
5069 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
5070 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx;
5071 XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx;
5072 XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx;
5073 XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx;
5074 XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx;
5075 XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
5076 XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx;
5077 XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx;
5078 XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
5079 XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx;
5080 XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx;
5081 XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx;
5082 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx;
5083 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx;
5084 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx;
5085 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx;
5086 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx;
5087 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx;
5088 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx;
5089 XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx);
5090 /* Make this one a permanent local. */
5091 buffer_permanent_local_flags[idx++] = 1;
5092 XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx;
5093 XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx;
5094 XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx;
5095 XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx;
5096 XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx;
5097 XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx;
5098 XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_height), idx); ++idx;
5099 XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx;
5100 XSETFASTINT (BVAR (&buffer_local_flags, horizontal_scroll_bar_type), idx); ++idx;
5101 XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx;
5102 XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx;
5103 XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx;
5104 XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx;
5105 XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx;
5106 XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx;
5107 XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx;
5108 XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx;
5109 XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
5110 XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
5111
5112 /* Need more room? */
5113 if (idx >= MAX_PER_BUFFER_VARS)
5114 emacs_abort ();
5115 last_per_buffer_idx = idx;
5116
5030 /* Make sure all markable slots in buffer_defaults 5117 /* Make sure all markable slots in buffer_defaults
5031 are initialized reasonably, so mark_buffer won't choke. */ 5118 are initialized reasonably, so mark_buffer won't choke. */
5032 reset_buffer (&buffer_defaults); 5119 reset_buffer (&buffer_defaults);
@@ -5113,79 +5200,9 @@ init_buffer_once (void)
5113 to say that it has its own local value for the slot. 5200 to say that it has its own local value for the slot.
5114 The local flag bits are in the local_var_flags slot of the buffer. */ 5201 The local flag bits are in the local_var_flags slot of the buffer. */
5115 5202
5116 /* Nothing can work if this isn't true */ 5203 /* Nothing can work if this isn't true. */
5117 { verify (sizeof (EMACS_INT) == word_size); } 5204 { verify (sizeof (EMACS_INT) == word_size); }
5118 5205
5119 /* 0 means not a lisp var, -1 means always local, else mask */
5120 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5121 bset_filename (&buffer_local_flags, make_number (-1));
5122 bset_directory (&buffer_local_flags, make_number (-1));
5123 bset_backed_up (&buffer_local_flags, make_number (-1));
5124 bset_save_length (&buffer_local_flags, make_number (-1));
5125 bset_auto_save_file_name (&buffer_local_flags, make_number (-1));
5126 bset_read_only (&buffer_local_flags, make_number (-1));
5127 bset_major_mode (&buffer_local_flags, make_number (-1));
5128 bset_mode_name (&buffer_local_flags, make_number (-1));
5129 bset_undo_list (&buffer_local_flags, make_number (-1));
5130 bset_mark_active (&buffer_local_flags, make_number (-1));
5131 bset_point_before_scroll (&buffer_local_flags, make_number (-1));
5132 bset_file_truename (&buffer_local_flags, make_number (-1));
5133 bset_invisibility_spec (&buffer_local_flags, make_number (-1));
5134 bset_file_format (&buffer_local_flags, make_number (-1));
5135 bset_auto_save_file_format (&buffer_local_flags, make_number (-1));
5136 bset_display_count (&buffer_local_flags, make_number (-1));
5137 bset_display_time (&buffer_local_flags, make_number (-1));
5138 bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1));
5139
5140 idx = 1;
5141 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
5142 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx;
5143 XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx;
5144 XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx;
5145 XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx;
5146 XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx;
5147 XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
5148 XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx;
5149 XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx;
5150 XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
5151 XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx;
5152 XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx;
5153 XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx;
5154 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx;
5155 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx;
5156 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx;
5157 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx;
5158 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx;
5159 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx;
5160 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx;
5161 XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx);
5162 /* Make this one a permanent local. */
5163 buffer_permanent_local_flags[idx++] = 1;
5164 XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx;
5165 XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx;
5166 XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx;
5167 XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx;
5168 XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx;
5169 XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx;
5170 XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_height), idx); ++idx;
5171 XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx;
5172 XSETFASTINT (BVAR (&buffer_local_flags, horizontal_scroll_bar_type), idx); ++idx;
5173 XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx;
5174 XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx;
5175 XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx;
5176 XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx;
5177 XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx;
5178 XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx;
5179 XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx;
5180 XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx;
5181 XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
5182 XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
5183
5184 /* Need more room? */
5185 if (idx >= MAX_PER_BUFFER_VARS)
5186 emacs_abort ();
5187 last_per_buffer_idx = idx;
5188
5189 Vbuffer_alist = Qnil; 5206 Vbuffer_alist = Qnil;
5190 current_buffer = 0; 5207 current_buffer = 0;
5191 all_buffers = 0; 5208 all_buffers = 0;
@@ -5202,7 +5219,7 @@ init_buffer_once (void)
5202 DEFSYM (Qkill_buffer_hook, "kill-buffer-hook"); 5219 DEFSYM (Qkill_buffer_hook, "kill-buffer-hook");
5203 Fput (Qkill_buffer_hook, Qpermanent_local, Qt); 5220 Fput (Qkill_buffer_hook, Qpermanent_local, Qt);
5204 5221
5205 /* super-magic invisible buffer */ 5222 /* Super-magic invisible buffer. */
5206 Vprin1_to_string_buffer = Fget_buffer_create (build_pure_c_string (" prin1")); 5223 Vprin1_to_string_buffer = Fget_buffer_create (build_pure_c_string (" prin1"));
5207 Vbuffer_alist = Qnil; 5224 Vbuffer_alist = Qnil;
5208 5225