aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2011-02-21 17:34:51 -0500
committerStefan Monnier2011-02-21 17:34:51 -0500
commitf619ad4ca2ce943d53589469c010e451afab97dd (patch)
treee1b71f79518372ecab4c677ae948504450d8bf5d /src
parenta647cb26b695a542e3a546104afdf4c7c47eb061 (diff)
parent9f8370e63f65f76887b319ab6a0368d4a332777c (diff)
downloademacs-f619ad4ca2ce943d53589469c010e451afab97dd.tar.gz
emacs-f619ad4ca2ce943d53589469c010e451afab97dd.zip
Merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.trunk613
-rw-r--r--src/Makefile.in4
-rw-r--r--src/alloc.c25
-rw-r--r--src/buffer.c708
-rw-r--r--src/buffer.h155
-rw-r--r--src/bytecode.c23
-rw-r--r--src/callint.c22
-rw-r--r--src/callproc.c53
-rw-r--r--src/casefiddle.c12
-rw-r--r--src/casetab.c10
-rw-r--r--src/category.c8
-rw-r--r--src/category.h2
-rw-r--r--src/character.c4
-rw-r--r--src/character.h12
-rw-r--r--src/charset.c2
-rw-r--r--src/cmds.c24
-rw-r--r--src/coding.c36
-rw-r--r--src/composite.c8
-rw-r--r--src/config.in95
-rw-r--r--src/data.c24
-rw-r--r--src/deps.mk13
-rw-r--r--src/dired.c7
-rw-r--r--src/dispextern.h6
-rw-r--r--src/dispnew.c8
-rw-r--r--src/doc.c2
-rw-r--r--src/editfns.c74
-rw-r--r--src/fileio.c202
-rw-r--r--src/filelock.c14
-rw-r--r--src/filemode.c245
-rw-r--r--src/fns.c12
-rw-r--r--src/font.c2
-rw-r--r--src/frame.c18
-rw-r--r--src/fringe.c18
-rw-r--r--src/getloadavg.c1037
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/indent.c62
-rw-r--r--src/insdel.c62
-rw-r--r--src/intervals.c4
-rw-r--r--src/intervals.h4
-rw-r--r--src/keyboard.c250
-rw-r--r--src/keyboard.h43
-rw-r--r--src/keymap.c40
-rw-r--r--src/lisp.h20
-rw-r--r--src/lread.c33
-rw-r--r--src/m/alpha.h7
-rw-r--r--src/m/amdx86-64.h7
-rw-r--r--src/m/ia64.h7
-rw-r--r--src/m/ibms390.h7
-rw-r--r--src/m/macppc.h7
-rw-r--r--src/m/sparc.h7
-rw-r--r--src/m/template.h7
-rw-r--r--src/m/vax.h10
-rw-r--r--src/macros.c42
-rw-r--r--src/makefile.w32-in18
-rw-r--r--src/marker.c12
-rw-r--r--src/md5.c430
-rw-r--r--src/md5.h148
-rw-r--r--src/minibuf.c22
-rw-r--r--src/msdos.c8
-rw-r--r--src/nsfns.m12
-rw-r--r--src/nsterm.m4
-rw-r--r--src/print.c48
-rw-r--r--src/process.c80
-rw-r--r--src/s/aix4-2.h7
-rw-r--r--src/s/bsd-common.h11
-rw-r--r--src/s/freebsd.h2
-rw-r--r--src/s/hpux10-20.h21
-rw-r--r--src/s/ms-w32.h4
-rw-r--r--src/s/msdos.h11
-rw-r--r--src/s/netbsd.h3
-rw-r--r--src/s/unixware.h10
-rw-r--r--src/s/usg5-4-common.h7
-rw-r--r--src/search.c48
-rw-r--r--src/syntax.c16
-rw-r--r--src/syntax.h6
-rw-r--r--src/term.c23
-rw-r--r--src/termcap.c1
-rw-r--r--src/terminal.c21
-rw-r--r--src/undo.c62
-rw-r--r--src/w32fns.c12
-rw-r--r--src/w32term.c2
-rw-r--r--src/window.c70
-rw-r--r--src/xdisp.c249
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c10
-rw-r--r--src/xftfont.c8
-rw-r--r--src/xmenu.c42
-rw-r--r--src/xrdb.c6
-rw-r--r--src/xsettings.c23
-rw-r--r--src/xterm.c11
90 files changed, 2159 insertions, 3430 deletions
diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk
index 68a12d4f55a..9713a4a6ed5 100644
--- a/src/ChangeLog.trunk
+++ b/src/ChangeLog.trunk
@@ -1,3 +1,574 @@
12011-02-21 Eli Zaretskii <eliz@gnu.org>
2
3 * makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to
4 lib/makefilw.w32-in.
5 ($(BLD)/dired.$(O)): Depend on $(EMACS_ROOT)/lib/filemode.h.
6 (GLOBAL_SOURCES): Remove filemode.c.
7 (OBJ1): Remove $(BLD)/filemode.$(O).
8
92011-02-21 Paul Eggert <eggert@cs.ucla.edu>
10
11 Import filemode module from gnulib.
12 * Makefile.in (base_obj): Remove filemode.o, as it's now in ../lib.
13 * deps.mk (dired.o): Depend on ../lib/filemode.h, too.
14 (filemode.o): Remove; this is now in ../lib.
15 * dired.c: Include <filemode.h>.
16 (filemodestring): Remove now-redundant decl.
17 * config.in: Regenerate.
18
192011-02-20 Eli Zaretskii <eliz@gnu.org>
20
21 * makefile.w32-in ($(BLD)/fns.$(O)): Depend on
22 $(EMACS_ROOT)/lib/md5.h and on stamp_BLD.
23
242011-02-20 Christoph Scholtes <cschol2112@gmail.com>
25
26 * makefile.w32-in: Remove md5.$(O).
27 ($(BLD)/md5.$(O)): Remove prerequisites, moved to
28 lib/makefile.w32-in.
29
302011-02-20 Paul Eggert <eggert@cs.ucla.edu>
31
32 Import crypto/md5 and stdint modules from gnulib.
33 * Makefile.in (base_obj): Remove md5.o, since this file
34 is in lib now.
35 * config.in: Regenerate.
36 * md5.h, md5.h: Move to ../lib.
37 * deps.mk (md5.o): Remove.
38 (fns.o): Depend on ../lib/md5.h, not md5.h.
39
402011-02-19 Eli Zaretskii <eliz@gnu.org>
41
42 * termcap.c (tputs): Don't declare baud_rate.
43
44 * s/msdos.h (strtold): Define to _strtold.
45
462011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
47
48 * process.c (Fstart_process, Fmake_serial_process)
49 (Fmake_network_process, server_accept_connection):
50 Use empty_unibyte_string.
51
52 * alloc.c (make_unibyte_string): Don't SET_UNIBYTE redundantly.
53
54 * lread.c (Qdir_ok): New constant.
55 (syms_of_lread): Initialize it.
56 (openp): Don't ignore directories if the predicate returns dir-ok.
57
582011-02-18 Eli Zaretskii <eliz@gnu.org>
59
60 * xdisp.c (display_line): Fix the change made for bug#7939.
61
62 * terminal.c (create_terminal): Use default-keyboard-coding-system
63 and default-terminal-coding-system to initialize coding systems of
64 the new terminal. (Bug#7840)
65
662011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
67
68 * lisp.h (BYTE_MARK_STACK): New macro.
69 (mark_byte_stack): Only declare if BYTE_MARK_STACK is set.
70
71 * bytecode.c (BYTE_MAINTAIN_TOP): New macros.
72 (struct byte_stack): Only define `top' and `bottom' if used.
73 (mark_byte_stack): Only define if used.
74 (BEFORE_POTENTIAL_GC, AFTER_POTENTIAL_GC): Nullify if BYTE_MAINTAIN_TOP
75 is not set.
76 (Fbyte_code): Don't set `bottom' unless BYTE_MAINTAIN_TOP is set.
77
78 * term.c (OUTPUT_IF): Use OUTPUT.
79
80 * alloc.c (Fgarbage_collect): When using stack scanning, don't
81 redundantly scan byte-code stacks, catchlist, and handlerlist.
82
832011-02-17 Jan Djärv <jan.h.d@swipnet.se>
84
85 * nsfns.m (Fx_create_frame, ns_set_name_as_filename)
86 (Fns_read_file_name): Replace B_ with BVAR.
87
88 * nsterm.m (ns_term_init): Use KVAR.
89
902011-02-16 Eli Zaretskii <eliz@gnu.org>
91
92 * msdos.c (internal_terminal_init): Use KVAR.
93
94 * w32fns.c (Fx_create_frame): Use KVAR.
95
96 * w32term.c (w32_create_terminal): Use KVAR.
97
98 * s/ms-w32.h (MODE_LINE_BINARY_TEXT): Remove.
99 (getloadavg): Declare prototype which was removed from lisp.h.
100
101 * xdisp.c (decode_mode_spec): Don't use MODE_LINE_BINARY_TEXT.
102
103 * fileio.c (Finsert_file_contents, Fwrite_region):
104 Remove references to buffer_file_type.
105 (syms_of_fileio): Don't intern and staticpro
106 find-buffer-file-type.
107
108 * callproc.c (syms_of_callproc): Remove references to
109 buffer_file_type.
110
111 * buffer.c (reset_buffer_local_variables): Don't set
112 buffer_file_type.
113 (init_buffer_once): Likewise.
114 (syms_of_buffer): Don't define buffer-file-type.
115
116 * buffer.h (struct buffer): Remove buffer_file_type.
117
1182011-02-16 Tom Tromey <tromey@parfait>
119
120 * callint.c (Fcall_interactively): Update for change to field names.
121 * doc.c (Fsubstitute_command_keys): Update for change to field names.
122 * cmds.c (Fself_insert_command): Update for change to field names.
123 * keymap.c (Fcurrent_active_maps, Fkey_binding)
124 (Fdescribe_buffer_bindings): Update for change to field names.
125 * macros.c (Fstart_kbd_macro, end_kbd_macro, Fend_kbd_macro)
126 (store_kbd_macro_char, Fcall_last_kbd_macro, Fexecute_kbd_macro):
127 Update for change to field names.
128 * keyboard.c (echo_char, echo_dash, echo_now, cancel_echoing)
129 (echo_length, echo_truncate, cmd_error, command_loop_1)
130 (read_char, kbd_buffer_store_event_hold, make_lispy_event)
131 (menu_bar_items, tool_bar_items, read_char_minibuf_menu_prompt)
132 (read_key_sequence, Fcommand_execute, Fexecute_extended_command)
133 (Fdiscard_input, init_kboard, init_keyboard, mark_kboards):
134 Update for change to field names.
135 * xfns.c (Fx_create_frame): Update for change to field names.
136 * xterm.c (x_connection_closed, x_term_init): Update for change to
137 field names.
138 * term.c (term_get_fkeys_1, CONDITIONAL_REASSIGN, init_tty):
139 Update for change to field names.
140 * window.c (window_scroll_pixel_based, window_scroll_line_based):
141 Update for change to field names.
142 * frame.c (make_frame_without_minibuffer, Fhandle_switch_frame)
143 (delete_frame): Update for change to field names.
144 * lisp.h (DEFVAR_KBOARD): Update for change to field names.
145 * keyboard.h (struct kboard): Rename all Lisp_Object fields.
146 (KBOARD_INTERNAL_FIELD, KVAR): New macros.
147
1482011-02-16 Tom Tromey <tromey@redhat.com>
149
150 * lisp.h (DEFVAR_BUFFER_DEFAULTS): Use BVAR.
151
1522011-02-16 Tom Tromey <tromey@parfait>
153
154 * xfns.c (x_create_tip_frame, Fx_show_tip): Replace B_ with BVAR.
155 * xfaces.c (compute_char_face): Replace B_ with BVAR.
156 * xdisp.c (pos_visible_p, init_iterator, reseat_1)
157 (message_dolog, update_echo_area, ensure_echo_area_buffers)
158 (with_echo_area_buffer, setup_echo_area_for_printing)
159 (set_message_1, update_menu_bar, update_tool_bar)
160 (text_outside_line_unchanged_p, redisplay_internal)
161 (try_scrolling, try_cursor_movement, redisplay_window)
162 (try_window_reusing_current_matrix, row_containing_pos)
163 (try_window_id, get_overlay_arrow_glyph_row, display_line)
164 (Fcurrent_bidi_paragraph_direction, display_mode_lines)
165 (decode_mode_spec_coding, decode_mode_spec, display_count_lines)
166 (get_window_cursor_type, note_mouse_highlight): Replace B_ with
167 BVAR.
168 * window.c (window_display_table, unshow_buffer, window_loop)
169 (window_min_size_2, set_window_buffer, Fset_window_buffer)
170 (select_window, Fforce_window_update, temp_output_buffer_show)
171 (Fset_window_configuration, save_window_save): Replace B_ with
172 BVAR.
173 * w32fns.c (x_create_tip_frame, Fx_show_tip, Fw32_shell_execute):
174 Replace B_ with BVAR.
175 * undo.c (record_point, record_insert, record_delete)
176 (record_marker_adjustment, record_first_change)
177 (record_property_change, Fundo_boundary, truncate_undo_list)
178 (Fprimitive_undo): Replace B_ with BVAR.
179 * syntax.h (Vstandard_syntax_table, CURRENT_SYNTAX_TABLE)
180 (SETUP_BUFFER_SYNTAX_TABLE): Replace B_ with BVAR.
181 * syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table)
182 (Fset_syntax_table, Fmodify_syntax_entry, skip_chars)
183 (skip_syntaxes, scan_lists): Replace B_ with BVAR.
184 * search.c (compile_pattern_1, compile_pattern, looking_at_1)
185 (string_match_1, fast_looking_at, newline_cache_on_off)
186 (search_command, search_buffer, simple_search, boyer_moore)
187 (Freplace_match): Replace B_ with BVAR.
188 * process.c (get_process, list_processes_1, Fstart_process)
189 (Fmake_serial_process, Fmake_network_process)
190 (read_process_output, send_process, exec_sentinel)
191 (status_notify, setup_process_coding_systems): Replace B_ with
192 BVAR.
193 * print.c (PRINTDECLARE, PRINTPREPARE, PRINTFINISH, printchar)
194 (strout, print_string, temp_output_buffer_setup, print_object):
195 Replace B_ with BVAR.
196 * msdos.c (IT_frame_up_to_date): Replace B_ with BVAR.
197 * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer):
198 Replace B_ with BVAR.
199 * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted)
200 (set_marker_both, set_marker_restricted_both, unchain_marker):
201 Replace B_ with BVAR.
202 * lread.c (readchar, unreadchar, openp, readevalloop)
203 (Feval_buffer, Feval_region): Replace B_ with BVAR.
204 * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE): Replace B_ with BVAR.
205 * keymap.c (Flocal_key_binding, Fuse_local_map)
206 (Fcurrent_local_map, push_key_description)
207 (Fdescribe_buffer_bindings): Replace B_ with BVAR.
208 * keyboard.c (command_loop_1, read_char_minibuf_menu_prompt)
209 (read_key_sequence): Replace B_ with BVAR.
210 * intervals.h (TEXT_PROP_MEANS_INVISIBLE): Replace B_ with BVAR.
211 * intervals.c (set_point_both, get_local_map): Replace B_ with
212 BVAR.
213 * insdel.c (check_markers, insert_char, insert_1_both)
214 (insert_from_string_1, insert_from_gap, insert_from_buffer_1)
215 (adjust_after_replace, replace_range, del_range_2)
216 (modify_region, prepare_to_modify_buffer)
217 (Fcombine_after_change_execute): Replace B_ with BVAR.
218 * indent.c (buffer_display_table, recompute_width_table)
219 (width_run_cache_on_off, current_column, scan_for_column)
220 (Findent_to, position_indentation, compute_motion, vmotion):
221 Replace B_ with BVAR.
222 * fringe.c (get_logical_cursor_bitmap)
223 (get_logical_fringe_bitmap, update_window_fringes): Replace B_
224 with BVAR.
225 * frame.c (make_frame_visible_1): Replace B_ with BVAR.
226 * font.c (font_at): Replace B_ with BVAR.
227 * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5):
228 Replace B_ with BVAR.
229 * filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer)
230 (unlock_buffer): Replace B_ with BVAR.
231 * fileio.c (Fexpand_file_name, Ffile_directory_p)
232 (Ffile_regular_p, Ffile_selinux_context)
233 (Fset_file_selinux_context, Ffile_modes, Fset_file_modes)
234 (Fset_file_times, Ffile_newer_than_file_p, decide_coding_unwind)
235 (Finsert_file_contents, choose_write_coding_system)
236 (Fwrite_region, build_annotations, Fverify_visited_file_modtime)
237 (Fset_visited_file_modtime, auto_save_error, auto_save_1)
238 (Fdo_auto_save, Fset_buffer_auto_saved): Replace B_ with BVAR.
239 * editfns.c (region_limit, Fmark_marker, save_excursion_save)
240 (save_excursion_restore, Fprevious_char, Fchar_before)
241 (general_insert_function, Finsert_char, Finsert_byte)
242 (make_buffer_string_both, Finsert_buffer_substring)
243 (Fcompare_buffer_substrings, subst_char_in_region_unwind)
244 (subst_char_in_region_unwind_1, Fsubst_char_in_region)
245 (Ftranslate_region_internal, save_restriction_restore)
246 (Fchar_equal): Replace B_ with BVAR.
247 * dispnew.c (Fframe_or_buffer_changed_p): Replace B_ with BVAR.
248 * dispextern.h (WINDOW_WANTS_MODELINE_P)
249 (WINDOW_WANTS_HEADER_LINE_P): Replace B_ with BVAR.
250 * dired.c (directory_files_internal): Replace B_ with BVAR.
251 * data.c (swap_in_symval_forwarding, set_internal)
252 (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p):
253 Replace B_ with BVAR.
254 * composite.c (fill_gstring_header)
255 (composition_compute_stop_pos, composition_adjust_point)
256 (Ffind_composition_internal): Replace B_ with BVAR.
257 * coding.c (decode_coding, encode_coding)
258 (make_conversion_work_buffer, decode_coding_gap)
259 (decode_coding_object, encode_coding_object)
260 (Fdetect_coding_region, Ffind_coding_systems_region_internal)
261 (Funencodable_char_position, Fcheck_coding_systems_region):
262 Replace B_ with BVAR.
263 * cmds.c (Fself_insert_command, internal_self_insert): Replace B_
264 with BVAR.
265 * charset.c (Ffind_charset_region): Replace B_ with BVAR.
266 * character.h (FETCH_CHAR_ADVANCE, INC_BOTH, DEC_BOTH)
267 (ASCII_CHAR_WIDTH): Replace B_ with BVAR.
268 * character.c (chars_in_text, Fget_byte): Replace B_ with BVAR.
269 * category.h (Vstandard_category_table): Replace B_ with BVAR.
270 * category.c (check_category_table, Fcategory_table)
271 (Fset_category_table, char_category_set): Replace B_ with BVAR.
272 * casetab.c (Fcurrent_case_table, set_case_table): Replace B_ with
273 BVAR.
274 * casefiddle.c (casify_object, casify_region): Replace B_ with
275 BVAR.
276 * callproc.c (Fcall_process, Fcall_process_region): Replace B_
277 with BVAR.
278 * callint.c (check_mark, Fcall_interactively): Replace B_ with
279 BVAR.
280 * bytecode.c (Fbyte_code): Replace B_ with BVAR.
281 * buffer.h (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE, BVAR): Replace B_
282 with BVAR.
283 * buffer.c (Fbuffer_live_p, Fget_file_buffer)
284 (get_truename_buffer, Fget_buffer_create)
285 (clone_per_buffer_values, Fmake_indirect_buffer, reset_buffer)
286 (reset_buffer_local_variables, Fbuffer_name, Fbuffer_file_name)
287 (Fbuffer_local_value, buffer_lisp_local_variables)
288 (Fset_buffer_modified_p, Frestore_buffer_modified_p)
289 (Frename_buffer, Fother_buffer, Fbuffer_enable_undo)
290 (Fkill_buffer, Fset_buffer_major_mode, set_buffer_internal_1)
291 (set_buffer_temp, Fset_buffer, set_buffer_if_live)
292 (Fbarf_if_buffer_read_only, Fbury_buffer, Ferase_buffer)
293 (Fbuffer_swap_text, swapfield_, Fbuffer_swap_text)
294 (Fset_buffer_multibyte, swap_out_buffer_local_variables)
295 (record_overlay_string, overlay_strings, init_buffer_once)
296 (init_buffer, syms_of_buffer): Replace B_ with BVAR.
297
2982011-02-16 Eli Zaretskii <eliz@gnu.org>
299
300 * xdisp.c (redisplay_internal): Resynchronize `w' if the selected
301 window is changed inside calls to do_pending_window_change.
302 (Bug#8020)
303
3042011-02-16 Paul Eggert <eggert@cs.ucla.edu>
305
306 Remove no-longer needed getloadavg symbols.
307 * m/alpha.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
308 * m/amdx86-64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
309 * m/ia64.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
310 * m/ibms390.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
311 * m/macppc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
312 * m/sparc.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
313 * m/template.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
314 * m/vax.h (LOAD_AVE_TYPE, LOAD_AVE_CVT): Remove.
315 * s/aix4-2.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
316 * s/bsd-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove #undef.
317 * s/hpux10-20.h (KERNEL_FILE, LOAD_AVE_TYPE, LOAD_AVE_CVT):
318 (LDAV_SYMBOL): Remove.
319 * s/unixware.h (LOAD_AVE_TYPE, LOAD_AVE_CVT, FSCALE): Remove.
320 * s/usg5-4-common.h (KERNEL_FILE, LDAV_SYMBOL): Remove.
321
322 Import getloadavg module from gnulib.
323 * deps.mk (getloadavg.o): Remove; gnulib now does this.
324 * lisp.h (getloadavg) [!defined HAVE_GETLOADAVG]: Remove; gnulib
325 now does this.
326 * src/s/freebsd.h (HAVE_GETLOADAVG): Remove; gnulib now does this.
327 * src/s/netbsd.h (HAVE_GETLOADAVG): Likewise.
328 * config.in: Regenerate.
329
3302011-02-15 Eli Zaretskii <eliz@gnu.org>
331
332 * nsfns.m (ns_set_name_as_filename, Fns_read_file_name): Use B_.
333
3342011-02-14 Michael Welsh Duggan <md5i@md5i.com>
335
336 * print.c (float_to_string): Ensure that a decimal point is
337 printed if using dtoastr (Bug#8033).
338
3392011-02-14 Eli Zaretskii <eliz@gnu.org>
340
341 * msdos.c (IT_frame_up_to_date):
342 * s/msdos.h (MODE_LINE_BINARY_TEXT): Use B_ for the MS-DOS build.
343
344 * dired.c (directory_files_internal):
345 * fileio.c (Finsert_file_contents):
346 * insdel.c (prepare_to_modify_buffer):
347 * xdisp.c (pos_visible_p):
348 * s/ms-w32.h (MODE_LINE_BINARY_TEXT):
349 * w32fns.c (Fw32_shell_execute, Fx_show_tip, x_create_tip_frame):
350 Use B_ for the MS-Windows build.
351
3522011-02-14 Jan Djärv <jan.h.d@swipnet.se>
353
354 * xrdb.c (x_load_resources): For LUCID and XFT, don't put a
355 resource that specifies helvetica for menus and dialogs.
356
357 * xmenu.c (apply_systemfont_to_dialog): Apply to *dialog.font.
358 (apply_systemfont_to_menu): Set resources *menubar*font and
359 *popup*font. Remove defflt.
360 (set_frame_menubar, create_and_show_popup_menu):
361 Call apply_systemfont_to_menu before lw_create_widget.
362
3632011-02-14 Tom Tromey <tromey@redhat.com>
364
365 * buffer.c (init_buffer_once, syms_of_buffer): Use B_ in DOS_NT case.
366
367 * keyboard.h: Remove obsolete comment.
368
3692011-02-14 Tom Tromey <tromey@parfait>
370
371 * composite.c (fill_gstring_header)
372 (composition_compute_stop_pos, composition_adjust_point)
373 (Ffind_composition_internal): Use B_.
374 * intervals.c (set_point_both, get_local_map): Use B_.
375 * callproc.c (Fcall_process, Fcall_process_region): Use B_.
376 * process.c (get_process, list_processes_1, Fstart_process)
377 (Fmake_serial_process, Fmake_network_process)
378 (read_process_output, send_process, exec_sentinel)
379 (status_notify, setup_process_coding_systems): Use B_.
380 * bytecode.c (Fbyte_code): Use B_.
381 * syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table)
382 (Fset_syntax_table, Fmodify_syntax_entry, skip_chars)
383 (skip_syntaxes, scan_lists): Use B_.
384 * lread.c (readchar, unreadchar, openp, readevalloop)
385 (Feval_buffer, Feval_region): Use B_.
386 * print.c (printchar, strout, print_string, PRINTDECLARE)
387 (PRINTPREPARE, PRINTFINISH, temp_output_buffer_setup)
388 (print_object): Use B_.
389 * font.c (font_at): Use B_.
390 * fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5):
391 Use B_.
392 * callint.c (check_mark, Fcall_interactively): Use B_.
393 * editfns.c (region_limit, Fmark_marker, save_excursion_save)
394 (save_excursion_restore, Fprevious_char, Fchar_before)
395 (general_insert_function, Finsert_char, Finsert_byte)
396 (make_buffer_string_both, Finsert_buffer_substring)
397 (Fcompare_buffer_substrings, subst_char_in_region_unwind)
398 (subst_char_in_region_unwind_1, Fsubst_char_in_region)
399 (Ftranslate_region_internal, save_restriction_restore)
400 (Fchar_equal): Use B_.
401 * data.c (swap_in_symval_forwarding, set_internal)
402 (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p):
403 Use B_.
404 * undo.c (record_point, record_insert, record_delete)
405 (record_marker_adjustment, record_first_change)
406 (record_property_change, Fundo_boundary, truncate_undo_list)
407 (Fprimitive_undo): Use B_.
408 * search.c (compile_pattern_1, compile_pattern, looking_at_1)
409 (string_match_1, fast_looking_at, newline_cache_on_off)
410 (search_command, search_buffer, simple_search, boyer_moore)
411 (Freplace_match): Use B_.
412 * indent.c (buffer_display_table, recompute_width_table)
413 (width_run_cache_on_off, current_column, scan_for_column)
414 (Findent_to, position_indentation, compute_motion, vmotion):
415 Use B_.
416 * casefiddle.c (casify_object, casify_region): Use B_.
417 * casetab.c (Fcurrent_case_table, set_case_table): Use B_.
418 * cmds.c (Fself_insert_command, internal_self_insert): Use B_.
419 * fileio.c (Fexpand_file_name, Ffile_directory_p)
420 (Ffile_regular_p, Ffile_selinux_context)
421 (Fset_file_selinux_context, Ffile_modes, Fset_file_modes)
422 (Fset_file_times, Ffile_newer_than_file_p, decide_coding_unwind)
423 (Finsert_file_contents, choose_write_coding_system)
424 (Fwrite_region, build_annotations, Fverify_visited_file_modtime)
425 (Fset_visited_file_modtime, auto_save_error, auto_save_1)
426 (Fdo_auto_save, Fset_buffer_auto_saved): Use B_.
427 * minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Use B_.
428 * marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted)
429 (set_marker_both, set_marker_restricted_both, unchain_marker):
430 Use B_.
431 * insdel.c (check_markers, insert_char, insert_1_both)
432 (insert_from_string_1, insert_from_gap, insert_from_buffer_1)
433 (adjust_after_replace, replace_range, del_range_2)
434 (modify_region, prepare_to_modify_buffer)
435 (Fcombine_after_change_execute): Use B_.
436 * filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer)
437 (unlock_buffer): Use B_.
438 * keymap.c (Flocal_key_binding, Fuse_local_map)
439 (Fcurrent_local_map, push_key_description)
440 (Fdescribe_buffer_bindings): Use B_.
441 * keyboard.c (command_loop_1, read_char_minibuf_menu_prompt)
442 (read_key_sequence): Use B_.
443 * fringe.c (get_logical_cursor_bitmap)
444 (get_logical_fringe_bitmap, update_window_fringes): Use B_.
445 * xfns.c (x_create_tip_frame, Fx_show_tip): Use B_.
446 * xfaces.c (compute_char_face): Use B_.
447 * character.c (chars_in_text, Fget_byte): Use B_.
448 * category.c (check_category_table, Fcategory_table)
449 (Fset_category_table, char_category_set): Use B_.
450 * coding.c (decode_coding, encode_coding)
451 (make_conversion_work_buffer, decode_coding_gap)
452 (decode_coding_object, encode_coding_object)
453 (Fdetect_coding_region, Ffind_coding_systems_region_internal)
454 (Funencodable_char_position, Fcheck_coding_systems_region):
455 Use B_.
456 * charset.c (Ffind_charset_region): Use B_.
457 * window.c (window_display_table, unshow_buffer, window_loop)
458 (window_min_size_2, set_window_buffer, Fset_window_buffer)
459 (select_window, Fforce_window_update, temp_output_buffer_show)
460 (Fset_window_configuration, save_window_save): Use B_.
461 * xdisp.c (pos_visible_p, init_iterator, reseat_1)
462 (message_dolog, update_echo_area, ensure_echo_area_buffers)
463 (with_echo_area_buffer, setup_echo_area_for_printing)
464 (set_message_1, update_menu_bar, update_tool_bar)
465 (text_outside_line_unchanged_p, redisplay_internal)
466 (try_scrolling, try_cursor_movement, redisplay_window)
467 (try_window_reusing_current_matrix, row_containing_pos)
468 (try_window_id, get_overlay_arrow_glyph_row, display_line)
469 (Fcurrent_bidi_paragraph_direction, display_mode_lines)
470 (decode_mode_spec_coding, decode_mode_spec, display_count_lines)
471 (get_window_cursor_type, note_mouse_highlight): Use B_.
472 * frame.c (make_frame_visible_1): Use B_.
473 * dispnew.c (Fframe_or_buffer_changed_p): Use B_.
474 * dispextern.h (WINDOW_WANTS_HEADER_LINE_P)
475 (WINDOW_WANTS_MODELINE_P): Use B_.
476 * syntax.h (Vstandard_syntax_table): Update.
477 (CURRENT_SYNTAX_TABLE, SETUP_BUFFER_SYNTAX_TABLE): Use B_.
478 * intervals.h (TEXT_PROP_MEANS_INVISIBLE): Update.
479 (TEXT_PROP_MEANS_INVISIBLE): Use B_.
480 * character.h (FETCH_CHAR_ADVANCE): Update.
481 (INC_BOTH, ASCII_CHAR_WIDTH, DEC_BOTH): Use B_.
482 * category.h (Vstandard_category_table): Update.
483 * lisp.h (DEFVAR_BUFFER_DEFAULTS): Update for change to field
484 names.
485 (DOWNCASE_TABLE, UPCASE_TABLE): Use B_.
486 * buffer.c (swapfield_): New macro.
487 (Fbuffer_swap_text): Use swapfield_ where appropriate.
488 (Fbuffer_live_p, Fget_file_buffer, get_truename_buffer)
489 (Fget_buffer_create, clone_per_buffer_values)
490 (Fmake_indirect_buffer, reset_buffer)
491 (reset_buffer_local_variables, Fbuffer_name, Fbuffer_file_name)
492 (Fbuffer_local_value, buffer_lisp_local_variables)
493 (Fset_buffer_modified_p, Frestore_buffer_modified_p)
494 (Frename_buffer, Fother_buffer, Fbuffer_enable_undo)
495 (Fkill_buffer, Fset_buffer_major_mode, set_buffer_internal_1)
496 (set_buffer_temp, Fset_buffer, set_buffer_if_live)
497 (Fbarf_if_buffer_read_only, Fbury_buffer, Ferase_buffer)
498 (Fbuffer_swap_text, Fset_buffer_multibyte)
499 (swap_out_buffer_local_variables, record_overlay_string)
500 (overlay_strings, init_buffer_once, init_buffer, syms_of_buffer):
501 Use B_.
502 * buffer.h (struct buffer): Rename all Lisp_Object fields.
503 (BUFFER_INTERNAL_FIELD, B_): New macro.
504 (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE): Use B_.
505
5062011-02-14 Jan Djärv <jan.h.d@swipnet.se>
507
508 * gtkutil.c (xg_tool_bar_menu_proxy): Handle case when tool bar label
509 is null.
510
5112011-02-13 Jan Djärv <jan.h.d@swipnet.se>
512
513 * callproc.c (Fcall_process):
514 * process.c (create_process): Replace Gtk with GConf in SIGPIPE
515 comment.
516
5172011-02-12 Martin Rudalics <rudalics@gmx.at>
518
519 * window.c (select_window): Check inhibit_point_swap argument when
520 deciding whether to return immediately.
521
5222011-02-12 Jan Djärv <jan.h.d@swipnet.se>
523
524 * nsterm.m (setFrame, initFrame): Make sure pixel_height doesn't become
525 zero (Bug#7348).
526
5272011-02-12 Chong Yidong <cyd@stupidchicken.com>
528
529 * config.in (TERMINFO): New definition.
530
531 * s/netbsd.h: Use it to choose between terminfo and termcap
532 (Bug#7642).
533
5342011-02-12 Paul Eggert <eggert@cs.ucla.edu>
535
536 * md5.c (md5_process_bytes): Use sizeof, not __alignof__.
537 The difference doesn't matter here, in practice, and sizeof is
538 more portable to non-GCC compilers. Also, this makes the code
539 match the already-existing comment.
540
5412011-02-12 Andreas Schwab <schwab@linux-m68k.org>
542
543 * process.c (create_process): Reset SIGPIPE handler in the child.
544 * callproc.c (Fcall_process): Likewise. (Bug#5238)
545
5462011-02-12 Eli Zaretskii <eliz@gnu.org>
547
548 * xdisp.c <this_line_min_pos>: New variable.
549 (move_it_in_display_line_to): Record in this_line_min_pos the
550 smallest position iterated across.
551 (display_line): Use this_line_min_pos to record the smallest
552 position in the line even if it is not displayed due to
553 hscrolling. (Bug#7939)
554
5552011-02-12 Paul Eggert <eggert@cs.ucla.edu>
556
557 Port to Sun C 5.11, which has __attribute__ ((__aligned (N))).
558 * md5.h (ATTRIBUTE_ALIGNED): New macro.
559 (struct md5_ctx): Use it.
560
561 Port to Solaris 10, which doesn't support FC_HINT_STYLE.
562 * xftfont.c (FC_HINT_STYLE): #define to "hintstyle" if not
563 defined.
564 * xsettings.c (parse_settings, apply_xft_settings): Don't assume
565 FC_HINT_STYLE is supported.
566
5672011-02-11 Jan Djärv <jan.h.d@swipnet.se>
568
569 * xterm.c (x_set_frame_alpha): Access data before it is free:d.
570 Make sure we don't do x_catch_errors twice.
571
12011-02-10 Glenn Morris <rgm@gnu.org> 5722011-02-10 Glenn Morris <rgm@gnu.org>
2 573
3 * Makefile.in (really-lwlib): Depend on globals.h, for parallel builds. 574 * Makefile.in (really-lwlib): Depend on globals.h, for parallel builds.
@@ -112,8 +683,8 @@
112 callers changed. 683 callers changed.
113 * editfns.c (general_insert_function): Change signature to 684 * editfns.c (general_insert_function): Change signature to
114 match changes to insert functions' signatures. 685 match changes to insert functions' signatures.
115 * keymap.c (map_keymap_char_table_item, map_keymap_internal): Use 686 * keymap.c (map_keymap_char_table_item, map_keymap_internal):
116 explicit cast when converting between void * and function pointer 687 Use explicit cast when converting between void * and function pointer
117 types, as C89 requires this. 688 types, as C89 requires this.
118 689
1192011-02-05 Paul Eggert <eggert@cs.ucla.edu> 6902011-02-05 Paul Eggert <eggert@cs.ucla.edu>
@@ -233,7 +804,7 @@
2332011-02-01 Paul Eggert <eggert@cs.ucla.edu> 8042011-02-01 Paul Eggert <eggert@cs.ucla.edu>
234 805
235 format-time-string now supports subsecond time stamp resolution 806 format-time-string now supports subsecond time stamp resolution
236 * editfns.c (emacs_nmemftime): Renamed from emacs_memftimeu, 807 * editfns.c (emacs_nmemftime): Rename from emacs_memftimeu,
237 for consistency with its new argument and with gnulib nstrftime. 808 for consistency with its new argument and with gnulib nstrftime.
238 All callers changed. New argument NS. 809 All callers changed. New argument NS.
239 (Fformat_time_string): Check that the time argument's microseconds 810 (Fformat_time_string): Check that the time argument's microseconds
@@ -563,11 +1134,11 @@
563 (history_delete_duplicates, inhibit_x_resources) 1134 (history_delete_duplicates, inhibit_x_resources)
564 (last_nonmenu_event, load_in_progress, max_specpdl_size) 1135 (last_nonmenu_event, load_in_progress, max_specpdl_size)
565 (minibuffer_auto_raise, print_escape_newlines, scroll_margin) 1136 (minibuffer_auto_raise, print_escape_newlines, scroll_margin)
566 (use_dialog_box, use_file_dialog): Remove declaration. Include 1137 (use_dialog_box, use_file_dialog): Remove declaration.
567 globals.h. 1138 Include globals.h.
568 * keymap.h (Voverriding_local_map) 1139 * keymap.h (Voverriding_local_map)
569 (Voverriding_local_map_menu_flag, meta_prefix_char): Remove 1140 (Voverriding_local_map_menu_flag, meta_prefix_char):
570 declaration. 1141 Remove declaration.
571 * keyboard.h (Vdouble_click_time, Vfunction_key_map) 1142 * keyboard.h (Vdouble_click_time, Vfunction_key_map)
572 (Vinput_method_function, Vkey_translation_map) 1143 (Vinput_method_function, Vkey_translation_map)
573 (Vlucid_menu_bar_dirty_flag, Vthis_original_command) 1144 (Vlucid_menu_bar_dirty_flag, Vthis_original_command)
@@ -585,16 +1156,16 @@
585 (focus_follows_mouse): Remove declaration. 1156 (focus_follows_mouse): Remove declaration.
586 * fontset.h (Valternate_fontname_alist, Vfontset_alias_alist) 1157 * fontset.h (Valternate_fontname_alist, Vfontset_alias_alist)
587 (Vignore_relative_composition, Votf_script_alist) 1158 (Vignore_relative_composition, Votf_script_alist)
588 (Vuse_default_ascent, Vvertical_centering_font_regexp): Remove 1159 (Vuse_default_ascent, Vvertical_centering_font_regexp):
589 declaration. 1160 Remove declaration.
590 * font.h (Vfont_log): Remove declaration. 1161 * font.h (Vfont_log): Remove declaration.
591 * dosfns.h (Vdos_display_scancodes, Vdos_version) 1162 * dosfns.h (Vdos_display_scancodes, Vdos_version)
592 (Vdos_windows_version, dos_codepage, dos_country_code) 1163 (Vdos_windows_version, dos_codepage, dos_country_code)
593 (dos_decimal_point, dos_hyper_key, dos_keyboard_layout) 1164 (dos_decimal_point, dos_hyper_key, dos_keyboard_layout)
594 (dos_keypad_mode, dos_super_key, dos_timezone_offset): Remove 1165 (dos_keypad_mode, dos_super_key, dos_timezone_offset):
595 declaration. 1166 Remove declaration.
596 * disptab.h (Vglyph_table, Vstandard_display_table): Remove 1167 * disptab.h (Vglyph_table, Vstandard_display_table):
597 declaration. 1168 Remove declaration.
598 * dispextern.h (Vface_remapping_alist, Vglyphless_char_display) 1169 * dispextern.h (Vface_remapping_alist, Vglyphless_char_display)
599 (Vmouse_autoselect_window, Voverflow_newline_into_fringe) 1170 (Vmouse_autoselect_window, Voverflow_newline_into_fringe)
600 (Vshow_trailing_whitespace, Vtool_bar_button_margin) 1171 (Vshow_trailing_whitespace, Vtool_bar_button_margin)
@@ -622,10 +1193,10 @@
622 (Vselect_safe_coding_system_function) 1193 (Vselect_safe_coding_system_function)
623 (Vtranslation_table_for_input, coding_system_require_warning) 1194 (Vtranslation_table_for_input, coding_system_require_warning)
624 (eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided) 1195 (eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided)
625 (eol_mnemonic_unix, inherit_process_coding_system): Remove 1196 (eol_mnemonic_unix, inherit_process_coding_system):
626 declaration. 1197 Remove declaration.
627 * charset.h (Vcharset_list, Vcurrent_iso639_language): Remove 1198 * charset.h (Vcharset_list, Vcurrent_iso639_language):
628 declaration. 1199 Remove declaration.
629 * character.h (Vauto_fill_chars, Vchar_direction_table) 1200 * character.h (Vauto_fill_chars, Vchar_direction_table)
630 (Vchar_script_table, Vchar_width_table, Vprintable_chars) 1201 (Vchar_script_table, Vchar_width_table, Vprintable_chars)
631 (Vscript_representative_chars, Vtranslation_table_vector) 1202 (Vscript_representative_chars, Vtranslation_table_vector)
@@ -740,8 +1311,8 @@
740 (w32_strict_fontnames, w32_strict_painting): Remove. 1311 (w32_strict_fontnames, w32_strict_painting): Remove.
741 (Vhourglass_delay, Vmenu_bar_mode, Vtool_bar_mode) 1312 (Vhourglass_delay, Vmenu_bar_mode, Vtool_bar_mode)
742 (Vw32_recognize_altgr, Vwindow_system_version) 1313 (Vw32_recognize_altgr, Vwindow_system_version)
743 (w32_num_mouse_buttons, w32_use_visible_system_caret): Remove 1314 (w32_num_mouse_buttons, w32_use_visible_system_caret):
744 declaration. 1315 Remove declaration.
745 * w32console.c (syms_of_ntterm): Update. 1316 * w32console.c (syms_of_ntterm): Update.
746 (w32_use_full_screen_buffer): Remove. 1317 (w32_use_full_screen_buffer): Remove.
747 (Vtty_defined_color_alist): Remove declaration. 1318 (Vtty_defined_color_alist): Remove declaration.
@@ -1572,7 +2143,7 @@
1572 2143
1573 * gtkutil.c (menubar_map_cb): New function (Bug#7425). 2144 * gtkutil.c (menubar_map_cb): New function (Bug#7425).
1574 (xg_update_frame_menubar): Connect signal map to menubar_map_cb. 2145 (xg_update_frame_menubar): Connect signal map to menubar_map_cb.
1575 Use 23 as menubar height if 0. (Bug#7425). 2146 Use 23 as menubar height if 0. (Bug#7425).
1576 2147
15772010-11-26 Eli Zaretskii <eliz@gnu.org> 21482010-11-26 Eli Zaretskii <eliz@gnu.org>
1578 2149
@@ -2579,7 +3150,7 @@
2579 is more portable. 3150 is more portable.
2580 3151
2581 * keyboard.c (gobble_input): Move call of xd_read_queued_messages ... 3152 * keyboard.c (gobble_input): Move call of xd_read_queued_messages ...
2582 (kbd_buffer_get_event): ... here. This is needed for cygwin, which 3153 (kbd_buffer_get_event): ... here. This is needed for cygwin, which
2583 has not defined SIGIO. 3154 has not defined SIGIO.
2584 3155
25852010-10-08 Chong Yidong <cyd@stupidchicken.com> 31562010-10-08 Chong Yidong <cyd@stupidchicken.com>
diff --git a/src/Makefile.in b/src/Makefile.in
index fda65be7084..e1195968f7f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -347,14 +347,14 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
347 cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \ 347 cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
348 emacs.o keyboard.o macros.o keymap.o sysdep.o \ 348 emacs.o keyboard.o macros.o keymap.o sysdep.o \
349 buffer.o filelock.o insdel.o marker.o \ 349 buffer.o filelock.o insdel.o marker.o \
350 minibuf.o fileio.o dired.o filemode.o \ 350 minibuf.o fileio.o dired.o \
351 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \ 351 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
352 alloc.o data.o doc.o editfns.o callint.o \ 352 alloc.o data.o doc.o editfns.o callint.o \
353 eval.o floatfns.o fns.o font.o print.o lread.o \ 353 eval.o floatfns.o fns.o font.o print.o lread.o \
354 syntax.o $(UNEXEC_OBJ) bytecode.o \ 354 syntax.o $(UNEXEC_OBJ) bytecode.o \
355 process.o gnutls.o callproc.o \ 355 process.o gnutls.o callproc.o \
356 region-cache.o sound.o atimer.o \ 356 region-cache.o sound.o atimer.o \
357 doprnt.o intervals.o textprop.o composite.o md5.o xml.o \ 357 doprnt.o intervals.o textprop.o composite.o xml.o \
358 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) 358 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ)
359obj = $(base_obj) $(NS_OBJC_OBJ) 359obj = $(base_obj) $(NS_OBJC_OBJ)
360 360
diff --git a/src/alloc.c b/src/alloc.c
index 4c29ce0b4ec..81a17b5c13b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2301,7 +2301,6 @@ make_unibyte_string (const char *contents, EMACS_INT length)
2301 register Lisp_Object val; 2301 register Lisp_Object val;
2302 val = make_uninit_string (length); 2302 val = make_uninit_string (length);
2303 memcpy (SDATA (val), contents, length); 2303 memcpy (SDATA (val), contents, length);
2304 STRING_SET_UNIBYTE (val);
2305 return val; 2304 return val;
2306} 2305}
2307 2306
@@ -3943,7 +3942,7 @@ live_buffer_p (struct mem_node *m, void *p)
3943 must not have been killed. */ 3942 must not have been killed. */
3944 return (m->type == MEM_TYPE_BUFFER 3943 return (m->type == MEM_TYPE_BUFFER
3945 && p == m->start 3944 && p == m->start
3946 && !NILP (((struct buffer *) p)->name)); 3945 && !NILP (((struct buffer *) p)->BUFFER_INTERNAL_FIELD (name)));
3947} 3946}
3948 3947
3949#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */ 3948#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */
@@ -4899,8 +4898,6 @@ returns nil, because real GC can't be done. */)
4899 (void) 4898 (void)
4900{ 4899{
4901 register struct specbinding *bind; 4900 register struct specbinding *bind;
4902 struct catchtag *catch;
4903 struct handler *handler;
4904 char stack_top_variable; 4901 char stack_top_variable;
4905 register int i; 4902 register int i;
4906 int message_p; 4903 int message_p;
@@ -4929,11 +4926,11 @@ returns nil, because real GC can't be done. */)
4929 turned off in that buffer. Calling truncate_undo_list on 4926 turned off in that buffer. Calling truncate_undo_list on
4930 Qt tends to return NULL, which effectively turns undo back on. 4927 Qt tends to return NULL, which effectively turns undo back on.
4931 So don't call truncate_undo_list if undo_list is Qt. */ 4928 So don't call truncate_undo_list if undo_list is Qt. */
4932 if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt)) 4929 if (! NILP (nextb->BUFFER_INTERNAL_FIELD (name)) && ! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
4933 truncate_undo_list (nextb); 4930 truncate_undo_list (nextb);
4934 4931
4935 /* Shrink buffer gaps, but skip indirect and dead buffers. */ 4932 /* Shrink buffer gaps, but skip indirect and dead buffers. */
4936 if (nextb->base_buffer == 0 && !NILP (nextb->name) 4933 if (nextb->base_buffer == 0 && !NILP (nextb->BUFFER_INTERNAL_FIELD (name))
4937 && ! nextb->text->inhibit_shrinking) 4934 && ! nextb->text->inhibit_shrinking)
4938 { 4935 {
4939 /* If a buffer's gap size is more than 10% of the buffer 4936 /* If a buffer's gap size is more than 10% of the buffer
@@ -5030,7 +5027,9 @@ returns nil, because real GC can't be done. */)
5030 mark_object (tail->var[i]); 5027 mark_object (tail->var[i]);
5031 } 5028 }
5032 mark_byte_stack (); 5029 mark_byte_stack ();
5033#endif 5030 {
5031 struct catchtag *catch;
5032 struct handler *handler;
5034 5033
5035 for (catch = catchlist; catch; catch = catch->next) 5034 for (catch = catchlist; catch; catch = catch->next)
5036 { 5035 {
@@ -5042,7 +5041,9 @@ returns nil, because real GC can't be done. */)
5042 mark_object (handler->handler); 5041 mark_object (handler->handler);
5043 mark_object (handler->var); 5042 mark_object (handler->var);
5044 } 5043 }
5044 }
5045 mark_backtrace (); 5045 mark_backtrace ();
5046#endif
5046 5047
5047#ifdef HAVE_WINDOW_SYSTEM 5048#ifdef HAVE_WINDOW_SYSTEM
5048 mark_fringe_data (); 5049 mark_fringe_data ();
@@ -5066,10 +5067,10 @@ returns nil, because real GC can't be done. */)
5066 turned off in that buffer. Calling truncate_undo_list on 5067 turned off in that buffer. Calling truncate_undo_list on
5067 Qt tends to return NULL, which effectively turns undo back on. 5068 Qt tends to return NULL, which effectively turns undo back on.
5068 So don't call truncate_undo_list if undo_list is Qt. */ 5069 So don't call truncate_undo_list if undo_list is Qt. */
5069 if (! EQ (nextb->undo_list, Qt)) 5070 if (! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
5070 { 5071 {
5071 Lisp_Object tail, prev; 5072 Lisp_Object tail, prev;
5072 tail = nextb->undo_list; 5073 tail = nextb->BUFFER_INTERNAL_FIELD (undo_list);
5073 prev = Qnil; 5074 prev = Qnil;
5074 while (CONSP (tail)) 5075 while (CONSP (tail))
5075 { 5076 {
@@ -5078,7 +5079,7 @@ returns nil, because real GC can't be done. */)
5078 && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit) 5079 && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit)
5079 { 5080 {
5080 if (NILP (prev)) 5081 if (NILP (prev))
5081 nextb->undo_list = tail = XCDR (tail); 5082 nextb->BUFFER_INTERNAL_FIELD (undo_list) = tail = XCDR (tail);
5082 else 5083 else
5083 { 5084 {
5084 tail = XCDR (tail); 5085 tail = XCDR (tail);
@@ -5094,7 +5095,7 @@ returns nil, because real GC can't be done. */)
5094 } 5095 }
5095 /* Now that we have stripped the elements that need not be in the 5096 /* Now that we have stripped the elements that need not be in the
5096 undo_list any more, we can finally mark the list. */ 5097 undo_list any more, we can finally mark the list. */
5097 mark_object (nextb->undo_list); 5098 mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list));
5098 5099
5099 nextb = nextb->next; 5100 nextb = nextb->next;
5100 } 5101 }
@@ -5652,7 +5653,7 @@ mark_buffer (Lisp_Object buf)
5652 5653
5653 /* buffer-local Lisp variables start at `undo_list', 5654 /* buffer-local Lisp variables start at `undo_list',
5654 tho only the ones from `name' on are GC'd normally. */ 5655 tho only the ones from `name' on are GC'd normally. */
5655 for (ptr = &buffer->name; 5656 for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name);
5656 (char *)ptr < (char *)buffer + sizeof (struct buffer); 5657 (char *)ptr < (char *)buffer + sizeof (struct buffer);
5657 ptr++) 5658 ptr++)
5658 mark_object (*ptr); 5659 mark_object (*ptr);
diff --git a/src/buffer.c b/src/buffer.c
index 5229f899e65..1b413ccb8b0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -162,7 +162,7 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0,
162Value is nil if OBJECT is not a buffer or if it has been killed. */) 162Value is nil if OBJECT is not a buffer or if it has been killed. */)
163 (Lisp_Object object) 163 (Lisp_Object object)
164{ 164{
165 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) 165 return ((BUFFERP (object) && ! NILP (BVAR (XBUFFER (object), name)))
166 ? Qt : Qnil); 166 ? Qt : Qnil);
167} 167}
168 168
@@ -266,8 +266,8 @@ See also `find-buffer-visiting'. */)
266 { 266 {
267 buf = Fcdr (XCAR (tail)); 267 buf = Fcdr (XCAR (tail));
268 if (!BUFFERP (buf)) continue; 268 if (!BUFFERP (buf)) continue;
269 if (!STRINGP (XBUFFER (buf)->filename)) continue; 269 if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue;
270 tem = Fstring_equal (XBUFFER (buf)->filename, filename); 270 tem = Fstring_equal (BVAR (XBUFFER (buf), filename), filename);
271 if (!NILP (tem)) 271 if (!NILP (tem))
272 return buf; 272 return buf;
273 } 273 }
@@ -283,8 +283,8 @@ get_truename_buffer (register Lisp_Object filename)
283 { 283 {
284 buf = Fcdr (XCAR (tail)); 284 buf = Fcdr (XCAR (tail));
285 if (!BUFFERP (buf)) continue; 285 if (!BUFFERP (buf)) continue;
286 if (!STRINGP (XBUFFER (buf)->file_truename)) continue; 286 if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue;
287 tem = Fstring_equal (XBUFFER (buf)->file_truename, filename); 287 tem = Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename);
288 if (!NILP (tem)) 288 if (!NILP (tem))
289 return buf; 289 return buf;
290 } 290 }
@@ -353,7 +353,7 @@ even if it is dead. The return value is never nil. */)
353 353
354 b->newline_cache = 0; 354 b->newline_cache = 0;
355 b->width_run_cache = 0; 355 b->width_run_cache = 0;
356 b->width_table = Qnil; 356 BVAR (b, width_table) = Qnil;
357 b->prevent_redisplay_optimizations_p = 1; 357 b->prevent_redisplay_optimizations_p = 1;
358 358
359 /* Put this on the chain of all buffers including killed ones. */ 359 /* Put this on the chain of all buffers including killed ones. */
@@ -362,22 +362,22 @@ even if it is dead. The return value is never nil. */)
362 362
363 /* An ordinary buffer normally doesn't need markers 363 /* An ordinary buffer normally doesn't need markers
364 to handle BEGV and ZV. */ 364 to handle BEGV and ZV. */
365 b->pt_marker = Qnil; 365 BVAR (b, pt_marker) = Qnil;
366 b->begv_marker = Qnil; 366 BVAR (b, begv_marker) = Qnil;
367 b->zv_marker = Qnil; 367 BVAR (b, zv_marker) = Qnil;
368 368
369 name = Fcopy_sequence (buffer_or_name); 369 name = Fcopy_sequence (buffer_or_name);
370 STRING_SET_INTERVALS (name, NULL_INTERVAL); 370 STRING_SET_INTERVALS (name, NULL_INTERVAL);
371 b->name = name; 371 BVAR (b, name) = name;
372 372
373 b->undo_list = (SREF (name, 0) != ' ') ? Qnil : Qt; 373 BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt;
374 374
375 reset_buffer (b); 375 reset_buffer (b);
376 reset_buffer_local_variables (b, 1); 376 reset_buffer_local_variables (b, 1);
377 377
378 b->mark = Fmake_marker (); 378 BVAR (b, mark) = Fmake_marker ();
379 BUF_MARKERS (b) = NULL; 379 BUF_MARKERS (b) = NULL;
380 b->name = name; 380 BVAR (b, name) = name;
381 381
382 /* Put this in the alist of all live buffers. */ 382 /* Put this in the alist of all live buffers. */
383 XSETBUFFER (buffer, b); 383 XSETBUFFER (buffer, b);
@@ -486,7 +486,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
486 486
487 /* Get (a copy of) the alist of Lisp-level local variables of FROM 487 /* Get (a copy of) the alist of Lisp-level local variables of FROM
488 and install that in TO. */ 488 and install that in TO. */
489 to->local_var_alist = buffer_lisp_local_variables (from); 489 BVAR (to, local_var_alist) = buffer_lisp_local_variables (from);
490} 490}
491 491
492DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 492DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer,
@@ -512,7 +512,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
512 base_buffer = Fget_buffer (base_buffer); 512 base_buffer = Fget_buffer (base_buffer);
513 if (NILP (base_buffer)) 513 if (NILP (base_buffer))
514 error ("No such buffer: `%s'", SDATA (tem)); 514 error ("No such buffer: `%s'", SDATA (tem));
515 if (NILP (XBUFFER (base_buffer)->name)) 515 if (NILP (BVAR (XBUFFER (base_buffer), name)))
516 error ("Base buffer has been killed"); 516 error ("Base buffer has been killed");
517 517
518 if (SCHARS (name) == 0) 518 if (SCHARS (name) == 0)
@@ -536,7 +536,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
536 536
537 b->newline_cache = 0; 537 b->newline_cache = 0;
538 b->width_run_cache = 0; 538 b->width_run_cache = 0;
539 b->width_table = Qnil; 539 BVAR (b, width_table) = Qnil;
540 540
541 /* Put this on the chain of all buffers including killed ones. */ 541 /* Put this on the chain of all buffers including killed ones. */
542 b->next = all_buffers; 542 b->next = all_buffers;
@@ -544,7 +544,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
544 544
545 name = Fcopy_sequence (name); 545 name = Fcopy_sequence (name);
546 STRING_SET_INTERVALS (name, NULL_INTERVAL); 546 STRING_SET_INTERVALS (name, NULL_INTERVAL);
547 b->name = name; 547 BVAR (b, name) = name;
548 548
549 reset_buffer (b); 549 reset_buffer (b);
550 reset_buffer_local_variables (b, 1); 550 reset_buffer_local_variables (b, 1);
@@ -553,57 +553,57 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
553 XSETBUFFER (buf, b); 553 XSETBUFFER (buf, b);
554 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 554 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
555 555
556 b->mark = Fmake_marker (); 556 BVAR (b, mark) = Fmake_marker ();
557 b->name = name; 557 BVAR (b, name) = name;
558 558
559 /* The multibyte status belongs to the base buffer. */ 559 /* The multibyte status belongs to the base buffer. */
560 b->enable_multibyte_characters = b->base_buffer->enable_multibyte_characters; 560 BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters);
561 561
562 /* Make sure the base buffer has markers for its narrowing. */ 562 /* Make sure the base buffer has markers for its narrowing. */
563 if (NILP (b->base_buffer->pt_marker)) 563 if (NILP (BVAR (b->base_buffer, pt_marker)))
564 { 564 {
565 b->base_buffer->pt_marker = Fmake_marker (); 565 BVAR (b->base_buffer, pt_marker) = Fmake_marker ();
566 set_marker_both (b->base_buffer->pt_marker, base_buffer, 566 set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer,
567 BUF_PT (b->base_buffer), 567 BUF_PT (b->base_buffer),
568 BUF_PT_BYTE (b->base_buffer)); 568 BUF_PT_BYTE (b->base_buffer));
569 } 569 }
570 if (NILP (b->base_buffer->begv_marker)) 570 if (NILP (BVAR (b->base_buffer, begv_marker)))
571 { 571 {
572 b->base_buffer->begv_marker = Fmake_marker (); 572 BVAR (b->base_buffer, begv_marker) = Fmake_marker ();
573 set_marker_both (b->base_buffer->begv_marker, base_buffer, 573 set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer,
574 BUF_BEGV (b->base_buffer), 574 BUF_BEGV (b->base_buffer),
575 BUF_BEGV_BYTE (b->base_buffer)); 575 BUF_BEGV_BYTE (b->base_buffer));
576 } 576 }
577 if (NILP (b->base_buffer->zv_marker)) 577 if (NILP (BVAR (b->base_buffer, zv_marker)))
578 { 578 {
579 b->base_buffer->zv_marker = Fmake_marker (); 579 BVAR (b->base_buffer, zv_marker) = Fmake_marker ();
580 set_marker_both (b->base_buffer->zv_marker, base_buffer, 580 set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer,
581 BUF_ZV (b->base_buffer), 581 BUF_ZV (b->base_buffer),
582 BUF_ZV_BYTE (b->base_buffer)); 582 BUF_ZV_BYTE (b->base_buffer));
583 XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; 583 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
584 } 584 }
585 585
586 if (NILP (clone)) 586 if (NILP (clone))
587 { 587 {
588 /* Give the indirect buffer markers for its narrowing. */ 588 /* Give the indirect buffer markers for its narrowing. */
589 b->pt_marker = Fmake_marker (); 589 BVAR (b, pt_marker) = Fmake_marker ();
590 set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); 590 set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b));
591 b->begv_marker = Fmake_marker (); 591 BVAR (b, begv_marker) = Fmake_marker ();
592 set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); 592 set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b));
593 b->zv_marker = Fmake_marker (); 593 BVAR (b, zv_marker) = Fmake_marker ();
594 set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); 594 set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b));
595 XMARKER (b->zv_marker)->insertion_type = 1; 595 XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
596 } 596 }
597 else 597 else
598 { 598 {
599 struct buffer *old_b = current_buffer; 599 struct buffer *old_b = current_buffer;
600 600
601 clone_per_buffer_values (b->base_buffer, b); 601 clone_per_buffer_values (b->base_buffer, b);
602 b->filename = Qnil; 602 BVAR (b, filename) = Qnil;
603 b->file_truename = Qnil; 603 BVAR (b, file_truename) = Qnil;
604 b->display_count = make_number (0); 604 BVAR (b, display_count) = make_number (0);
605 b->backed_up = Qnil; 605 BVAR (b, backed_up) = Qnil;
606 b->auto_save_file_name = Qnil; 606 BVAR (b, auto_save_file_name) = Qnil;
607 set_buffer_internal_1 (b); 607 set_buffer_internal_1 (b);
608 Fset (intern ("buffer-save-without-query"), Qnil); 608 Fset (intern ("buffer-save-without-query"), Qnil);
609 Fset (intern ("buffer-file-number"), Qnil); 609 Fset (intern ("buffer-file-number"), Qnil);
@@ -647,34 +647,34 @@ delete_all_overlays (struct buffer *b)
647void 647void
648reset_buffer (register struct buffer *b) 648reset_buffer (register struct buffer *b)
649{ 649{
650 b->filename = Qnil; 650 BVAR (b, filename) = Qnil;
651 b->file_truename = Qnil; 651 BVAR (b, file_truename) = Qnil;
652 b->directory = (current_buffer) ? current_buffer->directory : Qnil; 652 BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil;
653 b->modtime = 0; 653 b->modtime = 0;
654 b->modtime_size = -1; 654 b->modtime_size = -1;
655 XSETFASTINT (b->save_length, 0); 655 XSETFASTINT (BVAR (b, save_length), 0);
656 b->last_window_start = 1; 656 b->last_window_start = 1;
657 /* It is more conservative to start out "changed" than "unchanged". */ 657 /* It is more conservative to start out "changed" than "unchanged". */
658 b->clip_changed = 0; 658 b->clip_changed = 0;
659 b->prevent_redisplay_optimizations_p = 1; 659 b->prevent_redisplay_optimizations_p = 1;
660 b->backed_up = Qnil; 660 BVAR (b, backed_up) = Qnil;
661 BUF_AUTOSAVE_MODIFF (b) = 0; 661 BUF_AUTOSAVE_MODIFF (b) = 0;
662 b->auto_save_failure_time = -1; 662 b->auto_save_failure_time = -1;
663 b->auto_save_file_name = Qnil; 663 BVAR (b, auto_save_file_name) = Qnil;
664 b->read_only = Qnil; 664 BVAR (b, read_only) = Qnil;
665 b->overlays_before = NULL; 665 b->overlays_before = NULL;
666 b->overlays_after = NULL; 666 b->overlays_after = NULL;
667 b->overlay_center = BEG; 667 b->overlay_center = BEG;
668 b->mark_active = Qnil; 668 BVAR (b, mark_active) = Qnil;
669 b->point_before_scroll = Qnil; 669 BVAR (b, point_before_scroll) = Qnil;
670 b->file_format = Qnil; 670 BVAR (b, file_format) = Qnil;
671 b->auto_save_file_format = Qt; 671 BVAR (b, auto_save_file_format) = Qt;
672 b->last_selected_window = Qnil; 672 BVAR (b, last_selected_window) = Qnil;
673 XSETINT (b->display_count, 0); 673 XSETINT (BVAR (b, display_count), 0);
674 b->display_time = Qnil; 674 BVAR (b, display_time) = Qnil;
675 b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters; 675 BVAR (b, enable_multibyte_characters) = BVAR (&buffer_defaults, enable_multibyte_characters);
676 b->cursor_type = buffer_defaults.cursor_type; 676 BVAR (b, cursor_type) = BVAR (&buffer_defaults, cursor_type);
677 b->extra_line_spacing = buffer_defaults.extra_line_spacing; 677 BVAR (b, extra_line_spacing) = BVAR (&buffer_defaults, extra_line_spacing);
678 678
679 b->display_error_modiff = 0; 679 b->display_error_modiff = 0;
680} 680}
@@ -698,10 +698,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
698 things that depend on the major mode. 698 things that depend on the major mode.
699 default-major-mode is handled at a higher level. 699 default-major-mode is handled at a higher level.
700 We ignore it here. */ 700 We ignore it here. */
701 b->major_mode = Qfundamental_mode; 701 BVAR (b, major_mode) = Qfundamental_mode;
702 b->keymap = Qnil; 702 BVAR (b, keymap) = Qnil;
703 b->mode_name = QSFundamental; 703 BVAR (b, mode_name) = QSFundamental;
704 b->minor_modes = Qnil; 704 BVAR (b, minor_modes) = Qnil;
705 705
706 /* If the standard case table has been altered and invalidated, 706 /* If the standard case table has been altered and invalidated,
707 fix up its insides first. */ 707 fix up its insides first. */
@@ -710,22 +710,19 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
710 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) 710 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
711 Fset_standard_case_table (Vascii_downcase_table); 711 Fset_standard_case_table (Vascii_downcase_table);
712 712
713 b->downcase_table = Vascii_downcase_table; 713 BVAR (b, downcase_table) = Vascii_downcase_table;
714 b->upcase_table = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; 714 BVAR (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0];
715 b->case_canon_table = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; 715 BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1];
716 b->case_eqv_table = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; 716 BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2];
717 b->invisibility_spec = Qt; 717 BVAR (b, invisibility_spec) = Qt;
718#ifndef DOS_NT
719 b->buffer_file_type = Qnil;
720#endif
721 718
722 /* Reset all (or most) per-buffer variables to their defaults. */ 719 /* Reset all (or most) per-buffer variables to their defaults. */
723 if (permanent_too) 720 if (permanent_too)
724 b->local_var_alist = Qnil; 721 BVAR (b, local_var_alist) = Qnil;
725 else 722 else
726 { 723 {
727 Lisp_Object tmp, prop, last = Qnil; 724 Lisp_Object tmp, prop, last = Qnil;
728 for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) 725 for (tmp = BVAR (b, local_var_alist); CONSP (tmp); tmp = XCDR (tmp))
729 if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) 726 if (!NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
730 { 727 {
731 /* If permanent-local, keep it. */ 728 /* If permanent-local, keep it. */
@@ -755,7 +752,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
755 } 752 }
756 /* Delete this local variable. */ 753 /* Delete this local variable. */
757 else if (NILP (last)) 754 else if (NILP (last))
758 b->local_var_alist = XCDR (tmp); 755 BVAR (b, local_var_alist) = XCDR (tmp);
759 else 756 else
760 XSETCDR (last, XCDR (tmp)); 757 XSETCDR (last, XCDR (tmp));
761 } 758 }
@@ -830,9 +827,9 @@ Return nil if BUFFER has been killed. */)
830 (register Lisp_Object buffer) 827 (register Lisp_Object buffer)
831{ 828{
832 if (NILP (buffer)) 829 if (NILP (buffer))
833 return current_buffer->name; 830 return BVAR (current_buffer, name);
834 CHECK_BUFFER (buffer); 831 CHECK_BUFFER (buffer);
835 return XBUFFER (buffer)->name; 832 return BVAR (XBUFFER (buffer), name);
836} 833}
837 834
838DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, 835DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
@@ -841,9 +838,9 @@ No argument or nil as argument means use the current buffer. */)
841 (register Lisp_Object buffer) 838 (register Lisp_Object buffer)
842{ 839{
843 if (NILP (buffer)) 840 if (NILP (buffer))
844 return current_buffer->filename; 841 return BVAR (current_buffer, filename);
845 CHECK_BUFFER (buffer); 842 CHECK_BUFFER (buffer);
846 return XBUFFER (buffer)->filename; 843 return BVAR (XBUFFER (buffer), filename);
847} 844}
848 845
849DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, 846DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
@@ -895,7 +892,7 @@ is the default binding of the variable. */)
895 { /* Look in local_var_alist. */ 892 { /* Look in local_var_alist. */
896 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 893 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
897 XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ 894 XSETSYMBOL (variable, sym); /* Update In case of aliasing. */
898 result = Fassoc (variable, buf->local_var_alist); 895 result = Fassoc (variable, BVAR (buf, local_var_alist));
899 if (!NILP (result)) 896 if (!NILP (result))
900 { 897 {
901 if (blv->fwd) 898 if (blv->fwd)
@@ -944,7 +941,7 @@ buffer_lisp_local_variables (struct buffer *buf)
944{ 941{
945 Lisp_Object result = Qnil; 942 Lisp_Object result = Qnil;
946 register Lisp_Object tail; 943 register Lisp_Object tail;
947 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 944 for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
948 { 945 {
949 Lisp_Object val, elt; 946 Lisp_Object val, elt;
950 947
@@ -1043,9 +1040,9 @@ A non-nil FLAG means mark the buffer modified. */)
1043 /* If buffer becoming modified, lock the file. 1040 /* If buffer becoming modified, lock the file.
1044 If buffer becoming unmodified, unlock the file. */ 1041 If buffer becoming unmodified, unlock the file. */
1045 1042
1046 fn = current_buffer->file_truename; 1043 fn = BVAR (current_buffer, file_truename);
1047 /* Test buffer-file-name so that binding it to nil is effective. */ 1044 /* Test buffer-file-name so that binding it to nil is effective. */
1048 if (!NILP (fn) && ! NILP (current_buffer->filename)) 1045 if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
1049 { 1046 {
1050 already = SAVE_MODIFF < MODIFF; 1047 already = SAVE_MODIFF < MODIFF;
1051 if (!already && !NILP (flag)) 1048 if (!already && !NILP (flag))
@@ -1110,9 +1107,9 @@ state of the current buffer. Use with care. */)
1110 /* If buffer becoming modified, lock the file. 1107 /* If buffer becoming modified, lock the file.
1111 If buffer becoming unmodified, unlock the file. */ 1108 If buffer becoming unmodified, unlock the file. */
1112 1109
1113 fn = current_buffer->file_truename; 1110 fn = BVAR (current_buffer, file_truename);
1114 /* Test buffer-file-name so that binding it to nil is effective. */ 1111 /* Test buffer-file-name so that binding it to nil is effective. */
1115 if (!NILP (fn) && ! NILP (current_buffer->filename)) 1112 if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
1116 { 1113 {
1117 int already = SAVE_MODIFF < MODIFF; 1114 int already = SAVE_MODIFF < MODIFF;
1118 if (!already && !NILP (flag)) 1115 if (!already && !NILP (flag))
@@ -1199,14 +1196,14 @@ This does not change the name of the visited file (if any). */)
1199 with the original name. It makes UNIQUE equivalent to 1196 with the original name. It makes UNIQUE equivalent to
1200 (rename-buffer (generate-new-buffer-name NEWNAME)). */ 1197 (rename-buffer (generate-new-buffer-name NEWNAME)). */
1201 if (NILP (unique) && XBUFFER (tem) == current_buffer) 1198 if (NILP (unique) && XBUFFER (tem) == current_buffer)
1202 return current_buffer->name; 1199 return BVAR (current_buffer, name);
1203 if (!NILP (unique)) 1200 if (!NILP (unique))
1204 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); 1201 newname = Fgenerate_new_buffer_name (newname, BVAR (current_buffer, name));
1205 else 1202 else
1206 error ("Buffer name `%s' is in use", SDATA (newname)); 1203 error ("Buffer name `%s' is in use", SDATA (newname));
1207 } 1204 }
1208 1205
1209 current_buffer->name = newname; 1206 BVAR (current_buffer, name) = newname;
1210 1207
1211 /* Catch redisplay's attention. Unless we do this, the mode lines for 1208 /* Catch redisplay's attention. Unless we do this, the mode lines for
1212 any windows displaying current_buffer will stay unchanged. */ 1209 any windows displaying current_buffer will stay unchanged. */
@@ -1214,11 +1211,11 @@ This does not change the name of the visited file (if any). */)
1214 1211
1215 XSETBUFFER (buf, current_buffer); 1212 XSETBUFFER (buf, current_buffer);
1216 Fsetcar (Frassq (buf, Vbuffer_alist), newname); 1213 Fsetcar (Frassq (buf, Vbuffer_alist), newname);
1217 if (NILP (current_buffer->filename) 1214 if (NILP (BVAR (current_buffer, filename))
1218 && !NILP (current_buffer->auto_save_file_name)) 1215 && !NILP (BVAR (current_buffer, auto_save_file_name)))
1219 call0 (intern ("rename-auto-save-file")); 1216 call0 (intern ("rename-auto-save-file"));
1220 /* Refetch since that last call may have done GC. */ 1217 /* Refetch since that last call may have done GC. */
1221 return current_buffer->name; 1218 return BVAR (current_buffer, name);
1222} 1219}
1223 1220
1224DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, 1221DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
@@ -1263,9 +1260,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */)
1263 continue; 1260 continue;
1264 if (NILP (buf)) 1261 if (NILP (buf))
1265 continue; 1262 continue;
1266 if (NILP (XBUFFER (buf)->name)) 1263 if (NILP (BVAR (XBUFFER (buf), name)))
1267 continue; 1264 continue;
1268 if (SREF (XBUFFER (buf)->name, 0) == ' ') 1265 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
1269 continue; 1266 continue;
1270 /* If the selected frame has a buffer_predicate, 1267 /* If the selected frame has a buffer_predicate,
1271 disregard buffers that don't fit the predicate. */ 1268 disregard buffers that don't fit the predicate. */
@@ -1313,8 +1310,8 @@ No argument or nil as argument means do this for the current buffer. */)
1313 nsberror (buffer); 1310 nsberror (buffer);
1314 } 1311 }
1315 1312
1316 if (EQ (XBUFFER (real_buffer)->undo_list, Qt)) 1313 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt))
1317 XBUFFER (real_buffer)->undo_list = Qnil; 1314 BVAR (XBUFFER (real_buffer), undo_list) = Qnil;
1318 1315
1319 return Qnil; 1316 return Qnil;
1320} 1317}
@@ -1359,16 +1356,16 @@ with SIGHUP. */)
1359 b = XBUFFER (buffer); 1356 b = XBUFFER (buffer);
1360 1357
1361 /* Avoid trouble for buffer already dead. */ 1358 /* Avoid trouble for buffer already dead. */
1362 if (NILP (b->name)) 1359 if (NILP (BVAR (b, name)))
1363 return Qnil; 1360 return Qnil;
1364 1361
1365 /* Query if the buffer is still modified. */ 1362 /* Query if the buffer is still modified. */
1366 if (INTERACTIVE && !NILP (b->filename) 1363 if (INTERACTIVE && !NILP (BVAR (b, filename))
1367 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 1364 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
1368 { 1365 {
1369 GCPRO1 (buffer); 1366 GCPRO1 (buffer);
1370 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", 1367 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ",
1371 b->name, make_number (0))); 1368 BVAR (b, name), make_number (0)));
1372 UNGCPRO; 1369 UNGCPRO;
1373 if (NILP (tem)) 1370 if (NILP (tem))
1374 return Qnil; 1371 return Qnil;
@@ -1402,7 +1399,7 @@ with SIGHUP. */)
1402 if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) 1399 if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
1403 return Qnil; 1400 return Qnil;
1404 1401
1405 if (NILP (b->name)) 1402 if (NILP (BVAR (b, name)))
1406 return Qnil; 1403 return Qnil;
1407 1404
1408 /* When we kill a base buffer, kill all its indirect buffers. 1405 /* When we kill a base buffer, kill all its indirect buffers.
@@ -1417,7 +1414,7 @@ with SIGHUP. */)
1417 for (other = all_buffers; other; other = other->next) 1414 for (other = all_buffers; other; other = other->next)
1418 /* all_buffers contains dead buffers too; 1415 /* all_buffers contains dead buffers too;
1419 don't re-kill them. */ 1416 don't re-kill them. */
1420 if (other->base_buffer == b && !NILP (other->name)) 1417 if (other->base_buffer == b && !NILP (BVAR (other, name)))
1421 { 1418 {
1422 Lisp_Object buffer; 1419 Lisp_Object buffer;
1423 XSETBUFFER (buffer, other); 1420 XSETBUFFER (buffer, other);
@@ -1462,7 +1459,7 @@ with SIGHUP. */)
1462 /* Killing buffer processes may run sentinels which may 1459 /* Killing buffer processes may run sentinels which may
1463 have called kill-buffer. */ 1460 have called kill-buffer. */
1464 1461
1465 if (NILP (b->name)) 1462 if (NILP (BVAR (b, name)))
1466 return Qnil; 1463 return Qnil;
1467 1464
1468 clear_charpos_cache (b); 1465 clear_charpos_cache (b);
@@ -1476,7 +1473,7 @@ with SIGHUP. */)
1476 1473
1477 /* Delete any auto-save file, if we saved it in this session. 1474 /* Delete any auto-save file, if we saved it in this session.
1478 But not if the buffer is modified. */ 1475 But not if the buffer is modified. */
1479 if (STRINGP (b->auto_save_file_name) 1476 if (STRINGP (BVAR (b, auto_save_file_name))
1480 && BUF_AUTOSAVE_MODIFF (b) != 0 1477 && BUF_AUTOSAVE_MODIFF (b) != 0
1481 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b) 1478 && BUF_SAVE_MODIFF (b) < BUF_AUTOSAVE_MODIFF (b)
1482 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 1479 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
@@ -1485,7 +1482,7 @@ with SIGHUP. */)
1485 Lisp_Object tem; 1482 Lisp_Object tem;
1486 tem = Fsymbol_value (intern ("delete-auto-save-files")); 1483 tem = Fsymbol_value (intern ("delete-auto-save-files"));
1487 if (! NILP (tem)) 1484 if (! NILP (tem))
1488 internal_delete_file (b->auto_save_file_name); 1485 internal_delete_file (BVAR (b, auto_save_file_name));
1489 } 1486 }
1490 1487
1491 if (b->base_buffer) 1488 if (b->base_buffer)
@@ -1525,7 +1522,7 @@ with SIGHUP. */)
1525 swap_out_buffer_local_variables (b); 1522 swap_out_buffer_local_variables (b);
1526 reset_buffer_local_variables (b, 1); 1523 reset_buffer_local_variables (b, 1);
1527 1524
1528 b->name = Qnil; 1525 BVAR (b, name) = Qnil;
1529 1526
1530 BLOCK_INPUT; 1527 BLOCK_INPUT;
1531 if (! b->base_buffer) 1528 if (! b->base_buffer)
@@ -1541,9 +1538,9 @@ with SIGHUP. */)
1541 free_region_cache (b->width_run_cache); 1538 free_region_cache (b->width_run_cache);
1542 b->width_run_cache = 0; 1539 b->width_run_cache = 0;
1543 } 1540 }
1544 b->width_table = Qnil; 1541 BVAR (b, width_table) = Qnil;
1545 UNBLOCK_INPUT; 1542 UNBLOCK_INPUT;
1546 b->undo_list = Qnil; 1543 BVAR (b, undo_list) = Qnil;
1547 1544
1548 return Qt; 1545 return Qt;
1549} 1546}
@@ -1637,15 +1634,15 @@ the current buffer's major mode. */)
1637 1634
1638 CHECK_BUFFER (buffer); 1635 CHECK_BUFFER (buffer);
1639 1636
1640 if (STRINGP (XBUFFER (buffer)->name) 1637 if (STRINGP (BVAR (XBUFFER (buffer), name))
1641 && strcmp (SSDATA (XBUFFER (buffer)->name), "*scratch*") == 0) 1638 && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
1642 function = find_symbol_value (intern ("initial-major-mode")); 1639 function = find_symbol_value (intern ("initial-major-mode"));
1643 else 1640 else
1644 { 1641 {
1645 function = buffer_defaults.major_mode; 1642 function = BVAR (&buffer_defaults, major_mode);
1646 if (NILP (function) 1643 if (NILP (function)
1647 && NILP (Fget (current_buffer->major_mode, Qmode_class))) 1644 && NILP (Fget (BVAR (current_buffer, major_mode), Qmode_class)))
1648 function = current_buffer->major_mode; 1645 function = BVAR (current_buffer, major_mode);
1649 } 1646 }
1650 1647
1651 if (NILP (function) || EQ (function, Qfundamental_mode)) 1648 if (NILP (function) || EQ (function, Qfundamental_mode))
@@ -1795,29 +1792,29 @@ set_buffer_internal_1 (register struct buffer *b)
1795 /* Put the undo list back in the base buffer, so that it appears 1792 /* Put the undo list back in the base buffer, so that it appears
1796 that an indirect buffer shares the undo list of its base. */ 1793 that an indirect buffer shares the undo list of its base. */
1797 if (old_buf->base_buffer) 1794 if (old_buf->base_buffer)
1798 old_buf->base_buffer->undo_list = old_buf->undo_list; 1795 BVAR (old_buf->base_buffer, undo_list) = BVAR (old_buf, undo_list);
1799 1796
1800 /* If the old current buffer has markers to record PT, BEGV and ZV 1797 /* If the old current buffer has markers to record PT, BEGV and ZV
1801 when it is not current, update them now. */ 1798 when it is not current, update them now. */
1802 if (! NILP (old_buf->pt_marker)) 1799 if (! NILP (BVAR (old_buf, pt_marker)))
1803 { 1800 {
1804 Lisp_Object obuf; 1801 Lisp_Object obuf;
1805 XSETBUFFER (obuf, old_buf); 1802 XSETBUFFER (obuf, old_buf);
1806 set_marker_both (old_buf->pt_marker, obuf, 1803 set_marker_both (BVAR (old_buf, pt_marker), obuf,
1807 BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); 1804 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1808 } 1805 }
1809 if (! NILP (old_buf->begv_marker)) 1806 if (! NILP (BVAR (old_buf, begv_marker)))
1810 { 1807 {
1811 Lisp_Object obuf; 1808 Lisp_Object obuf;
1812 XSETBUFFER (obuf, old_buf); 1809 XSETBUFFER (obuf, old_buf);
1813 set_marker_both (old_buf->begv_marker, obuf, 1810 set_marker_both (BVAR (old_buf, begv_marker), obuf,
1814 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); 1811 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1815 } 1812 }
1816 if (! NILP (old_buf->zv_marker)) 1813 if (! NILP (BVAR (old_buf, zv_marker)))
1817 { 1814 {
1818 Lisp_Object obuf; 1815 Lisp_Object obuf;
1819 XSETBUFFER (obuf, old_buf); 1816 XSETBUFFER (obuf, old_buf);
1820 set_marker_both (old_buf->zv_marker, obuf, 1817 set_marker_both (BVAR (old_buf, zv_marker), obuf,
1821 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); 1818 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1822 } 1819 }
1823 } 1820 }
@@ -1825,24 +1822,24 @@ set_buffer_internal_1 (register struct buffer *b)
1825 /* Get the undo list from the base buffer, so that it appears 1822 /* Get the undo list from the base buffer, so that it appears
1826 that an indirect buffer shares the undo list of its base. */ 1823 that an indirect buffer shares the undo list of its base. */
1827 if (b->base_buffer) 1824 if (b->base_buffer)
1828 b->undo_list = b->base_buffer->undo_list; 1825 BVAR (b, undo_list) = BVAR (b->base_buffer, undo_list);
1829 1826
1830 /* If the new current buffer has markers to record PT, BEGV and ZV 1827 /* If the new current buffer has markers to record PT, BEGV and ZV
1831 when it is not current, fetch them now. */ 1828 when it is not current, fetch them now. */
1832 if (! NILP (b->pt_marker)) 1829 if (! NILP (BVAR (b, pt_marker)))
1833 { 1830 {
1834 BUF_PT (b) = marker_position (b->pt_marker); 1831 BUF_PT (b) = marker_position (BVAR (b, pt_marker));
1835 BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); 1832 BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
1836 } 1833 }
1837 if (! NILP (b->begv_marker)) 1834 if (! NILP (BVAR (b, begv_marker)))
1838 { 1835 {
1839 BUF_BEGV (b) = marker_position (b->begv_marker); 1836 BUF_BEGV (b) = marker_position (BVAR (b, begv_marker));
1840 BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); 1837 BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
1841 } 1838 }
1842 if (! NILP (b->zv_marker)) 1839 if (! NILP (BVAR (b, zv_marker)))
1843 { 1840 {
1844 BUF_ZV (b) = marker_position (b->zv_marker); 1841 BUF_ZV (b) = marker_position (BVAR (b, zv_marker));
1845 BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); 1842 BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker));
1846 } 1843 }
1847 1844
1848 /* Look down buffer's list of local Lisp variables 1845 /* Look down buffer's list of local Lisp variables
@@ -1850,7 +1847,7 @@ set_buffer_internal_1 (register struct buffer *b)
1850 1847
1851 do 1848 do
1852 { 1849 {
1853 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1850 for (tail = BVAR (b, local_var_alist); CONSP (tail); tail = XCDR (tail))
1854 { 1851 {
1855 Lisp_Object var = XCAR (XCAR (tail)); 1852 Lisp_Object var = XCAR (XCAR (tail));
1856 struct Lisp_Symbol *sym = XSYMBOL (var); 1853 struct Lisp_Symbol *sym = XSYMBOL (var);
@@ -1883,45 +1880,45 @@ set_buffer_temp (struct buffer *b)
1883 { 1880 {
1884 /* If the old current buffer has markers to record PT, BEGV and ZV 1881 /* If the old current buffer has markers to record PT, BEGV and ZV
1885 when it is not current, update them now. */ 1882 when it is not current, update them now. */
1886 if (! NILP (old_buf->pt_marker)) 1883 if (! NILP (BVAR (old_buf, pt_marker)))
1887 { 1884 {
1888 Lisp_Object obuf; 1885 Lisp_Object obuf;
1889 XSETBUFFER (obuf, old_buf); 1886 XSETBUFFER (obuf, old_buf);
1890 set_marker_both (old_buf->pt_marker, obuf, 1887 set_marker_both (BVAR (old_buf, pt_marker), obuf,
1891 BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); 1888 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1892 } 1889 }
1893 if (! NILP (old_buf->begv_marker)) 1890 if (! NILP (BVAR (old_buf, begv_marker)))
1894 { 1891 {
1895 Lisp_Object obuf; 1892 Lisp_Object obuf;
1896 XSETBUFFER (obuf, old_buf); 1893 XSETBUFFER (obuf, old_buf);
1897 set_marker_both (old_buf->begv_marker, obuf, 1894 set_marker_both (BVAR (old_buf, begv_marker), obuf,
1898 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); 1895 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1899 } 1896 }
1900 if (! NILP (old_buf->zv_marker)) 1897 if (! NILP (BVAR (old_buf, zv_marker)))
1901 { 1898 {
1902 Lisp_Object obuf; 1899 Lisp_Object obuf;
1903 XSETBUFFER (obuf, old_buf); 1900 XSETBUFFER (obuf, old_buf);
1904 set_marker_both (old_buf->zv_marker, obuf, 1901 set_marker_both (BVAR (old_buf, zv_marker), obuf,
1905 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); 1902 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1906 } 1903 }
1907 } 1904 }
1908 1905
1909 /* If the new current buffer has markers to record PT, BEGV and ZV 1906 /* If the new current buffer has markers to record PT, BEGV and ZV
1910 when it is not current, fetch them now. */ 1907 when it is not current, fetch them now. */
1911 if (! NILP (b->pt_marker)) 1908 if (! NILP (BVAR (b, pt_marker)))
1912 { 1909 {
1913 BUF_PT (b) = marker_position (b->pt_marker); 1910 BUF_PT (b) = marker_position (BVAR (b, pt_marker));
1914 BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); 1911 BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
1915 } 1912 }
1916 if (! NILP (b->begv_marker)) 1913 if (! NILP (BVAR (b, begv_marker)))
1917 { 1914 {
1918 BUF_BEGV (b) = marker_position (b->begv_marker); 1915 BUF_BEGV (b) = marker_position (BVAR (b, begv_marker));
1919 BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); 1916 BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
1920 } 1917 }
1921 if (! NILP (b->zv_marker)) 1918 if (! NILP (BVAR (b, zv_marker)))
1922 { 1919 {
1923 BUF_ZV (b) = marker_position (b->zv_marker); 1920 BUF_ZV (b) = marker_position (BVAR (b, zv_marker));
1924 BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); 1921 BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker));
1925 } 1922 }
1926} 1923}
1927 1924
@@ -1938,7 +1935,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
1938 buffer = Fget_buffer (buffer_or_name); 1935 buffer = Fget_buffer (buffer_or_name);
1939 if (NILP (buffer)) 1936 if (NILP (buffer))
1940 nsberror (buffer_or_name); 1937 nsberror (buffer_or_name);
1941 if (NILP (XBUFFER (buffer)->name)) 1938 if (NILP (BVAR (XBUFFER (buffer), name)))
1942 error ("Selecting deleted buffer"); 1939 error ("Selecting deleted buffer");
1943 set_buffer_internal (XBUFFER (buffer)); 1940 set_buffer_internal (XBUFFER (buffer));
1944 return buffer; 1941 return buffer;
@@ -1949,7 +1946,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
1949Lisp_Object 1946Lisp_Object
1950set_buffer_if_live (Lisp_Object buffer) 1947set_buffer_if_live (Lisp_Object buffer)
1951{ 1948{
1952 if (! NILP (XBUFFER (buffer)->name)) 1949 if (! NILP (BVAR (XBUFFER (buffer), name)))
1953 Fset_buffer (buffer); 1950 Fset_buffer (buffer);
1954 return Qnil; 1951 return Qnil;
1955} 1952}
@@ -1959,7 +1956,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
1959 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) 1956 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */)
1960 (void) 1957 (void)
1961{ 1958{
1962 if (!NILP (current_buffer->read_only) 1959 if (!NILP (BVAR (current_buffer, read_only))
1963 && NILP (Vinhibit_read_only)) 1960 && NILP (Vinhibit_read_only))
1964 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); 1961 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
1965 return Qnil; 1962 return Qnil;
@@ -2008,7 +2005,7 @@ its frame, iconify that frame. */)
2008 2005
2009 /* Move buffer to the end of the buffer list. Do nothing if the 2006 /* Move buffer to the end of the buffer list. Do nothing if the
2010 buffer is killed. */ 2007 buffer is killed. */
2011 if (!NILP (XBUFFER (buffer)->name)) 2008 if (!NILP (BVAR (XBUFFER (buffer), name)))
2012 { 2009 {
2013 Lisp_Object aelt, link; 2010 Lisp_Object aelt, link;
2014 2011
@@ -2041,7 +2038,7 @@ so the buffer is truly empty after this. */)
2041 /* Prevent warnings, or suspension of auto saving, that would happen 2038 /* Prevent warnings, or suspension of auto saving, that would happen
2042 if future size is less than past size. Use of erase-buffer 2039 if future size is less than past size. Use of erase-buffer
2043 implies that the future text is not really related to the past text. */ 2040 implies that the future text is not really related to the past text. */
2044 XSETFASTINT (current_buffer->save_length, 0); 2041 XSETFASTINT (BVAR (current_buffer, save_length), 0);
2045 return Qnil; 2042 return Qnil;
2046} 2043}
2047 2044
@@ -2111,7 +2108,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2111 CHECK_BUFFER (buffer); 2108 CHECK_BUFFER (buffer);
2112 other_buffer = XBUFFER (buffer); 2109 other_buffer = XBUFFER (buffer);
2113 2110
2114 if (NILP (other_buffer->name)) 2111 if (NILP (BVAR (other_buffer, name)))
2115 error ("Cannot swap a dead buffer's text"); 2112 error ("Cannot swap a dead buffer's text");
2116 2113
2117 /* Actually, it probably works just fine. 2114 /* Actually, it probably works just fine.
@@ -2138,6 +2135,12 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2138 other_buffer->field = current_buffer->field; \ 2135 other_buffer->field = current_buffer->field; \
2139 current_buffer->field = tmp##field; \ 2136 current_buffer->field = tmp##field; \
2140 } while (0) 2137 } while (0)
2138#define swapfield_(field, type) \
2139 do { \
2140 type tmp##field = BVAR (other_buffer, field); \
2141 BVAR (other_buffer, field) = BVAR (current_buffer, field); \
2142 BVAR (current_buffer, field) = tmp##field; \
2143 } while (0)
2141 2144
2142 swapfield (own_text, struct buffer_text); 2145 swapfield (own_text, struct buffer_text);
2143 eassert (current_buffer->text == &current_buffer->own_text); 2146 eassert (current_buffer->text == &current_buffer->own_text);
@@ -2165,18 +2168,18 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2165 swapfield (overlays_before, struct Lisp_Overlay *); 2168 swapfield (overlays_before, struct Lisp_Overlay *);
2166 swapfield (overlays_after, struct Lisp_Overlay *); 2169 swapfield (overlays_after, struct Lisp_Overlay *);
2167 swapfield (overlay_center, EMACS_INT); 2170 swapfield (overlay_center, EMACS_INT);
2168 swapfield (undo_list, Lisp_Object); 2171 swapfield_ (undo_list, Lisp_Object);
2169 swapfield (mark, Lisp_Object); 2172 swapfield_ (mark, Lisp_Object);
2170 swapfield (enable_multibyte_characters, Lisp_Object); 2173 swapfield_ (enable_multibyte_characters, Lisp_Object);
2171 swapfield (bidi_display_reordering, Lisp_Object); 2174 swapfield_ (bidi_display_reordering, Lisp_Object);
2172 swapfield (bidi_paragraph_direction, Lisp_Object); 2175 swapfield_ (bidi_paragraph_direction, Lisp_Object);
2173 /* FIXME: Not sure what we should do with these *_marker fields. 2176 /* FIXME: Not sure what we should do with these *_marker fields.
2174 Hopefully they're just nil anyway. */ 2177 Hopefully they're just nil anyway. */
2175 swapfield (pt_marker, Lisp_Object); 2178 swapfield_ (pt_marker, Lisp_Object);
2176 swapfield (begv_marker, Lisp_Object); 2179 swapfield_ (begv_marker, Lisp_Object);
2177 swapfield (zv_marker, Lisp_Object); 2180 swapfield_ (zv_marker, Lisp_Object);
2178 current_buffer->point_before_scroll = Qnil; 2181 BVAR (current_buffer, point_before_scroll) = Qnil;
2179 other_buffer->point_before_scroll = Qnil; 2182 BVAR (other_buffer, point_before_scroll) = Qnil;
2180 2183
2181 current_buffer->text->modiff++; other_buffer->text->modiff++; 2184 current_buffer->text->modiff++; other_buffer->text->modiff++;
2182 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2185 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++;
@@ -2250,21 +2253,21 @@ current buffer is cleared. */)
2250 EMACS_INT begv, zv; 2253 EMACS_INT begv, zv;
2251 int narrowed = (BEG != BEGV || Z != ZV); 2254 int narrowed = (BEG != BEGV || Z != ZV);
2252 int modified_p = !NILP (Fbuffer_modified_p (Qnil)); 2255 int modified_p = !NILP (Fbuffer_modified_p (Qnil));
2253 Lisp_Object old_undo = current_buffer->undo_list; 2256 Lisp_Object old_undo = BVAR (current_buffer, undo_list);
2254 struct gcpro gcpro1; 2257 struct gcpro gcpro1;
2255 2258
2256 if (current_buffer->base_buffer) 2259 if (current_buffer->base_buffer)
2257 error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); 2260 error ("Cannot do `set-buffer-multibyte' on an indirect buffer");
2258 2261
2259 /* Do nothing if nothing actually changes. */ 2262 /* Do nothing if nothing actually changes. */
2260 if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) 2263 if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters)))
2261 return flag; 2264 return flag;
2262 2265
2263 GCPRO1 (old_undo); 2266 GCPRO1 (old_undo);
2264 2267
2265 /* Don't record these buffer changes. We will put a special undo entry 2268 /* Don't record these buffer changes. We will put a special undo entry
2266 instead. */ 2269 instead. */
2267 current_buffer->undo_list = Qt; 2270 BVAR (current_buffer, undo_list) = Qt;
2268 2271
2269 /* If the cached position is for this buffer, clear it out. */ 2272 /* If the cached position is for this buffer, clear it out. */
2270 clear_charpos_cache (current_buffer); 2273 clear_charpos_cache (current_buffer);
@@ -2286,7 +2289,7 @@ current buffer is cleared. */)
2286 to calculate the old correspondences. */ 2289 to calculate the old correspondences. */
2287 set_intervals_multibyte (0); 2290 set_intervals_multibyte (0);
2288 2291
2289 current_buffer->enable_multibyte_characters = Qnil; 2292 BVAR (current_buffer, enable_multibyte_characters) = Qnil;
2290 2293
2291 Z = Z_BYTE; 2294 Z = Z_BYTE;
2292 BEGV = BEGV_BYTE; 2295 BEGV = BEGV_BYTE;
@@ -2424,7 +2427,7 @@ current buffer is cleared. */)
2424 2427
2425 /* Do this first, so that chars_in_text asks the right question. 2428 /* Do this first, so that chars_in_text asks the right question.
2426 set_intervals_multibyte needs it too. */ 2429 set_intervals_multibyte needs it too. */
2427 current_buffer->enable_multibyte_characters = Qt; 2430 BVAR (current_buffer, enable_multibyte_characters) = Qt;
2428 2431
2429 GPT_BYTE = advance_to_char_boundary (GPT_BYTE); 2432 GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
2430 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; 2433 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2482,7 +2485,7 @@ current buffer is cleared. */)
2482 if (!EQ (old_undo, Qt)) 2485 if (!EQ (old_undo, Qt))
2483 { 2486 {
2484 /* Represent all the above changes by a special undo entry. */ 2487 /* Represent all the above changes by a special undo entry. */
2485 current_buffer->undo_list = Fcons (list3 (Qapply, 2488 BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply,
2486 intern ("set-buffer-multibyte"), 2489 intern ("set-buffer-multibyte"),
2487 NILP (flag) ? Qt : Qnil), 2490 NILP (flag) ? Qt : Qnil),
2488 old_undo); 2491 old_undo);
@@ -2498,10 +2501,10 @@ current buffer is cleared. */)
2498 /* Copy this buffer's new multibyte status 2501 /* Copy this buffer's new multibyte status
2499 into all of its indirect buffers. */ 2502 into all of its indirect buffers. */
2500 for (other = all_buffers; other; other = other->next) 2503 for (other = all_buffers; other; other = other->next)
2501 if (other->base_buffer == current_buffer && !NILP (other->name)) 2504 if (other->base_buffer == current_buffer && !NILP (BVAR (other, name)))
2502 { 2505 {
2503 other->enable_multibyte_characters 2506 BVAR (other, enable_multibyte_characters)
2504 = current_buffer->enable_multibyte_characters; 2507 = BVAR (current_buffer, enable_multibyte_characters);
2505 other->prevent_redisplay_optimizations_p = 1; 2508 other->prevent_redisplay_optimizations_p = 1;
2506 } 2509 }
2507 2510
@@ -2568,7 +2571,7 @@ swap_out_buffer_local_variables (struct buffer *b)
2568 Lisp_Object oalist, alist, buffer; 2571 Lisp_Object oalist, alist, buffer;
2569 2572
2570 XSETBUFFER (buffer, b); 2573 XSETBUFFER (buffer, b);
2571 oalist = b->local_var_alist; 2574 oalist = BVAR (b, local_var_alist);
2572 2575
2573 for (alist = oalist; CONSP (alist); alist = XCDR (alist)) 2576 for (alist = oalist; CONSP (alist); alist = XCDR (alist))
2574 { 2577 {
@@ -3072,7 +3075,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str
3072 ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); 3075 ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0);
3073 ssl->used++; 3076 ssl->used++;
3074 3077
3075 if (NILP (current_buffer->enable_multibyte_characters)) 3078 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
3076 nbytes = SCHARS (str); 3079 nbytes = SCHARS (str);
3077 else if (! STRING_MULTIBYTE (str)) 3080 else if (! STRING_MULTIBYTE (str))
3078 nbytes = count_size_as_multibyte (SDATA (str), 3081 nbytes = count_size_as_multibyte (SDATA (str),
@@ -3084,7 +3087,7 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str
3084 3087
3085 if (STRINGP (str2)) 3088 if (STRINGP (str2))
3086 { 3089 {
3087 if (NILP (current_buffer->enable_multibyte_characters)) 3090 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
3088 nbytes = SCHARS (str2); 3091 nbytes = SCHARS (str2);
3089 else if (! STRING_MULTIBYTE (str2)) 3092 else if (! STRING_MULTIBYTE (str2))
3090 nbytes = count_size_as_multibyte (SDATA (str2), 3093 nbytes = count_size_as_multibyte (SDATA (str2),
@@ -3114,7 +3117,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
3114 Lisp_Object overlay, window, str; 3117 Lisp_Object overlay, window, str;
3115 struct Lisp_Overlay *ov; 3118 struct Lisp_Overlay *ov;
3116 EMACS_INT startpos, endpos; 3119 EMACS_INT startpos, endpos;
3117 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3120 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
3118 3121
3119 overlay_heads.used = overlay_heads.bytes = 0; 3122 overlay_heads.used = overlay_heads.bytes = 0;
3120 overlay_tails.used = overlay_tails.bytes = 0; 3123 overlay_tails.used = overlay_tails.bytes = 0;
@@ -4985,9 +4988,9 @@ init_buffer_once (void)
4985 /* Make sure all markable slots in buffer_defaults 4988 /* Make sure all markable slots in buffer_defaults
4986 are initialized reasonably, so mark_buffer won't choke. */ 4989 are initialized reasonably, so mark_buffer won't choke. */
4987 reset_buffer (&buffer_defaults); 4990 reset_buffer (&buffer_defaults);
4988 eassert (EQ (buffer_defaults.name, make_number (0))); 4991 eassert (EQ (BVAR (&buffer_defaults, name), make_number (0)));
4989 reset_buffer_local_variables (&buffer_defaults, 1); 4992 reset_buffer_local_variables (&buffer_defaults, 1);
4990 eassert (EQ (buffer_local_symbols.name, make_number (0))); 4993 eassert (EQ (BVAR (&buffer_local_symbols, name), make_number (0)));
4991 reset_buffer (&buffer_local_symbols); 4994 reset_buffer (&buffer_local_symbols);
4992 reset_buffer_local_variables (&buffer_local_symbols, 1); 4995 reset_buffer_local_variables (&buffer_local_symbols, 1);
4993 /* Prevent GC from getting confused. */ 4996 /* Prevent GC from getting confused. */
@@ -5004,60 +5007,57 @@ init_buffer_once (void)
5004 /* Must do these before making the first buffer! */ 5007 /* Must do these before making the first buffer! */
5005 5008
5006 /* real setup is done in bindings.el */ 5009 /* real setup is done in bindings.el */
5007 buffer_defaults.mode_line_format = make_pure_c_string ("%-"); 5010 BVAR (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-");
5008 buffer_defaults.header_line_format = Qnil; 5011 BVAR (&buffer_defaults, header_line_format) = Qnil;
5009 buffer_defaults.abbrev_mode = Qnil; 5012 BVAR (&buffer_defaults, abbrev_mode) = Qnil;
5010 buffer_defaults.overwrite_mode = Qnil; 5013 BVAR (&buffer_defaults, overwrite_mode) = Qnil;
5011 buffer_defaults.case_fold_search = Qt; 5014 BVAR (&buffer_defaults, case_fold_search) = Qt;
5012 buffer_defaults.auto_fill_function = Qnil; 5015 BVAR (&buffer_defaults, auto_fill_function) = Qnil;
5013 buffer_defaults.selective_display = Qnil; 5016 BVAR (&buffer_defaults, selective_display) = Qnil;
5014#ifndef old 5017#ifndef old
5015 buffer_defaults.selective_display_ellipses = Qt; 5018 BVAR (&buffer_defaults, selective_display_ellipses) = Qt;
5016#endif 5019#endif
5017 buffer_defaults.abbrev_table = Qnil; 5020 BVAR (&buffer_defaults, abbrev_table) = Qnil;
5018 buffer_defaults.display_table = Qnil; 5021 BVAR (&buffer_defaults, display_table) = Qnil;
5019 buffer_defaults.undo_list = Qnil; 5022 BVAR (&buffer_defaults, undo_list) = Qnil;
5020 buffer_defaults.mark_active = Qnil; 5023 BVAR (&buffer_defaults, mark_active) = Qnil;
5021 buffer_defaults.file_format = Qnil; 5024 BVAR (&buffer_defaults, file_format) = Qnil;
5022 buffer_defaults.auto_save_file_format = Qt; 5025 BVAR (&buffer_defaults, auto_save_file_format) = Qt;
5023 buffer_defaults.overlays_before = NULL; 5026 buffer_defaults.overlays_before = NULL;
5024 buffer_defaults.overlays_after = NULL; 5027 buffer_defaults.overlays_after = NULL;
5025 buffer_defaults.overlay_center = BEG; 5028 buffer_defaults.overlay_center = BEG;
5026 5029
5027 XSETFASTINT (buffer_defaults.tab_width, 8); 5030 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
5028 buffer_defaults.truncate_lines = Qnil; 5031 BVAR (&buffer_defaults, truncate_lines) = Qnil;
5029 buffer_defaults.word_wrap = Qnil; 5032 BVAR (&buffer_defaults, word_wrap) = Qnil;
5030 buffer_defaults.ctl_arrow = Qt; 5033 BVAR (&buffer_defaults, ctl_arrow) = Qt;
5031 buffer_defaults.bidi_display_reordering = Qnil; 5034 BVAR (&buffer_defaults, bidi_display_reordering) = Qnil;
5032 buffer_defaults.bidi_paragraph_direction = Qnil; 5035 BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil;
5033 buffer_defaults.cursor_type = Qt; 5036 BVAR (&buffer_defaults, cursor_type) = Qt;
5034 buffer_defaults.extra_line_spacing = Qnil; 5037 BVAR (&buffer_defaults, extra_line_spacing) = Qnil;
5035 buffer_defaults.cursor_in_non_selected_windows = Qt; 5038 BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt;
5036 5039
5037#ifdef DOS_NT 5040 BVAR (&buffer_defaults, enable_multibyte_characters) = Qt;
5038 buffer_defaults.buffer_file_type = Qnil; /* TEXT */ 5041 BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil;
5039#endif 5042 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
5040 buffer_defaults.enable_multibyte_characters = Qt; 5043 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
5041 buffer_defaults.buffer_file_coding_system = Qnil; 5044 BVAR (&buffer_defaults, cache_long_line_scans) = Qnil;
5042 XSETFASTINT (buffer_defaults.fill_column, 70); 5045 BVAR (&buffer_defaults, file_truename) = Qnil;
5043 XSETFASTINT (buffer_defaults.left_margin, 0); 5046 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
5044 buffer_defaults.cache_long_line_scans = Qnil; 5047 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
5045 buffer_defaults.file_truename = Qnil; 5048 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
5046 XSETFASTINT (buffer_defaults.display_count, 0); 5049 BVAR (&buffer_defaults, left_fringe_width) = Qnil;
5047 XSETFASTINT (buffer_defaults.left_margin_cols, 0); 5050 BVAR (&buffer_defaults, right_fringe_width) = Qnil;
5048 XSETFASTINT (buffer_defaults.right_margin_cols, 0); 5051 BVAR (&buffer_defaults, fringes_outside_margins) = Qnil;
5049 buffer_defaults.left_fringe_width = Qnil; 5052 BVAR (&buffer_defaults, scroll_bar_width) = Qnil;
5050 buffer_defaults.right_fringe_width = Qnil; 5053 BVAR (&buffer_defaults, vertical_scroll_bar_type) = Qt;
5051 buffer_defaults.fringes_outside_margins = Qnil; 5054 BVAR (&buffer_defaults, indicate_empty_lines) = Qnil;
5052 buffer_defaults.scroll_bar_width = Qnil; 5055 BVAR (&buffer_defaults, indicate_buffer_boundaries) = Qnil;
5053 buffer_defaults.vertical_scroll_bar_type = Qt; 5056 BVAR (&buffer_defaults, fringe_indicator_alist) = Qnil;
5054 buffer_defaults.indicate_empty_lines = Qnil; 5057 BVAR (&buffer_defaults, fringe_cursor_alist) = Qnil;
5055 buffer_defaults.indicate_buffer_boundaries = Qnil; 5058 BVAR (&buffer_defaults, scroll_up_aggressively) = Qnil;
5056 buffer_defaults.fringe_indicator_alist = Qnil; 5059 BVAR (&buffer_defaults, scroll_down_aggressively) = Qnil;
5057 buffer_defaults.fringe_cursor_alist = Qnil; 5060 BVAR (&buffer_defaults, display_time) = Qnil;
5058 buffer_defaults.scroll_up_aggressively = Qnil;
5059 buffer_defaults.scroll_down_aggressively = Qnil;
5060 buffer_defaults.display_time = Qnil;
5061 5061
5062 /* Assign the local-flags to the slots that have default values. 5062 /* Assign the local-flags to the slots that have default values.
5063 The local flag is a bit that is used in the buffer 5063 The local flag is a bit that is used in the buffer
@@ -5069,73 +5069,68 @@ init_buffer_once (void)
5069 5069
5070 /* 0 means not a lisp var, -1 means always local, else mask */ 5070 /* 0 means not a lisp var, -1 means always local, else mask */
5071 memset (&buffer_local_flags, 0, sizeof buffer_local_flags); 5071 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5072 XSETINT (buffer_local_flags.filename, -1); 5072 XSETINT (BVAR (&buffer_local_flags, filename), -1);
5073 XSETINT (buffer_local_flags.directory, -1); 5073 XSETINT (BVAR (&buffer_local_flags, directory), -1);
5074 XSETINT (buffer_local_flags.backed_up, -1); 5074 XSETINT (BVAR (&buffer_local_flags, backed_up), -1);
5075 XSETINT (buffer_local_flags.save_length, -1); 5075 XSETINT (BVAR (&buffer_local_flags, save_length), -1);
5076 XSETINT (buffer_local_flags.auto_save_file_name, -1); 5076 XSETINT (BVAR (&buffer_local_flags, auto_save_file_name), -1);
5077 XSETINT (buffer_local_flags.read_only, -1); 5077 XSETINT (BVAR (&buffer_local_flags, read_only), -1);
5078 XSETINT (buffer_local_flags.major_mode, -1); 5078 XSETINT (BVAR (&buffer_local_flags, major_mode), -1);
5079 XSETINT (buffer_local_flags.mode_name, -1); 5079 XSETINT (BVAR (&buffer_local_flags, mode_name), -1);
5080 XSETINT (buffer_local_flags.undo_list, -1); 5080 XSETINT (BVAR (&buffer_local_flags, undo_list), -1);
5081 XSETINT (buffer_local_flags.mark_active, -1); 5081 XSETINT (BVAR (&buffer_local_flags, mark_active), -1);
5082 XSETINT (buffer_local_flags.point_before_scroll, -1); 5082 XSETINT (BVAR (&buffer_local_flags, point_before_scroll), -1);
5083 XSETINT (buffer_local_flags.file_truename, -1); 5083 XSETINT (BVAR (&buffer_local_flags, file_truename), -1);
5084 XSETINT (buffer_local_flags.invisibility_spec, -1); 5084 XSETINT (BVAR (&buffer_local_flags, invisibility_spec), -1);
5085 XSETINT (buffer_local_flags.file_format, -1); 5085 XSETINT (BVAR (&buffer_local_flags, file_format), -1);
5086 XSETINT (buffer_local_flags.auto_save_file_format, -1); 5086 XSETINT (BVAR (&buffer_local_flags, auto_save_file_format), -1);
5087 XSETINT (buffer_local_flags.display_count, -1); 5087 XSETINT (BVAR (&buffer_local_flags, display_count), -1);
5088 XSETINT (buffer_local_flags.display_time, -1); 5088 XSETINT (BVAR (&buffer_local_flags, display_time), -1);
5089 XSETINT (buffer_local_flags.enable_multibyte_characters, -1); 5089 XSETINT (BVAR (&buffer_local_flags, enable_multibyte_characters), -1);
5090 5090
5091 idx = 1; 5091 idx = 1;
5092 XSETFASTINT (buffer_local_flags.mode_line_format, idx); ++idx; 5092 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
5093 XSETFASTINT (buffer_local_flags.abbrev_mode, idx); ++idx; 5093 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx;
5094 XSETFASTINT (buffer_local_flags.overwrite_mode, idx); ++idx; 5094 XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx;
5095 XSETFASTINT (buffer_local_flags.case_fold_search, idx); ++idx; 5095 XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx;
5096 XSETFASTINT (buffer_local_flags.auto_fill_function, idx); ++idx; 5096 XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx;
5097 XSETFASTINT (buffer_local_flags.selective_display, idx); ++idx; 5097 XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx;
5098#ifndef old 5098#ifndef old
5099 XSETFASTINT (buffer_local_flags.selective_display_ellipses, idx); ++idx; 5099 XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
5100#endif
5101 XSETFASTINT (buffer_local_flags.tab_width, idx); ++idx;
5102 XSETFASTINT (buffer_local_flags.truncate_lines, idx); ++idx;
5103 XSETFASTINT (buffer_local_flags.word_wrap, idx); ++idx;
5104 XSETFASTINT (buffer_local_flags.ctl_arrow, idx); ++idx;
5105 XSETFASTINT (buffer_local_flags.fill_column, idx); ++idx;
5106 XSETFASTINT (buffer_local_flags.left_margin, idx); ++idx;
5107 XSETFASTINT (buffer_local_flags.abbrev_table, idx); ++idx;
5108 XSETFASTINT (buffer_local_flags.display_table, idx); ++idx;
5109#ifdef DOS_NT
5110 XSETFASTINT (buffer_local_flags.buffer_file_type, idx);
5111 /* Make this one a permanent local. */
5112 buffer_permanent_local_flags[idx++] = 1;
5113#endif 5100#endif
5114 XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; 5101 XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx;
5115 XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; 5102 XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx;
5116 XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; 5103 XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
5117 XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; 5104 XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx;
5118 XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; 5105 XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx;
5119 XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); 5106 XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx;
5107 XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx;
5108 XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx;
5109 XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx;
5110 XSETFASTINT (BVAR (&buffer_local_flags, cache_long_line_scans), idx); ++idx;
5111 XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx;
5112 XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); ++idx;
5113 XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); ++idx;
5114 XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx);
5120 /* Make this one a permanent local. */ 5115 /* Make this one a permanent local. */
5121 buffer_permanent_local_flags[idx++] = 1; 5116 buffer_permanent_local_flags[idx++] = 1;
5122 XSETFASTINT (buffer_local_flags.left_margin_cols, idx); ++idx; 5117 XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx;
5123 XSETFASTINT (buffer_local_flags.right_margin_cols, idx); ++idx; 5118 XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx;
5124 XSETFASTINT (buffer_local_flags.left_fringe_width, idx); ++idx; 5119 XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx;
5125 XSETFASTINT (buffer_local_flags.right_fringe_width, idx); ++idx; 5120 XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx;
5126 XSETFASTINT (buffer_local_flags.fringes_outside_margins, idx); ++idx; 5121 XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); ++idx;
5127 XSETFASTINT (buffer_local_flags.scroll_bar_width, idx); ++idx; 5122 XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx;
5128 XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; 5123 XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); ++idx;
5129 XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; 5124 XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx;
5130 XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; 5125 XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); ++idx;
5131 XSETFASTINT (buffer_local_flags.fringe_indicator_alist, idx); ++idx; 5126 XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx;
5132 XSETFASTINT (buffer_local_flags.fringe_cursor_alist, idx); ++idx; 5127 XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx;
5133 XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; 5128 XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx;
5134 XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; 5129 XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx;
5135 XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; 5130 XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx;
5136 XSETFASTINT (buffer_local_flags.cursor_type, idx); ++idx; 5131 XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx;
5137 XSETFASTINT (buffer_local_flags.extra_line_spacing, idx); ++idx; 5132 XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
5138 XSETFASTINT (buffer_local_flags.cursor_in_non_selected_windows, idx); ++idx; 5133 XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
5139 5134
5140 /* Need more room? */ 5135 /* Need more room? */
5141 if (idx >= MAX_PER_BUFFER_VARS) 5136 if (idx >= MAX_PER_BUFFER_VARS)
@@ -5149,7 +5144,7 @@ init_buffer_once (void)
5149 QSFundamental = make_pure_c_string ("Fundamental"); 5144 QSFundamental = make_pure_c_string ("Fundamental");
5150 5145
5151 Qfundamental_mode = intern_c_string ("fundamental-mode"); 5146 Qfundamental_mode = intern_c_string ("fundamental-mode");
5152 buffer_defaults.major_mode = Qfundamental_mode; 5147 BVAR (&buffer_defaults, major_mode) = Qfundamental_mode;
5153 5148
5154 Qmode_class = intern_c_string ("mode-class"); 5149 Qmode_class = intern_c_string ("mode-class");
5155 5150
@@ -5192,7 +5187,7 @@ init_buffer (void)
5192#endif /* USE_MMAP_FOR_BUFFERS */ 5187#endif /* USE_MMAP_FOR_BUFFERS */
5193 5188
5194 Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); 5189 Fset_buffer (Fget_buffer_create (build_string ("*scratch*")));
5195 if (NILP (buffer_defaults.enable_multibyte_characters)) 5190 if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5196 Fset_buffer_multibyte (Qnil); 5191 Fset_buffer_multibyte (Qnil);
5197 5192
5198 pwd = get_current_dir_name (); 5193 pwd = get_current_dir_name ();
@@ -5213,28 +5208,28 @@ init_buffer (void)
5213 pwd[len + 1] = '\0'; 5208 pwd[len + 1] = '\0';
5214 } 5209 }
5215 5210
5216 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); 5211 BVAR (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd));
5217 if (! NILP (buffer_defaults.enable_multibyte_characters)) 5212 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5218 /* At this moment, we still don't know how to decode the 5213 /* At this moment, we still don't know how to decode the
5219 directory name. So, we keep the bytes in multibyte form so 5214 directory name. So, we keep the bytes in multibyte form so
5220 that ENCODE_FILE correctly gets the original bytes. */ 5215 that ENCODE_FILE correctly gets the original bytes. */
5221 current_buffer->directory 5216 BVAR (current_buffer, directory)
5222 = string_to_multibyte (current_buffer->directory); 5217 = string_to_multibyte (BVAR (current_buffer, directory));
5223 5218
5224 /* Add /: to the front of the name 5219 /* Add /: to the front of the name
5225 if it would otherwise be treated as magic. */ 5220 if it would otherwise be treated as magic. */
5226 temp = Ffind_file_name_handler (current_buffer->directory, Qt); 5221 temp = Ffind_file_name_handler (BVAR (current_buffer, directory), Qt);
5227 if (! NILP (temp) 5222 if (! NILP (temp)
5228 /* If the default dir is just /, TEMP is non-nil 5223 /* If the default dir is just /, TEMP is non-nil
5229 because of the ange-ftp completion handler. 5224 because of the ange-ftp completion handler.
5230 However, it is not necessary to turn / into /:/. 5225 However, it is not necessary to turn / into /:/.
5231 So avoid doing that. */ 5226 So avoid doing that. */
5232 && strcmp ("/", SSDATA (current_buffer->directory))) 5227 && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
5233 current_buffer->directory 5228 BVAR (current_buffer, directory)
5234 = concat2 (build_string ("/:"), current_buffer->directory); 5229 = concat2 (build_string ("/:"), BVAR (current_buffer, directory));
5235 5230
5236 temp = get_minibuffer (0); 5231 temp = get_minibuffer (0);
5237 XBUFFER (temp)->directory = current_buffer->directory; 5232 BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory);
5238 5233
5239 free (pwd); 5234 free (pwd);
5240} 5235}
@@ -5410,14 +5405,6 @@ This is the same as (default-value 'tab-width). */);
5410 doc: /* Default value of `case-fold-search' for buffers that don't override it. 5405 doc: /* Default value of `case-fold-search' for buffers that don't override it.
5411This is the same as (default-value 'case-fold-search). */); 5406This is the same as (default-value 'case-fold-search). */);
5412 5407
5413#ifdef DOS_NT
5414 DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-type",
5415 buffer_file_type,
5416 doc: /* Default file type for buffers that do not override it.
5417This is the same as (default-value 'buffer-file-type).
5418The file type is nil for text, t for binary. */);
5419#endif
5420
5421 DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width", 5408 DEFVAR_BUFFER_DEFAULTS ("default-left-margin-width",
5422 left_margin_cols, 5409 left_margin_cols,
5423 doc: /* Default value of `left-margin-width' for buffers that don't override it. 5410 doc: /* Default value of `left-margin-width' for buffers that don't override it.
@@ -5486,13 +5473,13 @@ This value applies in buffers that don't have their own local values.
5486This is the same as (default-value 'scroll-down-aggressively). */); 5473This is the same as (default-value 'scroll-down-aggressively). */);
5487 5474
5488 DEFVAR_PER_BUFFER ("header-line-format", 5475 DEFVAR_PER_BUFFER ("header-line-format",
5489 &current_buffer->header_line_format, 5476 &BVAR (current_buffer, header_line_format),
5490 Qnil, 5477 Qnil,
5491 doc: /* Analogous to `mode-line-format', but controls the header line. 5478 doc: /* Analogous to `mode-line-format', but controls the header line.
5492The header line appears, optionally, at the top of a window; 5479The header line appears, optionally, at the top of a window;
5493the mode line appears at the bottom. */); 5480the mode line appears at the bottom. */);
5494 5481
5495 DEFVAR_PER_BUFFER ("mode-line-format", &current_buffer->mode_line_format, 5482 DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format),
5496 Qnil, 5483 Qnil,
5497 doc: /* Template for displaying mode line for current buffer. 5484 doc: /* Template for displaying mode line for current buffer.
5498Each buffer has its own value of this variable. 5485Each buffer has its own value of this variable.
@@ -5549,7 +5536,7 @@ Decimal digits after the % specify field width to which to pad. */);
5549 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode, 5536 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode,
5550 doc: /* *Value of `major-mode' for new buffers. */); 5537 doc: /* *Value of `major-mode' for new buffers. */);
5551 5538
5552 DEFVAR_PER_BUFFER ("major-mode", &current_buffer->major_mode, 5539 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode),
5553 make_number (Lisp_Symbol), 5540 make_number (Lisp_Symbol),
5554 doc: /* Symbol for current buffer's major mode. 5541 doc: /* Symbol for current buffer's major mode.
5555The default value (normally `fundamental-mode') affects new buffers. 5542The default value (normally `fundamental-mode') affects new buffers.
@@ -5562,46 +5549,46 @@ the buffer. Thus, the mode and its hooks should not expect certain
5562variables such as `buffer-read-only' and `buffer-file-coding-system' 5549variables such as `buffer-read-only' and `buffer-file-coding-system'
5563to be set up. */); 5550to be set up. */);
5564 5551
5565 DEFVAR_PER_BUFFER ("mode-name", &current_buffer->mode_name, 5552 DEFVAR_PER_BUFFER ("mode-name", &BVAR (current_buffer, mode_name),
5566 Qnil, 5553 Qnil,
5567 doc: /* Pretty name of current buffer's major mode. 5554 doc: /* Pretty name of current buffer's major mode.
5568Usually a string, but can use any of the constructs for `mode-line-format', 5555Usually a string, but can use any of the constructs for `mode-line-format',
5569which see. 5556which see.
5570Format with `format-mode-line' to produce a string value. */); 5557Format with `format-mode-line' to produce a string value. */);
5571 5558
5572 DEFVAR_PER_BUFFER ("local-abbrev-table", &current_buffer->abbrev_table, Qnil, 5559 DEFVAR_PER_BUFFER ("local-abbrev-table", &BVAR (current_buffer, abbrev_table), Qnil,
5573 doc: /* Local (mode-specific) abbrev table of current buffer. */); 5560 doc: /* Local (mode-specific) abbrev table of current buffer. */);
5574 5561
5575 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil, 5562 DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR (current_buffer, abbrev_mode), Qnil,
5576 doc: /* Non-nil if Abbrev mode is enabled. 5563 doc: /* Non-nil if Abbrev mode is enabled.
5577Use the command `abbrev-mode' to change this variable. */); 5564Use the command `abbrev-mode' to change this variable. */);
5578 5565
5579 DEFVAR_PER_BUFFER ("case-fold-search", &current_buffer->case_fold_search, 5566 DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search),
5580 Qnil, 5567 Qnil,
5581 doc: /* *Non-nil if searches and matches should ignore case. */); 5568 doc: /* *Non-nil if searches and matches should ignore case. */);
5582 5569
5583 DEFVAR_PER_BUFFER ("fill-column", &current_buffer->fill_column, 5570 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
5584 make_number (LISP_INT_TAG), 5571 make_number (LISP_INT_TAG),
5585 doc: /* *Column beyond which automatic line-wrapping should happen. 5572 doc: /* *Column beyond which automatic line-wrapping should happen.
5586Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5573Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5587 5574
5588 DEFVAR_PER_BUFFER ("left-margin", &current_buffer->left_margin, 5575 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
5589 make_number (LISP_INT_TAG), 5576 make_number (LISP_INT_TAG),
5590 doc: /* *Column for the default `indent-line-function' to indent to. 5577 doc: /* *Column for the default `indent-line-function' to indent to.
5591Linefeed indents to this column in Fundamental mode. */); 5578Linefeed indents to this column in Fundamental mode. */);
5592 5579
5593 DEFVAR_PER_BUFFER ("tab-width", &current_buffer->tab_width, 5580 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
5594 make_number (LISP_INT_TAG), 5581 make_number (LISP_INT_TAG),
5595 doc: /* *Distance between tab stops (for display of tab characters), in columns. */); 5582 doc: /* *Distance between tab stops (for display of tab characters), in columns. */);
5596 5583
5597 DEFVAR_PER_BUFFER ("ctl-arrow", &current_buffer->ctl_arrow, Qnil, 5584 DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil,
5598 doc: /* *Non-nil means display control chars with uparrow. 5585 doc: /* *Non-nil means display control chars with uparrow.
5599A value of nil means use backslash and octal digits. 5586A value of nil means use backslash and octal digits.
5600This variable does not apply to characters whose display is specified 5587This variable does not apply to characters whose display is specified
5601in the current display table (if there is one). */); 5588in the current display table (if there is one). */);
5602 5589
5603 DEFVAR_PER_BUFFER ("enable-multibyte-characters", 5590 DEFVAR_PER_BUFFER ("enable-multibyte-characters",
5604 &current_buffer->enable_multibyte_characters, 5591 &BVAR (current_buffer, enable_multibyte_characters),
5605 Qnil, 5592 Qnil,
5606 doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. 5593 doc: /* Non-nil means the buffer contents are regarded as multi-byte characters.
5607Otherwise they are regarded as unibyte. This affects the display, 5594Otherwise they are regarded as unibyte. This affects the display,
@@ -5615,7 +5602,7 @@ See also variable `default-enable-multibyte-characters' and Info node
5615 XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; 5602 XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1;
5616 5603
5617 DEFVAR_PER_BUFFER ("buffer-file-coding-system", 5604 DEFVAR_PER_BUFFER ("buffer-file-coding-system",
5618 &current_buffer->buffer_file_coding_system, Qnil, 5605 &BVAR (current_buffer, buffer_file_coding_system), Qnil,
5619 doc: /* Coding system to be used for encoding the buffer contents on saving. 5606 doc: /* Coding system to be used for encoding the buffer contents on saving.
5620This variable applies to saving the buffer, and also to `write-region' 5607This variable applies to saving the buffer, and also to `write-region'
5621and other functions that use `write-region'. 5608and other functions that use `write-region'.
@@ -5633,11 +5620,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable.
5633This variable is never applied to a way of decoding a file while reading it. */); 5620This variable is never applied to a way of decoding a file while reading it. */);
5634 5621
5635 DEFVAR_PER_BUFFER ("bidi-display-reordering", 5622 DEFVAR_PER_BUFFER ("bidi-display-reordering",
5636 &current_buffer->bidi_display_reordering, Qnil, 5623 &BVAR (current_buffer, bidi_display_reordering), Qnil,
5637 doc: /* Non-nil means reorder bidirectional text for display in the visual order. */); 5624 doc: /* Non-nil means reorder bidirectional text for display in the visual order. */);
5638 5625
5639 DEFVAR_PER_BUFFER ("bidi-paragraph-direction", 5626 DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
5640 &current_buffer->bidi_paragraph_direction, Qnil, 5627 &BVAR (current_buffer, bidi_paragraph_direction), Qnil,
5641 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. 5628 doc: /* *If non-nil, forces directionality of text paragraphs in the buffer.
5642 5629
5643If this is nil (the default), the direction of each paragraph is 5630If this is nil (the default), the direction of each paragraph is
@@ -5648,7 +5635,7 @@ Any other value is treated as nil.
5648This variable has no effect unless the buffer's value of 5635This variable has no effect unless the buffer's value of
5649\`bidi-display-reordering' is non-nil. */); 5636\`bidi-display-reordering' is non-nil. */);
5650 5637
5651 DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines, Qnil, 5638 DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil,
5652 doc: /* *Non-nil means do not display continuation lines. 5639 doc: /* *Non-nil means do not display continuation lines.
5653Instead, give each line of text just one screen line. 5640Instead, give each line of text just one screen line.
5654 5641
@@ -5656,7 +5643,7 @@ Note that this is overridden by the variable
5656`truncate-partial-width-windows' if that variable is non-nil 5643`truncate-partial-width-windows' if that variable is non-nil
5657and this buffer is not full-frame width. */); 5644and this buffer is not full-frame width. */);
5658 5645
5659 DEFVAR_PER_BUFFER ("word-wrap", &current_buffer->word_wrap, Qnil, 5646 DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil,
5660 doc: /* *Non-nil means to use word-wrapping for continuation lines. 5647 doc: /* *Non-nil means to use word-wrapping for continuation lines.
5661When word-wrapping is on, continuation lines are wrapped at the space 5648When word-wrapping is on, continuation lines are wrapped at the space
5662or tab character nearest to the right window edge. 5649or tab character nearest to the right window edge.
@@ -5668,21 +5655,12 @@ word-wrapping, you might want to reduce the value of
5668`truncate-partial-width-windows', since wrapping can make text readable 5655`truncate-partial-width-windows', since wrapping can make text readable
5669in narrower windows. */); 5656in narrower windows. */);
5670 5657
5671#ifdef DOS_NT 5658 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
5672 DEFVAR_PER_BUFFER ("buffer-file-type", &current_buffer->buffer_file_type,
5673 Qnil,
5674 doc: /* Non-nil if the visited file is a binary file.
5675This variable is meaningful on MS-DOG and Windows NT.
5676On those systems, it is automatically local in every buffer.
5677On other systems, this variable is normally always nil. */);
5678#endif
5679
5680 DEFVAR_PER_BUFFER ("default-directory", &current_buffer->directory,
5681 make_number (Lisp_String), 5659 make_number (Lisp_String),
5682 doc: /* Name of default directory of current buffer. Should end with slash. 5660 doc: /* Name of default directory of current buffer. Should end with slash.
5683To interactively change the default directory, use command `cd'. */); 5661To interactively change the default directory, use command `cd'. */);
5684 5662
5685 DEFVAR_PER_BUFFER ("auto-fill-function", &current_buffer->auto_fill_function, 5663 DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function),
5686 Qnil, 5664 Qnil,
5687 doc: /* Function called (if non-nil) to perform auto-fill. 5665 doc: /* Function called (if non-nil) to perform auto-fill.
5688It is called after self-inserting any character specified in 5666It is called after self-inserting any character specified in
@@ -5690,30 +5668,30 @@ the `auto-fill-chars' table.
5690NOTE: This variable is not a hook; 5668NOTE: This variable is not a hook;
5691its value may not be a list of functions. */); 5669its value may not be a list of functions. */);
5692 5670
5693 DEFVAR_PER_BUFFER ("buffer-file-name", &current_buffer->filename, 5671 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename),
5694 make_number (Lisp_String), 5672 make_number (Lisp_String),
5695 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); 5673 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */);
5696 5674
5697 DEFVAR_PER_BUFFER ("buffer-file-truename", &current_buffer->file_truename, 5675 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename),
5698 make_number (Lisp_String), 5676 make_number (Lisp_String),
5699 doc: /* Abbreviated truename of file visited in current buffer, or nil if none. 5677 doc: /* Abbreviated truename of file visited in current buffer, or nil if none.
5700The truename of a file is calculated by `file-truename' 5678The truename of a file is calculated by `file-truename'
5701and then abbreviated with `abbreviate-file-name'. */); 5679and then abbreviated with `abbreviate-file-name'. */);
5702 5680
5703 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", 5681 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name",
5704 &current_buffer->auto_save_file_name, 5682 &BVAR (current_buffer, auto_save_file_name),
5705 make_number (Lisp_String), 5683 make_number (Lisp_String),
5706 doc: /* Name of file for auto-saving current buffer. 5684 doc: /* Name of file for auto-saving current buffer.
5707If it is nil, that means don't auto-save this buffer. */); 5685If it is nil, that means don't auto-save this buffer. */);
5708 5686
5709 DEFVAR_PER_BUFFER ("buffer-read-only", &current_buffer->read_only, Qnil, 5687 DEFVAR_PER_BUFFER ("buffer-read-only", &BVAR (current_buffer, read_only), Qnil,
5710 doc: /* Non-nil if this buffer is read-only. */); 5688 doc: /* Non-nil if this buffer is read-only. */);
5711 5689
5712 DEFVAR_PER_BUFFER ("buffer-backed-up", &current_buffer->backed_up, Qnil, 5690 DEFVAR_PER_BUFFER ("buffer-backed-up", &BVAR (current_buffer, backed_up), Qnil,
5713 doc: /* Non-nil if this buffer's file has been backed up. 5691 doc: /* Non-nil if this buffer's file has been backed up.
5714Backing up is done before the first time the file is saved. */); 5692Backing up is done before the first time the file is saved. */);
5715 5693
5716 DEFVAR_PER_BUFFER ("buffer-saved-size", &current_buffer->save_length, 5694 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
5717 make_number (LISP_INT_TAG), 5695 make_number (LISP_INT_TAG),
5718 doc: /* Length of current buffer when last read in, saved or auto-saved. 5696 doc: /* Length of current buffer when last read in, saved or auto-saved.
57190 initially. 56970 initially.
@@ -5723,7 +5701,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer
5723if its text size shrinks. If you use `buffer-swap-text' on a buffer, 5701if its text size shrinks. If you use `buffer-swap-text' on a buffer,
5724you probably should set this to -2 in that buffer. */); 5702you probably should set this to -2 in that buffer. */);
5725 5703
5726 DEFVAR_PER_BUFFER ("selective-display", &current_buffer->selective_display, 5704 DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display),
5727 Qnil, 5705 Qnil,
5728 doc: /* Non-nil enables selective display. 5706 doc: /* Non-nil enables selective display.
5729An integer N as value means display only lines 5707An integer N as value means display only lines
@@ -5734,12 +5712,12 @@ in a file, save the ^M as a newline. */);
5734 5712
5735#ifndef old 5713#ifndef old
5736 DEFVAR_PER_BUFFER ("selective-display-ellipses", 5714 DEFVAR_PER_BUFFER ("selective-display-ellipses",
5737 &current_buffer->selective_display_ellipses, 5715 &BVAR (current_buffer, selective_display_ellipses),
5738 Qnil, 5716 Qnil,
5739 doc: /* Non-nil means display ... on previous line when a line is invisible. */); 5717 doc: /* Non-nil means display ... on previous line when a line is invisible. */);
5740#endif 5718#endif
5741 5719
5742 DEFVAR_PER_BUFFER ("overwrite-mode", &current_buffer->overwrite_mode, Qnil, 5720 DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil,
5743 doc: /* Non-nil if self-insertion should replace existing text. 5721 doc: /* Non-nil if self-insertion should replace existing text.
5744The value should be one of `overwrite-mode-textual', 5722The value should be one of `overwrite-mode-textual',
5745`overwrite-mode-binary', or nil. 5723`overwrite-mode-binary', or nil.
@@ -5748,7 +5726,7 @@ inserts at the end of a line, and inserts when point is before a tab,
5748until the tab is filled in. 5726until the tab is filled in.
5749If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); 5727If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */);
5750 5728
5751 DEFVAR_PER_BUFFER ("buffer-display-table", &current_buffer->display_table, 5729 DEFVAR_PER_BUFFER ("buffer-display-table", &BVAR (current_buffer, display_table),
5752 Qnil, 5730 Qnil,
5753 doc: /* Display table that controls display of the contents of current buffer. 5731 doc: /* Display table that controls display of the contents of current buffer.
5754 5732
@@ -5785,39 +5763,39 @@ In addition, a char-table has six extra slots to control the display of:
5785 5763
5786See also the functions `display-table-slot' and `set-display-table-slot'. */); 5764See also the functions `display-table-slot' and `set-display-table-slot'. */);
5787 5765
5788 DEFVAR_PER_BUFFER ("left-margin-width", &current_buffer->left_margin_cols, 5766 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols),
5789 Qnil, 5767 Qnil,
5790 doc: /* *Width of left marginal area for display of a buffer. 5768 doc: /* *Width of left marginal area for display of a buffer.
5791A value of nil means no marginal area. */); 5769A value of nil means no marginal area. */);
5792 5770
5793 DEFVAR_PER_BUFFER ("right-margin-width", &current_buffer->right_margin_cols, 5771 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols),
5794 Qnil, 5772 Qnil,
5795 doc: /* *Width of right marginal area for display of a buffer. 5773 doc: /* *Width of right marginal area for display of a buffer.
5796A value of nil means no marginal area. */); 5774A value of nil means no marginal area. */);
5797 5775
5798 DEFVAR_PER_BUFFER ("left-fringe-width", &current_buffer->left_fringe_width, 5776 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width),
5799 Qnil, 5777 Qnil,
5800 doc: /* *Width of this buffer's left fringe (in pixels). 5778 doc: /* *Width of this buffer's left fringe (in pixels).
5801A value of 0 means no left fringe is shown in this buffer's window. 5779A value of 0 means no left fringe is shown in this buffer's window.
5802A value of nil means to use the left fringe width from the window's frame. */); 5780A value of nil means to use the left fringe width from the window's frame. */);
5803 5781
5804 DEFVAR_PER_BUFFER ("right-fringe-width", &current_buffer->right_fringe_width, 5782 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width),
5805 Qnil, 5783 Qnil,
5806 doc: /* *Width of this buffer's right fringe (in pixels). 5784 doc: /* *Width of this buffer's right fringe (in pixels).
5807A value of 0 means no right fringe is shown in this buffer's window. 5785A value of 0 means no right fringe is shown in this buffer's window.
5808A value of nil means to use the right fringe width from the window's frame. */); 5786A value of nil means to use the right fringe width from the window's frame. */);
5809 5787
5810 DEFVAR_PER_BUFFER ("fringes-outside-margins", &current_buffer->fringes_outside_margins, 5788 DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins),
5811 Qnil, 5789 Qnil,
5812 doc: /* *Non-nil means to display fringes outside display margins. 5790 doc: /* *Non-nil means to display fringes outside display margins.
5813A value of nil means to display fringes between margins and buffer text. */); 5791A value of nil means to display fringes between margins and buffer text. */);
5814 5792
5815 DEFVAR_PER_BUFFER ("scroll-bar-width", &current_buffer->scroll_bar_width, 5793 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
5816 Qnil, 5794 Qnil,
5817 doc: /* *Width of this buffer's scroll bars in pixels. 5795 doc: /* *Width of this buffer's scroll bars in pixels.
5818A value of nil means to use the scroll bar width from the window's frame. */); 5796A value of nil means to use the scroll bar width from the window's frame. */);
5819 5797
5820 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &current_buffer->vertical_scroll_bar_type, 5798 DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
5821 Qnil, 5799 Qnil,
5822 doc: /* *Position of this buffer's vertical scroll bar. 5800 doc: /* *Position of this buffer's vertical scroll bar.
5823The value takes effect whenever you tell a window to display this buffer; 5801The value takes effect whenever you tell a window to display this buffer;
@@ -5828,13 +5806,13 @@ of the window; a value of nil means don't show any vertical scroll bars.
5828A value of t (the default) means do whatever the window's frame specifies. */); 5806A value of t (the default) means do whatever the window's frame specifies. */);
5829 5807
5830 DEFVAR_PER_BUFFER ("indicate-empty-lines", 5808 DEFVAR_PER_BUFFER ("indicate-empty-lines",
5831 &current_buffer->indicate_empty_lines, Qnil, 5809 &BVAR (current_buffer, indicate_empty_lines), Qnil,
5832 doc: /* *Visually indicate empty lines after the buffer end. 5810 doc: /* *Visually indicate empty lines after the buffer end.
5833If non-nil, a bitmap is displayed in the left fringe of a window on 5811If non-nil, a bitmap is displayed in the left fringe of a window on
5834window-systems. */); 5812window-systems. */);
5835 5813
5836 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", 5814 DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
5837 &current_buffer->indicate_buffer_boundaries, Qnil, 5815 &BVAR (current_buffer, indicate_buffer_boundaries), Qnil,
5838 doc: /* *Visually indicate buffer boundaries and scrolling. 5816 doc: /* *Visually indicate buffer boundaries and scrolling.
5839If non-nil, the first and last line of the buffer are marked in the fringe 5817If non-nil, the first and last line of the buffer are marked in the fringe
5840of a window on window-systems with angle bitmaps, or if the window can be 5818of a window on window-systems with angle bitmaps, or if the window can be
@@ -5859,7 +5837,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left
5859fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); 5837fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */);
5860 5838
5861 DEFVAR_PER_BUFFER ("fringe-indicator-alist", 5839 DEFVAR_PER_BUFFER ("fringe-indicator-alist",
5862 &current_buffer->fringe_indicator_alist, Qnil, 5840 &BVAR (current_buffer, fringe_indicator_alist), Qnil,
5863 doc: /* *Mapping from logical to physical fringe indicator bitmaps. 5841 doc: /* *Mapping from logical to physical fringe indicator bitmaps.
5864The value is an alist where each element (INDICATOR . BITMAPS) 5842The value is an alist where each element (INDICATOR . BITMAPS)
5865specifies the fringe bitmaps used to display a specific logical 5843specifies the fringe bitmaps used to display a specific logical
@@ -5878,7 +5856,7 @@ last (only) line has no final newline. BITMAPS may also be a single
5878symbol which is used in both left and right fringes. */); 5856symbol which is used in both left and right fringes. */);
5879 5857
5880 DEFVAR_PER_BUFFER ("fringe-cursor-alist", 5858 DEFVAR_PER_BUFFER ("fringe-cursor-alist",
5881 &current_buffer->fringe_cursor_alist, Qnil, 5859 &BVAR (current_buffer, fringe_cursor_alist), Qnil,
5882 doc: /* *Mapping from logical to physical fringe cursor bitmaps. 5860 doc: /* *Mapping from logical to physical fringe cursor bitmaps.
5883The value is an alist where each element (CURSOR . BITMAP) 5861The value is an alist where each element (CURSOR . BITMAP)
5884specifies the fringe bitmaps used to display a specific logical 5862specifies the fringe bitmaps used to display a specific logical
@@ -5893,7 +5871,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical
5893cursor type. */); 5871cursor type. */);
5894 5872
5895 DEFVAR_PER_BUFFER ("scroll-up-aggressively", 5873 DEFVAR_PER_BUFFER ("scroll-up-aggressively",
5896 &current_buffer->scroll_up_aggressively, Qnil, 5874 &BVAR (current_buffer, scroll_up_aggressively), Qnil,
5897 doc: /* How far to scroll windows upward. 5875 doc: /* How far to scroll windows upward.
5898If you move point off the bottom, the window scrolls automatically. 5876If you move point off the bottom, the window scrolls automatically.
5899This variable controls how far it scrolls. The value nil, the default, 5877This variable controls how far it scrolls. The value nil, the default,
@@ -5906,7 +5884,7 @@ window scrolls by a full window height. Meaningful values are
5906between 0.0 and 1.0, inclusive. */); 5884between 0.0 and 1.0, inclusive. */);
5907 5885
5908 DEFVAR_PER_BUFFER ("scroll-down-aggressively", 5886 DEFVAR_PER_BUFFER ("scroll-down-aggressively",
5909 &current_buffer->scroll_down_aggressively, Qnil, 5887 &BVAR (current_buffer, scroll_down_aggressively), Qnil,
5910 doc: /* How far to scroll windows downward. 5888 doc: /* How far to scroll windows downward.
5911If you move point off the top, the window scrolls automatically. 5889If you move point off the top, the window scrolls automatically.
5912This variable controls how far it scrolls. The value nil, the default, 5890This variable controls how far it scrolls. The value nil, the default,
@@ -5961,7 +5939,7 @@ from happening repeatedly and making Emacs nonfunctional. */);
5961The functions are run using the `run-hooks' function. */); 5939The functions are run using the `run-hooks' function. */);
5962 Vfirst_change_hook = Qnil; 5940 Vfirst_change_hook = Qnil;
5963 5941
5964 DEFVAR_PER_BUFFER ("buffer-undo-list", &current_buffer->undo_list, Qnil, 5942 DEFVAR_PER_BUFFER ("buffer-undo-list", &BVAR (current_buffer, undo_list), Qnil,
5965 doc: /* List of undo entries in current buffer. 5943 doc: /* List of undo entries in current buffer.
5966Recent changes come first; older changes follow newer. 5944Recent changes come first; older changes follow newer.
5967 5945
@@ -6002,10 +5980,10 @@ the changes between two undo boundaries as a single step to be undone.
6002 5980
6003If the value of the variable is t, undo information is not recorded. */); 5981If the value of the variable is t, undo information is not recorded. */);
6004 5982
6005 DEFVAR_PER_BUFFER ("mark-active", &current_buffer->mark_active, Qnil, 5983 DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil,
6006 doc: /* Non-nil means the mark and region are currently active in this buffer. */); 5984 doc: /* Non-nil means the mark and region are currently active in this buffer. */);
6007 5985
6008 DEFVAR_PER_BUFFER ("cache-long-line-scans", &current_buffer->cache_long_line_scans, Qnil, 5986 DEFVAR_PER_BUFFER ("cache-long-line-scans", &BVAR (current_buffer, cache_long_line_scans), Qnil,
6009 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. 5987 doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly.
6010 5988
6011Normally, the line-motion functions work by scanning the buffer for 5989Normally, the line-motion functions work by scanning the buffer for
@@ -6033,23 +6011,23 @@ maintained internally by the Emacs primitives. Enabling or disabling
6033the cache should not affect the behavior of any of the motion 6011the cache should not affect the behavior of any of the motion
6034functions; it should only affect their performance. */); 6012functions; it should only affect their performance. */);
6035 6013
6036 DEFVAR_PER_BUFFER ("point-before-scroll", &current_buffer->point_before_scroll, Qnil, 6014 DEFVAR_PER_BUFFER ("point-before-scroll", &BVAR (current_buffer, point_before_scroll), Qnil,
6037 doc: /* Value of point before the last series of scroll operations, or nil. */); 6015 doc: /* Value of point before the last series of scroll operations, or nil. */);
6038 6016
6039 DEFVAR_PER_BUFFER ("buffer-file-format", &current_buffer->file_format, Qnil, 6017 DEFVAR_PER_BUFFER ("buffer-file-format", &BVAR (current_buffer, file_format), Qnil,
6040 doc: /* List of formats to use when saving this buffer. 6018 doc: /* List of formats to use when saving this buffer.
6041Formats are defined by `format-alist'. This variable is 6019Formats are defined by `format-alist'. This variable is
6042set when a file is visited. */); 6020set when a file is visited. */);
6043 6021
6044 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", 6022 DEFVAR_PER_BUFFER ("buffer-auto-save-file-format",
6045 &current_buffer->auto_save_file_format, Qnil, 6023 &BVAR (current_buffer, auto_save_file_format), Qnil,
6046 doc: /* *Format in which to write auto-save files. 6024 doc: /* *Format in which to write auto-save files.
6047Should be a list of symbols naming formats that are defined in `format-alist'. 6025Should be a list of symbols naming formats that are defined in `format-alist'.
6048If it is t, which is the default, auto-save files are written in the 6026If it is t, which is the default, auto-save files are written in the
6049same format as a regular save would use. */); 6027same format as a regular save would use. */);
6050 6028
6051 DEFVAR_PER_BUFFER ("buffer-invisibility-spec", 6029 DEFVAR_PER_BUFFER ("buffer-invisibility-spec",
6052 &current_buffer->invisibility_spec, Qnil, 6030 &BVAR (current_buffer, invisibility_spec), Qnil,
6053 doc: /* Invisibility spec of this buffer. 6031 doc: /* Invisibility spec of this buffer.
6054The default is t, which means that text is invisible 6032The default is t, which means that text is invisible
6055if it has a non-nil `invisible' property. 6033if it has a non-nil `invisible' property.
@@ -6060,12 +6038,12 @@ then characters with property value PROP are invisible,
6060and they have an ellipsis as well if ELLIPSIS is non-nil. */); 6038and they have an ellipsis as well if ELLIPSIS is non-nil. */);
6061 6039
6062 DEFVAR_PER_BUFFER ("buffer-display-count", 6040 DEFVAR_PER_BUFFER ("buffer-display-count",
6063 &current_buffer->display_count, Qnil, 6041 &BVAR (current_buffer, display_count), Qnil,
6064 doc: /* A number incremented each time this buffer is displayed in a window. 6042 doc: /* A number incremented each time this buffer is displayed in a window.
6065The function `set-window-buffer' increments it. */); 6043The function `set-window-buffer' increments it. */);
6066 6044
6067 DEFVAR_PER_BUFFER ("buffer-display-time", 6045 DEFVAR_PER_BUFFER ("buffer-display-time",
6068 &current_buffer->display_time, Qnil, 6046 &BVAR (current_buffer, display_time), Qnil,
6069 doc: /* Time stamp updated each time this buffer is displayed in a window. 6047 doc: /* Time stamp updated each time this buffer is displayed in a window.
6070The function `set-window-buffer' updates this variable 6048The function `set-window-buffer' updates this variable
6071to the value obtained by calling `current-time'. 6049to the value obtained by calling `current-time'.
@@ -6100,7 +6078,7 @@ and disregard a `read-only' text property if the property value
6100is a member of the list. */); 6078is a member of the list. */);
6101 Vinhibit_read_only = Qnil; 6079 Vinhibit_read_only = Qnil;
6102 6080
6103 DEFVAR_PER_BUFFER ("cursor-type", &current_buffer->cursor_type, Qnil, 6081 DEFVAR_PER_BUFFER ("cursor-type", &BVAR (current_buffer, cursor_type), Qnil,
6104 doc: /* Cursor to use when this buffer is in the selected window. 6082 doc: /* Cursor to use when this buffer is in the selected window.
6105Values are interpreted as follows: 6083Values are interpreted as follows:
6106 6084
@@ -6119,7 +6097,7 @@ cursor's appearance is instead controlled by the variable
6119`cursor-in-non-selected-windows'. */); 6097`cursor-in-non-selected-windows'. */);
6120 6098
6121 DEFVAR_PER_BUFFER ("line-spacing", 6099 DEFVAR_PER_BUFFER ("line-spacing",
6122 &current_buffer->extra_line_spacing, Qnil, 6100 &BVAR (current_buffer, extra_line_spacing), Qnil,
6123 doc: /* Additional space to put between lines when displaying a buffer. 6101 doc: /* Additional space to put between lines when displaying a buffer.
6124The space is measured in pixels, and put below lines on graphic displays, 6102The space is measured in pixels, and put below lines on graphic displays,
6125see `display-graphic-p'. 6103see `display-graphic-p'.
@@ -6127,7 +6105,7 @@ If value is a floating point number, it specifies the spacing relative
6127to the default frame line height. A value of nil means add no extra space. */); 6105to the default frame line height. A value of nil means add no extra space. */);
6128 6106
6129 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", 6107 DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
6130 &current_buffer->cursor_in_non_selected_windows, Qnil, 6108 &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil,
6131 doc: /* *Non-nil means show a cursor in non-selected windows. 6109 doc: /* *Non-nil means show a cursor in non-selected windows.
6132If nil, only shows a cursor in the selected window. 6110If nil, only shows a cursor in the selected window.
6133If t, displays a cursor related to the usual cursor type 6111If t, displays a cursor related to the usual cursor type
diff --git a/src/buffer.h b/src/buffer.h
index 31f96040b2d..65c7168d60a 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -321,7 +321,7 @@ while (0)
321/* Return character at byte position POS. */ 321/* Return character at byte position POS. */
322 322
323#define FETCH_CHAR(pos) \ 323#define FETCH_CHAR(pos) \
324 (!NILP (current_buffer->enable_multibyte_characters) \ 324 (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \
325 ? FETCH_MULTIBYTE_CHAR ((pos)) \ 325 ? FETCH_MULTIBYTE_CHAR ((pos)) \
326 : FETCH_BYTE ((pos))) 326 : FETCH_BYTE ((pos)))
327 327
@@ -346,7 +346,7 @@ extern unsigned char *_fetch_multibyte_char_p;
346 multibyte. */ 346 multibyte. */
347 347
348#define FETCH_CHAR_AS_MULTIBYTE(pos) \ 348#define FETCH_CHAR_AS_MULTIBYTE(pos) \
349 (!NILP (current_buffer->enable_multibyte_characters) \ 349 (!NILP (BVAR (current_buffer, enable_multibyte_characters)) \
350 ? FETCH_MULTIBYTE_CHAR ((pos)) \ 350 ? FETCH_MULTIBYTE_CHAR ((pos)) \
351 : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos)))) 351 : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos))))
352 352
@@ -464,6 +464,15 @@ struct buffer_text
464 int inhibit_shrinking; 464 int inhibit_shrinking;
465 }; 465 };
466 466
467/* Lisp fields in struct buffer are hidden from most code and accessed
468 via the BVAR macro, below. Only select pieces of code, like the GC,
469 are allowed to use BUFFER_INTERNAL_FIELD. */
470#define BUFFER_INTERNAL_FIELD(field) field ## _
471
472/* Most code should use this macro to access Lisp fields in struct
473 buffer. */
474#define BVAR(buf, field) ((buf)->BUFFER_INTERNAL_FIELD (field))
475
467/* This is the structure that the buffer Lisp object points to. */ 476/* This is the structure that the buffer Lisp object points to. */
468 477
469struct buffer 478struct buffer
@@ -587,138 +596,132 @@ struct buffer
587 because local variables have to be right in the struct buffer. 596 because local variables have to be right in the struct buffer.
588 So we copy it around in set_buffer_internal. 597 So we copy it around in set_buffer_internal.
589 This comes before `name' because it is marked in a special way. */ 598 This comes before `name' because it is marked in a special way. */
590 Lisp_Object undo_list; 599 Lisp_Object BUFFER_INTERNAL_FIELD (undo_list);
591 600
592 /* The name of this buffer. */ 601 /* The name of this buffer. */
593 Lisp_Object name; 602 Lisp_Object BUFFER_INTERNAL_FIELD (name);
594 603
595 /* The name of the file visited in this buffer, or nil. */ 604 /* The name of the file visited in this buffer, or nil. */
596 Lisp_Object filename; 605 Lisp_Object BUFFER_INTERNAL_FIELD (filename);
597 /* Dir for expanding relative file names. */ 606 /* Dir for expanding relative file names. */
598 Lisp_Object directory; 607 Lisp_Object BUFFER_INTERNAL_FIELD (directory);
599 /* True if this buffer has been backed up (if you write to the 608 /* True if this buffer has been backed up (if you write to the
600 visited file and it hasn't been backed up, then a backup will 609 visited file and it hasn't been backed up, then a backup will
601 be made). */ 610 be made). */
602 /* This isn't really used by the C code, so could be deleted. */ 611 /* This isn't really used by the C code, so could be deleted. */
603 Lisp_Object backed_up; 612 Lisp_Object BUFFER_INTERNAL_FIELD (backed_up);
604 /* Length of file when last read or saved. 613 /* Length of file when last read or saved.
605 -1 means auto saving turned off because buffer shrank a lot. 614 -1 means auto saving turned off because buffer shrank a lot.
606 -2 means don't turn off auto saving if buffer shrinks. 615 -2 means don't turn off auto saving if buffer shrinks.
607 (That value is used with buffer-swap-text.) 616 (That value is used with buffer-swap-text.)
608 This is not in the struct buffer_text 617 This is not in the struct buffer_text
609 because it's not used in indirect buffers at all. */ 618 because it's not used in indirect buffers at all. */
610 Lisp_Object save_length; 619 Lisp_Object BUFFER_INTERNAL_FIELD (save_length);
611 /* File name used for auto-saving this buffer. 620 /* File name used for auto-saving this buffer.
612 This is not in the struct buffer_text 621 This is not in the struct buffer_text
613 because it's not used in indirect buffers at all. */ 622 because it's not used in indirect buffers at all. */
614 Lisp_Object auto_save_file_name; 623 Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_name);
615 624
616 /* Non-nil if buffer read-only. */ 625 /* Non-nil if buffer read-only. */
617 Lisp_Object read_only; 626 Lisp_Object BUFFER_INTERNAL_FIELD (read_only);
618 /* "The mark". This is a marker which may 627 /* "The mark". This is a marker which may
619 point into this buffer or may point nowhere. */ 628 point into this buffer or may point nowhere. */
620 Lisp_Object mark; 629 Lisp_Object BUFFER_INTERNAL_FIELD (mark);
621 630
622 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all 631 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all
623 per-buffer variables of this buffer. For locally unbound 632 per-buffer variables of this buffer. For locally unbound
624 symbols, just the symbol appears as the element. */ 633 symbols, just the symbol appears as the element. */
625 Lisp_Object local_var_alist; 634 Lisp_Object BUFFER_INTERNAL_FIELD (local_var_alist);
626 635
627 /* Symbol naming major mode (eg, lisp-mode). */ 636 /* Symbol naming major mode (eg, lisp-mode). */
628 Lisp_Object major_mode; 637 Lisp_Object BUFFER_INTERNAL_FIELD (major_mode);
629 /* Pretty name of major mode (eg, "Lisp"). */ 638 /* Pretty name of major mode (eg, "Lisp"). */
630 Lisp_Object mode_name; 639 Lisp_Object BUFFER_INTERNAL_FIELD (mode_name);
631 /* Mode line element that controls format of mode line. */ 640 /* Mode line element that controls format of mode line. */
632 Lisp_Object mode_line_format; 641 Lisp_Object BUFFER_INTERNAL_FIELD (mode_line_format);
633 642
634 /* Analogous to mode_line_format for the line displayed at the top 643 /* Analogous to mode_line_format for the line displayed at the top
635 of windows. Nil means don't display that line. */ 644 of windows. Nil means don't display that line. */
636 Lisp_Object header_line_format; 645 Lisp_Object BUFFER_INTERNAL_FIELD (header_line_format);
637 646
638 /* Keys that are bound local to this buffer. */ 647 /* Keys that are bound local to this buffer. */
639 Lisp_Object keymap; 648 Lisp_Object BUFFER_INTERNAL_FIELD (keymap);
640 /* This buffer's local abbrev table. */ 649 /* This buffer's local abbrev table. */
641 Lisp_Object abbrev_table; 650 Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_table);
642 /* This buffer's syntax table. */ 651 /* This buffer's syntax table. */
643 Lisp_Object syntax_table; 652 Lisp_Object BUFFER_INTERNAL_FIELD (syntax_table);
644 /* This buffer's category table. */ 653 /* This buffer's category table. */
645 Lisp_Object category_table; 654 Lisp_Object BUFFER_INTERNAL_FIELD (category_table);
646 655
647 /* Values of several buffer-local variables. */ 656 /* Values of several buffer-local variables. */
648 /* tab-width is buffer-local so that redisplay can find it 657 /* tab-width is buffer-local so that redisplay can find it
649 in buffers that are not current. */ 658 in buffers that are not current. */
650 Lisp_Object case_fold_search; 659 Lisp_Object BUFFER_INTERNAL_FIELD (case_fold_search);
651 Lisp_Object tab_width; 660 Lisp_Object BUFFER_INTERNAL_FIELD (tab_width);
652 Lisp_Object fill_column; 661 Lisp_Object BUFFER_INTERNAL_FIELD (fill_column);
653 Lisp_Object left_margin; 662 Lisp_Object BUFFER_INTERNAL_FIELD (left_margin);
654 /* Function to call when insert space past fill column. */ 663 /* Function to call when insert space past fill column. */
655 Lisp_Object auto_fill_function; 664 Lisp_Object BUFFER_INTERNAL_FIELD (auto_fill_function);
656 /* nil: text, t: binary.
657 This value is meaningful only on certain operating systems. */
658 /* Actually, we don't need this flag any more because end-of-line
659 is handled correctly according to the buffer-file-coding-system
660 of the buffer. Just keeping it for backward compatibility. */
661 Lisp_Object buffer_file_type;
662 665
663 /* Case table for case-conversion in this buffer. 666 /* Case table for case-conversion in this buffer.
664 This char-table maps each char into its lower-case version. */ 667 This char-table maps each char into its lower-case version. */
665 Lisp_Object downcase_table; 668 Lisp_Object BUFFER_INTERNAL_FIELD (downcase_table);
666 /* Char-table mapping each char to its upper-case version. */ 669 /* Char-table mapping each char to its upper-case version. */
667 Lisp_Object upcase_table; 670 Lisp_Object BUFFER_INTERNAL_FIELD (upcase_table);
668 /* Char-table for conversion for case-folding search. */ 671 /* Char-table for conversion for case-folding search. */
669 Lisp_Object case_canon_table; 672 Lisp_Object BUFFER_INTERNAL_FIELD (case_canon_table);
670 /* Char-table of equivalences for case-folding search. */ 673 /* Char-table of equivalences for case-folding search. */
671 Lisp_Object case_eqv_table; 674 Lisp_Object BUFFER_INTERNAL_FIELD (case_eqv_table);
672 675
673 /* Non-nil means do not display continuation lines. */ 676 /* Non-nil means do not display continuation lines. */
674 Lisp_Object truncate_lines; 677 Lisp_Object BUFFER_INTERNAL_FIELD (truncate_lines);
675 /* Non-nil means to use word wrapping when displaying continuation lines. */ 678 /* Non-nil means to use word wrapping when displaying continuation lines. */
676 Lisp_Object word_wrap; 679 Lisp_Object BUFFER_INTERNAL_FIELD (word_wrap);
677 /* Non-nil means display ctl chars with uparrow. */ 680 /* Non-nil means display ctl chars with uparrow. */
678 Lisp_Object ctl_arrow; 681 Lisp_Object BUFFER_INTERNAL_FIELD (ctl_arrow);
679 /* Non-nil means reorder bidirectional text for display in the 682 /* Non-nil means reorder bidirectional text for display in the
680 visual order. */ 683 visual order. */
681 Lisp_Object bidi_display_reordering; 684 Lisp_Object BUFFER_INTERNAL_FIELD (bidi_display_reordering);
682 /* If non-nil, specifies which direction of text to force in all the 685 /* If non-nil, specifies which direction of text to force in all the
683 paragraphs of the buffer. Nil means determine paragraph 686 paragraphs of the buffer. Nil means determine paragraph
684 direction dynamically for each paragraph. */ 687 direction dynamically for each paragraph. */
685 Lisp_Object bidi_paragraph_direction; 688 Lisp_Object BUFFER_INTERNAL_FIELD (bidi_paragraph_direction);
686 /* Non-nil means do selective display; 689 /* Non-nil means do selective display;
687 see doc string in syms_of_buffer (buffer.c) for details. */ 690 see doc string in syms_of_buffer (buffer.c) for details. */
688 Lisp_Object selective_display; 691 Lisp_Object BUFFER_INTERNAL_FIELD (selective_display);
689#ifndef old 692#ifndef old
690 /* Non-nil means show ... at end of line followed by invisible lines. */ 693 /* Non-nil means show ... at end of line followed by invisible lines. */
691 Lisp_Object selective_display_ellipses; 694 Lisp_Object BUFFER_INTERNAL_FIELD (selective_display_ellipses);
692#endif 695#endif
693 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ 696 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
694 Lisp_Object minor_modes; 697 Lisp_Object BUFFER_INTERNAL_FIELD (minor_modes);
695 /* t if "self-insertion" should overwrite; `binary' if it should also 698 /* t if "self-insertion" should overwrite; `binary' if it should also
696 overwrite newlines and tabs - for editing executables and the like. */ 699 overwrite newlines and tabs - for editing executables and the like. */
697 Lisp_Object overwrite_mode; 700 Lisp_Object BUFFER_INTERNAL_FIELD (overwrite_mode);
698 /* non-nil means abbrev mode is on. Expand abbrevs automatically. */ 701 /* non-nil means abbrev mode is on. Expand abbrevs automatically. */
699 Lisp_Object abbrev_mode; 702 Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_mode);
700 /* Display table to use for text in this buffer. */ 703 /* Display table to use for text in this buffer. */
701 Lisp_Object display_table; 704 Lisp_Object BUFFER_INTERNAL_FIELD (display_table);
702 /* t means the mark and region are currently active. */ 705 /* t means the mark and region are currently active. */
703 Lisp_Object mark_active; 706 Lisp_Object BUFFER_INTERNAL_FIELD (mark_active);
704 707
705 /* Non-nil means the buffer contents are regarded as multi-byte 708 /* Non-nil means the buffer contents are regarded as multi-byte
706 form of characters, not a binary code. */ 709 form of characters, not a binary code. */
707 Lisp_Object enable_multibyte_characters; 710 Lisp_Object BUFFER_INTERNAL_FIELD (enable_multibyte_characters);
708 711
709 /* Coding system to be used for encoding the buffer contents on 712 /* Coding system to be used for encoding the buffer contents on
710 saving. */ 713 saving. */
711 Lisp_Object buffer_file_coding_system; 714 Lisp_Object BUFFER_INTERNAL_FIELD (buffer_file_coding_system);
712 715
713 /* List of symbols naming the file format used for visited file. */ 716 /* List of symbols naming the file format used for visited file. */
714 Lisp_Object file_format; 717 Lisp_Object BUFFER_INTERNAL_FIELD (file_format);
715 718
716 /* List of symbols naming the file format used for auto-save file. */ 719 /* List of symbols naming the file format used for auto-save file. */
717 Lisp_Object auto_save_file_format; 720 Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_format);
718 721
719 /* True if the newline position cache and width run cache are 722 /* True if the newline position cache and width run cache are
720 enabled. See search.c and indent.c. */ 723 enabled. See search.c and indent.c. */
721 Lisp_Object cache_long_line_scans; 724 Lisp_Object BUFFER_INTERNAL_FIELD (cache_long_line_scans);
722 725
723 /* If the width run cache is enabled, this table contains the 726 /* If the width run cache is enabled, this table contains the
724 character widths width_run_cache (see above) assumes. When we 727 character widths width_run_cache (see above) assumes. When we
@@ -726,99 +729,99 @@ struct buffer
726 current display table to see whether the display table has 729 current display table to see whether the display table has
727 affected the widths of any characters. If it has, we 730 affected the widths of any characters. If it has, we
728 invalidate the width run cache, and re-initialize width_table. */ 731 invalidate the width run cache, and re-initialize width_table. */
729 Lisp_Object width_table; 732 Lisp_Object BUFFER_INTERNAL_FIELD (width_table);
730 733
731 /* In an indirect buffer, or a buffer that is the base of an 734 /* In an indirect buffer, or a buffer that is the base of an
732 indirect buffer, this holds a marker that records 735 indirect buffer, this holds a marker that records
733 PT for this buffer when the buffer is not current. */ 736 PT for this buffer when the buffer is not current. */
734 Lisp_Object pt_marker; 737 Lisp_Object BUFFER_INTERNAL_FIELD (pt_marker);
735 738
736 /* In an indirect buffer, or a buffer that is the base of an 739 /* In an indirect buffer, or a buffer that is the base of an
737 indirect buffer, this holds a marker that records 740 indirect buffer, this holds a marker that records
738 BEGV for this buffer when the buffer is not current. */ 741 BEGV for this buffer when the buffer is not current. */
739 Lisp_Object begv_marker; 742 Lisp_Object BUFFER_INTERNAL_FIELD (begv_marker);
740 743
741 /* In an indirect buffer, or a buffer that is the base of an 744 /* In an indirect buffer, or a buffer that is the base of an
742 indirect buffer, this holds a marker that records 745 indirect buffer, this holds a marker that records
743 ZV for this buffer when the buffer is not current. */ 746 ZV for this buffer when the buffer is not current. */
744 Lisp_Object zv_marker; 747 Lisp_Object BUFFER_INTERNAL_FIELD (zv_marker);
745 748
746 /* This holds the point value before the last scroll operation. 749 /* This holds the point value before the last scroll operation.
747 Explicitly setting point sets this to nil. */ 750 Explicitly setting point sets this to nil. */
748 Lisp_Object point_before_scroll; 751 Lisp_Object BUFFER_INTERNAL_FIELD (point_before_scroll);
749 752
750 /* Truename of the visited file, or nil. */ 753 /* Truename of the visited file, or nil. */
751 Lisp_Object file_truename; 754 Lisp_Object BUFFER_INTERNAL_FIELD (file_truename);
752 755
753 /* Invisibility spec of this buffer. 756 /* Invisibility spec of this buffer.
754 t => any non-nil `invisible' property means invisible. 757 t => any non-nil `invisible' property means invisible.
755 A list => `invisible' property means invisible 758 A list => `invisible' property means invisible
756 if it is memq in that list. */ 759 if it is memq in that list. */
757 Lisp_Object invisibility_spec; 760 Lisp_Object BUFFER_INTERNAL_FIELD (invisibility_spec);
758 761
759 /* This is the last window that was selected with this buffer in it, 762 /* This is the last window that was selected with this buffer in it,
760 or nil if that window no longer displays this buffer. */ 763 or nil if that window no longer displays this buffer. */
761 Lisp_Object last_selected_window; 764 Lisp_Object BUFFER_INTERNAL_FIELD (last_selected_window);
762 765
763 /* Incremented each time the buffer is displayed in a window. */ 766 /* Incremented each time the buffer is displayed in a window. */
764 Lisp_Object display_count; 767 Lisp_Object BUFFER_INTERNAL_FIELD (display_count);
765 768
766 /* Widths of left and right marginal areas for windows displaying 769 /* Widths of left and right marginal areas for windows displaying
767 this buffer. */ 770 this buffer. */
768 Lisp_Object left_margin_cols, right_margin_cols; 771 Lisp_Object BUFFER_INTERNAL_FIELD (left_margin_cols), BUFFER_INTERNAL_FIELD (right_margin_cols);
769 772
770 /* Widths of left and right fringe areas for windows displaying 773 /* Widths of left and right fringe areas for windows displaying
771 this buffer. */ 774 this buffer. */
772 Lisp_Object left_fringe_width, right_fringe_width; 775 Lisp_Object BUFFER_INTERNAL_FIELD (left_fringe_width), BUFFER_INTERNAL_FIELD (right_fringe_width);
773 776
774 /* Non-nil means fringes are drawn outside display margins; 777 /* Non-nil means fringes are drawn outside display margins;
775 othersize draw them between margin areas and text. */ 778 othersize draw them between margin areas and text. */
776 Lisp_Object fringes_outside_margins; 779 Lisp_Object BUFFER_INTERNAL_FIELD (fringes_outside_margins);
777 780
778 /* Width and type of scroll bar areas for windows displaying 781 /* Width and type of scroll bar areas for windows displaying
779 this buffer. */ 782 this buffer. */
780 Lisp_Object scroll_bar_width, vertical_scroll_bar_type; 783 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_bar_width), BUFFER_INTERNAL_FIELD (vertical_scroll_bar_type);
781 784
782 /* Non-nil means indicate lines not displaying text (in a style 785 /* Non-nil means indicate lines not displaying text (in a style
783 like vi). */ 786 like vi). */
784 Lisp_Object indicate_empty_lines; 787 Lisp_Object BUFFER_INTERNAL_FIELD (indicate_empty_lines);
785 788
786 /* Non-nil means indicate buffer boundaries and scrolling. */ 789 /* Non-nil means indicate buffer boundaries and scrolling. */
787 Lisp_Object indicate_buffer_boundaries; 790 Lisp_Object BUFFER_INTERNAL_FIELD (indicate_buffer_boundaries);
788 791
789 /* Logical to physical fringe bitmap mappings. */ 792 /* Logical to physical fringe bitmap mappings. */
790 Lisp_Object fringe_indicator_alist; 793 Lisp_Object BUFFER_INTERNAL_FIELD (fringe_indicator_alist);
791 794
792 /* Logical to physical cursor bitmap mappings. */ 795 /* Logical to physical cursor bitmap mappings. */
793 Lisp_Object fringe_cursor_alist; 796 Lisp_Object BUFFER_INTERNAL_FIELD (fringe_cursor_alist);
794 797
795 /* Time stamp updated each time this buffer is displayed in a window. */ 798 /* Time stamp updated each time this buffer is displayed in a window. */
796 Lisp_Object display_time; 799 Lisp_Object BUFFER_INTERNAL_FIELD (display_time);
797 800
798 /* If scrolling the display because point is below the bottom of a 801 /* If scrolling the display because point is below the bottom of a
799 window showing this buffer, try to choose a window start so 802 window showing this buffer, try to choose a window start so
800 that point ends up this number of lines from the top of the 803 that point ends up this number of lines from the top of the
801 window. Nil means that scrolling method isn't used. */ 804 window. Nil means that scrolling method isn't used. */
802 Lisp_Object scroll_up_aggressively; 805 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_up_aggressively);
803 806
804 /* If scrolling the display because point is above the top of a 807 /* If scrolling the display because point is above the top of a
805 window showing this buffer, try to choose a window start so 808 window showing this buffer, try to choose a window start so
806 that point ends up this number of lines from the bottom of the 809 that point ends up this number of lines from the bottom of the
807 window. Nil means that scrolling method isn't used. */ 810 window. Nil means that scrolling method isn't used. */
808 Lisp_Object scroll_down_aggressively; 811 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_down_aggressively);
809 812
810 /* Desired cursor type in this buffer. See the doc string of 813 /* Desired cursor type in this buffer. See the doc string of
811 per-buffer variable `cursor-type'. */ 814 per-buffer variable `cursor-type'. */
812 Lisp_Object cursor_type; 815 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_type);
813 816
814 /* An integer > 0 means put that number of pixels below text lines 817 /* An integer > 0 means put that number of pixels below text lines
815 in the display of this buffer. */ 818 in the display of this buffer. */
816 Lisp_Object extra_line_spacing; 819 Lisp_Object BUFFER_INTERNAL_FIELD (extra_line_spacing);
817 820
818 /* *Cursor type to display in non-selected windows. 821 /* *Cursor type to display in non-selected windows.
819 t means to use hollow box cursor. 822 t means to use hollow box cursor.
820 See `cursor-type' for other values. */ 823 See `cursor-type' for other values. */
821 Lisp_Object cursor_in_non_selected_windows; 824 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows);
822}; 825};
823 826
824 827
@@ -942,7 +945,7 @@ extern int last_per_buffer_idx;
942 from the start of a buffer structure. */ 945 from the start of a buffer structure. */
943 946
944#define PER_BUFFER_VAR_OFFSET(VAR) \ 947#define PER_BUFFER_VAR_OFFSET(VAR) \
945 offsetof (struct buffer, VAR) 948 offsetof (struct buffer, BUFFER_INTERNAL_FIELD (VAR))
946 949
947/* Return the index of buffer-local variable VAR. Each per-buffer 950/* Return the index of buffer-local variable VAR. Each per-buffer
948 variable has an index > 0 associated with it, except when it always 951 variable has an index > 0 associated with it, except when it always
diff --git a/src/bytecode.c b/src/bytecode.c
index b2e9e3c5b56..639c543dbf9 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -51,7 +51,7 @@ by Hallvard:
51 * 51 *
52 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram. 52 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
53 */ 53 */
54#define BYTE_CODE_SAFE 54/* #define BYTE_CODE_SAFE 1 */
55/* #define BYTE_CODE_METER */ 55/* #define BYTE_CODE_METER */
56 56
57 57
@@ -236,6 +236,8 @@ extern Lisp_Object Qand_optional, Qand_rest;
236#define Bconstant 0300 236#define Bconstant 0300
237#define CONSTANTLIM 0100 237#define CONSTANTLIM 0100
238 238
239/* Whether to maintain a `top' and `bottom' field in the stack frame. */
240#define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK)
239 241
240/* Structure describing a value stack used during byte-code execution 242/* Structure describing a value stack used during byte-code execution
241 in Fbyte_code. */ 243 in Fbyte_code. */
@@ -248,7 +250,9 @@ struct byte_stack
248 250
249 /* Top and bottom of stack. The bottom points to an area of memory 251 /* Top and bottom of stack. The bottom points to an area of memory
250 allocated with alloca in Fbyte_code. */ 252 allocated with alloca in Fbyte_code. */
253#if BYTE_MAINTAIN_TOP
251 Lisp_Object *top, *bottom; 254 Lisp_Object *top, *bottom;
255#endif
252 256
253 /* The string containing the byte-code, and its current address. 257 /* The string containing the byte-code, and its current address.
254 Storing this here protects it from GC because mark_byte_stack 258 Storing this here protects it from GC because mark_byte_stack
@@ -275,6 +279,7 @@ struct byte_stack *byte_stack_list;
275 279
276/* Mark objects on byte_stack_list. Called during GC. */ 280/* Mark objects on byte_stack_list. Called during GC. */
277 281
282#if BYTE_MARK_STACK
278void 283void
279mark_byte_stack (void) 284mark_byte_stack (void)
280{ 285{
@@ -299,7 +304,7 @@ mark_byte_stack (void)
299 mark_object (stack->constants); 304 mark_object (stack->constants);
300 } 305 }
301} 306}
302 307#endif
303 308
304/* Unmark objects in the stacks on byte_stack_list. Relocate program 309/* Unmark objects in the stacks on byte_stack_list. Relocate program
305 counters. Called when GC has completed. */ 310 counters. Called when GC has completed. */
@@ -353,8 +358,13 @@ unmark_byte_stack (void)
353/* Actions that must be performed before and after calling a function 358/* Actions that must be performed before and after calling a function
354 that might GC. */ 359 that might GC. */
355 360
361#if !BYTE_MAINTAIN_TOP
362#define BEFORE_POTENTIAL_GC() ((void)0)
363#define AFTER_POTENTIAL_GC() ((void)0)
364#else
356#define BEFORE_POTENTIAL_GC() stack.top = top 365#define BEFORE_POTENTIAL_GC() stack.top = top
357#define AFTER_POTENTIAL_GC() stack.top = NULL 366#define AFTER_POTENTIAL_GC() stack.top = NULL
367#endif
358 368
359/* Garbage collect if we have consed enough since the last time. 369/* Garbage collect if we have consed enough since the last time.
360 We do this at every branch, to avoid loops that never GC. */ 370 We do this at every branch, to avoid loops that never GC. */
@@ -478,10 +488,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
478 stack.byte_string = bytestr; 488 stack.byte_string = bytestr;
479 stack.pc = stack.byte_string_start = SDATA (bytestr); 489 stack.pc = stack.byte_string_start = SDATA (bytestr);
480 stack.constants = vector; 490 stack.constants = vector;
481 stack.bottom = (Lisp_Object *) alloca (XFASTINT (maxdepth) 491 top = (Lisp_Object *) alloca (XFASTINT (maxdepth)
482 * sizeof (Lisp_Object)); 492 * sizeof (Lisp_Object));
483 top = stack.bottom - 1; 493#if BYTE_MAINTAIN_TOP
494 stack.bottom = top;
484 stack.top = NULL; 495 stack.top = NULL;
496#endif
497 top -= 1;
485 stack.next = byte_stack_list; 498 stack.next = byte_stack_list;
486 byte_stack_list = &stack; 499 byte_stack_list = &stack;
487 500
@@ -1468,7 +1481,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1468 CHECK_CHARACTER (TOP); 1481 CHECK_CHARACTER (TOP);
1469 AFTER_POTENTIAL_GC (); 1482 AFTER_POTENTIAL_GC ();
1470 c = XFASTINT (TOP); 1483 c = XFASTINT (TOP);
1471 if (NILP (current_buffer->enable_multibyte_characters)) 1484 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
1472 MAKE_CHAR_MULTIBYTE (c); 1485 MAKE_CHAR_MULTIBYTE (c);
1473 XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]); 1486 XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]);
1474 } 1487 }
diff --git a/src/callint.c b/src/callint.c
index 36d295d750c..253f2b9dd09 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -149,12 +149,12 @@ static void
149check_mark (int for_region) 149check_mark (int for_region)
150{ 150{
151 Lisp_Object tem; 151 Lisp_Object tem;
152 tem = Fmarker_buffer (current_buffer->mark); 152 tem = Fmarker_buffer (BVAR (current_buffer, mark));
153 if (NILP (tem) || (XBUFFER (tem) != current_buffer)) 153 if (NILP (tem) || (XBUFFER (tem) != current_buffer))
154 error (for_region ? "The mark is not set now, so there is no region" 154 error (for_region ? "The mark is not set now, so there is no region"
155 : "The mark is not set now"); 155 : "The mark is not set now");
156 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) 156 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive)
157 && NILP (current_buffer->mark_active)) 157 && NILP (BVAR (current_buffer, mark_active)))
158 xsignal0 (Qmark_inactive); 158 xsignal0 (Qmark_inactive);
159} 159}
160 160
@@ -280,7 +280,7 @@ invoke it. If KEYS is omitted or nil, the return value of
280 save_this_command = Vthis_command; 280 save_this_command = Vthis_command;
281 save_this_original_command = Vthis_original_command; 281 save_this_original_command = Vthis_original_command;
282 save_real_this_command = real_this_command; 282 save_real_this_command = real_this_command;
283 save_last_command = current_kboard->Vlast_command; 283 save_last_command = KVAR (current_kboard, Vlast_command);
284 284
285 if (NILP (keys)) 285 if (NILP (keys))
286 keys = this_command_keys, key_count = this_command_key_count; 286 keys = this_command_keys, key_count = this_command_key_count;
@@ -363,7 +363,7 @@ invoke it. If KEYS is omitted or nil, the return value of
363 Vthis_command = save_this_command; 363 Vthis_command = save_this_command;
364 Vthis_original_command = save_this_original_command; 364 Vthis_original_command = save_this_original_command;
365 real_this_command= save_real_this_command; 365 real_this_command= save_real_this_command;
366 current_kboard->Vlast_command = save_last_command; 366 KVAR (current_kboard, Vlast_command) = save_last_command;
367 367
368 temporarily_switch_to_single_kboard (NULL); 368 temporarily_switch_to_single_kboard (NULL);
369 return unbind_to (speccount, apply1 (function, specs)); 369 return unbind_to (speccount, apply1 (function, specs));
@@ -385,7 +385,7 @@ invoke it. If KEYS is omitted or nil, the return value of
385 else if (*string == '*') 385 else if (*string == '*')
386 { 386 {
387 string++; 387 string++;
388 if (!NILP (current_buffer->read_only)) 388 if (!NILP (BVAR (current_buffer, read_only)))
389 { 389 {
390 if (!NILP (record_flag)) 390 if (!NILP (record_flag))
391 { 391 {
@@ -543,7 +543,7 @@ invoke it. If KEYS is omitted or nil, the return value of
543 543
544 case 'D': /* Directory name. */ 544 case 'D': /* Directory name. */
545 args[i] = Fread_file_name (callint_message, Qnil, 545 args[i] = Fread_file_name (callint_message, Qnil,
546 current_buffer->directory, Qlambda, Qnil, 546 BVAR (current_buffer, directory), Qlambda, Qnil,
547 Qfile_directory_p); 547 Qfile_directory_p);
548 break; 548 break;
549 549
@@ -661,7 +661,7 @@ invoke it. If KEYS is omitted or nil, the return value of
661 case 'm': /* Value of mark. Does not do I/O. */ 661 case 'm': /* Value of mark. Does not do I/O. */
662 check_mark (0); 662 check_mark (0);
663 /* visargs[i] = Qnil; */ 663 /* visargs[i] = Qnil; */
664 args[i] = current_buffer->mark; 664 args[i] = BVAR (current_buffer, mark);
665 varies[i] = 2; 665 varies[i] = 2;
666 break; 666 break;
667 667
@@ -717,11 +717,11 @@ invoke it. If KEYS is omitted or nil, the return value of
717 check_mark (1); 717 check_mark (1);
718 set_marker_both (point_marker, Qnil, PT, PT_BYTE); 718 set_marker_both (point_marker, Qnil, PT, PT_BYTE);
719 /* visargs[i+1] = Qnil; */ 719 /* visargs[i+1] = Qnil; */
720 foo = marker_position (current_buffer->mark); 720 foo = marker_position (BVAR (current_buffer, mark));
721 /* visargs[i] = Qnil; */ 721 /* visargs[i] = Qnil; */
722 args[i] = PT < foo ? point_marker : current_buffer->mark; 722 args[i] = PT < foo ? point_marker : BVAR (current_buffer, mark);
723 varies[i] = 3; 723 varies[i] = 3;
724 args[++i] = PT > foo ? point_marker : current_buffer->mark; 724 args[++i] = PT > foo ? point_marker : BVAR (current_buffer, mark);
725 varies[i] = 4; 725 varies[i] = 4;
726 break; 726 break;
727 727
@@ -832,7 +832,7 @@ invoke it. If KEYS is omitted or nil, the return value of
832 Vthis_command = save_this_command; 832 Vthis_command = save_this_command;
833 Vthis_original_command = save_this_original_command; 833 Vthis_original_command = save_this_original_command;
834 real_this_command= save_real_this_command; 834 real_this_command= save_real_this_command;
835 current_kboard->Vlast_command = save_last_command; 835 KVAR (current_kboard, Vlast_command) = save_last_command;
836 836
837 { 837 {
838 Lisp_Object val; 838 Lisp_Object val;
diff --git a/src/callproc.c b/src/callproc.c
index 925eefb4b02..c53a92bbaf8 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -74,10 +74,6 @@ extern char **environ;
74/* Pattern used by call-process-region to make temp files. */ 74/* Pattern used by call-process-region to make temp files. */
75static Lisp_Object Vtemp_file_name_pattern; 75static Lisp_Object Vtemp_file_name_pattern;
76 76
77#ifdef DOS_NT
78Lisp_Object Qbuffer_file_type;
79#endif /* DOS_NT */
80
81/* True if we are about to fork off a synchronous process or if we 77/* True if we are about to fork off a synchronous process or if we
82 are waiting for it. */ 78 are waiting for it. */
83int synch_process_alive; 79int synch_process_alive;
@@ -265,7 +261,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
265 261
266 if (nargs >= 2 && ! NILP (args[1])) 262 if (nargs >= 2 && ! NILP (args[1]))
267 { 263 {
268 infile = Fexpand_file_name (args[1], current_buffer->directory); 264 infile = Fexpand_file_name (args[1], BVAR (current_buffer, directory));
269 CHECK_STRING (infile); 265 CHECK_STRING (infile);
270 } 266 }
271 else 267 else
@@ -322,7 +318,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
322 { 318 {
323 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 319 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
324 320
325 current_dir = current_buffer->directory; 321 current_dir = BVAR (current_buffer, directory);
326 322
327 GCPRO4 (infile, buffer, current_dir, error_file); 323 GCPRO4 (infile, buffer, current_dir, error_file);
328 324
@@ -336,7 +332,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
336 332
337 if (NILP (Ffile_accessible_directory_p (current_dir))) 333 if (NILP (Ffile_accessible_directory_p (current_dir)))
338 report_file_error ("Setting current directory", 334 report_file_error ("Setting current directory",
339 Fcons (current_buffer->directory, Qnil)); 335 Fcons (BVAR (current_buffer, directory), Qnil));
340 336
341 if (STRING_MULTIBYTE (infile)) 337 if (STRING_MULTIBYTE (infile))
342 infile = ENCODE_FILE (infile); 338 infile = ENCODE_FILE (infile);
@@ -445,6 +441,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
445 register char **save_environ = environ; 441 register char **save_environ = environ;
446 register int fd1 = fd[1]; 442 register int fd1 = fd[1];
447 int fd_error = fd1; 443 int fd_error = fd1;
444#ifdef HAVE_WORKING_VFORK
445 sigset_t procmask;
446 sigset_t blocked;
447 struct sigaction sigpipe_action;
448#endif
448 449
449#if 0 /* Some systems don't have sigblock. */ 450#if 0 /* Some systems don't have sigblock. */
450 mask = sigblock (sigmask (SIGCHLD)); 451 mask = sigblock (sigmask (SIGCHLD));
@@ -525,6 +526,18 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
525 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, 526 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv,
526 0, current_dir); 527 0, current_dir);
527#else /* not WINDOWSNT */ 528#else /* not WINDOWSNT */
529
530#ifdef HAVE_WORKING_VFORK
531 /* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
532 this sets the parent's signal handlers as well as the child's.
533 So delay all interrupts whose handlers the child might munge,
534 and record the current handlers so they can be restored later. */
535 sigemptyset (&blocked);
536 sigaddset (&blocked, SIGPIPE);
537 sigaction (SIGPIPE, 0, &sigpipe_action);
538 sigprocmask (SIG_BLOCK, &blocked, &procmask);
539#endif
540
528 BLOCK_INPUT; 541 BLOCK_INPUT;
529 542
530 pid = vfork (); 543 pid = vfork ();
@@ -541,11 +554,26 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
541#else 554#else
542 setpgrp (pid, pid); 555 setpgrp (pid, pid);
543#endif /* USG */ 556#endif /* USG */
557
558 /* GConf causes us to ignore SIGPIPE, make sure it is restored
559 in the child. */
560 //signal (SIGPIPE, SIG_DFL);
561#ifdef HAVE_WORKING_VFORK
562 sigprocmask (SIG_SETMASK, &procmask, 0);
563#endif
564
544 child_setup (filefd, fd1, fd_error, (char **) new_argv, 565 child_setup (filefd, fd1, fd_error, (char **) new_argv,
545 0, current_dir); 566 0, current_dir);
546 } 567 }
547 568
548 UNBLOCK_INPUT; 569 UNBLOCK_INPUT;
570
571#ifdef HAVE_WORKING_VFORK
572 /* Restore the signal state. */
573 sigaction (SIGPIPE, &sigpipe_action, 0);
574 sigprocmask (SIG_SETMASK, &procmask, 0);
575#endif
576
549#endif /* not WINDOWSNT */ 577#endif /* not WINDOWSNT */
550 578
551 /* The MSDOS case did this already. */ 579 /* The MSDOS case did this already. */
@@ -631,7 +659,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
631 /* In unibyte mode, character code conversion should not take 659 /* In unibyte mode, character code conversion should not take
632 place but EOL conversion should. So, setup raw-text or one 660 place but EOL conversion should. So, setup raw-text or one
633 of the subsidiary according to the information just setup. */ 661 of the subsidiary according to the information just setup. */
634 if (NILP (current_buffer->enable_multibyte_characters) 662 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
635 && !NILP (val)) 663 && !NILP (val))
636 val = raw_text_coding_system (val); 664 val = raw_text_coding_system (val);
637 setup_coding_system (val, &process_coding); 665 setup_coding_system (val, &process_coding);
@@ -681,7 +709,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
681 709
682 if (!NILP (buffer)) 710 if (!NILP (buffer))
683 { 711 {
684 if (NILP (current_buffer->enable_multibyte_characters) 712 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
685 && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) 713 && ! CODING_MAY_REQUIRE_DECODING (&process_coding))
686 insert_1_both (buf, nread, nread, 0, 1, 0); 714 insert_1_both (buf, nread, nread, 0, 1, 0);
687 else 715 else
@@ -894,7 +922,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
894 /* Decide coding-system of the contents of the temporary file. */ 922 /* Decide coding-system of the contents of the temporary file. */
895 if (!NILP (Vcoding_system_for_write)) 923 if (!NILP (Vcoding_system_for_write))
896 val = Vcoding_system_for_write; 924 val = Vcoding_system_for_write;
897 else if (NILP (current_buffer->enable_multibyte_characters)) 925 else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
898 val = Qraw_text; 926 val = Qraw_text;
899 else 927 else
900 { 928 {
@@ -1503,11 +1531,6 @@ set_initial_environment (void)
1503void 1531void
1504syms_of_callproc (void) 1532syms_of_callproc (void)
1505{ 1533{
1506#ifdef DOS_NT
1507 Qbuffer_file_type = intern_c_string ("buffer-file-type");
1508 staticpro (&Qbuffer_file_type);
1509#endif /* DOS_NT */
1510
1511#ifndef DOS_NT 1534#ifndef DOS_NT
1512 Vtemp_file_name_pattern = build_string ("emacsXXXXXX"); 1535 Vtemp_file_name_pattern = build_string ("emacsXXXXXX");
1513#elif defined (WINDOWSNT) 1536#elif defined (WINDOWSNT)
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 62d261278ab..26fa0db2d77 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -39,15 +39,15 @@ casify_object (enum case_action flag, Lisp_Object obj)
39 register int inword = flag == CASE_DOWN; 39 register int inword = flag == CASE_DOWN;
40 40
41 /* If the case table is flagged as modified, rescan it. */ 41 /* If the case table is flagged as modified, rescan it. */
42 if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) 42 if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1]))
43 Fset_case_table (current_buffer->downcase_table); 43 Fset_case_table (BVAR (current_buffer, downcase_table));
44 44
45 if (INTEGERP (obj)) 45 if (INTEGERP (obj))
46 { 46 {
47 int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER 47 int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
48 | CHAR_SHIFT | CHAR_CTL | CHAR_META); 48 | CHAR_SHIFT | CHAR_CTL | CHAR_META);
49 int flags = XINT (obj) & flagbits; 49 int flags = XINT (obj) & flagbits;
50 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 50 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
51 51
52 /* If the character has higher bits set 52 /* If the character has higher bits set
53 above the flags, return it unchanged. 53 above the flags, return it unchanged.
@@ -198,7 +198,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
198{ 198{
199 register int c; 199 register int c;
200 register int inword = flag == CASE_DOWN; 200 register int inword = flag == CASE_DOWN;
201 register int multibyte = !NILP (current_buffer->enable_multibyte_characters); 201 register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
202 EMACS_INT start, end; 202 EMACS_INT start, end;
203 EMACS_INT start_byte, end_byte; 203 EMACS_INT start_byte, end_byte;
204 EMACS_INT first = -1, last; /* Position of first and last changes. */ 204 EMACS_INT first = -1, last; /* Position of first and last changes. */
@@ -210,8 +210,8 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
210 return; 210 return;
211 211
212 /* If the case table is flagged as modified, rescan it. */ 212 /* If the case table is flagged as modified, rescan it. */
213 if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) 213 if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1]))
214 Fset_case_table (current_buffer->downcase_table); 214 Fset_case_table (BVAR (current_buffer, downcase_table));
215 215
216 validate_region (&b, &e); 216 validate_region (&b, &e);
217 start = XFASTINT (b); 217 start = XFASTINT (b);
diff --git a/src/casetab.c b/src/casetab.c
index 0db9d63f7a6..5207e5315ae 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -71,7 +71,7 @@ DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0,
71 doc: /* Return the case table of the current buffer. */) 71 doc: /* Return the case table of the current buffer. */)
72 (void) 72 (void)
73{ 73{
74 return current_buffer->downcase_table; 74 return BVAR (current_buffer, downcase_table);
75} 75}
76 76
77DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0, 77DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0,
@@ -160,10 +160,10 @@ set_case_table (Lisp_Object table, int standard)
160 } 160 }
161 else 161 else
162 { 162 {
163 current_buffer->downcase_table = table; 163 BVAR (current_buffer, downcase_table) = table;
164 current_buffer->upcase_table = up; 164 BVAR (current_buffer, upcase_table) = up;
165 current_buffer->case_canon_table = canon; 165 BVAR (current_buffer, case_canon_table) = canon;
166 current_buffer->case_eqv_table = eqv; 166 BVAR (current_buffer, case_eqv_table) = eqv;
167 } 167 }
168 168
169 return table; 169 return table;
diff --git a/src/category.c b/src/category.c
index 06046959b6f..bcd73d3a487 100644
--- a/src/category.c
+++ b/src/category.c
@@ -190,7 +190,7 @@ Lisp_Object
190check_category_table (Lisp_Object table) 190check_category_table (Lisp_Object table)
191{ 191{
192 if (NILP (table)) 192 if (NILP (table))
193 return current_buffer->category_table; 193 return BVAR (current_buffer, category_table);
194 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table); 194 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table);
195 return table; 195 return table;
196} 196}
@@ -200,7 +200,7 @@ DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0,
200This is the one specified by the current buffer. */) 200This is the one specified by the current buffer. */)
201 (void) 201 (void)
202{ 202{
203 return current_buffer->category_table; 203 return BVAR (current_buffer, category_table);
204} 204}
205 205
206DEFUN ("standard-category-table", Fstandard_category_table, 206DEFUN ("standard-category-table", Fstandard_category_table,
@@ -281,7 +281,7 @@ Return TABLE. */)
281{ 281{
282 int idx; 282 int idx;
283 table = check_category_table (table); 283 table = check_category_table (table);
284 current_buffer->category_table = table; 284 BVAR (current_buffer, category_table) = table;
285 /* Indicate that this buffer now has a specified category table. */ 285 /* Indicate that this buffer now has a specified category table. */
286 idx = PER_BUFFER_VAR_IDX (category_table); 286 idx = PER_BUFFER_VAR_IDX (category_table);
287 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 287 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -292,7 +292,7 @@ Return TABLE. */)
292Lisp_Object 292Lisp_Object
293char_category_set (int c) 293char_category_set (int c)
294{ 294{
295 return CHAR_TABLE_REF (current_buffer->category_table, c); 295 return CHAR_TABLE_REF (BVAR (current_buffer, category_table), c);
296} 296}
297 297
298DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, 298DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0,
diff --git a/src/category.h b/src/category.h
index 561b06b6f60..b279f3d9c59 100644
--- a/src/category.h
+++ b/src/category.h
@@ -91,7 +91,7 @@ extern Lisp_Object _temp_category_set;
91 91
92/* The standard category table is stored where it will automatically 92/* The standard category table is stored where it will automatically
93 be used in all new buffers. */ 93 be used in all new buffers. */
94#define Vstandard_category_table buffer_defaults.category_table 94#define Vstandard_category_table BVAR (&buffer_defaults, category_table)
95 95
96/* Return the category set of character C in the current category table. */ 96/* Return the category set of character C in the current category table. */
97#define CATEGORY_SET(c) char_category_set (c) 97#define CATEGORY_SET(c) char_category_set (c)
diff --git a/src/character.c b/src/character.c
index 397481e5b39..f12c4f28d31 100644
--- a/src/character.c
+++ b/src/character.c
@@ -521,7 +521,7 @@ chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
521{ 521{
522 /* current_buffer is null at early stages of Emacs initialization. */ 522 /* current_buffer is null at early stages of Emacs initialization. */
523 if (current_buffer == 0 523 if (current_buffer == 0
524 || NILP (current_buffer->enable_multibyte_characters)) 524 || NILP (BVAR (current_buffer, enable_multibyte_characters)))
525 return nbytes; 525 return nbytes;
526 526
527 return multibyte_chars_in_text (ptr, nbytes); 527 return multibyte_chars_in_text (ptr, nbytes);
@@ -987,7 +987,7 @@ character is not ASCII nor 8-bit character, an error is signalled. */)
987 pos = XFASTINT (position); 987 pos = XFASTINT (position);
988 p = CHAR_POS_ADDR (pos); 988 p = CHAR_POS_ADDR (pos);
989 } 989 }
990 if (NILP (current_buffer->enable_multibyte_characters)) 990 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
991 return make_number (*p); 991 return make_number (*p);
992 } 992 }
993 else 993 else
diff --git a/src/character.h b/src/character.h
index f2ccb28bb37..fb29ced66b7 100644
--- a/src/character.h
+++ b/src/character.h
@@ -417,7 +417,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
417 do \ 417 do \
418 { \ 418 { \
419 CHARIDX++; \ 419 CHARIDX++; \
420 if (!NILP (current_buffer->enable_multibyte_characters)) \ 420 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \
421 { \ 421 { \
422 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ 422 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \
423 int len; \ 423 int len; \
@@ -484,7 +484,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
484 do \ 484 do \
485 { \ 485 { \
486 (charpos)++; \ 486 (charpos)++; \
487 if (NILP (current_buffer->enable_multibyte_characters)) \ 487 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \
488 (bytepos)++; \ 488 (bytepos)++; \
489 else \ 489 else \
490 INC_POS ((bytepos)); \ 490 INC_POS ((bytepos)); \
@@ -498,7 +498,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
498 do \ 498 do \
499 { \ 499 { \
500 (charpos)--; \ 500 (charpos)--; \
501 if (NILP (current_buffer->enable_multibyte_characters)) \ 501 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \
502 (bytepos)--; \ 502 (bytepos)--; \
503 else \ 503 else \
504 DEC_POS ((bytepos)); \ 504 DEC_POS ((bytepos)); \
@@ -561,11 +561,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
561#define ASCII_CHAR_WIDTH(c) \ 561#define ASCII_CHAR_WIDTH(c) \
562 (c < 0x20 \ 562 (c < 0x20 \
563 ? (c == '\t' \ 563 ? (c == '\t' \
564 ? XFASTINT (current_buffer->tab_width) \ 564 ? XFASTINT (BVAR (current_buffer, tab_width)) \
565 : (c == '\n' ? 0 : (NILP (current_buffer->ctl_arrow) ? 4 : 2))) \ 565 : (c == '\n' ? 0 : (NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2))) \
566 : (c < 0x7f \ 566 : (c < 0x7f \
567 ? 1 \ 567 ? 1 \
568 : ((NILP (current_buffer->ctl_arrow) ? 4 : 2)))) 568 : ((NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2))))
569 569
570/* Return the width of character C. The width is measured by how many 570/* Return the width of character C. The width is measured by how many
571 columns C will occupy on the screen when displayed in the current 571 columns C will occupy on the screen when displayed in the current
diff --git a/src/charset.c b/src/charset.c
index 229f2c2cdae..3624e740acb 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1554,7 +1554,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
1554 EMACS_INT from, from_byte, to, stop, stop_byte; 1554 EMACS_INT from, from_byte, to, stop, stop_byte;
1555 int i; 1555 int i;
1556 Lisp_Object val; 1556 Lisp_Object val;
1557 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 1557 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
1558 1558
1559 validate_region (&beg, &end); 1559 validate_region (&beg, &end);
1560 from = XFASTINT (beg); 1560 from = XFASTINT (beg);
diff --git a/src/cmds.c b/src/cmds.c
index 93b7e2b7651..336bf1154f9 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -277,7 +277,7 @@ After insertion, the value of `auto-fill-function' is called if the
277 int remove_boundary = 1; 277 int remove_boundary = 1;
278 CHECK_NATNUM (n); 278 CHECK_NATNUM (n);
279 279
280 if (!EQ (Vthis_command, current_kboard->Vlast_command)) 280 if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command)))
281 nonundocount = 0; 281 nonundocount = 0;
282 282
283 if (NILP (Vexecuting_kbd_macro) 283 if (NILP (Vexecuting_kbd_macro)
@@ -292,10 +292,10 @@ After insertion, the value of `auto-fill-function' is called if the
292 } 292 }
293 293
294 if (remove_boundary 294 if (remove_boundary
295 && CONSP (current_buffer->undo_list) 295 && CONSP (BVAR (current_buffer, undo_list))
296 && NILP (XCAR (current_buffer->undo_list))) 296 && NILP (XCAR (BVAR (current_buffer, undo_list))))
297 /* Remove the undo_boundary that was just pushed. */ 297 /* Remove the undo_boundary that was just pushed. */
298 current_buffer->undo_list = XCDR (current_buffer->undo_list); 298 BVAR (current_buffer, undo_list) = XCDR (BVAR (current_buffer, undo_list));
299 299
300 /* Barf if the key that invoked this was not a character. */ 300 /* Barf if the key that invoked this was not a character. */
301 if (!CHARACTERP (last_command_event)) 301 if (!CHARACTERP (last_command_event))
@@ -335,12 +335,12 @@ internal_self_insert (int c, EMACS_INT n)
335 EMACS_INT chars_to_delete = 0; 335 EMACS_INT chars_to_delete = 0;
336 EMACS_INT spaces_to_insert = 0; 336 EMACS_INT spaces_to_insert = 0;
337 337
338 overwrite = current_buffer->overwrite_mode; 338 overwrite = BVAR (current_buffer, overwrite_mode);
339 if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)) 339 if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions))
340 hairy = 1; 340 hairy = 1;
341 341
342 /* At first, get multi-byte form of C in STR. */ 342 /* At first, get multi-byte form of C in STR. */
343 if (!NILP (current_buffer->enable_multibyte_characters)) 343 if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
344 { 344 {
345 len = CHAR_STRING (c, str); 345 len = CHAR_STRING (c, str);
346 if (len == 1) 346 if (len == 1)
@@ -416,11 +416,11 @@ internal_self_insert (int c, EMACS_INT n)
416 416
417 synt = SYNTAX (c); 417 synt = SYNTAX (c);
418 418
419 if (!NILP (current_buffer->abbrev_mode) 419 if (!NILP (BVAR (current_buffer, abbrev_mode))
420 && synt != Sword 420 && synt != Sword
421 && NILP (current_buffer->read_only) 421 && NILP (BVAR (current_buffer, read_only))
422 && PT > BEGV 422 && PT > BEGV
423 && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters) 423 && (SYNTAX (!NILP (BVAR (current_buffer, enable_multibyte_characters))
424 ? XFASTINT (Fprevious_char ()) 424 ? XFASTINT (Fprevious_char ())
425 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) 425 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
426 == Sword)) 426 == Sword))
@@ -448,7 +448,7 @@ internal_self_insert (int c, EMACS_INT n)
448 448
449 if (chars_to_delete) 449 if (chars_to_delete)
450 { 450 {
451 int mc = ((NILP (current_buffer->enable_multibyte_characters) 451 int mc = ((NILP (BVAR (current_buffer, enable_multibyte_characters))
452 && SINGLE_BYTE_CHAR_P (c)) 452 && SINGLE_BYTE_CHAR_P (c))
453 ? UNIBYTE_TO_CHAR (c) : c); 453 ? UNIBYTE_TO_CHAR (c) : c);
454 Lisp_Object string = Fmake_string (make_number (n), make_number (mc)); 454 Lisp_Object string = Fmake_string (make_number (n), make_number (mc));
@@ -479,7 +479,7 @@ internal_self_insert (int c, EMACS_INT n)
479 if ((CHAR_TABLE_P (Vauto_fill_chars) 479 if ((CHAR_TABLE_P (Vauto_fill_chars)
480 ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c)) 480 ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
481 : (c == ' ' || c == '\n')) 481 : (c == ' ' || c == '\n'))
482 && !NILP (current_buffer->auto_fill_function)) 482 && !NILP (BVAR (current_buffer, auto_fill_function)))
483 { 483 {
484 Lisp_Object tem; 484 Lisp_Object tem;
485 485
@@ -488,7 +488,7 @@ internal_self_insert (int c, EMACS_INT n)
488 that. Must have the newline in place already so filling and 488 that. Must have the newline in place already so filling and
489 justification, if any, know where the end is going to be. */ 489 justification, if any, know where the end is going to be. */
490 SET_PT_BOTH (PT - 1, PT_BYTE - 1); 490 SET_PT_BOTH (PT - 1, PT_BYTE - 1);
491 tem = call0 (current_buffer->auto_fill_function); 491 tem = call0 (BVAR (current_buffer, auto_fill_function));
492 /* Test PT < ZV in case the auto-fill-function is strange. */ 492 /* Test PT < ZV in case the auto-fill-function is strange. */
493 if (c == '\n' && PT < ZV) 493 if (c == '\n' && PT < ZV)
494 SET_PT_BOTH (PT + 1, PT_BYTE + 1); 494 SET_PT_BOTH (PT + 1, PT_BYTE + 1);
diff --git a/src/coding.c b/src/coding.c
index a9f16de56f3..f6310369ad3 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7038,8 +7038,8 @@ decode_coding (struct coding_system *coding)
7038 set_buffer_internal (XBUFFER (coding->dst_object)); 7038 set_buffer_internal (XBUFFER (coding->dst_object));
7039 if (GPT != PT) 7039 if (GPT != PT)
7040 move_gap_both (PT, PT_BYTE); 7040 move_gap_both (PT, PT_BYTE);
7041 undo_list = current_buffer->undo_list; 7041 undo_list = BVAR (current_buffer, undo_list);
7042 current_buffer->undo_list = Qt; 7042 BVAR (current_buffer, undo_list) = Qt;
7043 } 7043 }
7044 7044
7045 coding->consumed = coding->consumed_char = 0; 7045 coding->consumed = coding->consumed_char = 0;
@@ -7136,7 +7136,7 @@ decode_coding (struct coding_system *coding)
7136 decode_eol (coding); 7136 decode_eol (coding);
7137 if (BUFFERP (coding->dst_object)) 7137 if (BUFFERP (coding->dst_object))
7138 { 7138 {
7139 current_buffer->undo_list = undo_list; 7139 BVAR (current_buffer, undo_list) = undo_list;
7140 record_insert (coding->dst_pos, coding->produced_char); 7140 record_insert (coding->dst_pos, coding->produced_char);
7141 } 7141 }
7142 return coding->result; 7142 return coding->result;
@@ -7433,7 +7433,7 @@ encode_coding (struct coding_system *coding)
7433 { 7433 {
7434 set_buffer_internal (XBUFFER (coding->dst_object)); 7434 set_buffer_internal (XBUFFER (coding->dst_object));
7435 coding->dst_multibyte 7435 coding->dst_multibyte
7436 = ! NILP (current_buffer->enable_multibyte_characters); 7436 = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
7437 } 7437 }
7438 7438
7439 coding->consumed = coding->consumed_char = 0; 7439 coding->consumed = coding->consumed_char = 0;
@@ -7504,8 +7504,8 @@ make_conversion_work_buffer (int multibyte)
7504 doesn't compile new regexps. */ 7504 doesn't compile new regexps. */
7505 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); 7505 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
7506 Ferase_buffer (); 7506 Ferase_buffer ();
7507 current_buffer->undo_list = Qt; 7507 BVAR (current_buffer, undo_list) = Qt;
7508 current_buffer->enable_multibyte_characters = multibyte ? Qt : Qnil; 7508 BVAR (current_buffer, enable_multibyte_characters) = multibyte ? Qt : Qnil;
7509 set_buffer_internal (current); 7509 set_buffer_internal (current);
7510 return workbuf; 7510 return workbuf;
7511} 7511}
@@ -7562,7 +7562,7 @@ decode_coding_gap (struct coding_system *coding,
7562 coding->dst_object = coding->src_object; 7562 coding->dst_object = coding->src_object;
7563 coding->dst_pos = PT; 7563 coding->dst_pos = PT;
7564 coding->dst_pos_byte = PT_BYTE; 7564 coding->dst_pos_byte = PT_BYTE;
7565 coding->dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); 7565 coding->dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
7566 7566
7567 if (CODING_REQUIRE_DETECTION (coding)) 7567 if (CODING_REQUIRE_DETECTION (coding))
7568 detect_coding (coding); 7568 detect_coding (coding);
@@ -7728,7 +7728,7 @@ decode_coding_object (struct coding_system *coding,
7728 coding->dst_pos = BUF_PT (XBUFFER (dst_object)); 7728 coding->dst_pos = BUF_PT (XBUFFER (dst_object));
7729 coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object)); 7729 coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object));
7730 coding->dst_multibyte 7730 coding->dst_multibyte
7731 = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); 7731 = ! NILP (BVAR (XBUFFER (dst_object), enable_multibyte_characters));
7732 } 7732 }
7733 else 7733 else
7734 { 7734 {
@@ -7798,7 +7798,7 @@ decode_coding_object (struct coding_system *coding,
7798 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); 7798 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte);
7799 else if (saved_pt < from + chars) 7799 else if (saved_pt < from + chars)
7800 TEMP_SET_PT_BOTH (from, from_byte); 7800 TEMP_SET_PT_BOTH (from, from_byte);
7801 else if (! NILP (current_buffer->enable_multibyte_characters)) 7801 else if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
7802 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), 7802 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars),
7803 saved_pt_byte + (coding->produced - bytes)); 7803 saved_pt_byte + (coding->produced - bytes));
7804 else 7804 else
@@ -7822,7 +7822,7 @@ decode_coding_object (struct coding_system *coding,
7822 { 7822 {
7823 tail->bytepos = from_byte + coding->produced; 7823 tail->bytepos = from_byte + coding->produced;
7824 tail->charpos 7824 tail->charpos
7825 = (NILP (current_buffer->enable_multibyte_characters) 7825 = (NILP (BVAR (current_buffer, enable_multibyte_characters))
7826 ? tail->bytepos : from + coding->produced_char); 7826 ? tail->bytepos : from + coding->produced_char);
7827 } 7827 }
7828 } 7828 }
@@ -7960,7 +7960,7 @@ encode_coding_object (struct coding_system *coding,
7960 set_buffer_temp (current); 7960 set_buffer_temp (current);
7961 } 7961 }
7962 coding->dst_multibyte 7962 coding->dst_multibyte
7963 = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); 7963 = ! NILP (BVAR (XBUFFER (dst_object), enable_multibyte_characters));
7964 } 7964 }
7965 else if (EQ (dst_object, Qt)) 7965 else if (EQ (dst_object, Qt))
7966 { 7966 {
@@ -8003,7 +8003,7 @@ encode_coding_object (struct coding_system *coding,
8003 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); 8003 TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte);
8004 else if (saved_pt < from + chars) 8004 else if (saved_pt < from + chars)
8005 TEMP_SET_PT_BOTH (from, from_byte); 8005 TEMP_SET_PT_BOTH (from, from_byte);
8006 else if (! NILP (current_buffer->enable_multibyte_characters)) 8006 else if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
8007 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), 8007 TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars),
8008 saved_pt_byte + (coding->produced - bytes)); 8008 saved_pt_byte + (coding->produced - bytes));
8009 else 8009 else
@@ -8027,7 +8027,7 @@ encode_coding_object (struct coding_system *coding,
8027 { 8027 {
8028 tail->bytepos = from_byte + coding->produced; 8028 tail->bytepos = from_byte + coding->produced;
8029 tail->charpos 8029 tail->charpos
8030 = (NILP (current_buffer->enable_multibyte_characters) 8030 = (NILP (BVAR (current_buffer, enable_multibyte_characters))
8031 ? tail->bytepos : from + coding->produced_char); 8031 ? tail->bytepos : from + coding->produced_char);
8032 } 8032 }
8033 } 8033 }
@@ -8481,8 +8481,8 @@ highest priority. */)
8481 return detect_coding_system (BYTE_POS_ADDR (from_byte), 8481 return detect_coding_system (BYTE_POS_ADDR (from_byte),
8482 to - from, to_byte - from_byte, 8482 to - from, to_byte - from_byte,
8483 !NILP (highest), 8483 !NILP (highest),
8484 !NILP (current_buffer 8484 !NILP (BVAR (current_buffer
8485 ->enable_multibyte_characters), 8485 , enable_multibyte_characters)),
8486 Qnil); 8486 Qnil);
8487} 8487}
8488 8488
@@ -8564,7 +8564,7 @@ DEFUN ("find-coding-systems-region-internal",
8564 CHECK_NUMBER_COERCE_MARKER (end); 8564 CHECK_NUMBER_COERCE_MARKER (end);
8565 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) 8565 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
8566 args_out_of_range (start, end); 8566 args_out_of_range (start, end);
8567 if (NILP (current_buffer->enable_multibyte_characters)) 8567 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
8568 return Qt; 8568 return Qt;
8569 start_byte = CHAR_TO_BYTE (XINT (start)); 8569 start_byte = CHAR_TO_BYTE (XINT (start));
8570 end_byte = CHAR_TO_BYTE (XINT (end)); 8570 end_byte = CHAR_TO_BYTE (XINT (end));
@@ -8698,7 +8698,7 @@ to the string. */)
8698 validate_region (&start, &end); 8698 validate_region (&start, &end);
8699 from = XINT (start); 8699 from = XINT (start);
8700 to = XINT (end); 8700 to = XINT (end);
8701 if (NILP (current_buffer->enable_multibyte_characters) 8701 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
8702 || (ascii_compatible 8702 || (ascii_compatible
8703 && (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from))))) 8703 && (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from)))))
8704 return Qnil; 8704 return Qnil;
@@ -8814,7 +8814,7 @@ is nil. */)
8814 CHECK_NUMBER_COERCE_MARKER (end); 8814 CHECK_NUMBER_COERCE_MARKER (end);
8815 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) 8815 if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end))
8816 args_out_of_range (start, end); 8816 args_out_of_range (start, end);
8817 if (NILP (current_buffer->enable_multibyte_characters)) 8817 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
8818 return Qnil; 8818 return Qnil;
8819 start_byte = CHAR_TO_BYTE (XINT (start)); 8819 start_byte = CHAR_TO_BYTE (XINT (start));
8820 end_byte = CHAR_TO_BYTE (XINT (end)); 8820 end_byte = CHAR_TO_BYTE (XINT (end));
diff --git a/src/composite.c b/src/composite.c
index 58bc68597cc..0b0602bf283 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -796,7 +796,7 @@ fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lis
796 796
797 if (NILP (string)) 797 if (NILP (string))
798 { 798 {
799 if (NILP (current_buffer->enable_multibyte_characters)) 799 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
800 error ("Attempt to shape unibyte text"); 800 error ("Attempt to shape unibyte text");
801 validate_region (&start, &end); 801 validate_region (&start, &end);
802 from = XFASTINT (start); 802 from = XFASTINT (start);
@@ -1028,7 +1028,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1028 cmp_it->stop_pos = endpos = start; 1028 cmp_it->stop_pos = endpos = start;
1029 cmp_it->ch = -1; 1029 cmp_it->ch = -1;
1030 } 1030 }
1031 if (NILP (current_buffer->enable_multibyte_characters) 1031 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
1032 || NILP (Vauto_composition_mode)) 1032 || NILP (Vauto_composition_mode))
1033 return; 1033 return;
1034 if (bytepos < 0) 1034 if (bytepos < 0)
@@ -1674,7 +1674,7 @@ composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt)
1674 return new_pt; 1674 return new_pt;
1675 } 1675 }
1676 1676
1677 if (NILP (current_buffer->enable_multibyte_characters) 1677 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
1678 || NILP (Vauto_composition_mode)) 1678 || NILP (Vauto_composition_mode))
1679 return new_pt; 1679 return new_pt;
1680 1680
@@ -1851,7 +1851,7 @@ See `find-composition' for more details. */)
1851 1851
1852 if (!find_composition (from, to, &start, &end, &prop, string)) 1852 if (!find_composition (from, to, &start, &end, &prop, string))
1853 { 1853 {
1854 if (!NILP (current_buffer->enable_multibyte_characters) 1854 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
1855 && ! NILP (Vauto_composition_mode) 1855 && ! NILP (Vauto_composition_mode)
1856 && find_automatic_composition (from, to, &start, &end, &gstring, 1856 && find_automatic_composition (from, to, &start, &end, &gstring,
1857 string)) 1857 string))
diff --git a/src/config.in b/src/config.in
index df492bf8f87..1fd1f89ede3 100644
--- a/src/config.in
+++ b/src/config.in
@@ -31,6 +31,21 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31/* Define if building universal (internal helper macro) */ 31/* Define if building universal (internal helper macro) */
32#undef AC_APPLE_UNIVERSAL_BUILD 32#undef AC_APPLE_UNIVERSAL_BUILD
33 33
34/* Define to the number of bits in type 'ptrdiff_t'. */
35#undef BITSIZEOF_PTRDIFF_T
36
37/* Define to the number of bits in type 'sig_atomic_t'. */
38#undef BITSIZEOF_SIG_ATOMIC_T
39
40/* Define to the number of bits in type 'size_t'. */
41#undef BITSIZEOF_SIZE_T
42
43/* Define to the number of bits in type 'wchar_t'. */
44#undef BITSIZEOF_WCHAR_T
45
46/* Define to the number of bits in type 'wint_t'. */
47#undef BITSIZEOF_WINT_T
48
34/* Define if Emacs cannot be dumped on your system. */ 49/* Define if Emacs cannot be dumped on your system. */
35#undef CANNOT_DUMP 50#undef CANNOT_DUMP
36 51
@@ -42,9 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42/* Define to 1 if using `alloca.c'. */ 57/* Define to 1 if using `alloca.c'. */
43#undef C_ALLOCA 58#undef C_ALLOCA
44 59
45/* Define to 1 if using `getloadavg.c'. */
46#undef C_GETLOADAVG
47
48/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */ 60/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
49#undef DGUX 61#undef DGUX
50 62
@@ -74,10 +86,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
74/* Define this to check for short string overrun. */ 86/* Define this to check for short string overrun. */
75#undef GC_CHECK_STRING_OVERRUN 87#undef GC_CHECK_STRING_OVERRUN
76 88
77/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid.
78 */
79#undef GETLOADAVG_PRIVILEGED
80
81/* Define to 1 if the `getpgrp' function requires zero arguments. */ 89/* Define to 1 if the `getpgrp' function requires zero arguments. */
82#undef GETPGRP_VOID 90#undef GETPGRP_VOID
83 91
@@ -144,6 +152,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
144 don't. */ 152 don't. */
145#undef HAVE_DECL_LOCALTIME_R 153#undef HAVE_DECL_LOCALTIME_R
146 154
155/* Define to 1 if you have the declaration of `strmode', and to 0 if you
156 don't. */
157#undef HAVE_DECL_STRMODE
158
147/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you 159/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
148 don't. */ 160 don't. */
149#undef HAVE_DECL_SYS_SIGLIST 161#undef HAVE_DECL_SYS_SIGLIST
@@ -225,9 +237,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
225/* Define to 1 if you have the `getline' function. */ 237/* Define to 1 if you have the `getline' function. */
226#undef HAVE_GETLINE 238#undef HAVE_GETLINE
227 239
228/* Define to 1 if you have the `getloadavg' function. */
229#undef HAVE_GETLOADAVG
230
231/* Define to 1 if you have the <getopt.h> header file. */ 240/* Define to 1 if you have the <getopt.h> header file. */
232#undef HAVE_GETOPT_H 241#undef HAVE_GETOPT_H
233 242
@@ -408,6 +417,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
408/* Define to 1 if using libotf. */ 417/* Define to 1 if using libotf. */
409#undef HAVE_LIBOTF 418#undef HAVE_LIBOTF
410 419
420/* Define to 1 if you have the `perfstat' library (-lperfstat). */
421#undef HAVE_LIBPERFSTAT
422
411/* Define to 1 if you have the <libpng/png.h> header file. */ 423/* Define to 1 if you have the <libpng/png.h> header file. */
412#undef HAVE_LIBPNG_PNG_H 424#undef HAVE_LIBPNG_PNG_H
413 425
@@ -447,6 +459,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
447/* Define to 1 if you support file names longer than 14 characters. */ 459/* Define to 1 if you support file names longer than 14 characters. */
448#undef HAVE_LONG_FILE_NAMES 460#undef HAVE_LONG_FILE_NAMES
449 461
462/* Define to 1 if the system has the type `long long int'. */
463#undef HAVE_LONG_LONG_INT
464
450/* Define to 1 if you have the `lrand48' function. */ 465/* Define to 1 if you have the `lrand48' function. */
451#undef HAVE_LRAND48 466#undef HAVE_LRAND48
452 467
@@ -603,6 +618,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
603/* Define to 1 if you have the `shutdown' function. */ 618/* Define to 1 if you have the `shutdown' function. */
604#undef HAVE_SHUTDOWN 619#undef HAVE_SHUTDOWN
605 620
621/* Define to 1 if 'sig_atomic_t' is a signed integer type. */
622#undef HAVE_SIGNED_SIG_ATOMIC_T
623
624/* Define to 1 if 'wchar_t' is a signed integer type. */
625#undef HAVE_SIGNED_WCHAR_T
626
627/* Define to 1 if 'wint_t' is a signed integer type. */
628#undef HAVE_SIGNED_WINT_T
629
606/* Define to 1 if the system has the type `size_t'. */ 630/* Define to 1 if the system has the type `size_t'. */
607#undef HAVE_SIZE_T 631#undef HAVE_SIZE_T
608 632
@@ -666,12 +690,24 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
666/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */ 690/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
667#undef HAVE_STRUCT_UTIMBUF 691#undef HAVE_STRUCT_UTIMBUF
668 692
693/* Define if struct stat has an st_dm_mode member. */
694#undef HAVE_ST_DM_MODE
695
669/* Define to 1 if you have the `sync' function. */ 696/* Define to 1 if you have the `sync' function. */
670#undef HAVE_SYNC 697#undef HAVE_SYNC
671 698
672/* Define to 1 if you have the `sysinfo' function. */ 699/* Define to 1 if you have the `sysinfo' function. */
673#undef HAVE_SYSINFO 700#undef HAVE_SYSINFO
674 701
702/* Define to 1 if you have the <sys/bitypes.h> header file. */
703#undef HAVE_SYS_BITYPES_H
704
705/* Define to 1 if you have the <sys/inttypes.h> header file. */
706#undef HAVE_SYS_INTTYPES_H
707
708/* Define to 1 if you have the <sys/loadavg.h> header file. */
709#undef HAVE_SYS_LOADAVG_H
710
675/* Define to 1 if you have the <sys/mman.h> header file. */ 711/* Define to 1 if you have the <sys/mman.h> header file. */
676#undef HAVE_SYS_MMAN_H 712#undef HAVE_SYS_MMAN_H
677 713
@@ -749,6 +785,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
749/* Define to 1 if you have the <unistd.h> header file. */ 785/* Define to 1 if you have the <unistd.h> header file. */
750#undef HAVE_UNISTD_H 786#undef HAVE_UNISTD_H
751 787
788/* Define to 1 if the system has the type `unsigned long long int'. */
789#undef HAVE_UNSIGNED_LONG_LONG_INT
790
752/* Define to 1 if you have the <util.h> header file. */ 791/* Define to 1 if you have the <util.h> header file. */
753#undef HAVE_UTIL_H 792#undef HAVE_UTIL_H
754 793
@@ -767,6 +806,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
767/* Define to 1 if you have the <vfork.h> header file. */ 806/* Define to 1 if you have the <vfork.h> header file. */
768#undef HAVE_VFORK_H 807#undef HAVE_VFORK_H
769 808
809/* Define to 1 if you have the <wchar.h> header file. */
810#undef HAVE_WCHAR_H
811
770/* Define if you have the 'wchar_t' type. */ 812/* Define if you have the 'wchar_t' type. */
771#undef HAVE_WCHAR_T 813#undef HAVE_WCHAR_T
772 814
@@ -870,10 +912,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
870/* Define to support POP mail retrieval. */ 912/* Define to support POP mail retrieval. */
871#undef MAIL_USE_POP 913#undef MAIL_USE_POP
872 914
873/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend
874 on `HAVE_STRUCT_NLIST_N_UN_N_NAME */
875#undef NLIST_NAME_UNION
876
877/* Define to 1 if you don't have struct exception in math.h. */ 915/* Define to 1 if you don't have struct exception in math.h. */
878#undef NO_MATHERR 916#undef NO_MATHERR
879 917
@@ -889,6 +927,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
889/* Define to 1 if you are using NS windowing under GNUstep. */ 927/* Define to 1 if you are using NS windowing under GNUstep. */
890#undef NS_IMPL_GNUSTEP 928#undef NS_IMPL_GNUSTEP
891 929
930/* Define to 1 if the nlist n_name member is a pointer */
931#undef N_NAME_POINTER
932
892/* Define if the C compiler is the linker. */ 933/* Define if the C compiler is the linker. */
893#undef ORDINARY_LINK 934#undef ORDINARY_LINK
894 935
@@ -920,6 +961,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
920/* Define to 1 if the C compiler supports function prototypes. */ 961/* Define to 1 if the C compiler supports function prototypes. */
921#undef PROTOTYPES 962#undef PROTOTYPES
922 963
964/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
965 'ptrdiff_t'. */
966#undef PTRDIFF_T_SUFFIX
967
923/* Define REL_ALLOC if you want to use the relocating allocator for buffer 968/* Define REL_ALLOC if you want to use the relocating allocator for buffer
924 space. */ 969 space. */
925#undef REL_ALLOC 970#undef REL_ALLOC
@@ -927,6 +972,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
927/* Define as the return type of signal handlers (`int' or `void'). */ 972/* Define as the return type of signal handlers (`int' or `void'). */
928#undef RETSIGTYPE 973#undef RETSIGTYPE
929 974
975/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
976 'sig_atomic_t'. */
977#undef SIG_ATOMIC_T_SUFFIX
978
979/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
980 'size_t'. */
981#undef SIZE_T_SUFFIX
982
930/* If using the C implementation of alloca, define if you know the 983/* If using the C implementation of alloca, define if you know the
931 direction of stack growth for your system; otherwise it will be 984 direction of stack growth for your system; otherwise it will be
932 automatically deduced at runtime. 985 automatically deduced at runtime.
@@ -935,6 +988,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
935 STACK_DIRECTION = 0 => direction of growth unknown */ 988 STACK_DIRECTION = 0 => direction of growth unknown */
936#undef STACK_DIRECTION 989#undef STACK_DIRECTION
937 990
991/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
992#undef STAT_MACROS_BROKEN
993
938/* Define to 1 if you have the ANSI C header files. */ 994/* Define to 1 if you have the ANSI C header files. */
939#undef STDC_HEADERS 995#undef STDC_HEADERS
940 996
@@ -990,6 +1046,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
990/* Version number of package */ 1046/* Version number of package */
991#undef VERSION 1047#undef VERSION
992 1048
1049/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
1050 'wchar_t'. */
1051#undef WCHAR_T_SUFFIX
1052
1053/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
1054 'wint_t'. */
1055#undef WINT_T_SUFFIX
1056
993/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 1057/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
994 significant byte first (like Motorola and SPARC, unlike Intel). */ 1058 significant byte first (like Motorola and SPARC, unlike Intel). */
995#if defined AC_APPLE_UNIVERSAL_BUILD 1059#if defined AC_APPLE_UNIVERSAL_BUILD
@@ -1095,6 +1159,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1095/* Define to the name of the strftime replacement function. */ 1159/* Define to the name of the strftime replacement function. */
1096#undef my_strftime 1160#undef my_strftime
1097 1161
1162/* Define to the type of st_nlink in struct stat, or a supertype. */
1163#undef nlink_t
1164
1098/* Define to `int' if <sys/types.h> does not define. */ 1165/* Define to `int' if <sys/types.h> does not define. */
1099#undef pid_t 1166#undef pid_t
1100 1167
diff --git a/src/data.c b/src/data.c
index 2f17edd3fdc..ecedba24101 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1021,7 +1021,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1021 } 1021 }
1022 else 1022 else
1023 { 1023 {
1024 tem1 = assq_no_quit (var, current_buffer->local_var_alist); 1024 tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
1025 XSETBUFFER (blv->where, current_buffer); 1025 XSETBUFFER (blv->where, current_buffer);
1026 } 1026 }
1027 } 1027 }
@@ -1190,7 +1190,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1190 tem1 = Fassq (symbol, 1190 tem1 = Fassq (symbol,
1191 (blv->frame_local 1191 (blv->frame_local
1192 ? XFRAME (where)->param_alist 1192 ? XFRAME (where)->param_alist
1193 : XBUFFER (where)->local_var_alist)); 1193 : BVAR (XBUFFER (where), local_var_alist)));
1194 blv->where = where; 1194 blv->where = where;
1195 blv->found = 1; 1195 blv->found = 1;
1196 1196
@@ -1221,8 +1221,8 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1221 bindings, not for frame-local bindings. */ 1221 bindings, not for frame-local bindings. */
1222 eassert (!blv->frame_local); 1222 eassert (!blv->frame_local);
1223 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1223 tem1 = Fcons (symbol, XCDR (blv->defcell));
1224 XBUFFER (where)->local_var_alist 1224 BVAR (XBUFFER (where), local_var_alist)
1225 = Fcons (tem1, XBUFFER (where)->local_var_alist); 1225 = Fcons (tem1, BVAR (XBUFFER (where), local_var_alist));
1226 } 1226 }
1227 } 1227 }
1228 1228
@@ -1644,13 +1644,13 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1644 if (let_shadows_global_binding_p (symbol)) 1644 if (let_shadows_global_binding_p (symbol))
1645 message ("Making %s local to %s while let-bound!", 1645 message ("Making %s local to %s while let-bound!",
1646 SDATA (SYMBOL_NAME (variable)), 1646 SDATA (SYMBOL_NAME (variable)),
1647 SDATA (current_buffer->name)); 1647 SDATA (BVAR (current_buffer, name)));
1648 } 1648 }
1649 } 1649 }
1650 1650
1651 /* Make sure this buffer has its own value of symbol. */ 1651 /* Make sure this buffer has its own value of symbol. */
1652 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ 1652 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
1653 tem = Fassq (variable, current_buffer->local_var_alist); 1653 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1654 if (NILP (tem)) 1654 if (NILP (tem))
1655 { 1655 {
1656 if (let_shadows_buffer_binding_p (sym)) 1656 if (let_shadows_buffer_binding_p (sym))
@@ -1662,9 +1662,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1662 default value. */ 1662 default value. */
1663 find_symbol_value (variable); 1663 find_symbol_value (variable);
1664 1664
1665 current_buffer->local_var_alist 1665 BVAR (current_buffer, local_var_alist)
1666 = Fcons (Fcons (variable, XCDR (blv->defcell)), 1666 = Fcons (Fcons (variable, XCDR (blv->defcell)),
1667 current_buffer->local_var_alist); 1667 BVAR (current_buffer, local_var_alist));
1668 1668
1669 /* Make sure symbol does not think it is set up for this buffer; 1669 /* Make sure symbol does not think it is set up for this buffer;
1670 force it to look once again for this buffer's value. */ 1670 force it to look once again for this buffer's value. */
@@ -1730,10 +1730,10 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1730 1730
1731 /* Get rid of this buffer's alist element, if any. */ 1731 /* Get rid of this buffer's alist element, if any. */
1732 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1732 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1733 tem = Fassq (variable, current_buffer->local_var_alist); 1733 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1734 if (!NILP (tem)) 1734 if (!NILP (tem))
1735 current_buffer->local_var_alist 1735 BVAR (current_buffer, local_var_alist)
1736 = Fdelq (tem, current_buffer->local_var_alist); 1736 = Fdelq (tem, BVAR (current_buffer, local_var_alist));
1737 1737
1738 /* If the symbol is set up with the current buffer's binding 1738 /* If the symbol is set up with the current buffer's binding
1739 loaded, recompute its value. We have to do it now, or else 1739 loaded, recompute its value. We have to do it now, or else
@@ -1860,7 +1860,7 @@ BUFFER defaults to the current buffer. */)
1860 XSETBUFFER (tmp, buf); 1860 XSETBUFFER (tmp, buf);
1861 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ 1861 XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
1862 1862
1863 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1863 for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
1864 { 1864 {
1865 elt = XCAR (tail); 1865 elt = XCAR (tail);
1866 if (EQ (variable, XCAR (elt))) 1866 if (EQ (variable, XCAR (elt)))
diff --git a/src/deps.mk b/src/deps.mk
index e8ff3dd592e..77994bcaadb 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -9,17 +9,17 @@
9## it under the terms of the GNU General Public License as published by 9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation, either version 3 of the License, or 10## the Free Software Foundation, either version 3 of the License, or
11## (at your option) any later version. 11## (at your option) any later version.
12## 12##
13## GNU Emacs is distributed in the hope that it will be useful, 13## GNU Emacs is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of 14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16## GNU General Public License for more details. 16## GNU General Public License for more details.
17## 17##
18## You should have received a copy of the GNU General Public License 18## You should have received a copy of the GNU General Public License
19## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 19## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20 20
21## Commentary: 21## Commentary:
22## 22##
23## This file is inserted in src/Makefile if AUTO_DEPEND=no. 23## This file is inserted in src/Makefile if AUTO_DEPEND=no.
24## It defines static dependencies between the various source files. 24## It defines static dependencies between the various source files.
25 25
@@ -73,7 +73,7 @@ pre-crt0.o: pre-crt0.c
73dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h) 73dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
74dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \ 74dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
75 coding.h regex.h systime.h blockinput.h atimer.h composite.h \ 75 coding.h regex.h systime.h blockinput.h atimer.h composite.h \
76 ../lib/unistd.h globals.h 76 ../lib/filemode.h ../lib/unistd.h globals.h
77dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \ 77dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
78 window.h buffer.h termchar.h termopts.h termhooks.h cm.h \ 78 window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
79 disptab.h indent.h $(INTERVALS_H) nsgui.h ../lib/unistd.h \ 79 disptab.h indent.h $(INTERVALS_H) nsgui.h ../lib/unistd.h \
@@ -98,7 +98,6 @@ fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
98 commands.h globals.h ../lib/unistd.h 98 commands.h globals.h ../lib/unistd.h
99filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \ 99filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
100 ../lib/unistd.h lisp.h globals.h $(config_h) 100 ../lib/unistd.h lisp.h globals.h $(config_h)
101filemode.o: filemode.c $(config_h)
102font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \ 101font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
103 font.h lisp.h globals.h $(config_h) buffer.h composite.h fontset.h \ 102 font.h lisp.h globals.h $(config_h) buffer.h composite.h fontset.h \
104 xterm.h nsgui.h msdos.h 103 xterm.h nsgui.h msdos.h
@@ -115,7 +114,6 @@ fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
115ftfont.o: ftfont.c dispextern.h frame.h character.h charset.h composite.h \ 114ftfont.o: ftfont.c dispextern.h frame.h character.h charset.h composite.h \
116 font.h lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h \ 115 font.h lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h \
117 fontset.h ccl.h ftfont.h globals.h 116 fontset.h ccl.h ftfont.h globals.h
118getloadavg.o: getloadavg.c $(config_h)
119gnutls.o: gnutls.c gnutls.h process.h ../lib/unistd.h \ 117gnutls.o: gnutls.c gnutls.h process.h ../lib/unistd.h \
120 lisp.h globals.h $(config_h) 118 lisp.h globals.h $(config_h)
121gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \ 119gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
@@ -145,7 +143,6 @@ gmalloc.o: gmalloc.c $(config_h)
145ralloc.o: ralloc.c lisp.h $(config_h) 143ralloc.o: ralloc.c lisp.h $(config_h)
146vm-limit.o: vm-limit.c mem-limits.h lisp.h globals.h $(config_h) 144vm-limit.o: vm-limit.c mem-limits.h lisp.h globals.h $(config_h)
147marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h) 145marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h)
148md5.o: md5.c md5.h $(config_h)
149minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \ 146minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
150 buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \ 147 buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
151 termhooks.h lisp.h globals.h $(config_h) coding.h 148 termhooks.h lisp.h globals.h $(config_h) coding.h
@@ -284,7 +281,7 @@ eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h frame.h \
284 msdos.h 281 msdos.h
285floatfns.o: floatfns.c syssignal.h lisp.h globals.h $(config_h) 282floatfns.o: floatfns.c syssignal.h lisp.h globals.h $(config_h)
286fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h \ 283fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h \
287 keyboard.h keymap.h window.h $(INTERVALS_H) coding.h md5.h \ 284 keyboard.h keymap.h window.h $(INTERVALS_H) coding.h ../lib/md5.h \
288 blockinput.h atimer.h systime.h xterm.h ../lib/unistd.h globals.h 285 blockinput.h atimer.h systime.h xterm.h ../lib/unistd.h globals.h
289print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \ 286print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
290 lisp.h globals.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \ 287 lisp.h globals.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \
diff --git a/src/dired.c b/src/dired.c
index e37055258d6..b01ce8d4d8f 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -61,6 +61,8 @@ extern struct direct *readdir (DIR *);
61 61
62#endif /* HAVE_DIRENT_H */ 62#endif /* HAVE_DIRENT_H */
63 63
64#include <filemode.h>
65
64#ifdef MSDOS 66#ifdef MSDOS
65#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0) 67#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
66#else 68#else
@@ -82,9 +84,6 @@ extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
82 struct re_registers *, 84 struct re_registers *,
83 Lisp_Object, int, int); 85 Lisp_Object, int, int);
84 86
85/* From filemode.c. Can't go in Lisp.h because of `stat'. */
86extern void filemodestring (struct stat *, char *);
87
88/* if system does not have symbolic links, it does not have lstat. 87/* if system does not have symbolic links, it does not have lstat.
89 In that case, use ordinary stat instead. */ 88 In that case, use ordinary stat instead. */
90 89
@@ -158,7 +157,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
158# ifdef WINDOWSNT 157# ifdef WINDOWSNT
159 /* Windows users want case-insensitive wildcards. */ 158 /* Windows users want case-insensitive wildcards. */
160 bufp = compile_pattern (match, 0, 159 bufp = compile_pattern (match, 0,
161 buffer_defaults.case_canon_table, 0, 1); 160 BVAR (&buffer_defaults, case_canon_table), 0, 1);
162# else /* !WINDOWSNT */ 161# else /* !WINDOWSNT */
163 bufp = compile_pattern (match, 0, Qnil, 0, 1); 162 bufp = compile_pattern (match, 0, Qnil, 0, 1);
164# endif /* !WINDOWSNT */ 163# endif /* !WINDOWSNT */
diff --git a/src/dispextern.h b/src/dispextern.h
index 6d54ebefd84..6bb0c3a6aae 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1416,7 +1416,7 @@ struct glyph_string
1416 && !(W)->pseudo_window_p \ 1416 && !(W)->pseudo_window_p \
1417 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ 1417 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
1418 && BUFFERP ((W)->buffer) \ 1418 && BUFFERP ((W)->buffer) \
1419 && !NILP (XBUFFER ((W)->buffer)->mode_line_format) \ 1419 && !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format)) \
1420 && WINDOW_TOTAL_LINES (W) > 1) 1420 && WINDOW_TOTAL_LINES (W) > 1)
1421 1421
1422/* Value is non-zero if window W wants a header line. */ 1422/* Value is non-zero if window W wants a header line. */
@@ -1426,8 +1426,8 @@ struct glyph_string
1426 && !(W)->pseudo_window_p \ 1426 && !(W)->pseudo_window_p \
1427 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ 1427 && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
1428 && BUFFERP ((W)->buffer) \ 1428 && BUFFERP ((W)->buffer) \
1429 && !NILP (XBUFFER ((W)->buffer)->header_line_format) \ 1429 && !NILP (BVAR (XBUFFER ((W)->buffer), header_line_format)) \
1430 && WINDOW_TOTAL_LINES (W) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format)) 1430 && WINDOW_TOTAL_LINES (W) > 1 + !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format)))
1431 1431
1432 1432
1433/* Return proper value to be used as baseline offset of font that has 1433/* Return proper value to be used as baseline offset of font that has
diff --git a/src/dispnew.c b/src/dispnew.c
index 1aef70f1a5d..4e068bde536 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6129,7 +6129,7 @@ pass nil for VARIABLE. */)
6129 { 6129 {
6130 buf = XCDR (XCAR (tail)); 6130 buf = XCDR (XCAR (tail));
6131 /* Ignore buffers that aren't included in buffer lists. */ 6131 /* Ignore buffers that aren't included in buffer lists. */
6132 if (SREF (XBUFFER (buf)->name, 0) == ' ') 6132 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
6133 continue; 6133 continue;
6134 if (vecp == end) 6134 if (vecp == end)
6135 goto changed; 6135 goto changed;
@@ -6137,7 +6137,7 @@ pass nil for VARIABLE. */)
6137 goto changed; 6137 goto changed;
6138 if (vecp == end) 6138 if (vecp == end)
6139 goto changed; 6139 goto changed;
6140 if (!EQ (*vecp++, XBUFFER (buf)->read_only)) 6140 if (!EQ (*vecp++, BVAR (XBUFFER (buf), read_only)))
6141 goto changed; 6141 goto changed;
6142 if (vecp == end) 6142 if (vecp == end)
6143 goto changed; 6143 goto changed;
@@ -6184,10 +6184,10 @@ pass nil for VARIABLE. */)
6184 { 6184 {
6185 buf = XCDR (XCAR (tail)); 6185 buf = XCDR (XCAR (tail));
6186 /* Ignore buffers that aren't included in buffer lists. */ 6186 /* Ignore buffers that aren't included in buffer lists. */
6187 if (SREF (XBUFFER (buf)->name, 0) == ' ') 6187 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
6188 continue; 6188 continue;
6189 *vecp++ = buf; 6189 *vecp++ = buf;
6190 *vecp++ = XBUFFER (buf)->read_only; 6190 *vecp++ = BVAR (XBUFFER (buf), read_only);
6191 *vecp++ = Fbuffer_modified_p (buf); 6191 *vecp++ = Fbuffer_modified_p (buf);
6192 } 6192 }
6193 /* Fill up the vector with lambdas (always at least one). */ 6193 /* Fill up the vector with lambdas (always at least one). */
diff --git a/src/doc.c b/src/doc.c
index c56f0b6c9df..834321108b5 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -729,7 +729,7 @@ a new string, without any text properties, is returned. */)
729 or a specified local map (which means search just that and the 729 or a specified local map (which means search just that and the
730 global map). If non-nil, it might come from Voverriding_local_map, 730 global map). If non-nil, it might come from Voverriding_local_map,
731 or from a \\<mapname> construct in STRING itself.. */ 731 or from a \\<mapname> construct in STRING itself.. */
732 keymap = current_kboard->Voverriding_terminal_local_map; 732 keymap = KVAR (current_kboard, Voverriding_terminal_local_map);
733 if (NILP (keymap)) 733 if (NILP (keymap))
734 keymap = Voverriding_local_map; 734 keymap = Voverriding_local_map;
735 735
diff --git a/src/editfns.c b/src/editfns.c
index 30acc36f025..5d6189f2a3c 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -306,10 +306,10 @@ region_limit (int beginningp)
306 306
307 if (!NILP (Vtransient_mark_mode) 307 if (!NILP (Vtransient_mark_mode)
308 && NILP (Vmark_even_if_inactive) 308 && NILP (Vmark_even_if_inactive)
309 && NILP (current_buffer->mark_active)) 309 && NILP (BVAR (current_buffer, mark_active)))
310 xsignal0 (Qmark_inactive); 310 xsignal0 (Qmark_inactive);
311 311
312 m = Fmarker_position (current_buffer->mark); 312 m = Fmarker_position (BVAR (current_buffer, mark));
313 if (NILP (m)) 313 if (NILP (m))
314 error ("The mark is not set now, so there is no region"); 314 error ("The mark is not set now, so there is no region");
315 315
@@ -338,7 +338,7 @@ Watch out! Moving this marker changes the mark position.
338If you set the marker not to point anywhere, the buffer will have no mark. */) 338If you set the marker not to point anywhere, the buffer will have no mark. */)
339 (void) 339 (void)
340{ 340{
341 return current_buffer->mark; 341 return BVAR (current_buffer, mark);
342} 342}
343 343
344 344
@@ -866,9 +866,9 @@ save_excursion_save (void)
866 == current_buffer); 866 == current_buffer);
867 867
868 return Fcons (Fpoint_marker (), 868 return Fcons (Fpoint_marker (),
869 Fcons (Fcopy_marker (current_buffer->mark, Qnil), 869 Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil),
870 Fcons (visible ? Qt : Qnil, 870 Fcons (visible ? Qt : Qnil,
871 Fcons (current_buffer->mark_active, 871 Fcons (BVAR (current_buffer, mark_active),
872 selected_window)))); 872 selected_window))));
873} 873}
874 874
@@ -900,8 +900,8 @@ save_excursion_restore (Lisp_Object info)
900 /* Mark marker. */ 900 /* Mark marker. */
901 info = XCDR (info); 901 info = XCDR (info);
902 tem = XCAR (info); 902 tem = XCAR (info);
903 omark = Fmarker_position (current_buffer->mark); 903 omark = Fmarker_position (BVAR (current_buffer, mark));
904 Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); 904 Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ());
905 nmark = Fmarker_position (tem); 905 nmark = Fmarker_position (tem);
906 unchain_marker (XMARKER (tem)); 906 unchain_marker (XMARKER (tem));
907 907
@@ -922,14 +922,14 @@ save_excursion_restore (Lisp_Object info)
922 /* Mark active */ 922 /* Mark active */
923 info = XCDR (info); 923 info = XCDR (info);
924 tem = XCAR (info); 924 tem = XCAR (info);
925 tem1 = current_buffer->mark_active; 925 tem1 = BVAR (current_buffer, mark_active);
926 current_buffer->mark_active = tem; 926 BVAR (current_buffer, mark_active) = tem;
927 927
928 if (!NILP (Vrun_hooks)) 928 if (!NILP (Vrun_hooks))
929 { 929 {
930 /* If mark is active now, and either was not active 930 /* If mark is active now, and either was not active
931 or was at a different place, run the activate hook. */ 931 or was at a different place, run the activate hook. */
932 if (! NILP (current_buffer->mark_active)) 932 if (! NILP (BVAR (current_buffer, mark_active)))
933 { 933 {
934 if (! EQ (omark, nmark)) 934 if (! EQ (omark, nmark))
935 call1 (Vrun_hooks, intern ("activate-mark-hook")); 935 call1 (Vrun_hooks, intern ("activate-mark-hook"));
@@ -1114,7 +1114,7 @@ At the beginning of the buffer or accessible region, return 0. */)
1114 Lisp_Object temp; 1114 Lisp_Object temp;
1115 if (PT <= BEGV) 1115 if (PT <= BEGV)
1116 XSETFASTINT (temp, 0); 1116 XSETFASTINT (temp, 0);
1117 else if (!NILP (current_buffer->enable_multibyte_characters)) 1117 else if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
1118 { 1118 {
1119 EMACS_INT pos = PT_BYTE; 1119 EMACS_INT pos = PT_BYTE;
1120 DEC_POS (pos); 1120 DEC_POS (pos);
@@ -1228,7 +1228,7 @@ If POS is out of range, the value is nil. */)
1228 pos_byte = CHAR_TO_BYTE (XINT (pos)); 1228 pos_byte = CHAR_TO_BYTE (XINT (pos));
1229 } 1229 }
1230 1230
1231 if (!NILP (current_buffer->enable_multibyte_characters)) 1231 if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
1232 { 1232 {
1233 DEC_POS (pos_byte); 1233 DEC_POS (pos_byte);
1234 XSETFASTINT (val, FETCH_CHAR (pos_byte)); 1234 XSETFASTINT (val, FETCH_CHAR (pos_byte));
@@ -2135,7 +2135,7 @@ general_insert_function (void (*insert_func)
2135 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2135 unsigned char str[MAX_MULTIBYTE_LENGTH];
2136 int len; 2136 int len;
2137 2137
2138 if (!NILP (current_buffer->enable_multibyte_characters)) 2138 if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
2139 len = CHAR_STRING (XFASTINT (val), str); 2139 len = CHAR_STRING (XFASTINT (val), str);
2140 else 2140 else
2141 { 2141 {
@@ -2267,7 +2267,7 @@ from adjoining text, if those properties are sticky. */)
2267 CHECK_NUMBER (character); 2267 CHECK_NUMBER (character);
2268 CHECK_NUMBER (count); 2268 CHECK_NUMBER (count);
2269 2269
2270 if (!NILP (current_buffer->enable_multibyte_characters)) 2270 if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
2271 len = CHAR_STRING (XFASTINT (character), str); 2271 len = CHAR_STRING (XFASTINT (character), str);
2272 else 2272 else
2273 str[0] = XFASTINT (character), len = 1; 2273 str[0] = XFASTINT (character), len = 1;
@@ -2316,7 +2316,7 @@ from adjoining text, if those properties are sticky. */)
2316 if (XINT (byte) < 0 || XINT (byte) > 255) 2316 if (XINT (byte) < 0 || XINT (byte) > 255)
2317 args_out_of_range_3 (byte, make_number (0), make_number (255)); 2317 args_out_of_range_3 (byte, make_number (0), make_number (255));
2318 if (XINT (byte) >= 128 2318 if (XINT (byte) >= 128
2319 && ! NILP (current_buffer->enable_multibyte_characters)) 2319 && ! NILP (BVAR (current_buffer, enable_multibyte_characters)))
2320 XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte))); 2320 XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte)));
2321 return Finsert_char (byte, count, inherit); 2321 return Finsert_char (byte, count, inherit);
2322} 2322}
@@ -2370,7 +2370,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte,
2370 if (start < GPT && GPT < end) 2370 if (start < GPT && GPT < end)
2371 move_gap (start); 2371 move_gap (start);
2372 2372
2373 if (! NILP (current_buffer->enable_multibyte_characters)) 2373 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
2374 result = make_uninit_multibyte_string (end - start, end_byte - start_byte); 2374 result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
2375 else 2375 else
2376 result = make_uninit_string (end - start); 2376 result = make_uninit_string (end - start);
@@ -2485,7 +2485,7 @@ They default to the values of (point-min) and (point-max) in BUFFER. */)
2485 if (NILP (buf)) 2485 if (NILP (buf))
2486 nsberror (buffer); 2486 nsberror (buffer);
2487 bp = XBUFFER (buf); 2487 bp = XBUFFER (buf);
2488 if (NILP (bp->name)) 2488 if (NILP (BVAR (bp, name)))
2489 error ("Selecting deleted buffer"); 2489 error ("Selecting deleted buffer");
2490 2490
2491 if (NILP (start)) 2491 if (NILP (start))
@@ -2533,8 +2533,8 @@ determines whether case is significant or ignored. */)
2533 register EMACS_INT begp1, endp1, begp2, endp2, temp; 2533 register EMACS_INT begp1, endp1, begp2, endp2, temp;
2534 register struct buffer *bp1, *bp2; 2534 register struct buffer *bp1, *bp2;
2535 register Lisp_Object trt 2535 register Lisp_Object trt
2536 = (!NILP (current_buffer->case_fold_search) 2536 = (!NILP (BVAR (current_buffer, case_fold_search))
2537 ? current_buffer->case_canon_table : Qnil); 2537 ? BVAR (current_buffer, case_canon_table) : Qnil);
2538 EMACS_INT chars = 0; 2538 EMACS_INT chars = 0;
2539 EMACS_INT i1, i2, i1_byte, i2_byte; 2539 EMACS_INT i1, i2, i1_byte, i2_byte;
2540 2540
@@ -2549,7 +2549,7 @@ determines whether case is significant or ignored. */)
2549 if (NILP (buf1)) 2549 if (NILP (buf1))
2550 nsberror (buffer1); 2550 nsberror (buffer1);
2551 bp1 = XBUFFER (buf1); 2551 bp1 = XBUFFER (buf1);
2552 if (NILP (bp1->name)) 2552 if (NILP (BVAR (bp1, name)))
2553 error ("Selecting deleted buffer"); 2553 error ("Selecting deleted buffer");
2554 } 2554 }
2555 2555
@@ -2587,7 +2587,7 @@ determines whether case is significant or ignored. */)
2587 if (NILP (buf2)) 2587 if (NILP (buf2))
2588 nsberror (buffer2); 2588 nsberror (buffer2);
2589 bp2 = XBUFFER (buf2); 2589 bp2 = XBUFFER (buf2);
2590 if (NILP (bp2->name)) 2590 if (NILP (BVAR (bp2, name)))
2591 error ("Selecting deleted buffer"); 2591 error ("Selecting deleted buffer");
2592 } 2592 }
2593 2593
@@ -2627,7 +2627,7 @@ determines whether case is significant or ignored. */)
2627 2627
2628 QUIT; 2628 QUIT;
2629 2629
2630 if (! NILP (bp1->enable_multibyte_characters)) 2630 if (! NILP (BVAR (bp1, enable_multibyte_characters)))
2631 { 2631 {
2632 c1 = BUF_FETCH_MULTIBYTE_CHAR (bp1, i1_byte); 2632 c1 = BUF_FETCH_MULTIBYTE_CHAR (bp1, i1_byte);
2633 BUF_INC_POS (bp1, i1_byte); 2633 BUF_INC_POS (bp1, i1_byte);
@@ -2640,7 +2640,7 @@ determines whether case is significant or ignored. */)
2640 i1++; 2640 i1++;
2641 } 2641 }
2642 2642
2643 if (! NILP (bp2->enable_multibyte_characters)) 2643 if (! NILP (BVAR (bp2, enable_multibyte_characters)))
2644 { 2644 {
2645 c2 = BUF_FETCH_MULTIBYTE_CHAR (bp2, i2_byte); 2645 c2 = BUF_FETCH_MULTIBYTE_CHAR (bp2, i2_byte);
2646 BUF_INC_POS (bp2, i2_byte); 2646 BUF_INC_POS (bp2, i2_byte);
@@ -2680,13 +2680,13 @@ determines whether case is significant or ignored. */)
2680static Lisp_Object 2680static Lisp_Object
2681subst_char_in_region_unwind (Lisp_Object arg) 2681subst_char_in_region_unwind (Lisp_Object arg)
2682{ 2682{
2683 return current_buffer->undo_list = arg; 2683 return BVAR (current_buffer, undo_list) = arg;
2684} 2684}
2685 2685
2686static Lisp_Object 2686static Lisp_Object
2687subst_char_in_region_unwind_1 (Lisp_Object arg) 2687subst_char_in_region_unwind_1 (Lisp_Object arg)
2688{ 2688{
2689 return current_buffer->filename = arg; 2689 return BVAR (current_buffer, filename) = arg;
2690} 2690}
2691 2691
2692DEFUN ("subst-char-in-region", Fsubst_char_in_region, 2692DEFUN ("subst-char-in-region", Fsubst_char_in_region,
@@ -2712,7 +2712,7 @@ Both characters must have the same length of multi-byte form. */)
2712#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) 2712#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
2713 int maybe_byte_combining = COMBINING_NO; 2713 int maybe_byte_combining = COMBINING_NO;
2714 EMACS_INT last_changed = 0; 2714 EMACS_INT last_changed = 0;
2715 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2715 int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2716 2716
2717 restart: 2717 restart:
2718 2718
@@ -2756,12 +2756,12 @@ Both characters must have the same length of multi-byte form. */)
2756 if (!changed && !NILP (noundo)) 2756 if (!changed && !NILP (noundo))
2757 { 2757 {
2758 record_unwind_protect (subst_char_in_region_unwind, 2758 record_unwind_protect (subst_char_in_region_unwind,
2759 current_buffer->undo_list); 2759 BVAR (current_buffer, undo_list));
2760 current_buffer->undo_list = Qt; 2760 BVAR (current_buffer, undo_list) = Qt;
2761 /* Don't do file-locking. */ 2761 /* Don't do file-locking. */
2762 record_unwind_protect (subst_char_in_region_unwind_1, 2762 record_unwind_protect (subst_char_in_region_unwind_1,
2763 current_buffer->filename); 2763 BVAR (current_buffer, filename));
2764 current_buffer->filename = Qnil; 2764 BVAR (current_buffer, filename) = Qnil;
2765 } 2765 }
2766 2766
2767 if (pos_byte < GPT_BYTE) 2767 if (pos_byte < GPT_BYTE)
@@ -2824,7 +2824,7 @@ Both characters must have the same length of multi-byte form. */)
2824 2824
2825 struct gcpro gcpro1; 2825 struct gcpro gcpro1;
2826 2826
2827 tem = current_buffer->undo_list; 2827 tem = BVAR (current_buffer, undo_list);
2828 GCPRO1 (tem); 2828 GCPRO1 (tem);
2829 2829
2830 /* Make a multibyte string containing this single character. */ 2830 /* Make a multibyte string containing this single character. */
@@ -2843,7 +2843,7 @@ Both characters must have the same length of multi-byte form. */)
2843 INC_POS (pos_byte_next); 2843 INC_POS (pos_byte_next);
2844 2844
2845 if (! NILP (noundo)) 2845 if (! NILP (noundo))
2846 current_buffer->undo_list = tem; 2846 BVAR (current_buffer, undo_list) = tem;
2847 2847
2848 UNGCPRO; 2848 UNGCPRO;
2849 } 2849 }
@@ -2945,7 +2945,7 @@ It returns the number of characters changed. */)
2945 int cnt; /* Number of changes made. */ 2945 int cnt; /* Number of changes made. */
2946 EMACS_INT size; /* Size of translate table. */ 2946 EMACS_INT size; /* Size of translate table. */
2947 EMACS_INT pos, pos_byte, end_pos; 2947 EMACS_INT pos, pos_byte, end_pos;
2948 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 2948 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2949 int string_multibyte; 2949 int string_multibyte;
2950 Lisp_Object val; 2950 Lisp_Object val;
2951 2951
@@ -3206,7 +3206,7 @@ save_restriction_restore (Lisp_Object data)
3206 ? XMARKER (XCAR (data))->buffer 3206 ? XMARKER (XCAR (data))->buffer
3207 : XBUFFER (data)); 3207 : XBUFFER (data));
3208 3208
3209 if (buf && buf != current_buffer && !NILP (buf->pt_marker)) 3209 if (buf && buf != current_buffer && !NILP (BVAR (buf, pt_marker)))
3210 { /* If `buf' uses markers to keep track of PT, BEGV, and ZV (as 3210 { /* If `buf' uses markers to keep track of PT, BEGV, and ZV (as
3211 is the case if it is or has an indirect buffer), then make 3211 is the case if it is or has an indirect buffer), then make
3212 sure it is current before we update BEGV, so 3212 sure it is current before we update BEGV, so
@@ -4136,20 +4136,20 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
4136 4136
4137 if (XINT (c1) == XINT (c2)) 4137 if (XINT (c1) == XINT (c2))
4138 return Qt; 4138 return Qt;
4139 if (NILP (current_buffer->case_fold_search)) 4139 if (NILP (BVAR (current_buffer, case_fold_search)))
4140 return Qnil; 4140 return Qnil;
4141 4141
4142 /* Do these in separate statements, 4142 /* Do these in separate statements,
4143 then compare the variables. 4143 then compare the variables.
4144 because of the way DOWNCASE uses temp variables. */ 4144 because of the way DOWNCASE uses temp variables. */
4145 i1 = XFASTINT (c1); 4145 i1 = XFASTINT (c1);
4146 if (NILP (current_buffer->enable_multibyte_characters) 4146 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
4147 && ! ASCII_CHAR_P (i1)) 4147 && ! ASCII_CHAR_P (i1))
4148 { 4148 {
4149 MAKE_CHAR_MULTIBYTE (i1); 4149 MAKE_CHAR_MULTIBYTE (i1);
4150 } 4150 }
4151 i2 = XFASTINT (c2); 4151 i2 = XFASTINT (c2);
4152 if (NILP (current_buffer->enable_multibyte_characters) 4152 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
4153 && ! ASCII_CHAR_P (i2)) 4153 && ! ASCII_CHAR_P (i2))
4154 { 4154 {
4155 MAKE_CHAR_MULTIBYTE (i2); 4155 MAKE_CHAR_MULTIBYTE (i2);
diff --git a/src/fileio.c b/src/fileio.c
index 429fce9f5a0..2ccad83f668 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -770,7 +770,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
770 770
771 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ 771 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
772 if (NILP (default_directory)) 772 if (NILP (default_directory))
773 default_directory = current_buffer->directory; 773 default_directory = BVAR (current_buffer, directory);
774 if (! STRINGP (default_directory)) 774 if (! STRINGP (default_directory))
775 { 775 {
776#ifdef DOS_NT 776#ifdef DOS_NT
@@ -2669,7 +2669,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2669 struct stat st; 2669 struct stat st;
2670 Lisp_Object handler; 2670 Lisp_Object handler;
2671 2671
2672 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2672 absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
2673 2673
2674 /* If the file name has special constructs in it, 2674 /* If the file name has special constructs in it,
2675 call the corresponding file handler. */ 2675 call the corresponding file handler. */
@@ -2722,7 +2722,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2722 struct stat st; 2722 struct stat st;
2723 Lisp_Object handler; 2723 Lisp_Object handler;
2724 2724
2725 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2725 absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
2726 2726
2727 /* If the file name has special constructs in it, 2727 /* If the file name has special constructs in it,
2728 call the corresponding file handler. */ 2728 call the corresponding file handler. */
@@ -2769,7 +2769,7 @@ if file does not exist, is not accessible, or SELinux is disabled */)
2769 context_t context; 2769 context_t context;
2770#endif 2770#endif
2771 2771
2772 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2772 absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
2773 2773
2774 /* If the file name has special constructs in it, 2774 /* If the file name has special constructs in it,
2775 call the corresponding file handler. */ 2775 call the corresponding file handler. */
@@ -2827,7 +2827,7 @@ is disabled. */)
2827 context_t parsed_con; 2827 context_t parsed_con;
2828#endif 2828#endif
2829 2829
2830 absname = Fexpand_file_name (filename, current_buffer->directory); 2830 absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
2831 2831
2832 /* If the file name has special constructs in it, 2832 /* If the file name has special constructs in it,
2833 call the corresponding file handler. */ 2833 call the corresponding file handler. */
@@ -2894,7 +2894,7 @@ Return nil, if file does not exist or is not accessible. */)
2894 struct stat st; 2894 struct stat st;
2895 Lisp_Object handler; 2895 Lisp_Object handler;
2896 2896
2897 absname = expand_and_dir_to_file (filename, current_buffer->directory); 2897 absname = expand_and_dir_to_file (filename, BVAR (current_buffer, directory));
2898 2898
2899 /* If the file name has special constructs in it, 2899 /* If the file name has special constructs in it,
2900 call the corresponding file handler. */ 2900 call the corresponding file handler. */
@@ -2923,7 +2923,7 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */)
2923 Lisp_Object absname, encoded_absname; 2923 Lisp_Object absname, encoded_absname;
2924 Lisp_Object handler; 2924 Lisp_Object handler;
2925 2925
2926 absname = Fexpand_file_name (filename, current_buffer->directory); 2926 absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
2927 CHECK_NUMBER (mode); 2927 CHECK_NUMBER (mode);
2928 2928
2929 /* If the file name has special constructs in it, 2929 /* If the file name has special constructs in it,
@@ -2985,7 +2985,7 @@ Use the current time if TIME is nil. TIME is in the format of
2985 if (! lisp_time_argument (time, &sec, &usec)) 2985 if (! lisp_time_argument (time, &sec, &usec))
2986 error ("Invalid time specification"); 2986 error ("Invalid time specification");
2987 2987
2988 absname = Fexpand_file_name (filename, current_buffer->directory); 2988 absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
2989 2989
2990 /* If the file name has special constructs in it, 2990 /* If the file name has special constructs in it,
2991 call the corresponding file handler. */ 2991 call the corresponding file handler. */
@@ -3047,8 +3047,8 @@ otherwise, if FILE2 does not exist, the answer is t. */)
3047 3047
3048 absname1 = Qnil; 3048 absname1 = Qnil;
3049 GCPRO2 (absname1, file2); 3049 GCPRO2 (absname1, file2);
3050 absname1 = expand_and_dir_to_file (file1, current_buffer->directory); 3050 absname1 = expand_and_dir_to_file (file1, BVAR (current_buffer, directory));
3051 absname2 = expand_and_dir_to_file (file2, current_buffer->directory); 3051 absname2 = expand_and_dir_to_file (file2, BVAR (current_buffer, directory));
3052 UNGCPRO; 3052 UNGCPRO;
3053 3053
3054 /* If the file name has special constructs in it, 3054 /* If the file name has special constructs in it,
@@ -3075,10 +3075,6 @@ otherwise, if FILE2 does not exist, the answer is t. */)
3075 return (mtime1 > st.st_mtime) ? Qt : Qnil; 3075 return (mtime1 > st.st_mtime) ? Qt : Qnil;
3076} 3076}
3077 3077
3078#ifdef DOS_NT
3079Lisp_Object Qfind_buffer_file_type;
3080#endif /* DOS_NT */
3081
3082#ifndef READ_BUF_SIZE 3078#ifndef READ_BUF_SIZE
3083#define READ_BUF_SIZE (64 << 10) 3079#define READ_BUF_SIZE (64 << 10)
3084#endif 3080#endif
@@ -3116,8 +3112,8 @@ decide_coding_unwind (Lisp_Object unwind_data)
3116 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3112 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
3117 3113
3118 /* Now we are safe to change the buffer's multibyteness directly. */ 3114 /* Now we are safe to change the buffer's multibyteness directly. */
3119 current_buffer->enable_multibyte_characters = multibyte; 3115 BVAR (current_buffer, enable_multibyte_characters) = multibyte;
3120 current_buffer->undo_list = undo_list; 3116 BVAR (current_buffer, undo_list) = undo_list;
3121 3117
3122 return Qnil; 3118 return Qnil;
3123} 3119}
@@ -3212,7 +3208,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3212 if (current_buffer->base_buffer && ! NILP (visit)) 3208 if (current_buffer->base_buffer && ! NILP (visit))
3213 error ("Cannot do file visiting in an indirect buffer"); 3209 error ("Cannot do file visiting in an indirect buffer");
3214 3210
3215 if (!NILP (current_buffer->read_only)) 3211 if (!NILP (BVAR (current_buffer, read_only)))
3216 Fbarf_if_buffer_read_only (); 3212 Fbarf_if_buffer_read_only ();
3217 3213
3218 val = Qnil; 3214 val = Qnil;
@@ -3403,16 +3399,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
3403 buf = XBUFFER (buffer); 3399 buf = XBUFFER (buffer);
3404 3400
3405 delete_all_overlays (buf); 3401 delete_all_overlays (buf);
3406 buf->directory = current_buffer->directory; 3402 BVAR (buf, directory) = BVAR (current_buffer, directory);
3407 buf->read_only = Qnil; 3403 BVAR (buf, read_only) = Qnil;
3408 buf->filename = Qnil; 3404 BVAR (buf, filename) = Qnil;
3409 buf->undo_list = Qt; 3405 BVAR (buf, undo_list) = Qt;
3410 eassert (buf->overlays_before == NULL); 3406 eassert (buf->overlays_before == NULL);
3411 eassert (buf->overlays_after == NULL); 3407 eassert (buf->overlays_after == NULL);
3412 3408
3413 set_buffer_internal (buf); 3409 set_buffer_internal (buf);
3414 Ferase_buffer (); 3410 Ferase_buffer ();
3415 buf->enable_multibyte_characters = Qnil; 3411 BVAR (buf, enable_multibyte_characters) = Qnil;
3416 3412
3417 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); 3413 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
3418 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3414 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -3450,7 +3446,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3450 else 3446 else
3451 CHECK_CODING_SYSTEM (coding_system); 3447 CHECK_CODING_SYSTEM (coding_system);
3452 3448
3453 if (NILP (current_buffer->enable_multibyte_characters)) 3449 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
3454 /* We must suppress all character code conversion except for 3450 /* We must suppress all character code conversion except for
3455 end-of-line conversion. */ 3451 end-of-line conversion. */
3456 coding_system = raw_text_coding_system (coding_system); 3452 coding_system = raw_text_coding_system (coding_system);
@@ -3598,7 +3594,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3598 we cannot use this method; giveup and try the other. */ 3594 we cannot use this method; giveup and try the other. */
3599 if (same_at_end > same_at_start 3595 if (same_at_end > same_at_start
3600 && FETCH_BYTE (same_at_end - 1) >= 0200 3596 && FETCH_BYTE (same_at_end - 1) >= 0200
3601 && ! NILP (current_buffer->enable_multibyte_characters) 3597 && ! NILP (BVAR (current_buffer, enable_multibyte_characters))
3602 && (CODING_MAY_REQUIRE_DECODING (&coding))) 3598 && (CODING_MAY_REQUIRE_DECODING (&coding)))
3603 giveup_match_end = 1; 3599 giveup_match_end = 1;
3604 break; 3600 break;
@@ -3617,14 +3613,14 @@ variable `last-coding-system-used' to the coding system actually used. */)
3617 3613
3618 /* Extend the start of non-matching text area to multibyte 3614 /* Extend the start of non-matching text area to multibyte
3619 character boundary. */ 3615 character boundary. */
3620 if (! NILP (current_buffer->enable_multibyte_characters)) 3616 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
3621 while (same_at_start > BEGV_BYTE 3617 while (same_at_start > BEGV_BYTE
3622 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) 3618 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
3623 same_at_start--; 3619 same_at_start--;
3624 3620
3625 /* Extend the end of non-matching text area to multibyte 3621 /* Extend the end of non-matching text area to multibyte
3626 character boundary. */ 3622 character boundary. */
3627 if (! NILP (current_buffer->enable_multibyte_characters)) 3623 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
3628 while (same_at_end < ZV_BYTE 3624 while (same_at_end < ZV_BYTE
3629 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) 3625 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
3630 same_at_end++; 3626 same_at_end++;
@@ -3673,7 +3669,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3673 unsigned char *decoded; 3669 unsigned char *decoded;
3674 EMACS_INT temp; 3670 EMACS_INT temp;
3675 int this_count = SPECPDL_INDEX (); 3671 int this_count = SPECPDL_INDEX ();
3676 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3672 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
3677 Lisp_Object conversion_buffer; 3673 Lisp_Object conversion_buffer;
3678 3674
3679 conversion_buffer = code_conversion_save (1, multibyte); 3675 conversion_buffer = code_conversion_save (1, multibyte);
@@ -3778,7 +3774,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3778 3774
3779 /* Extend the start of non-matching text area to the previous 3775 /* Extend the start of non-matching text area to the previous
3780 multibyte character boundary. */ 3776 multibyte character boundary. */
3781 if (! NILP (current_buffer->enable_multibyte_characters)) 3777 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
3782 while (same_at_start > BEGV_BYTE 3778 while (same_at_start > BEGV_BYTE
3783 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) 3779 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start)))
3784 same_at_start--; 3780 same_at_start--;
@@ -3795,7 +3791,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3795 3791
3796 /* Extend the end of non-matching text area to the next 3792 /* Extend the end of non-matching text area to the next
3797 multibyte character boundary. */ 3793 multibyte character boundary. */
3798 if (! NILP (current_buffer->enable_multibyte_characters)) 3794 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
3799 while (same_at_end < ZV_BYTE 3795 while (same_at_end < ZV_BYTE
3800 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) 3796 && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end)))
3801 same_at_end++; 3797 same_at_end++;
@@ -3870,9 +3866,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
3870 if (NILP (visit) && inserted > 0) 3866 if (NILP (visit) && inserted > 0)
3871 { 3867 {
3872#ifdef CLASH_DETECTION 3868#ifdef CLASH_DETECTION
3873 if (!NILP (current_buffer->file_truename) 3869 if (!NILP (BVAR (current_buffer, file_truename))
3874 /* Make binding buffer-file-name to nil effective. */ 3870 /* Make binding buffer-file-name to nil effective. */
3875 && !NILP (current_buffer->filename) 3871 && !NILP (BVAR (current_buffer, filename))
3876 && SAVE_MODIFF >= MODIFF) 3872 && SAVE_MODIFF >= MODIFF)
3877 we_locked_file = 1; 3873 we_locked_file = 1;
3878#endif /* CLASH_DETECTION */ 3874#endif /* CLASH_DETECTION */
@@ -3977,7 +3973,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3977 { 3973 {
3978#ifdef CLASH_DETECTION 3974#ifdef CLASH_DETECTION
3979 if (we_locked_file) 3975 if (we_locked_file)
3980 unlock_file (current_buffer->file_truename); 3976 unlock_file (BVAR (current_buffer, file_truename));
3981#endif 3977#endif
3982 Vdeactivate_mark = old_Vdeactivate_mark; 3978 Vdeactivate_mark = old_Vdeactivate_mark;
3983 } 3979 }
@@ -4028,11 +4024,11 @@ variable `last-coding-system-used' to the coding system actually used. */)
4028 Lisp_Object unwind_data; 4024 Lisp_Object unwind_data;
4029 int count = SPECPDL_INDEX (); 4025 int count = SPECPDL_INDEX ();
4030 4026
4031 unwind_data = Fcons (current_buffer->enable_multibyte_characters, 4027 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
4032 Fcons (current_buffer->undo_list, 4028 Fcons (BVAR (current_buffer, undo_list),
4033 Fcurrent_buffer ())); 4029 Fcurrent_buffer ()));
4034 current_buffer->enable_multibyte_characters = Qnil; 4030 BVAR (current_buffer, enable_multibyte_characters) = Qnil;
4035 current_buffer->undo_list = Qt; 4031 BVAR (current_buffer, undo_list) = Qt;
4036 record_unwind_protect (decide_coding_unwind, unwind_data); 4032 record_unwind_protect (decide_coding_unwind, unwind_data);
4037 4033
4038 if (inserted > 0 && ! NILP (Vset_auto_coding_function)) 4034 if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4062,7 +4058,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4062 else 4058 else
4063 CHECK_CODING_SYSTEM (coding_system); 4059 CHECK_CODING_SYSTEM (coding_system);
4064 4060
4065 if (NILP (current_buffer->enable_multibyte_characters)) 4061 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
4066 /* We must suppress all character code conversion except for 4062 /* We must suppress all character code conversion except for
4067 end-of-line conversion. */ 4063 end-of-line conversion. */
4068 coding_system = raw_text_coding_system (coding_system); 4064 coding_system = raw_text_coding_system (coding_system);
@@ -4080,10 +4076,10 @@ variable `last-coding-system-used' to the coding system actually used. */)
4080 && NILP (replace)) 4076 && NILP (replace))
4081 /* Visiting a file with these coding system makes the buffer 4077 /* Visiting a file with these coding system makes the buffer
4082 unibyte. */ 4078 unibyte. */
4083 current_buffer->enable_multibyte_characters = Qnil; 4079 BVAR (current_buffer, enable_multibyte_characters) = Qnil;
4084 } 4080 }
4085 4081
4086 coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); 4082 coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
4087 if (CODING_MAY_REQUIRE_DECODING (&coding) 4083 if (CODING_MAY_REQUIRE_DECODING (&coding)
4088 && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding))) 4084 && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding)))
4089 { 4085 {
@@ -4103,18 +4099,6 @@ variable `last-coding-system-used' to the coding system actually used. */)
4103 4099
4104 /* Now INSERTED is measured in characters. */ 4100 /* Now INSERTED is measured in characters. */
4105 4101
4106#ifdef DOS_NT
4107 /* Use the conversion type to determine buffer-file-type
4108 (find-buffer-file-type is now used to help determine the
4109 conversion). */
4110 if ((VECTORP (CODING_ID_EOL_TYPE (coding.id))
4111 || EQ (CODING_ID_EOL_TYPE (coding.id), Qunix))
4112 && ! CODING_REQUIRE_DECODING (&coding))
4113 current_buffer->buffer_file_type = Qt;
4114 else
4115 current_buffer->buffer_file_type = Qnil;
4116#endif
4117
4118 handled: 4102 handled:
4119 4103
4120 if (deferred_remove_unwind_protect) 4104 if (deferred_remove_unwind_protect)
@@ -4124,24 +4108,24 @@ variable `last-coding-system-used' to the coding system actually used. */)
4124 4108
4125 if (!NILP (visit)) 4109 if (!NILP (visit))
4126 { 4110 {
4127 if (!EQ (current_buffer->undo_list, Qt) && !nochange) 4111 if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
4128 current_buffer->undo_list = Qnil; 4112 BVAR (current_buffer, undo_list) = Qnil;
4129 4113
4130 if (NILP (handler)) 4114 if (NILP (handler))
4131 { 4115 {
4132 current_buffer->modtime = st.st_mtime; 4116 current_buffer->modtime = st.st_mtime;
4133 current_buffer->modtime_size = st.st_size; 4117 current_buffer->modtime_size = st.st_size;
4134 current_buffer->filename = orig_filename; 4118 BVAR (current_buffer, filename) = orig_filename;
4135 } 4119 }
4136 4120
4137 SAVE_MODIFF = MODIFF; 4121 SAVE_MODIFF = MODIFF;
4138 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 4122 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
4139 XSETFASTINT (current_buffer->save_length, Z - BEG); 4123 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4140#ifdef CLASH_DETECTION 4124#ifdef CLASH_DETECTION
4141 if (NILP (handler)) 4125 if (NILP (handler))
4142 { 4126 {
4143 if (!NILP (current_buffer->file_truename)) 4127 if (!NILP (BVAR (current_buffer, file_truename)))
4144 unlock_file (current_buffer->file_truename); 4128 unlock_file (BVAR (current_buffer, file_truename));
4145 unlock_file (filename); 4129 unlock_file (filename);
4146 } 4130 }
4147#endif /* CLASH_DETECTION */ 4131#endif /* CLASH_DETECTION */
@@ -4174,8 +4158,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
4174 specbind (Qinhibit_modification_hooks, Qt); 4158 specbind (Qinhibit_modification_hooks, Qt);
4175 4159
4176 /* Save old undo list and don't record undo for decoding. */ 4160 /* Save old undo list and don't record undo for decoding. */
4177 old_undo = current_buffer->undo_list; 4161 old_undo = BVAR (current_buffer, undo_list);
4178 current_buffer->undo_list = Qt; 4162 BVAR (current_buffer, undo_list) = Qt;
4179 4163
4180 if (NILP (replace)) 4164 if (NILP (replace))
4181 { 4165 {
@@ -4263,7 +4247,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4263 4247
4264 if (NILP (visit)) 4248 if (NILP (visit))
4265 { 4249 {
4266 current_buffer->undo_list = old_undo; 4250 BVAR (current_buffer, undo_list) = old_undo;
4267 if (CONSP (old_undo) && inserted != old_inserted) 4251 if (CONSP (old_undo) && inserted != old_inserted)
4268 { 4252 {
4269 /* Adjust the last undo record for the size change during 4253 /* Adjust the last undo record for the size change during
@@ -4278,7 +4262,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4278 else 4262 else
4279 /* If undo_list was Qt before, keep it that way. 4263 /* If undo_list was Qt before, keep it that way.
4280 Otherwise start with an empty undo_list. */ 4264 Otherwise start with an empty undo_list. */
4281 current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil; 4265 BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil;
4282 4266
4283 unbind_to (count, Qnil); 4267 unbind_to (count, Qnil);
4284 } 4268 }
@@ -4332,8 +4316,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4332 Lisp_Object eol_parent = Qnil; 4316 Lisp_Object eol_parent = Qnil;
4333 4317
4334 if (auto_saving 4318 if (auto_saving
4335 && NILP (Fstring_equal (current_buffer->filename, 4319 && NILP (Fstring_equal (BVAR (current_buffer, filename),
4336 current_buffer->auto_save_file_name))) 4320 BVAR (current_buffer, auto_save_file_name))))
4337 { 4321 {
4338 val = Qutf_8_emacs; 4322 val = Qutf_8_emacs;
4339 eol_parent = Qunix; 4323 eol_parent = Qunix;
@@ -4362,12 +4346,12 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4362 int using_default_coding = 0; 4346 int using_default_coding = 0;
4363 int force_raw_text = 0; 4347 int force_raw_text = 0;
4364 4348
4365 val = current_buffer->buffer_file_coding_system; 4349 val = BVAR (current_buffer, buffer_file_coding_system);
4366 if (NILP (val) 4350 if (NILP (val)
4367 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) 4351 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
4368 { 4352 {
4369 val = Qnil; 4353 val = Qnil;
4370 if (NILP (current_buffer->enable_multibyte_characters)) 4354 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
4371 force_raw_text = 1; 4355 force_raw_text = 1;
4372 } 4356 }
4373 4357
@@ -4388,7 +4372,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4388 { 4372 {
4389 /* If we still have not decided a coding system, use the 4373 /* If we still have not decided a coding system, use the
4390 default value of buffer-file-coding-system. */ 4374 default value of buffer-file-coding-system. */
4391 val = current_buffer->buffer_file_coding_system; 4375 val = BVAR (current_buffer, buffer_file_coding_system);
4392 using_default_coding = 1; 4376 using_default_coding = 1;
4393 } 4377 }
4394 4378
@@ -4412,9 +4396,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4412 format, we use that of 4396 format, we use that of
4413 `default-buffer-file-coding-system'. */ 4397 `default-buffer-file-coding-system'. */
4414 if (! using_default_coding 4398 if (! using_default_coding
4415 && ! NILP (buffer_defaults.buffer_file_coding_system)) 4399 && ! NILP (BVAR (&buffer_defaults, buffer_file_coding_system)))
4416 val = (coding_inherit_eol_type 4400 val = (coding_inherit_eol_type
4417 (val, buffer_defaults.buffer_file_coding_system)); 4401 (val, BVAR (&buffer_defaults, buffer_file_coding_system)));
4418 4402
4419 /* If we decide not to encode text, use `raw-text' or one of its 4403 /* If we decide not to encode text, use `raw-text' or one of its
4420 subsidiaries. */ 4404 subsidiaries. */
@@ -4425,7 +4409,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4425 val = coding_inherit_eol_type (val, eol_parent); 4409 val = coding_inherit_eol_type (val, eol_parent);
4426 setup_coding_system (val, coding); 4410 setup_coding_system (val, coding);
4427 4411
4428 if (!STRINGP (start) && !NILP (current_buffer->selective_display)) 4412 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4429 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; 4413 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
4430 return val; 4414 return val;
4431} 4415}
@@ -4484,9 +4468,6 @@ This calls `write-region-annotate-functions' at the start, and
4484 int quietly = !NILP (visit); 4468 int quietly = !NILP (visit);
4485 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 4469 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
4486 struct buffer *given_buffer; 4470 struct buffer *given_buffer;
4487#ifdef DOS_NT
4488 int buffer_file_type = O_BINARY;
4489#endif /* DOS_NT */
4490 struct coding_system coding; 4471 struct coding_system coding;
4491 4472
4492 if (current_buffer->base_buffer && visiting) 4473 if (current_buffer->base_buffer && visiting)
@@ -4529,8 +4510,8 @@ This calls `write-region-annotate-functions' at the start, and
4529 if (visiting) 4510 if (visiting)
4530 { 4511 {
4531 SAVE_MODIFF = MODIFF; 4512 SAVE_MODIFF = MODIFF;
4532 XSETFASTINT (current_buffer->save_length, Z - BEG); 4513 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4533 current_buffer->filename = visit_file; 4514 BVAR (current_buffer, filename) = visit_file;
4534 } 4515 }
4535 UNGCPRO; 4516 UNGCPRO;
4536 return val; 4517 return val;
@@ -4596,7 +4577,7 @@ This calls `write-region-annotate-functions' at the start, and
4596 desc = -1; 4577 desc = -1;
4597 if (!NILP (append)) 4578 if (!NILP (append))
4598#ifdef DOS_NT 4579#ifdef DOS_NT
4599 desc = emacs_open (fn, O_WRONLY | buffer_file_type, 0); 4580 desc = emacs_open (fn, O_WRONLY | O_BINARY, 0);
4600#else /* not DOS_NT */ 4581#else /* not DOS_NT */
4601 desc = emacs_open (fn, O_WRONLY, 0); 4582 desc = emacs_open (fn, O_WRONLY, 0);
4602#endif /* not DOS_NT */ 4583#endif /* not DOS_NT */
@@ -4604,7 +4585,7 @@ This calls `write-region-annotate-functions' at the start, and
4604 if (desc < 0 && (NILP (append) || errno == ENOENT)) 4585 if (desc < 0 && (NILP (append) || errno == ENOENT))
4605#ifdef DOS_NT 4586#ifdef DOS_NT
4606 desc = emacs_open (fn, 4587 desc = emacs_open (fn,
4607 O_WRONLY | O_CREAT | buffer_file_type 4588 O_WRONLY | O_CREAT | O_BINARY
4608 | (EQ (mustbenew, Qexcl) ? O_EXCL : O_TRUNC), 4589 | (EQ (mustbenew, Qexcl) ? O_EXCL : O_TRUNC),
4609 S_IREAD | S_IWRITE); 4590 S_IREAD | S_IWRITE);
4610#else /* not DOS_NT */ 4591#else /* not DOS_NT */
@@ -4743,15 +4724,15 @@ This calls `write-region-annotate-functions' at the start, and
4743 if (visiting) 4724 if (visiting)
4744 { 4725 {
4745 SAVE_MODIFF = MODIFF; 4726 SAVE_MODIFF = MODIFF;
4746 XSETFASTINT (current_buffer->save_length, Z - BEG); 4727 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4747 current_buffer->filename = visit_file; 4728 BVAR (current_buffer, filename) = visit_file;
4748 update_mode_lines++; 4729 update_mode_lines++;
4749 } 4730 }
4750 else if (quietly) 4731 else if (quietly)
4751 { 4732 {
4752 if (auto_saving 4733 if (auto_saving
4753 && ! NILP (Fstring_equal (current_buffer->filename, 4734 && ! NILP (Fstring_equal (BVAR (current_buffer, filename),
4754 current_buffer->auto_save_file_name))) 4735 BVAR (current_buffer, auto_save_file_name))))
4755 SAVE_MODIFF = MODIFF; 4736 SAVE_MODIFF = MODIFF;
4756 4737
4757 return Qnil; 4738 return Qnil;
@@ -4833,10 +4814,10 @@ build_annotations (Lisp_Object start, Lisp_Object end)
4833 } 4814 }
4834 4815
4835 /* Now do the same for annotation functions implied by the file-format */ 4816 /* Now do the same for annotation functions implied by the file-format */
4836 if (auto_saving && (!EQ (current_buffer->auto_save_file_format, Qt))) 4817 if (auto_saving && (!EQ (BVAR (current_buffer, auto_save_file_format), Qt)))
4837 p = current_buffer->auto_save_file_format; 4818 p = BVAR (current_buffer, auto_save_file_format);
4838 else 4819 else
4839 p = current_buffer->file_format; 4820 p = BVAR (current_buffer, file_format);
4840 for (i = 0; CONSP (p); p = XCDR (p), ++i) 4821 for (i = 0; CONSP (p); p = XCDR (p), ++i)
4841 { 4822 {
4842 struct buffer *given_buffer = current_buffer; 4823 struct buffer *given_buffer = current_buffer;
@@ -5015,17 +4996,17 @@ See Info node `(elisp)Modification Time' for more details. */)
5015 b = XBUFFER (buf); 4996 b = XBUFFER (buf);
5016 } 4997 }
5017 4998
5018 if (!STRINGP (b->filename)) return Qt; 4999 if (!STRINGP (BVAR (b, filename))) return Qt;
5019 if (b->modtime == 0) return Qt; 5000 if (b->modtime == 0) return Qt;
5020 5001
5021 /* If the file name has special constructs in it, 5002 /* If the file name has special constructs in it,
5022 call the corresponding file handler. */ 5003 call the corresponding file handler. */
5023 handler = Ffind_file_name_handler (b->filename, 5004 handler = Ffind_file_name_handler (BVAR (b, filename),
5024 Qverify_visited_file_modtime); 5005 Qverify_visited_file_modtime);
5025 if (!NILP (handler)) 5006 if (!NILP (handler))
5026 return call2 (handler, Qverify_visited_file_modtime, buf); 5007 return call2 (handler, Qverify_visited_file_modtime, buf);
5027 5008
5028 filename = ENCODE_FILE (b->filename); 5009 filename = ENCODE_FILE (BVAR (b, filename));
5029 5010
5030 if (stat (SSDATA (filename), &st) < 0) 5011 if (stat (SSDATA (filename), &st) < 0)
5031 { 5012 {
@@ -5093,7 +5074,7 @@ An argument specifies the modification time value to use
5093 struct stat st; 5074 struct stat st;
5094 Lisp_Object handler; 5075 Lisp_Object handler;
5095 5076
5096 filename = Fexpand_file_name (current_buffer->filename, Qnil); 5077 filename = Fexpand_file_name (BVAR (current_buffer, filename), Qnil);
5097 5078
5098 /* If the file name has special constructs in it, 5079 /* If the file name has special constructs in it,
5099 call the corresponding file handler. */ 5080 call the corresponding file handler. */
@@ -5128,7 +5109,7 @@ auto_save_error (Lisp_Object error)
5128 ring_bell (XFRAME (selected_frame)); 5109 ring_bell (XFRAME (selected_frame));
5129 5110
5130 args[0] = build_string ("Auto-saving %s: %s"); 5111 args[0] = build_string ("Auto-saving %s: %s");
5131 args[1] = current_buffer->name; 5112 args[1] = BVAR (current_buffer, name);
5132 args[2] = Ferror_message_string (error); 5113 args[2] = Ferror_message_string (error);
5133 msg = Fformat (3, args); 5114 msg = Fformat (3, args);
5134 GCPRO1 (msg); 5115 GCPRO1 (msg);
@@ -5159,19 +5140,19 @@ auto_save_1 (void)
5159 auto_save_mode_bits = 0666; 5140 auto_save_mode_bits = 0666;
5160 5141
5161 /* Get visited file's mode to become the auto save file's mode. */ 5142 /* Get visited file's mode to become the auto save file's mode. */
5162 if (! NILP (current_buffer->filename)) 5143 if (! NILP (BVAR (current_buffer, filename)))
5163 { 5144 {
5164 if (stat (SSDATA (current_buffer->filename), &st) >= 0) 5145 if (stat (SSDATA (BVAR (current_buffer, filename)), &st) >= 0)
5165 /* But make sure we can overwrite it later! */ 5146 /* But make sure we can overwrite it later! */
5166 auto_save_mode_bits = st.st_mode | 0600; 5147 auto_save_mode_bits = st.st_mode | 0600;
5167 else if ((modes = Ffile_modes (current_buffer->filename), 5148 else if ((modes = Ffile_modes (BVAR (current_buffer, filename)),
5168 INTEGERP (modes))) 5149 INTEGERP (modes)))
5169 /* Remote files don't cooperate with stat. */ 5150 /* Remote files don't cooperate with stat. */
5170 auto_save_mode_bits = XINT (modes) | 0600; 5151 auto_save_mode_bits = XINT (modes) | 0600;
5171 } 5152 }
5172 5153
5173 return 5154 return
5174 Fwrite_region (Qnil, Qnil, current_buffer->auto_save_file_name, Qnil, 5155 Fwrite_region (Qnil, Qnil, BVAR (current_buffer, auto_save_file_name), Qnil,
5175 NILP (Vauto_save_visited_file_name) ? Qlambda : Qt, 5156 NILP (Vauto_save_visited_file_name) ? Qlambda : Qt,
5176 Qnil, Qnil); 5157 Qnil, Qnil);
5177} 5158}
@@ -5312,18 +5293,18 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5312 /* Record all the buffers that have auto save mode 5293 /* Record all the buffers that have auto save mode
5313 in the special file that lists them. For each of these buffers, 5294 in the special file that lists them. For each of these buffers,
5314 Record visited name (if any) and auto save name. */ 5295 Record visited name (if any) and auto save name. */
5315 if (STRINGP (b->auto_save_file_name) 5296 if (STRINGP (BVAR (b, auto_save_file_name))
5316 && stream != NULL && do_handled_files == 0) 5297 && stream != NULL && do_handled_files == 0)
5317 { 5298 {
5318 BLOCK_INPUT; 5299 BLOCK_INPUT;
5319 if (!NILP (b->filename)) 5300 if (!NILP (BVAR (b, filename)))
5320 { 5301 {
5321 fwrite (SDATA (b->filename), 1, 5302 fwrite (SDATA (BVAR (b, filename)), 1,
5322 SBYTES (b->filename), stream); 5303 SBYTES (BVAR (b, filename)), stream);
5323 } 5304 }
5324 putc ('\n', stream); 5305 putc ('\n', stream);
5325 fwrite (SDATA (b->auto_save_file_name), 1, 5306 fwrite (SDATA (BVAR (b, auto_save_file_name)), 1,
5326 SBYTES (b->auto_save_file_name), stream); 5307 SBYTES (BVAR (b, auto_save_file_name)), stream);
5327 putc ('\n', stream); 5308 putc ('\n', stream);
5328 UNBLOCK_INPUT; 5309 UNBLOCK_INPUT;
5329 } 5310 }
@@ -5340,13 +5321,13 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5340 /* Check for auto save enabled 5321 /* Check for auto save enabled
5341 and file changed since last auto save 5322 and file changed since last auto save
5342 and file changed since last real save. */ 5323 and file changed since last real save. */
5343 if (STRINGP (b->auto_save_file_name) 5324 if (STRINGP (BVAR (b, auto_save_file_name))
5344 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 5325 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
5345 && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) 5326 && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b)
5346 /* -1 means we've turned off autosaving for a while--see below. */ 5327 /* -1 means we've turned off autosaving for a while--see below. */
5347 && XINT (b->save_length) >= 0 5328 && XINT (BVAR (b, save_length)) >= 0
5348 && (do_handled_files 5329 && (do_handled_files
5349 || NILP (Ffind_file_name_handler (b->auto_save_file_name, 5330 || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name),
5350 Qwrite_region)))) 5331 Qwrite_region))))
5351 { 5332 {
5352 EMACS_TIME before_time, after_time; 5333 EMACS_TIME before_time, after_time;
@@ -5360,23 +5341,23 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5360 5341
5361 set_buffer_internal (b); 5342 set_buffer_internal (b);
5362 if (NILP (Vauto_save_include_big_deletions) 5343 if (NILP (Vauto_save_include_big_deletions)
5363 && (XFASTINT (b->save_length) * 10 5344 && (XFASTINT (BVAR (b, save_length)) * 10
5364 > (BUF_Z (b) - BUF_BEG (b)) * 13) 5345 > (BUF_Z (b) - BUF_BEG (b)) * 13)
5365 /* A short file is likely to change a large fraction; 5346 /* A short file is likely to change a large fraction;
5366 spare the user annoying messages. */ 5347 spare the user annoying messages. */
5367 && XFASTINT (b->save_length) > 5000 5348 && XFASTINT (BVAR (b, save_length)) > 5000
5368 /* These messages are frequent and annoying for `*mail*'. */ 5349 /* These messages are frequent and annoying for `*mail*'. */
5369 && !EQ (b->filename, Qnil) 5350 && !EQ (BVAR (b, filename), Qnil)
5370 && NILP (no_message)) 5351 && NILP (no_message))
5371 { 5352 {
5372 /* It has shrunk too much; turn off auto-saving here. */ 5353 /* It has shrunk too much; turn off auto-saving here. */
5373 minibuffer_auto_raise = orig_minibuffer_auto_raise; 5354 minibuffer_auto_raise = orig_minibuffer_auto_raise;
5374 message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save", 5355 message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save",
5375 b->name, 1); 5356 BVAR (b, name), 1);
5376 minibuffer_auto_raise = 0; 5357 minibuffer_auto_raise = 0;
5377 /* Turn off auto-saving until there's a real save, 5358 /* Turn off auto-saving until there's a real save,
5378 and prevent any more warnings. */ 5359 and prevent any more warnings. */
5379 XSETINT (b->save_length, -1); 5360 XSETINT (BVAR (b, save_length), -1);
5380 Fsleep_for (make_number (1), Qnil); 5361 Fsleep_for (make_number (1), Qnil);
5381 continue; 5362 continue;
5382 } 5363 }
@@ -5385,7 +5366,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5385 internal_condition_case (auto_save_1, Qt, auto_save_error); 5366 internal_condition_case (auto_save_1, Qt, auto_save_error);
5386 auto_saved++; 5367 auto_saved++;
5387 BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b); 5368 BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
5388 XSETFASTINT (current_buffer->save_length, Z - BEG); 5369 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
5389 set_buffer_internal (old); 5370 set_buffer_internal (old);
5390 5371
5391 EMACS_GET_TIME (after_time); 5372 EMACS_GET_TIME (after_time);
@@ -5432,7 +5413,7 @@ No auto-save file will be written until the buffer changes again. */)
5432 /* FIXME: This should not be called in indirect buffers, since 5413 /* FIXME: This should not be called in indirect buffers, since
5433 they're not autosaved. */ 5414 they're not autosaved. */
5434 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 5415 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
5435 XSETFASTINT (current_buffer->save_length, Z - BEG); 5416 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
5436 current_buffer->auto_save_failure_time = -1; 5417 current_buffer->auto_save_failure_time = -1;
5437 return Qnil; 5418 return Qnil;
5438} 5419}
@@ -5586,11 +5567,6 @@ syms_of_fileio (void)
5586 Qexcl = intern_c_string ("excl"); 5567 Qexcl = intern_c_string ("excl");
5587 staticpro (&Qexcl); 5568 staticpro (&Qexcl);
5588 5569
5589#ifdef DOS_NT
5590 Qfind_buffer_file_type = intern_c_string ("find-buffer-file-type");
5591 staticpro (&Qfind_buffer_file_type);
5592#endif /* DOS_NT */
5593
5594 DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system, 5570 DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system,
5595 doc: /* *Coding system for encoding file names. 5571 doc: /* *Coding system for encoding file names.
5596If it is nil, `default-file-name-coding-system' (which see) is used. */); 5572If it is nil, `default-file-name-coding-system' (which see) is used. */);
diff --git a/src/filelock.c b/src/filelock.c
index 8fa871f56ef..8e18bb7b650 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -637,9 +637,9 @@ unlock_all_files (void)
637 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 637 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
638 { 638 {
639 b = XBUFFER (XCDR (XCAR (tail))); 639 b = XBUFFER (XCDR (XCAR (tail)));
640 if (STRINGP (b->file_truename) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) 640 if (STRINGP (BVAR (b, file_truename)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
641 { 641 {
642 unlock_file(b->file_truename); 642 unlock_file(BVAR (b, file_truename));
643 } 643 }
644 } 644 }
645} 645}
@@ -652,7 +652,7 @@ or else nothing is done if current buffer isn't visiting a file. */)
652 (Lisp_Object file) 652 (Lisp_Object file)
653{ 653{
654 if (NILP (file)) 654 if (NILP (file))
655 file = current_buffer->file_truename; 655 file = BVAR (current_buffer, file_truename);
656 else 656 else
657 CHECK_STRING (file); 657 CHECK_STRING (file);
658 if (SAVE_MODIFF < MODIFF 658 if (SAVE_MODIFF < MODIFF
@@ -669,8 +669,8 @@ should not be locked in that case. */)
669 (void) 669 (void)
670{ 670{
671 if (SAVE_MODIFF < MODIFF 671 if (SAVE_MODIFF < MODIFF
672 && STRINGP (current_buffer->file_truename)) 672 && STRINGP (BVAR (current_buffer, file_truename)))
673 unlock_file (current_buffer->file_truename); 673 unlock_file (BVAR (current_buffer, file_truename));
674 return Qnil; 674 return Qnil;
675} 675}
676 676
@@ -680,8 +680,8 @@ void
680unlock_buffer (struct buffer *buffer) 680unlock_buffer (struct buffer *buffer)
681{ 681{
682 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) 682 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
683 && STRINGP (buffer->file_truename)) 683 && STRINGP (BVAR (buffer, file_truename)))
684 unlock_file (buffer->file_truename); 684 unlock_file (BVAR (buffer, file_truename));
685} 685}
686 686
687DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0, 687DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0,
diff --git a/src/filemode.c b/src/filemode.c
deleted file mode 100644
index d41cd56c569..00000000000
--- a/src/filemode.c
+++ /dev/null
@@ -1,245 +0,0 @@
1/* filemode.c -- make a string describing file modes
2 Copyright (C) 1985, 1990, 1993, 2001-2011 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 USA. */
18
19#include <config.h>
20#include <sys/types.h>
21#include <sys/stat.h>
22
23#if !S_IRUSR
24# if S_IREAD
25# define S_IRUSR S_IREAD
26# else
27# define S_IRUSR 00400
28# endif
29#endif
30
31#if !S_IWUSR
32# if S_IWRITE
33# define S_IWUSR S_IWRITE
34# else
35# define S_IWUSR 00200
36# endif
37#endif
38
39#if !S_IXUSR
40# if S_IEXEC
41# define S_IXUSR S_IEXEC
42# else
43# define S_IXUSR 00100
44# endif
45#endif
46
47#ifdef STAT_MACROS_BROKEN
48#undef S_ISBLK
49#undef S_ISCHR
50#undef S_ISDIR
51#undef S_ISFIFO
52#undef S_ISLNK
53#undef S_ISMPB
54#undef S_ISMPC
55#undef S_ISNWK
56#undef S_ISREG
57#undef S_ISSOCK
58#endif /* STAT_MACROS_BROKEN. */
59
60#if !defined(S_ISBLK) && defined(S_IFBLK)
61#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
62#endif
63#if !defined(S_ISCHR) && defined(S_IFCHR)
64#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
65#endif
66#if !defined(S_ISDIR) && defined(S_IFDIR)
67#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
68#endif
69#if !defined(S_ISREG) && defined(S_IFREG)
70#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
71#endif
72#if !defined(S_ISFIFO) && defined(S_IFIFO)
73#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
74#endif
75#if !defined(S_ISLNK) && defined(S_IFLNK)
76#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
77#endif
78#if !defined(S_ISSOCK) && defined(S_IFSOCK)
79#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
80#endif
81#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
82#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
83#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
84#endif
85#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
86#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
87#endif
88
89void mode_string (short unsigned int mode, char *str);
90static char ftypelet (long int bits);
91static void rwx (short unsigned int bits, char *chars);
92static void setst (short unsigned int bits, char *chars);
93
94/* filemodestring - fill in string STR with an ls-style ASCII
95 representation of the st_mode field of file stats block STATP.
96 10 characters are stored in STR; no terminating null is added.
97 The characters stored in STR are:
98
99 0 File type. 'd' for directory, 'c' for character
100 special, 'b' for block special, 'm' for multiplex,
101 'l' for symbolic link, 's' for socket, 'p' for fifo,
102 '-' for regular, '?' for any other file type
103
104 1 'r' if the owner may read, '-' otherwise.
105
106 2 'w' if the owner may write, '-' otherwise.
107
108 3 'x' if the owner may execute, 's' if the file is
109 set-user-id, '-' otherwise.
110 'S' if the file is set-user-id, but the execute
111 bit isn't set.
112
113 4 'r' if group members may read, '-' otherwise.
114
115 5 'w' if group members may write, '-' otherwise.
116
117 6 'x' if group members may execute, 's' if the file is
118 set-group-id, '-' otherwise.
119 'S' if it is set-group-id but not executable.
120
121 7 'r' if any user may read, '-' otherwise.
122
123 8 'w' if any user may write, '-' otherwise.
124
125 9 'x' if any user may execute, 't' if the file is "sticky"
126 (will be retained in swap space after execution), '-'
127 otherwise.
128 'T' if the file is sticky but not executable. */
129
130void
131filemodestring (struct stat *statp, char *str)
132{
133 mode_string (statp->st_mode, str);
134}
135
136/* Like filemodestring, but only the relevant part of the `struct stat'
137 is given as an argument. */
138
139void
140mode_string (short unsigned int mode, char *str)
141{
142 str[0] = ftypelet ((long) mode);
143 rwx ((mode & 0700) << 0, &str[1]);
144 rwx ((mode & 0070) << 3, &str[4]);
145 rwx ((mode & 0007) << 6, &str[7]);
146 setst (mode, str);
147}
148
149/* Return a character indicating the type of file described by
150 file mode BITS:
151 'd' for directories
152 'b' for block special files
153 'c' for character special files
154 'm' for multiplexor files
155 'l' for symbolic links
156 's' for sockets
157 'p' for fifos
158 '-' for regular files
159 '?' for any other file type. */
160
161static char
162ftypelet (long int bits)
163{
164#ifdef S_ISBLK
165 if (S_ISBLK (bits))
166 return 'b';
167#endif
168 if (S_ISCHR (bits))
169 return 'c';
170 if (S_ISDIR (bits))
171 return 'd';
172 if (S_ISREG (bits))
173 return '-';
174#ifdef S_ISFIFO
175 if (S_ISFIFO (bits))
176 return 'p';
177#endif
178#ifdef S_ISLNK
179 if (S_ISLNK (bits))
180 return 'l';
181#endif
182#ifdef S_ISSOCK
183 if (S_ISSOCK (bits))
184 return 's';
185#endif
186#ifdef S_ISMPC
187 if (S_ISMPC (bits))
188 return 'm';
189#endif
190#ifdef S_ISNWK
191 if (S_ISNWK (bits))
192 return 'n';
193#endif
194 return '?';
195}
196
197/* Look at read, write, and execute bits in BITS and set
198 flags in CHARS accordingly. */
199
200static void
201rwx (short unsigned int bits, char *chars)
202{
203 chars[0] = (bits & S_IRUSR) ? 'r' : '-';
204 chars[1] = (bits & S_IWUSR) ? 'w' : '-';
205 chars[2] = (bits & S_IXUSR) ? 'x' : '-';
206}
207
208/* Set the 's' and 't' flags in file attributes string CHARS,
209 according to the file mode BITS. */
210
211static void
212setst (short unsigned int bits, char *chars)
213{
214#ifdef S_ISUID
215 if (bits & S_ISUID)
216 {
217 if (chars[3] != 'x')
218 /* Set-uid, but not executable by owner. */
219 chars[3] = 'S';
220 else
221 chars[3] = 's';
222 }
223#endif
224#ifdef S_ISGID
225 if (bits & S_ISGID)
226 {
227 if (chars[6] != 'x')
228 /* Set-gid, but not executable by group. */
229 chars[6] = 'S';
230 else
231 chars[6] = 's';
232 }
233#endif
234#ifdef S_ISVTX
235 if (bits & S_ISVTX)
236 {
237 if (chars[9] != 'x')
238 /* Sticky, but not executable by others. */
239 chars[9] = 'T';
240 else
241 chars[9] = 't';
242 }
243#endif
244}
245
diff --git a/src/fns.c b/src/fns.c
index 326f210f84f..5748c3d6e02 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2987,7 +2987,7 @@ into shorter lines. */)
2987 SAFE_ALLOCA (encoded, char *, allength); 2987 SAFE_ALLOCA (encoded, char *, allength);
2988 encoded_length = base64_encode_1 ((char *) BYTE_POS_ADDR (ibeg), 2988 encoded_length = base64_encode_1 ((char *) BYTE_POS_ADDR (ibeg),
2989 encoded, length, NILP (no_line_break), 2989 encoded, length, NILP (no_line_break),
2990 !NILP (current_buffer->enable_multibyte_characters)); 2990 !NILP (BVAR (current_buffer, enable_multibyte_characters)));
2991 if (encoded_length > allength) 2991 if (encoded_length > allength)
2992 abort (); 2992 abort ();
2993 2993
@@ -3169,7 +3169,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
3169 EMACS_INT old_pos = PT; 3169 EMACS_INT old_pos = PT;
3170 EMACS_INT decoded_length; 3170 EMACS_INT decoded_length;
3171 EMACS_INT inserted_chars; 3171 EMACS_INT inserted_chars;
3172 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 3172 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
3173 USE_SAFE_ALLOCA; 3173 USE_SAFE_ALLOCA;
3174 3174
3175 validate_region (&beg, &end); 3175 validate_region (&beg, &end);
@@ -4687,12 +4687,12 @@ guesswork fails. Normally, an error is signaled in such case. */)
4687 { 4687 {
4688 int force_raw_text = 0; 4688 int force_raw_text = 0;
4689 4689
4690 coding_system = XBUFFER (object)->buffer_file_coding_system; 4690 coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
4691 if (NILP (coding_system) 4691 if (NILP (coding_system)
4692 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) 4692 || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
4693 { 4693 {
4694 coding_system = Qnil; 4694 coding_system = Qnil;
4695 if (NILP (current_buffer->enable_multibyte_characters)) 4695 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
4696 force_raw_text = 1; 4696 force_raw_text = 1;
4697 } 4697 }
4698 4698
@@ -4709,11 +4709,11 @@ guesswork fails. Normally, an error is signaled in such case. */)
4709 } 4709 }
4710 4710
4711 if (NILP (coding_system) 4711 if (NILP (coding_system)
4712 && !NILP (XBUFFER (object)->buffer_file_coding_system)) 4712 && !NILP (BVAR (XBUFFER (object), buffer_file_coding_system)))
4713 { 4713 {
4714 /* If we still have not decided a coding system, use the 4714 /* If we still have not decided a coding system, use the
4715 default value of buffer-file-coding-system. */ 4715 default value of buffer-file-coding-system. */
4716 coding_system = XBUFFER (object)->buffer_file_coding_system; 4716 coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
4717 } 4717 }
4718 4718
4719 if (!force_raw_text 4719 if (!force_raw_text
diff --git a/src/font.c b/src/font.c
index 841125a0587..d77eafb6ad2 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3637,7 +3637,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
3637 Lisp_Object font_object; 3637 Lisp_Object font_object;
3638 3638
3639 multibyte = (NILP (string) 3639 multibyte = (NILP (string)
3640 ? ! NILP (current_buffer->enable_multibyte_characters) 3640 ? ! NILP (BVAR (current_buffer, enable_multibyte_characters))
3641 : STRING_MULTIBYTE (string)); 3641 : STRING_MULTIBYTE (string));
3642 if (c < 0) 3642 if (c < 0)
3643 { 3643 {
diff --git a/src/frame.c b/src/frame.c
index 20bad4cb8c5..56e0e7ec919 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -428,20 +428,20 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
428 if (NILP (mini_window)) 428 if (NILP (mini_window))
429 { 429 {
430 /* Use default-minibuffer-frame if possible. */ 430 /* Use default-minibuffer-frame if possible. */
431 if (!FRAMEP (kb->Vdefault_minibuffer_frame) 431 if (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
432 || ! FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))) 432 || ! FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))
433 { 433 {
434 Lisp_Object frame_dummy; 434 Lisp_Object frame_dummy;
435 435
436 XSETFRAME (frame_dummy, f); 436 XSETFRAME (frame_dummy, f);
437 GCPRO1 (frame_dummy); 437 GCPRO1 (frame_dummy);
438 /* If there's no minibuffer frame to use, create one. */ 438 /* If there's no minibuffer frame to use, create one. */
439 kb->Vdefault_minibuffer_frame = 439 KVAR (kb, Vdefault_minibuffer_frame) =
440 call1 (intern ("make-initial-minibuffer-frame"), display); 440 call1 (intern ("make-initial-minibuffer-frame"), display);
441 UNGCPRO; 441 UNGCPRO;
442 } 442 }
443 443
444 mini_window = XFRAME (kb->Vdefault_minibuffer_frame)->minibuffer_window; 444 mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window;
445 } 445 }
446 446
447 f->minibuffer_window = mini_window; 447 f->minibuffer_window = mini_window;
@@ -889,7 +889,7 @@ to that frame. */)
889 (Lisp_Object event) 889 (Lisp_Object event)
890{ 890{
891 /* Preserve prefix arg that the command loop just cleared. */ 891 /* Preserve prefix arg that the command loop just cleared. */
892 current_kboard->Vprefix_arg = Vcurrent_prefix_arg; 892 KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg;
893 call1 (Vrun_hooks, Qmouse_leave_buffer_hook); 893 call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
894 return do_switch_frame (event, 0, 0, Qnil); 894 return do_switch_frame (event, 0, 0, Qnil);
895} 895}
@@ -1526,7 +1526,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1526 /* If we've deleted this keyboard's default_minibuffer_frame, try to 1526 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1527 find another one. Prefer minibuffer-only frames, but also notice 1527 find another one. Prefer minibuffer-only frames, but also notice
1528 frames with other windows. */ 1528 frames with other windows. */
1529 if (kb != NULL && EQ (frame, kb->Vdefault_minibuffer_frame)) 1529 if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)))
1530 { 1530 {
1531 Lisp_Object frames; 1531 Lisp_Object frames;
1532 1532
@@ -1575,11 +1575,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1575 if (NILP (frame_with_minibuf)) 1575 if (NILP (frame_with_minibuf))
1576 abort (); 1576 abort ();
1577 1577
1578 kb->Vdefault_minibuffer_frame = frame_with_minibuf; 1578 KVAR (kb, Vdefault_minibuffer_frame) = frame_with_minibuf;
1579 } 1579 }
1580 else 1580 else
1581 /* No frames left on this kboard--say no minibuffer either. */ 1581 /* No frames left on this kboard--say no minibuffer either. */
1582 kb->Vdefault_minibuffer_frame = Qnil; 1582 KVAR (kb, Vdefault_minibuffer_frame) = Qnil;
1583 } 1583 }
1584 1584
1585 /* Cause frame titles to update--necessary if we now have just one frame. */ 1585 /* Cause frame titles to update--necessary if we now have just one frame. */
@@ -1817,7 +1817,7 @@ make_frame_visible_1 (Lisp_Object window)
1817 w = XWINDOW (window); 1817 w = XWINDOW (window);
1818 1818
1819 if (!NILP (w->buffer)) 1819 if (!NILP (w->buffer))
1820 XBUFFER (w->buffer)->display_time = Fcurrent_time (); 1820 BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time ();
1821 1821
1822 if (!NILP (w->vchild)) 1822 if (!NILP (w->vchild))
1823 make_frame_visible_1 (w->vchild); 1823 make_frame_visible_1 (w->vchild);
diff --git a/src/fringe.c b/src/fringe.c
index 5c9088a924c..d42d6467f31 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -660,7 +660,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
660{ 660{
661 Lisp_Object cmap, bm = Qnil; 661 Lisp_Object cmap, bm = Qnil;
662 662
663 if ((cmap = XBUFFER (w->buffer)->fringe_cursor_alist), !NILP (cmap)) 663 if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap))
664 { 664 {
665 bm = Fassq (cursor, cmap); 665 bm = Fassq (cursor, cmap);
666 if (CONSP (bm)) 666 if (CONSP (bm))
@@ -670,9 +670,9 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor)
670 return lookup_fringe_bitmap (bm); 670 return lookup_fringe_bitmap (bm);
671 } 671 }
672 } 672 }
673 if (EQ (cmap, buffer_defaults.fringe_cursor_alist)) 673 if (EQ (cmap, BVAR (&buffer_defaults, fringe_cursor_alist)))
674 return NO_FRINGE_BITMAP; 674 return NO_FRINGE_BITMAP;
675 bm = Fassq (cursor, buffer_defaults.fringe_cursor_alist); 675 bm = Fassq (cursor, BVAR (&buffer_defaults, fringe_cursor_alist));
676 if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm))) 676 if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm)))
677 return NO_FRINGE_BITMAP; 677 return NO_FRINGE_BITMAP;
678 return lookup_fringe_bitmap (bm); 678 return lookup_fringe_bitmap (bm);
@@ -697,7 +697,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
697 If partial, lookup partial bitmap in default value if not found here. 697 If partial, lookup partial bitmap in default value if not found here.
698 If not partial, or no partial spec is present, use non-partial bitmap. */ 698 If not partial, or no partial spec is present, use non-partial bitmap. */
699 699
700 if ((cmap = XBUFFER (w->buffer)->fringe_indicator_alist), !NILP (cmap)) 700 if ((cmap = BVAR (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap))
701 { 701 {
702 bm1 = Fassq (bitmap, cmap); 702 bm1 = Fassq (bitmap, cmap);
703 if (CONSP (bm1)) 703 if (CONSP (bm1))
@@ -731,10 +731,10 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in
731 } 731 }
732 } 732 }
733 733
734 if (!EQ (cmap, buffer_defaults.fringe_indicator_alist) 734 if (!EQ (cmap, BVAR (&buffer_defaults, fringe_indicator_alist))
735 && !NILP (buffer_defaults.fringe_indicator_alist)) 735 && !NILP (BVAR (&buffer_defaults, fringe_indicator_alist)))
736 { 736 {
737 bm2 = Fassq (bitmap, buffer_defaults.fringe_indicator_alist); 737 bm2 = Fassq (bitmap, BVAR (&buffer_defaults, fringe_indicator_alist));
738 if (CONSP (bm2)) 738 if (CONSP (bm2))
739 { 739 {
740 if ((bm2 = XCDR (bm2)), !NILP (bm2)) 740 if ((bm2 = XCDR (bm2)), !NILP (bm2))
@@ -919,7 +919,7 @@ update_window_fringes (struct window *w, int keep_current_p)
919 return 0; 919 return 0;
920 920
921 if (!MINI_WINDOW_P (w) 921 if (!MINI_WINDOW_P (w)
922 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind))) 922 && (ind = BVAR (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind)))
923 { 923 {
924 if (EQ (ind, Qleft) || EQ (ind, Qright)) 924 if (EQ (ind, Qleft) || EQ (ind, Qright))
925 boundary_top = boundary_bot = arrow_top = arrow_bot = ind; 925 boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
@@ -988,7 +988,7 @@ update_window_fringes (struct window *w, int keep_current_p)
988 } 988 }
989 } 989 }
990 990
991 empty_pos = XBUFFER (w->buffer)->indicate_empty_lines; 991 empty_pos = BVAR (XBUFFER (w->buffer), indicate_empty_lines);
992 if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) 992 if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
993 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; 993 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
994 994
diff --git a/src/getloadavg.c b/src/getloadavg.c
deleted file mode 100644
index d9c24717b79..00000000000
--- a/src/getloadavg.c
+++ /dev/null
@@ -1,1037 +0,0 @@
1/* Get the system load averages.
2 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995,
3 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 Free Software Foundation, Inc.
5
6 NOTE: The canonical source of this file is maintained with gnulib.
7 Bugs can be reported to bug-gnulib@gnu.org.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 USA. */
23
24/* Compile-time symbols that this file uses:
25
26 HAVE_PSTAT_GETDYNAMIC Define this if your system has the
27 pstat_getdynamic function. I think it
28 is unique to HPUX9. The best way to get the
29 definition is through the AC_FUNC_GETLOADAVG
30 macro that comes with autoconf 2.13 or newer.
31 If that isn't an option, then just put
32 AC_CHECK_FUNCS(pstat_getdynamic) in your
33 configure.in file.
34 FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist.
35 KERNEL_FILE Pathname of the kernel to nlist.
36 LDAV_CVT() Scale the load average from the kernel.
37 Returns a double.
38 LDAV_SYMBOL Name of kernel symbol giving load average.
39 LOAD_AVE_TYPE Type of the load average array in the kernel.
40 Must be defined unless one of
41 apollo, DGUX, NeXT, or UMAX is defined;
42 or we have libkstat;
43 otherwise, no load average is available.
44 HAVE_NLIST_H nlist.h is available. NLIST_STRUCT defaults
45 to this.
46 NLIST_STRUCT Include nlist.h, not a.out.h, and
47 the nlist n_name element is a pointer,
48 not an array.
49 HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
50 LINUX_LDAV_FILE [__linux__]: File containing load averages.
51 HAVE_LOCALE_H locale.h is available.
52 HAVE_SETLOCALE The `setlocale' function is available.
53
54 Specific system predefines this file uses, aside from setting
55 default values if not emacs:
56
57 apollo
58 BSD Real BSD, not just BSD-like.
59 convex
60 DGUX
61 eunice UNIX emulator under VMS.
62 hpux
63 __MSDOS__ No-op for MSDOS.
64 NeXT
65 sgi
66 sequent Sequent Dynix 3.x.x (BSD)
67 _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV)
68 sony_news NEWS-OS (works at least for 4.1C)
69 UMAX
70 UMAX4_3
71 VMS
72 WINDOWS32 No-op for Windows95/NT.
73 __linux__ Linux: assumes /proc filesystem mounted.
74 Support from Michael K. Johnson.
75 __NetBSD__ NetBSD: assumes /kern filesystem mounted.
76
77 In addition, to avoid nesting many #ifdefs, we internally set
78 LDAV_DONE to indicate that the load average has been computed.
79
80 We also #define LDAV_PRIVILEGED if a program will require
81 special installation to be able to call getloadavg. */
82
83/* This should always be first. */
84#ifdef HAVE_CONFIG_H
85# include <config.h>
86#endif
87
88#include <sys/types.h>
89
90/* Both the Emacs and non-Emacs sections want this. Some
91 configuration files' definitions for the LOAD_AVE_CVT macro (like
92 sparc.h's) use macros like FSCALE, defined here. */
93#if defined (unix) || defined (__unix)
94# include <sys/param.h>
95#endif
96
97
98/* Exclude all the code except the test program at the end
99 if the system has its own `getloadavg' function.
100
101 The declaration of `errno' is needed by the test program
102 as well as the function itself, so it comes first. */
103
104#include <errno.h>
105
106#ifndef errno
107extern int errno;
108#endif
109
110#ifdef HAVE_LOCALE_H
111# include <locale.h>
112#endif
113#ifndef HAVE_SETLOCALE
114# define setlocale(Category, Locale) /* empty */
115#endif
116
117#ifndef HAVE_GETLOADAVG
118
119/* The existing Emacs configuration files define a macro called
120 LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
121 returns the load average multiplied by 100. What we actually want
122 is a macro called LDAV_CVT, which returns the load average as an
123 unmultiplied double.
124
125 For backwards compatibility, we'll define LDAV_CVT in terms of
126 LOAD_AVE_CVT, but future machine config files should just define
127 LDAV_CVT directly. */
128
129# if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT)
130# define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
131# endif
132
133# if !defined (BSD) && defined (ultrix)
134/* Ultrix behaves like BSD on Vaxen. */
135# define BSD
136# endif
137
138# ifdef NeXT
139/* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which
140 conflicts with the definition understood in this file, that this
141 really is BSD. */
142# undef BSD
143
144/* NeXT defines FSCALE in <sys/param.h>. However, we take FSCALE being
145 defined to mean that the nlist method should be used, which is not true. */
146# undef FSCALE
147# endif
148
149/* Same issues as for NeXT apply to the HURD-based GNU system. */
150# ifdef __GNU__
151# undef BSD
152# undef FSCALE
153# endif /* __GNU__ */
154
155/* Set values that are different from the defaults, which are
156 set a little farther down with #ifndef. */
157
158
159/* Some shorthands. */
160
161# if defined (HPUX) && !defined (hpux)
162# define hpux
163# endif
164
165# if defined (__hpux) && !defined (hpux)
166# define hpux
167# endif
168
169# if defined (__sun) && !defined (sun)
170# define sun
171# endif
172
173# if defined(hp300) && !defined(hpux)
174# define MORE_BSD
175# endif
176
177# if defined(ultrix) && defined(mips)
178# define decstation
179# endif
180
181# if defined (__SVR4) && !defined (SVR4)
182# define SVR4
183# endif
184
185# if (defined(sun) && defined(SVR4)) || defined (SOLARIS2)
186# define SUNOS_5
187# endif
188
189# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
190# define OSF_ALPHA
191# include <sys/mbuf.h>
192# include <sys/socket.h>
193# include <net/route.h>
194# include <sys/table.h>
195# endif
196
197# if defined (__osf__) && (defined (mips) || defined (__mips__))
198# define OSF_MIPS
199# include <sys/table.h>
200# endif
201
202/* UTek's /bin/cc on the 4300 has no architecture specific cpp define by
203 default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>. Combine
204 that with a couple of other things and we'll have a unique match. */
205# if !defined (tek4300) && defined (unix) && defined (m68k) && defined (mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
206# define tek4300 /* Define by emacs, but not by other users. */
207# endif
208
209
210/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */
211# ifndef LOAD_AVE_TYPE
212
213# ifdef MORE_BSD
214# define LOAD_AVE_TYPE long
215# endif
216
217# ifdef sun
218# define LOAD_AVE_TYPE long
219# endif
220
221# ifdef decstation
222# define LOAD_AVE_TYPE long
223# endif
224
225# ifdef _SEQUENT_
226# define LOAD_AVE_TYPE long
227# endif
228
229# ifdef sgi
230# define LOAD_AVE_TYPE long
231# endif
232
233# ifdef SVR4
234# define LOAD_AVE_TYPE long
235# endif
236
237# ifdef sony_news
238# define LOAD_AVE_TYPE long
239# endif
240
241# ifdef sequent
242# define LOAD_AVE_TYPE long
243# endif
244
245# ifdef OSF_ALPHA
246# define LOAD_AVE_TYPE long
247# endif
248
249# if defined (ardent) && defined (titan)
250# define LOAD_AVE_TYPE long
251# endif
252
253# ifdef tek4300
254# define LOAD_AVE_TYPE long
255# endif
256
257# if defined(alliant) && defined(i860) /* Alliant FX/2800 */
258# define LOAD_AVE_TYPE long
259# endif
260
261# ifdef _AIX
262# define LOAD_AVE_TYPE long
263# endif
264
265# ifdef convex
266# define LOAD_AVE_TYPE double
267# ifndef LDAV_CVT
268# define LDAV_CVT(n) (n)
269# endif
270# endif
271
272# endif /* No LOAD_AVE_TYPE. */
273
274# ifdef OSF_ALPHA
275/* <sys/param.h> defines an incorrect value for FSCALE on Alpha OSF/1,
276 according to ghazi@noc.rutgers.edu. */
277# undef FSCALE
278# define FSCALE 1024.0
279# endif
280
281# if defined(alliant) && defined(i860) /* Alliant FX/2800 */
282/* <sys/param.h> defines an incorrect value for FSCALE on an
283 Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */
284# undef FSCALE
285# define FSCALE 100.0
286# endif
287
288
289# ifndef FSCALE
290
291/* SunOS and some others define FSCALE in sys/param.h. */
292
293# ifdef MORE_BSD
294# define FSCALE 2048.0
295# endif
296
297# if defined(MIPS) || defined(SVR4) || defined(decstation)
298# define FSCALE 256
299# endif
300
301# if defined (sgi) || defined (sequent)
302/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
303 above under #ifdef MIPS. But we want the sgi value. */
304# undef FSCALE
305# define FSCALE 1000.0
306# endif
307
308# if defined (ardent) && defined (titan)
309# define FSCALE 65536.0
310# endif
311
312# ifdef tek4300
313# define FSCALE 100.0
314# endif
315
316# ifdef _AIX
317# define FSCALE 65536.0
318# endif
319
320# endif /* Not FSCALE. */
321
322# if !defined (LDAV_CVT) && defined (FSCALE)
323# define LDAV_CVT(n) (((double) (n)) / FSCALE)
324# endif
325
326# ifndef NLIST_STRUCT
327# if HAVE_NLIST_H
328# define NLIST_STRUCT
329# endif
330# endif
331
332# if defined(sgi) || (defined(mips) && !defined(BSD))
333# define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31))
334# endif
335
336
337# if !defined (KERNEL_FILE) && defined (sequent)
338# define KERNEL_FILE "/dynix"
339# endif
340
341# if !defined (KERNEL_FILE) && defined (hpux)
342# define KERNEL_FILE "/hp-ux"
343# endif
344
345# if !defined(KERNEL_FILE) && (defined(_SEQUENT_) || defined(MIPS) || defined(SVR4) || defined(ISC) || defined (sgi) || (defined (ardent) && defined (titan)))
346# define KERNEL_FILE "/unix"
347# endif
348
349
350# if !defined (LDAV_SYMBOL) && defined (alliant)
351# define LDAV_SYMBOL "_Loadavg"
352# endif
353
354# if !defined(LDAV_SYMBOL) && ((defined(hpux) && !defined(hp9000s300)) || defined(_SEQUENT_) || defined(SVR4) || defined(ISC) || defined(sgi) || (defined (ardent) && defined (titan)) || defined (_AIX))
355# define LDAV_SYMBOL "avenrun"
356# endif
357
358# include <unistd.h>
359# include <stdio.h>
360
361/* LOAD_AVE_TYPE should only get defined if we're going to use the
362 nlist method. */
363# if !defined(LOAD_AVE_TYPE) && (defined(BSD) || defined(LDAV_CVT) || defined(KERNEL_FILE) || defined(LDAV_SYMBOL))
364# define LOAD_AVE_TYPE double
365# endif
366
367# ifdef LOAD_AVE_TYPE
368
369# ifndef VMS
370# ifndef __linux__
371# ifndef NLIST_STRUCT
372# include <a.out.h>
373# else /* NLIST_STRUCT */
374# include <nlist.h>
375# endif /* NLIST_STRUCT */
376
377# ifdef SUNOS_5
378# include <fcntl.h>
379# include <kvm.h>
380# include <kstat.h>
381# endif
382
383# if defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
384# include <sys/pstat.h>
385# endif
386
387# ifndef KERNEL_FILE
388# define KERNEL_FILE "/vmunix"
389# endif /* KERNEL_FILE */
390
391# ifndef LDAV_SYMBOL
392# define LDAV_SYMBOL "_avenrun"
393# endif /* LDAV_SYMBOL */
394# endif /* __linux__ */
395
396# else /* VMS */
397
398# ifndef eunice
399# include <iodef.h>
400# include <descrip.h>
401# else /* eunice */
402# include <vms/iodef.h>
403# endif /* eunice */
404# endif /* VMS */
405
406# ifndef LDAV_CVT
407# define LDAV_CVT(n) ((double) (n))
408# endif /* !LDAV_CVT */
409
410# endif /* LOAD_AVE_TYPE */
411
412# if defined(__GNU__) && !defined (NeXT)
413/* Note that NeXT Openstep defines __GNU__ even though it should not. */
414/* GNU system acts much like NeXT, for load average purposes,
415 but not exactly. */
416# define NeXT
417# define host_self mach_host_self
418# endif
419
420# ifdef NeXT
421# ifdef HAVE_MACH_MACH_H
422# include <mach/mach.h>
423# else
424# include <mach.h>
425# endif
426# endif /* NeXT */
427
428# ifdef sgi
429# include <sys/sysmp.h>
430# endif /* sgi */
431
432# ifdef UMAX
433# include <stdio.h>
434# include <signal.h>
435# include <sys/time.h>
436# include <sys/wait.h>
437# include <sys/syscall.h>
438
439# ifdef UMAX_43
440# include <machine/cpu.h>
441# include <inq_stats/statistics.h>
442# include <inq_stats/sysstats.h>
443# include <inq_stats/cpustats.h>
444# include <inq_stats/procstats.h>
445# else /* Not UMAX_43. */
446# include <sys/sysdefs.h>
447# include <sys/statistics.h>
448# include <sys/sysstats.h>
449# include <sys/cpudefs.h>
450# include <sys/cpustats.h>
451# include <sys/procstats.h>
452# endif /* Not UMAX_43. */
453# endif /* UMAX */
454
455# ifdef DGUX
456# include <sys/dg_sys_info.h>
457# endif
458
459# if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
460# include <fcntl.h>
461# else
462# include <sys/file.h>
463# endif
464
465/* Avoid static vars inside a function since in HPUX they dump as pure. */
466
467# ifdef NeXT
468static processor_set_t default_set;
469static int getloadavg_initialized;
470# endif /* NeXT */
471
472# ifdef UMAX
473static unsigned int cpus = 0;
474static unsigned int samples;
475# endif /* UMAX */
476
477# ifdef DGUX
478static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
479# endif /* DGUX */
480
481#if !defined(HAVE_LIBKSTAT) && defined(LOAD_AVE_TYPE)
482/* File descriptor open to /dev/kmem or VMS load ave driver. */
483static int channel;
484/* Nonzero if channel is valid. */
485static int getloadavg_initialized;
486/* Offset in kmem to seek to read load average, or 0 means invalid. */
487static long offset;
488
489# if !defined(VMS) && !defined(sgi) && !defined(__linux__)
490static struct nlist name_list[2];
491# endif /* Not VMS or sgi */
492
493# ifdef SUNOS_5
494static kvm_t *kd;
495# endif /* SUNOS_5 */
496
497#endif /* LOAD_AVE_TYPE && !HAVE_LIBKSTAT */
498
499/* Put the 1 minute, 5 minute and 15 minute load averages
500 into the first NELEM elements of LOADAVG.
501 Return the number written (never more than 3, but may be less than NELEM),
502 or -1 if an error occurred. */
503
504int
505getloadavg (loadavg, nelem)
506 double loadavg[];
507 int nelem;
508{
509 int elem = 0; /* Return value. */
510
511# ifdef NO_GET_LOAD_AVG
512# define LDAV_DONE
513 /* Set errno to zero to indicate that there was no particular error;
514 this function just can't work at all on this system. */
515 errno = 0;
516 elem = -1;
517# endif
518
519# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)
520/* Use libkstat because we don't have to be root. */
521# define LDAV_DONE
522 kstat_ctl_t *kc;
523 kstat_t *ksp;
524 kstat_named_t *kn;
525
526 kc = kstat_open ();
527 if (kc == 0)
528 return -1;
529 ksp = kstat_lookup (kc, "unix", 0, "system_misc");
530 if (ksp == 0 )
531 return -1;
532 if (kstat_read (kc, ksp, 0) == -1)
533 return -1;
534
535
536 kn = kstat_data_lookup (ksp, "avenrun_1min");
537 if (kn == 0)
538 {
539 /* Return -1 if no load average information is available. */
540 nelem = 0;
541 elem = -1;
542 }
543
544 if (nelem >= 1)
545 loadavg[elem++] = (double) kn->value.ul/FSCALE;
546
547 if (nelem >= 2)
548 {
549 kn = kstat_data_lookup (ksp, "avenrun_5min");
550 if (kn != 0)
551 {
552 loadavg[elem++] = (double) kn->value.ul/FSCALE;
553
554 if (nelem >= 3)
555 {
556 kn = kstat_data_lookup (ksp, "avenrun_15min");
557 if (kn != 0)
558 loadavg[elem++] = (double) kn->value.ul/FSCALE;
559 }
560 }
561 }
562
563 kstat_close (kc);
564# endif /* HAVE_LIBKSTAT */
565
566# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
567/* Use pstat_getdynamic() because we don't have to be root. */
568# define LDAV_DONE
569# undef LOAD_AVE_TYPE
570
571 struct pst_dynamic dyn_info;
572 if (pstat_getdynamic (&dyn_info, sizeof (dyn_info), 0, 0) < 0)
573 return -1;
574 if (nelem > 0)
575 loadavg[elem++] = dyn_info.psd_avg_1_min;
576 if (nelem > 1)
577 loadavg[elem++] = dyn_info.psd_avg_5_min;
578 if (nelem > 2)
579 loadavg[elem++] = dyn_info.psd_avg_15_min;
580
581# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
582
583# if !defined (LDAV_DONE) && defined (__linux__)
584# define LDAV_DONE
585# undef LOAD_AVE_TYPE
586
587# ifndef LINUX_LDAV_FILE
588# define LINUX_LDAV_FILE "/proc/loadavg"
589# endif
590
591 char ldavgbuf[40];
592 double load_ave[3];
593 int fd, count;
594
595 fd = open (LINUX_LDAV_FILE, O_RDONLY);
596 if (fd == -1)
597 return -1;
598 count = read (fd, ldavgbuf, 40);
599 (void) close (fd);
600 if (count <= 0)
601 return -1;
602
603 /* The following sscanf must use the C locale. */
604 setlocale (LC_NUMERIC, "C");
605 count = sscanf (ldavgbuf, "%lf %lf %lf",
606 &load_ave[0], &load_ave[1], &load_ave[2]);
607 setlocale (LC_NUMERIC, "");
608 if (count < 1)
609 return -1;
610
611 for (elem = 0; elem < nelem && elem < count; elem++)
612 loadavg[elem] = load_ave[elem];
613
614 return elem;
615
616# endif /* __linux__ */
617
618# if !defined (LDAV_DONE) && defined (__NetBSD__)
619# define LDAV_DONE
620# undef LOAD_AVE_TYPE
621
622# ifndef NETBSD_LDAV_FILE
623# define NETBSD_LDAV_FILE "/kern/loadavg"
624# endif
625
626 unsigned long int load_ave[3], scale;
627 int count;
628 FILE *fp;
629
630 fp = fopen (NETBSD_LDAV_FILE, "r");
631 if (fp == NULL)
632 return -1;
633 count = fscanf (fp, "%lu %lu %lu %lu\n",
634 &load_ave[0], &load_ave[1], &load_ave[2],
635 &scale);
636 (void) fclose (fp);
637 if (count != 4)
638 return -1;
639
640 for (elem = 0; elem < nelem; elem++)
641 loadavg[elem] = (double) load_ave[elem] / (double) scale;
642
643 return elem;
644
645# endif /* __NetBSD__ */
646
647# if !defined (LDAV_DONE) && defined (NeXT)
648# define LDAV_DONE
649 /* The NeXT code was adapted from iscreen 3.2. */
650
651 host_t host;
652 struct processor_set_basic_info info;
653 unsigned info_count;
654
655 /* We only know how to get the 1-minute average for this system,
656 so even if the caller asks for more than 1, we only return 1. */
657
658 if (!getloadavg_initialized)
659 {
660 if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
661 getloadavg_initialized = 1;
662 }
663
664 if (getloadavg_initialized)
665 {
666 info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
667 if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
668 (processor_set_info_t) &info, &info_count)
669 != KERN_SUCCESS)
670 getloadavg_initialized = 0;
671 else
672 {
673 if (nelem > 0)
674 loadavg[elem++] = (double) info.load_average / LOAD_SCALE;
675 }
676 }
677
678 if (!getloadavg_initialized)
679 return -1;
680# endif /* NeXT */
681
682# if !defined (LDAV_DONE) && defined (UMAX)
683# define LDAV_DONE
684/* UMAX 4.2, which runs on the Encore Multimax multiprocessor, does not
685 have a /dev/kmem. Information about the workings of the running kernel
686 can be gathered with inq_stats system calls.
687 We only know how to get the 1-minute average for this system. */
688
689 struct proc_summary proc_sum_data;
690 struct stat_descr proc_info;
691 double load;
692 register unsigned int i, j;
693
694 if (cpus == 0)
695 {
696 register unsigned int c, i;
697 struct cpu_config conf;
698 struct stat_descr desc;
699
700 desc.sd_next = 0;
701 desc.sd_subsys = SUBSYS_CPU;
702 desc.sd_type = CPUTYPE_CONFIG;
703 desc.sd_addr = (char *) &conf;
704 desc.sd_size = sizeof conf;
705
706 if (inq_stats (1, &desc))
707 return -1;
708
709 c = 0;
710 for (i = 0; i < conf.config_maxclass; ++i)
711 {
712 struct class_stats stats;
713 memset (&stats, 0, sizeof stats);
714
715 desc.sd_type = CPUTYPE_CLASS;
716 desc.sd_objid = i;
717 desc.sd_addr = (char *) &stats;
718 desc.sd_size = sizeof stats;
719
720 if (inq_stats (1, &desc))
721 return -1;
722
723 c += stats.class_numcpus;
724 }
725 cpus = c;
726 samples = cpus < 2 ? 3 : (2 * cpus / 3);
727 }
728
729 proc_info.sd_next = 0;
730 proc_info.sd_subsys = SUBSYS_PROC;
731 proc_info.sd_type = PROCTYPE_SUMMARY;
732 proc_info.sd_addr = (char *) &proc_sum_data;
733 proc_info.sd_size = sizeof (struct proc_summary);
734 proc_info.sd_sizeused = 0;
735
736 if (inq_stats (1, &proc_info) != 0)
737 return -1;
738
739 load = proc_sum_data.ps_nrunnable;
740 j = 0;
741 for (i = samples - 1; i > 0; --i)
742 {
743 load += proc_sum_data.ps_nrun[j];
744 if (j++ == PS_NRUNSIZE)
745 j = 0;
746 }
747
748 if (nelem > 0)
749 loadavg[elem++] = load / samples / cpus;
750# endif /* UMAX */
751
752# if !defined (LDAV_DONE) && defined (DGUX)
753# define LDAV_DONE
754 /* This call can return -1 for an error, but with good args
755 it's not supposed to fail. The first argument is for no
756 apparent reason of type `long int *'. */
757 dg_sys_info ((long int *) &load_info,
758 DG_SYS_INFO_LOAD_INFO_TYPE,
759 DG_SYS_INFO_LOAD_VERSION_0);
760
761 if (nelem > 0)
762 loadavg[elem++] = load_info.one_minute;
763 if (nelem > 1)
764 loadavg[elem++] = load_info.five_minute;
765 if (nelem > 2)
766 loadavg[elem++] = load_info.fifteen_minute;
767# endif /* DGUX */
768
769# if !defined (LDAV_DONE) && defined (apollo)
770# define LDAV_DONE
771/* Apollo code from lisch@mentorg.com (Ray Lischner).
772
773 This system call is not documented. The load average is obtained as
774 three long integers, for the load average over the past minute,
775 five minutes, and fifteen minutes. Each value is a scaled integer,
776 with 16 bits of integer part and 16 bits of fraction part.
777
778 I'm not sure which operating system first supported this system call,
779 but I know that SR10.2 supports it. */
780
781 extern void proc1_$get_loadav ();
782 unsigned long load_ave[3];
783
784 proc1_$get_loadav (load_ave);
785
786 if (nelem > 0)
787 loadavg[elem++] = load_ave[0] / 65536.0;
788 if (nelem > 1)
789 loadavg[elem++] = load_ave[1] / 65536.0;
790 if (nelem > 2)
791 loadavg[elem++] = load_ave[2] / 65536.0;
792# endif /* apollo */
793
794# if !defined (LDAV_DONE) && defined (OSF_MIPS)
795# define LDAV_DONE
796
797 struct tbl_loadavg load_ave;
798 table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
799 loadavg[elem++]
800 = (load_ave.tl_lscale == 0
801 ? load_ave.tl_avenrun.d[0]
802 : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
803# endif /* OSF_MIPS */
804
805# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
806# define LDAV_DONE
807
808 /* A faithful emulation is going to have to be saved for a rainy day. */
809 for ( ; elem < nelem; elem++)
810 {
811 loadavg[elem] = 0.0;
812 }
813# endif /* __MSDOS__ || WINDOWS32 */
814
815# if !defined (LDAV_DONE) && defined (OSF_ALPHA)
816# define LDAV_DONE
817
818 struct tbl_loadavg load_ave;
819 table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
820 for (elem = 0; elem < nelem; elem++)
821 loadavg[elem]
822 = (load_ave.tl_lscale == 0
823 ? load_ave.tl_avenrun.d[elem]
824 : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
825# endif /* OSF_ALPHA */
826
827# if !defined (LDAV_DONE) && defined (VMS)
828 /* VMS specific code -- read from the Load Ave driver. */
829
830 LOAD_AVE_TYPE load_ave[3];
831 static int getloadavg_initialized = 0;
832# ifdef eunice
833 struct
834 {
835 int dsc$w_length;
836 char *dsc$a_pointer;
837 } descriptor;
838# endif
839
840 /* Ensure that there is a channel open to the load ave device. */
841 if (!getloadavg_initialized)
842 {
843 /* Attempt to open the channel. */
844# ifdef eunice
845 descriptor.dsc$w_length = 18;
846 descriptor.dsc$a_pointer = "$$VMS_LOAD_AVERAGE";
847# else
848 $DESCRIPTOR (descriptor, "LAV0:");
849# endif
850 if (sys$assign (&descriptor, &channel, 0, 0) & 1)
851 getloadavg_initialized = 1;
852 }
853
854 /* Read the load average vector. */
855 if (getloadavg_initialized
856 && !(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0,
857 load_ave, 12, 0, 0, 0, 0) & 1))
858 {
859 sys$dassgn (channel);
860 getloadavg_initialized = 0;
861 }
862
863 if (!getloadavg_initialized)
864 return -1;
865# endif /* VMS */
866
867# if !defined (LDAV_DONE) && defined(LOAD_AVE_TYPE) && !defined(VMS)
868
869 /* UNIX-specific code -- read the average from /dev/kmem. */
870
871# define LDAV_PRIVILEGED /* This code requires special installation. */
872
873 LOAD_AVE_TYPE load_ave[3];
874
875 /* Get the address of LDAV_SYMBOL. */
876 if (offset == 0)
877 {
878# ifndef sgi
879# ifndef NLIST_STRUCT
880 strcpy (name_list[0].n_name, LDAV_SYMBOL);
881 strcpy (name_list[1].n_name, "");
882# else /* NLIST_STRUCT */
883# ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
884 name_list[0].n_un.n_name = LDAV_SYMBOL;
885 name_list[1].n_un.n_name = 0;
886# else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
887 name_list[0].n_name = LDAV_SYMBOL;
888 name_list[1].n_name = 0;
889# endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
890# endif /* NLIST_STRUCT */
891
892# ifndef SUNOS_5
893 if (
894# if !(defined (_AIX) && !defined (ps2))
895 nlist (KERNEL_FILE, name_list)
896# else /* _AIX */
897 knlist (name_list, 1, sizeof (name_list[0]))
898# endif
899 >= 0)
900 /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */
901 {
902# ifdef FIXUP_KERNEL_SYMBOL_ADDR
903 FIXUP_KERNEL_SYMBOL_ADDR (name_list);
904# endif
905 offset = name_list[0].n_value;
906 }
907# endif /* !SUNOS_5 */
908# else /* sgi */
909 int ldav_off;
910
911 ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
912 if (ldav_off != -1)
913 offset = (long) ldav_off & 0x7fffffff;
914# endif /* sgi */
915 }
916
917 /* Make sure we have /dev/kmem open. */
918 if (!getloadavg_initialized)
919 {
920# ifndef SUNOS_5
921 channel = open ("/dev/kmem", 0);
922 if (channel >= 0)
923 {
924 /* Set the channel to close on exec, so it does not
925 litter any child's descriptor table. */
926# ifdef F_SETFD
927# ifndef FD_CLOEXEC
928# define FD_CLOEXEC 1
929# endif
930 (void) fcntl (channel, F_SETFD, FD_CLOEXEC);
931# endif
932 getloadavg_initialized = 1;
933 }
934# else /* SUNOS_5 */
935 /* We pass 0 for the kernel, corefile, and swapfile names
936 to use the currently running kernel. */
937 kd = kvm_open (0, 0, 0, O_RDONLY, 0);
938 if (kd != 0)
939 {
940 /* nlist the currently running kernel. */
941 kvm_nlist (kd, name_list);
942 offset = name_list[0].n_value;
943 getloadavg_initialized = 1;
944 }
945# endif /* SUNOS_5 */
946 }
947
948 /* If we can, get the load average values. */
949 if (offset && getloadavg_initialized)
950 {
951 /* Try to read the load. */
952# ifndef SUNOS_5
953 if (lseek (channel, offset, 0) == -1L
954 || read (channel, (char *) load_ave, sizeof (load_ave))
955 != sizeof (load_ave))
956 {
957 close (channel);
958 getloadavg_initialized = 0;
959 }
960# else /* SUNOS_5 */
961 if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
962 != sizeof (load_ave))
963 {
964 kvm_close (kd);
965 getloadavg_initialized = 0;
966 }
967# endif /* SUNOS_5 */
968 }
969
970 if (offset == 0 || !getloadavg_initialized)
971 return -1;
972# endif /* LOAD_AVE_TYPE and not VMS */
973
974# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */
975 if (nelem > 0)
976 loadavg[elem++] = LDAV_CVT (load_ave[0]);
977 if (nelem > 1)
978 loadavg[elem++] = LDAV_CVT (load_ave[1]);
979 if (nelem > 2)
980 loadavg[elem++] = LDAV_CVT (load_ave[2]);
981
982# define LDAV_DONE
983# endif /* !LDAV_DONE && LOAD_AVE_TYPE */
984
985# ifdef LDAV_DONE
986 return elem;
987# else
988 /* Set errno to zero to indicate that there was no particular error;
989 this function just can't work at all on this system. */
990 errno = 0;
991 return -1;
992# endif
993}
994
995#endif /* ! HAVE_GETLOADAVG */
996
997#ifdef TEST
998void
999main (argc, argv)
1000 int argc;
1001 char **argv;
1002{
1003 int naptime = 0;
1004
1005 if (argc > 1)
1006 naptime = atoi (argv[1]);
1007
1008 while (1)
1009 {
1010 double avg[3];
1011 int loads;
1012
1013 errno = 0; /* Don't be misled if it doesn't set errno. */
1014 loads = getloadavg (avg, 3);
1015 if (loads == -1)
1016 {
1017 perror ("Error getting load average");
1018 exit (1);
1019 }
1020 if (loads > 0)
1021 printf ("1-minute: %f ", avg[0]);
1022 if (loads > 1)
1023 printf ("5-minute: %f ", avg[1]);
1024 if (loads > 2)
1025 printf ("15-minute: %f ", avg[2]);
1026 if (loads > 0)
1027 putchar ('\n');
1028
1029 if (naptime == 0)
1030 break;
1031 sleep (naptime);
1032 }
1033
1034 exit (0);
1035}
1036#endif /* TEST */
1037
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 6367949a649..6ecd5d624af 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3677,7 +3677,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
3677 GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); 3677 GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1));
3678 GtkImage *wimage = GTK_IMAGE (c1); 3678 GtkImage *wimage = GTK_IMAGE (c1);
3679 GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label 3679 GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
3680 (gtk_label_get_text (wlbl)); 3680 (wlbl ? gtk_label_get_text (wlbl) : "");
3681 GtkWidget *wmenuimage; 3681 GtkWidget *wmenuimage;
3682 3682
3683 3683
diff --git a/src/indent.c b/src/indent.c
index 84ce140c5ba..85d26520cfb 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -70,7 +70,7 @@ buffer_display_table (void)
70{ 70{
71 Lisp_Object thisbuf; 71 Lisp_Object thisbuf;
72 72
73 thisbuf = current_buffer->display_table; 73 thisbuf = BVAR (current_buffer, display_table);
74 if (DISP_TABLE_P (thisbuf)) 74 if (DISP_TABLE_P (thisbuf))
75 return XCHAR_TABLE (thisbuf); 75 return XCHAR_TABLE (thisbuf);
76 if (DISP_TABLE_P (Vstandard_display_table)) 76 if (DISP_TABLE_P (Vstandard_display_table))
@@ -140,9 +140,9 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
140 int i; 140 int i;
141 struct Lisp_Vector *widthtab; 141 struct Lisp_Vector *widthtab;
142 142
143 if (!VECTORP (buf->width_table)) 143 if (!VECTORP (BVAR (buf, width_table)))
144 buf->width_table = Fmake_vector (make_number (256), make_number (0)); 144 BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0));
145 widthtab = XVECTOR (buf->width_table); 145 widthtab = XVECTOR (BVAR (buf, width_table));
146 if (widthtab->size != 256) 146 if (widthtab->size != 256)
147 abort (); 147 abort ();
148 148
@@ -156,17 +156,17 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
156static void 156static void
157width_run_cache_on_off (void) 157width_run_cache_on_off (void)
158{ 158{
159 if (NILP (current_buffer->cache_long_line_scans) 159 if (NILP (BVAR (current_buffer, cache_long_line_scans))
160 /* And, for the moment, this feature doesn't work on multibyte 160 /* And, for the moment, this feature doesn't work on multibyte
161 characters. */ 161 characters. */
162 || !NILP (current_buffer->enable_multibyte_characters)) 162 || !NILP (BVAR (current_buffer, enable_multibyte_characters)))
163 { 163 {
164 /* It should be off. */ 164 /* It should be off. */
165 if (current_buffer->width_run_cache) 165 if (current_buffer->width_run_cache)
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 current_buffer->width_table = Qnil; 169 BVAR (current_buffer, width_table) = Qnil;
170 } 170 }
171 } 171 }
172 else 172 else
@@ -329,8 +329,8 @@ current_column (void)
329 register int tab_seen; 329 register int tab_seen;
330 int post_tab; 330 int post_tab;
331 register int c; 331 register int c;
332 register int tab_width = XINT (current_buffer->tab_width); 332 register int tab_width = XINT (BVAR (current_buffer, tab_width));
333 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 333 int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
334 register struct Lisp_Char_Table *dp = buffer_display_table (); 334 register struct Lisp_Char_Table *dp = buffer_display_table ();
335 335
336 if (PT == last_known_column_point 336 if (PT == last_known_column_point
@@ -417,7 +417,7 @@ current_column (void)
417 col++; 417 col++;
418 else if (c == '\n' 418 else if (c == '\n'
419 || (c == '\r' 419 || (c == '\r'
420 && EQ (current_buffer->selective_display, Qt))) 420 && EQ (BVAR (current_buffer, selective_display), Qt)))
421 { 421 {
422 ptr++; 422 ptr++;
423 goto start_of_line_found; 423 goto start_of_line_found;
@@ -512,10 +512,10 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
512static void 512static void
513scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) 513scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
514{ 514{
515 register EMACS_INT tab_width = XINT (current_buffer->tab_width); 515 register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
516 register int ctl_arrow = !NILP (current_buffer->ctl_arrow); 516 register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
517 register struct Lisp_Char_Table *dp = buffer_display_table (); 517 register struct Lisp_Char_Table *dp = buffer_display_table ();
518 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 518 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
519 struct composition_it cmp_it; 519 struct composition_it cmp_it;
520 Lisp_Object window; 520 Lisp_Object window;
521 struct window *w; 521 struct window *w;
@@ -637,7 +637,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
637 637
638 if (c == '\n') 638 if (c == '\n')
639 goto endloop; 639 goto endloop;
640 if (c == '\r' && EQ (current_buffer->selective_display, Qt)) 640 if (c == '\r' && EQ (BVAR (current_buffer, selective_display), Qt))
641 goto endloop; 641 goto endloop;
642 if (c == '\t') 642 if (c == '\t')
643 { 643 {
@@ -655,7 +655,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
655 655
656 if (c == '\n') 656 if (c == '\n')
657 goto endloop; 657 goto endloop;
658 if (c == '\r' && EQ (current_buffer->selective_display, Qt)) 658 if (c == '\r' && EQ (BVAR (current_buffer, selective_display), Qt))
659 goto endloop; 659 goto endloop;
660 if (c == '\t') 660 if (c == '\t')
661 { 661 {
@@ -809,7 +809,7 @@ The return value is COLUMN. */)
809{ 809{
810 int mincol; 810 int mincol;
811 register int fromcol; 811 register int fromcol;
812 register int tab_width = XINT (current_buffer->tab_width); 812 register int tab_width = XINT (BVAR (current_buffer, tab_width));
813 813
814 CHECK_NUMBER (column); 814 CHECK_NUMBER (column);
815 if (NILP (minimum)) 815 if (NILP (minimum))
@@ -872,7 +872,7 @@ static double
872position_indentation (register int pos_byte) 872position_indentation (register int pos_byte)
873{ 873{
874 register EMACS_INT column = 0; 874 register EMACS_INT column = 0;
875 register EMACS_INT tab_width = XINT (current_buffer->tab_width); 875 register EMACS_INT tab_width = XINT (BVAR (current_buffer, tab_width));
876 register unsigned char *p; 876 register unsigned char *p;
877 register unsigned char *stop; 877 register unsigned char *stop;
878 unsigned char *start; 878 unsigned char *start;
@@ -924,7 +924,7 @@ position_indentation (register int pos_byte)
924 switch (*p++) 924 switch (*p++)
925 { 925 {
926 case 0240: 926 case 0240:
927 if (! NILP (current_buffer->enable_multibyte_characters)) 927 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
928 return column; 928 return column;
929 case ' ': 929 case ' ':
930 column++; 930 column++;
@@ -934,7 +934,7 @@ position_indentation (register int pos_byte)
934 break; 934 break;
935 default: 935 default:
936 if (ASCII_BYTE_P (p[-1]) 936 if (ASCII_BYTE_P (p[-1])
937 || NILP (current_buffer->enable_multibyte_characters)) 937 || NILP (BVAR (current_buffer, enable_multibyte_characters)))
938 return column; 938 return column;
939 { 939 {
940 int c; 940 int c;
@@ -1123,13 +1123,13 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1123 register EMACS_INT pos; 1123 register EMACS_INT pos;
1124 EMACS_INT pos_byte; 1124 EMACS_INT pos_byte;
1125 register int c = 0; 1125 register int c = 0;
1126 register EMACS_INT tab_width = XFASTINT (current_buffer->tab_width); 1126 register EMACS_INT tab_width = XFASTINT (BVAR (current_buffer, tab_width));
1127 register int ctl_arrow = !NILP (current_buffer->ctl_arrow); 1127 register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
1128 register struct Lisp_Char_Table *dp = window_display_table (win); 1128 register struct Lisp_Char_Table *dp = window_display_table (win);
1129 int selective 1129 int selective
1130 = (INTEGERP (current_buffer->selective_display) 1130 = (INTEGERP (BVAR (current_buffer, selective_display))
1131 ? XINT (current_buffer->selective_display) 1131 ? XINT (BVAR (current_buffer, selective_display))
1132 : !NILP (current_buffer->selective_display) ? -1 : 0); 1132 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
1133 int selective_rlen 1133 int selective_rlen
1134 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) 1134 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
1135 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0); 1135 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0);
@@ -1151,7 +1151,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1151 EMACS_INT next_width_run = from; 1151 EMACS_INT next_width_run = from;
1152 Lisp_Object window; 1152 Lisp_Object window;
1153 1153
1154 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 1154 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
1155 /* If previous char scanned was a wide character, 1155 /* If previous char scanned was a wide character,
1156 this is the column where it ended. Otherwise, this is 0. */ 1156 this is the column where it ended. Otherwise, this is 0. */
1157 EMACS_INT wide_column_end_hpos = 0; 1157 EMACS_INT wide_column_end_hpos = 0;
@@ -1170,8 +1170,8 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1170 1170
1171 width_run_cache_on_off (); 1171 width_run_cache_on_off ();
1172 if (dp == buffer_display_table ()) 1172 if (dp == buffer_display_table ())
1173 width_table = (VECTORP (current_buffer->width_table) 1173 width_table = (VECTORP (BVAR (current_buffer, width_table))
1174 ? XVECTOR (current_buffer->width_table)->contents 1174 ? XVECTOR (BVAR (current_buffer, width_table))->contents
1175 : 0); 1175 : 0);
1176 else 1176 else
1177 /* If the window has its own display table, we can't use the width 1177 /* If the window has its own display table, we can't use the width
@@ -1337,7 +1337,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1337 } 1337 }
1338 1338
1339 if (hscroll || truncate 1339 if (hscroll || truncate
1340 || !NILP (current_buffer->truncate_lines)) 1340 || !NILP (BVAR (current_buffer, truncate_lines)))
1341 { 1341 {
1342 /* Truncating: skip to newline, unless we are already past 1342 /* Truncating: skip to newline, unless we are already past
1343 TO (we need to go back below). */ 1343 TO (we need to go back below). */
@@ -1838,9 +1838,9 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
1838 EMACS_INT from_byte; 1838 EMACS_INT from_byte;
1839 EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0; 1839 EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
1840 int selective 1840 int selective
1841 = (INTEGERP (current_buffer->selective_display) 1841 = (INTEGERP (BVAR (current_buffer, selective_display))
1842 ? XINT (current_buffer->selective_display) 1842 ? XINT (BVAR (current_buffer, selective_display))
1843 : !NILP (current_buffer->selective_display) ? -1 : 0); 1843 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
1844 Lisp_Object window; 1844 Lisp_Object window;
1845 EMACS_INT start_hpos = 0; 1845 EMACS_INT start_hpos = 0;
1846 int did_motion; 1846 int did_motion;
diff --git a/src/insdel.c b/src/insdel.c
index db76f770dad..7fcf9522a33 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -78,7 +78,7 @@ void
78check_markers (void) 78check_markers (void)
79{ 79{
80 register struct Lisp_Marker *tail; 80 register struct Lisp_Marker *tail;
81 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 81 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
82 82
83 for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) 83 for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
84 { 84 {
@@ -703,7 +703,7 @@ insert_char (int c)
703 unsigned char str[MAX_MULTIBYTE_LENGTH]; 703 unsigned char str[MAX_MULTIBYTE_LENGTH];
704 int len; 704 int len;
705 705
706 if (! NILP (current_buffer->enable_multibyte_characters)) 706 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
707 len = CHAR_STRING (c, str); 707 len = CHAR_STRING (c, str);
708 else 708 else
709 { 709 {
@@ -891,7 +891,7 @@ insert_1_both (const char *string,
891 if (nchars == 0) 891 if (nchars == 0)
892 return; 892 return;
893 893
894 if (NILP (current_buffer->enable_multibyte_characters)) 894 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
895 nchars = nbytes; 895 nchars = nbytes;
896 896
897 if (prepare) 897 if (prepare)
@@ -1011,7 +1011,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1011 /* Make OUTGOING_NBYTES describe the text 1011 /* Make OUTGOING_NBYTES describe the text
1012 as it will be inserted in this buffer. */ 1012 as it will be inserted in this buffer. */
1013 1013
1014 if (NILP (current_buffer->enable_multibyte_characters)) 1014 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
1015 outgoing_nbytes = nchars; 1015 outgoing_nbytes = nchars;
1016 else if (! STRING_MULTIBYTE (string)) 1016 else if (! STRING_MULTIBYTE (string))
1017 outgoing_nbytes 1017 outgoing_nbytes
@@ -1034,7 +1034,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1034 between single-byte and multibyte. */ 1034 between single-byte and multibyte. */
1035 copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes, 1035 copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes,
1036 STRING_MULTIBYTE (string), 1036 STRING_MULTIBYTE (string),
1037 ! NILP (current_buffer->enable_multibyte_characters)); 1037 ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
1038 1038
1039#ifdef BYTE_COMBINING_DEBUG 1039#ifdef BYTE_COMBINING_DEBUG
1040 /* We have copied text into the gap, but we have not altered 1040 /* We have copied text into the gap, but we have not altered
@@ -1094,7 +1094,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1094void 1094void
1095insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) 1095insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
1096{ 1096{
1097 if (NILP (current_buffer->enable_multibyte_characters)) 1097 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
1098 nchars = nbytes; 1098 nchars = nbytes;
1099 1099
1100 record_insert (GPT, nchars); 1100 record_insert (GPT, nchars);
@@ -1162,9 +1162,9 @@ insert_from_buffer_1 (struct buffer *buf,
1162 /* Make OUTGOING_NBYTES describe the text 1162 /* Make OUTGOING_NBYTES describe the text
1163 as it will be inserted in this buffer. */ 1163 as it will be inserted in this buffer. */
1164 1164
1165 if (NILP (current_buffer->enable_multibyte_characters)) 1165 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
1166 outgoing_nbytes = nchars; 1166 outgoing_nbytes = nchars;
1167 else if (NILP (buf->enable_multibyte_characters)) 1167 else if (NILP (BVAR (buf, enable_multibyte_characters)))
1168 { 1168 {
1169 EMACS_INT outgoing_before_gap = 0; 1169 EMACS_INT outgoing_before_gap = 0;
1170 EMACS_INT outgoing_after_gap = 0; 1170 EMACS_INT outgoing_after_gap = 0;
@@ -1215,8 +1215,8 @@ insert_from_buffer_1 (struct buffer *buf,
1215 chunk_expanded 1215 chunk_expanded
1216 = copy_text (BUF_BYTE_ADDRESS (buf, from_byte), 1216 = copy_text (BUF_BYTE_ADDRESS (buf, from_byte),
1217 GPT_ADDR, chunk, 1217 GPT_ADDR, chunk,
1218 ! NILP (buf->enable_multibyte_characters), 1218 ! NILP (BVAR (buf, enable_multibyte_characters)),
1219 ! NILP (current_buffer->enable_multibyte_characters)); 1219 ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
1220 } 1220 }
1221 else 1221 else
1222 chunk_expanded = chunk = 0; 1222 chunk_expanded = chunk = 0;
@@ -1224,8 +1224,8 @@ insert_from_buffer_1 (struct buffer *buf,
1224 if (chunk < incoming_nbytes) 1224 if (chunk < incoming_nbytes)
1225 copy_text (BUF_BYTE_ADDRESS (buf, from_byte + chunk), 1225 copy_text (BUF_BYTE_ADDRESS (buf, from_byte + chunk),
1226 GPT_ADDR + chunk_expanded, incoming_nbytes - chunk, 1226 GPT_ADDR + chunk_expanded, incoming_nbytes - chunk,
1227 ! NILP (buf->enable_multibyte_characters), 1227 ! NILP (BVAR (buf, enable_multibyte_characters)),
1228 ! NILP (current_buffer->enable_multibyte_characters)); 1228 ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
1229 1229
1230#ifdef BYTE_COMBINING_DEBUG 1230#ifdef BYTE_COMBINING_DEBUG
1231 /* We have copied text into the gap, but we have not altered 1231 /* We have copied text into the gap, but we have not altered
@@ -1320,7 +1320,7 @@ adjust_after_replace (EMACS_INT from, EMACS_INT from_byte,
1320 adjust_markers_for_insert (from, from_byte, 1320 adjust_markers_for_insert (from, from_byte,
1321 from + len, from_byte + len_byte, 0); 1321 from + len, from_byte + len_byte, 0);
1322 1322
1323 if (! EQ (current_buffer->undo_list, Qt)) 1323 if (! EQ (BVAR (current_buffer, undo_list), Qt))
1324 { 1324 {
1325 if (nchars_del > 0) 1325 if (nchars_del > 0)
1326 record_delete (from, prev_text); 1326 record_delete (from, prev_text);
@@ -1481,7 +1481,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1481 /* Make OUTGOING_INSBYTES describe the text 1481 /* Make OUTGOING_INSBYTES describe the text
1482 as it will be inserted in this buffer. */ 1482 as it will be inserted in this buffer. */
1483 1483
1484 if (NILP (current_buffer->enable_multibyte_characters)) 1484 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
1485 outgoing_insbytes = inschars; 1485 outgoing_insbytes = inschars;
1486 else if (! STRING_MULTIBYTE (new)) 1486 else if (! STRING_MULTIBYTE (new))
1487 outgoing_insbytes 1487 outgoing_insbytes
@@ -1503,7 +1503,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1503 /* Even if we don't record for undo, we must keep the original text 1503 /* Even if we don't record for undo, we must keep the original text
1504 because we may have to recover it because of inappropriate byte 1504 because we may have to recover it because of inappropriate byte
1505 combining. */ 1505 combining. */
1506 if (! EQ (current_buffer->undo_list, Qt)) 1506 if (! EQ (BVAR (current_buffer, undo_list), Qt))
1507 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); 1507 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1);
1508 1508
1509 GAP_SIZE += nbytes_del; 1509 GAP_SIZE += nbytes_del;
@@ -1530,7 +1530,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1530 between single-byte and multibyte. */ 1530 between single-byte and multibyte. */
1531 copy_text (SDATA (new), GPT_ADDR, insbytes, 1531 copy_text (SDATA (new), GPT_ADDR, insbytes,
1532 STRING_MULTIBYTE (new), 1532 STRING_MULTIBYTE (new),
1533 ! NILP (current_buffer->enable_multibyte_characters)); 1533 ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
1534 1534
1535#ifdef BYTE_COMBINING_DEBUG 1535#ifdef BYTE_COMBINING_DEBUG
1536 /* We have copied text into the gap, but we have not marked 1536 /* We have copied text into the gap, but we have not marked
@@ -1543,7 +1543,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
1543 abort (); 1543 abort ();
1544#endif 1544#endif
1545 1545
1546 if (! EQ (current_buffer->undo_list, Qt)) 1546 if (! EQ (BVAR (current_buffer, undo_list), Qt))
1547 { 1547 {
1548 /* Record the insertion first, so that when we undo, 1548 /* Record the insertion first, so that when we undo,
1549 the deletion will be undone first. Thus, undo 1549 the deletion will be undone first. Thus, undo
@@ -1886,7 +1886,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte,
1886 abort (); 1886 abort ();
1887#endif 1887#endif
1888 1888
1889 if (ret_string || ! EQ (current_buffer->undo_list, Qt)) 1889 if (ret_string || ! EQ (BVAR (current_buffer, undo_list), Qt))
1890 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); 1890 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1);
1891 else 1891 else
1892 deletion = Qnil; 1892 deletion = Qnil;
@@ -1897,7 +1897,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte,
1897 so that undo handles this after reinserting the text. */ 1897 so that undo handles this after reinserting the text. */
1898 adjust_markers_for_delete (from, from_byte, to, to_byte); 1898 adjust_markers_for_delete (from, from_byte, to, to_byte);
1899 1899
1900 if (! EQ (current_buffer->undo_list, Qt)) 1900 if (! EQ (BVAR (current_buffer, undo_list), Qt))
1901 record_delete (from, deletion); 1901 record_delete (from, deletion);
1902 MODIFF++; 1902 MODIFF++;
1903 CHARS_MODIFF = MODIFF; 1903 CHARS_MODIFF = MODIFF;
@@ -1968,7 +1968,7 @@ modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end,
1968 if (! preserve_chars_modiff) 1968 if (! preserve_chars_modiff)
1969 CHARS_MODIFF = MODIFF; 1969 CHARS_MODIFF = MODIFF;
1970 1970
1971 buffer->point_before_scroll = Qnil; 1971 BVAR (buffer, point_before_scroll) = Qnil;
1972 1972
1973 if (buffer != old_buffer) 1973 if (buffer != old_buffer)
1974 set_buffer_internal (old_buffer); 1974 set_buffer_internal (old_buffer);
@@ -1990,7 +1990,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
1990{ 1990{
1991 struct buffer *base_buffer; 1991 struct buffer *base_buffer;
1992 1992
1993 if (!NILP (current_buffer->read_only)) 1993 if (!NILP (BVAR (current_buffer, read_only)))
1994 Fbarf_if_buffer_read_only (); 1994 Fbarf_if_buffer_read_only ();
1995 1995
1996 /* Let redisplay consider other windows than selected_window 1996 /* Let redisplay consider other windows than selected_window
@@ -2022,32 +2022,32 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
2022 base_buffer = current_buffer; 2022 base_buffer = current_buffer;
2023 2023
2024#ifdef CLASH_DETECTION 2024#ifdef CLASH_DETECTION
2025 if (!NILP (base_buffer->file_truename) 2025 if (!NILP (BVAR (base_buffer, file_truename))
2026 /* Make binding buffer-file-name to nil effective. */ 2026 /* Make binding buffer-file-name to nil effective. */
2027 && !NILP (base_buffer->filename) 2027 && !NILP (BVAR (base_buffer, filename))
2028 && SAVE_MODIFF >= MODIFF) 2028 && SAVE_MODIFF >= MODIFF)
2029 lock_file (base_buffer->file_truename); 2029 lock_file (BVAR (base_buffer, file_truename));
2030#else 2030#else
2031 /* At least warn if this file has changed on disk since it was visited. */ 2031 /* At least warn if this file has changed on disk since it was visited. */
2032 if (!NILP (base_buffer->filename) 2032 if (!NILP (BVAR (base_buffer, filename))
2033 && SAVE_MODIFF >= MODIFF 2033 && SAVE_MODIFF >= MODIFF
2034 && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ())) 2034 && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ()))
2035 && !NILP (Ffile_exists_p (base_buffer->filename))) 2035 && !NILP (Ffile_exists_p (BVAR (base_buffer, filename))))
2036 call1 (intern ("ask-user-about-supersession-threat"), 2036 call1 (intern ("ask-user-about-supersession-threat"),
2037 base_buffer->filename); 2037 BVAR (base_buffer,filename));
2038#endif /* not CLASH_DETECTION */ 2038#endif /* not CLASH_DETECTION */
2039 2039
2040 /* If `select-active-regions' is non-nil, save the region text. */ 2040 /* If `select-active-regions' is non-nil, save the region text. */
2041 if (!NILP (current_buffer->mark_active) 2041 if (!NILP (BVAR (current_buffer, mark_active))
2042 && !inhibit_modification_hooks 2042 && !inhibit_modification_hooks
2043 && XMARKER (current_buffer->mark)->buffer 2043 && XMARKER (BVAR (current_buffer, mark))->buffer
2044 && NILP (Vsaved_region_selection) 2044 && NILP (Vsaved_region_selection)
2045 && (EQ (Vselect_active_regions, Qonly) 2045 && (EQ (Vselect_active_regions, Qonly)
2046 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) 2046 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
2047 : (!NILP (Vselect_active_regions) 2047 : (!NILP (Vselect_active_regions)
2048 && !NILP (Vtransient_mark_mode)))) 2048 && !NILP (Vtransient_mark_mode))))
2049 { 2049 {
2050 EMACS_INT b = XMARKER (current_buffer->mark)->charpos; 2050 EMACS_INT b = XMARKER (BVAR (current_buffer, mark))->charpos;
2051 EMACS_INT e = PT; 2051 EMACS_INT e = PT;
2052 if (b < e) 2052 if (b < e)
2053 Vsaved_region_selection = make_buffer_string (b, e, 0); 2053 Vsaved_region_selection = make_buffer_string (b, e, 0);
@@ -2290,7 +2290,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
2290 non-nil, and insertion calls a file handler (e.g. through 2290 non-nil, and insertion calls a file handler (e.g. through
2291 lock_file) which scribbles into a temp file -- cyd */ 2291 lock_file) which scribbles into a temp file -- cyd */
2292 if (!BUFFERP (combine_after_change_buffer) 2292 if (!BUFFERP (combine_after_change_buffer)
2293 || NILP (XBUFFER (combine_after_change_buffer)->name)) 2293 || NILP (BVAR (XBUFFER (combine_after_change_buffer), name)))
2294 { 2294 {
2295 combine_after_change_list = Qnil; 2295 combine_after_change_list = Qnil;
2296 return Qnil; 2296 return Qnil;
diff --git a/src/intervals.c b/src/intervals.c
index ad46c17d588..6aee6e9d7fa 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1978,7 +1978,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos)
1978 int have_overlays; 1978 int have_overlays;
1979 EMACS_INT original_position; 1979 EMACS_INT original_position;
1980 1980
1981 current_buffer->point_before_scroll = Qnil; 1981 BVAR (current_buffer, point_before_scroll) = Qnil;
1982 1982
1983 if (charpos == PT) 1983 if (charpos == PT)
1984 return; 1984 return;
@@ -2342,7 +2342,7 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer,
2342 if (EQ (type, Qkeymap)) 2342 if (EQ (type, Qkeymap))
2343 return Qnil; 2343 return Qnil;
2344 else 2344 else
2345 return buffer->keymap; 2345 return BVAR (buffer, keymap);
2346} 2346}
2347 2347
2348/* Produce an interval tree reflecting the intervals in 2348/* Produce an interval tree reflecting the intervals in
diff --git a/src/intervals.h b/src/intervals.h
index 0762c9d8dc3..f6c1c002ce0 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -236,9 +236,9 @@ struct interval
236 and 2 if it is invisible but with an ellipsis. */ 236 and 2 if it is invisible but with an ellipsis. */
237 237
238#define TEXT_PROP_MEANS_INVISIBLE(prop) \ 238#define TEXT_PROP_MEANS_INVISIBLE(prop) \
239 (EQ (current_buffer->invisibility_spec, Qt) \ 239 (EQ (BVAR (current_buffer, invisibility_spec), Qt) \
240 ? !NILP (prop) \ 240 ? !NILP (prop) \
241 : invisible_p (prop, current_buffer->invisibility_spec)) 241 : invisible_p (prop, BVAR (current_buffer, invisibility_spec)))
242 242
243/* Declared in alloc.c */ 243/* Declared in alloc.c */
244 244
diff --git a/src/keyboard.c b/src/keyboard.c
index eb586183f08..1f14af78844 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -461,7 +461,7 @@ echo_char (Lisp_Object c)
461 char *ptr = buffer; 461 char *ptr = buffer;
462 Lisp_Object echo_string; 462 Lisp_Object echo_string;
463 463
464 echo_string = current_kboard->echo_string; 464 echo_string = KVAR (current_kboard, echo_string);
465 465
466 /* If someone has passed us a composite event, use its head symbol. */ 466 /* If someone has passed us a composite event, use its head symbol. */
467 c = EVENT_HEAD (c); 467 c = EVENT_HEAD (c);
@@ -528,7 +528,7 @@ echo_char (Lisp_Object c)
528 else if (STRINGP (echo_string)) 528 else if (STRINGP (echo_string))
529 echo_string = concat2 (echo_string, build_string (" ")); 529 echo_string = concat2 (echo_string, build_string (" "));
530 530
531 current_kboard->echo_string 531 KVAR (current_kboard, echo_string)
532 = concat2 (echo_string, make_string (buffer, ptr - buffer)); 532 = concat2 (echo_string, make_string (buffer, ptr - buffer));
533 533
534 echo_now (); 534 echo_now ();
@@ -542,31 +542,31 @@ void
542echo_dash (void) 542echo_dash (void)
543{ 543{
544 /* Do nothing if not echoing at all. */ 544 /* Do nothing if not echoing at all. */
545 if (NILP (current_kboard->echo_string)) 545 if (NILP (KVAR (current_kboard, echo_string)))
546 return; 546 return;
547 547
548 if (this_command_key_count == 0) 548 if (this_command_key_count == 0)
549 return; 549 return;
550 550
551 if (!current_kboard->immediate_echo 551 if (!current_kboard->immediate_echo
552 && SCHARS (current_kboard->echo_string) == 0) 552 && SCHARS (KVAR (current_kboard, echo_string)) == 0)
553 return; 553 return;
554 554
555 /* Do nothing if we just printed a prompt. */ 555 /* Do nothing if we just printed a prompt. */
556 if (current_kboard->echo_after_prompt 556 if (current_kboard->echo_after_prompt
557 == SCHARS (current_kboard->echo_string)) 557 == SCHARS (KVAR (current_kboard, echo_string)))
558 return; 558 return;
559 559
560 /* Do nothing if we have already put a dash at the end. */ 560 /* Do nothing if we have already put a dash at the end. */
561 if (SCHARS (current_kboard->echo_string) > 1) 561 if (SCHARS (KVAR (current_kboard, echo_string)) > 1)
562 { 562 {
563 Lisp_Object last_char, prev_char, idx; 563 Lisp_Object last_char, prev_char, idx;
564 564
565 idx = make_number (SCHARS (current_kboard->echo_string) - 2); 565 idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 2);
566 prev_char = Faref (current_kboard->echo_string, idx); 566 prev_char = Faref (KVAR (current_kboard, echo_string), idx);
567 567
568 idx = make_number (SCHARS (current_kboard->echo_string) - 1); 568 idx = make_number (SCHARS (KVAR (current_kboard, echo_string)) - 1);
569 last_char = Faref (current_kboard->echo_string, idx); 569 last_char = Faref (KVAR (current_kboard, echo_string), idx);
570 570
571 if (XINT (last_char) == '-' && XINT (prev_char) != ' ') 571 if (XINT (last_char) == '-' && XINT (prev_char) != ' ')
572 return; 572 return;
@@ -574,7 +574,7 @@ echo_dash (void)
574 574
575 /* Put a dash at the end of the buffer temporarily, 575 /* Put a dash at the end of the buffer temporarily,
576 but make it go away when the next character is added. */ 576 but make it go away when the next character is added. */
577 current_kboard->echo_string = concat2 (current_kboard->echo_string, 577 KVAR (current_kboard, echo_string) = concat2 (KVAR (current_kboard, echo_string),
578 build_string ("-")); 578 build_string ("-"));
579 echo_now (); 579 echo_now ();
580} 580}
@@ -617,9 +617,9 @@ echo_now (void)
617 } 617 }
618 618
619 echoing = 1; 619 echoing = 1;
620 message3_nolog (current_kboard->echo_string, 620 message3_nolog (KVAR (current_kboard, echo_string),
621 SBYTES (current_kboard->echo_string), 621 SBYTES (KVAR (current_kboard, echo_string)),
622 STRING_MULTIBYTE (current_kboard->echo_string)); 622 STRING_MULTIBYTE (KVAR (current_kboard, echo_string)));
623 echoing = 0; 623 echoing = 0;
624 624
625 /* Record in what buffer we echoed, and from which kboard. */ 625 /* Record in what buffer we echoed, and from which kboard. */
@@ -637,7 +637,7 @@ cancel_echoing (void)
637{ 637{
638 current_kboard->immediate_echo = 0; 638 current_kboard->immediate_echo = 0;
639 current_kboard->echo_after_prompt = -1; 639 current_kboard->echo_after_prompt = -1;
640 current_kboard->echo_string = Qnil; 640 KVAR (current_kboard, echo_string) = Qnil;
641 ok_to_echo_at_next_pause = NULL; 641 ok_to_echo_at_next_pause = NULL;
642 echo_kboard = NULL; 642 echo_kboard = NULL;
643 echo_message_buffer = Qnil; 643 echo_message_buffer = Qnil;
@@ -648,8 +648,8 @@ cancel_echoing (void)
648static int 648static int
649echo_length (void) 649echo_length (void)
650{ 650{
651 return (STRINGP (current_kboard->echo_string) 651 return (STRINGP (KVAR (current_kboard, echo_string))
652 ? SCHARS (current_kboard->echo_string) 652 ? SCHARS (KVAR (current_kboard, echo_string))
653 : 0); 653 : 0);
654} 654}
655 655
@@ -660,9 +660,9 @@ echo_length (void)
660static void 660static void
661echo_truncate (EMACS_INT nchars) 661echo_truncate (EMACS_INT nchars)
662{ 662{
663 if (STRINGP (current_kboard->echo_string)) 663 if (STRINGP (KVAR (current_kboard, echo_string)))
664 current_kboard->echo_string 664 KVAR (current_kboard, echo_string)
665 = Fsubstring (current_kboard->echo_string, 665 = Fsubstring (KVAR (current_kboard, echo_string),
666 make_number (0), make_number (nchars)); 666 make_number (0), make_number (nchars));
667 truncate_echo_area (nchars); 667 truncate_echo_area (nchars);
668} 668}
@@ -993,8 +993,8 @@ cmd_error (Lisp_Object data)
993 Vstandard_input = Qt; 993 Vstandard_input = Qt;
994 Vexecuting_kbd_macro = Qnil; 994 Vexecuting_kbd_macro = Qnil;
995 executing_kbd_macro = Qnil; 995 executing_kbd_macro = Qnil;
996 current_kboard->Vprefix_arg = Qnil; 996 KVAR (current_kboard, Vprefix_arg) = Qnil;
997 current_kboard->Vlast_prefix_arg = Qnil; 997 KVAR (current_kboard, Vlast_prefix_arg) = Qnil;
998 cancel_echoing (); 998 cancel_echoing ();
999 999
1000 /* Avoid unquittable loop if data contains a circular list. */ 1000 /* Avoid unquittable loop if data contains a circular list. */
@@ -1302,8 +1302,8 @@ command_loop_1 (void)
1302#endif 1302#endif
1303 int already_adjusted = 0; 1303 int already_adjusted = 0;
1304 1304
1305 current_kboard->Vprefix_arg = Qnil; 1305 KVAR (current_kboard, Vprefix_arg) = Qnil;
1306 current_kboard->Vlast_prefix_arg = Qnil; 1306 KVAR (current_kboard, Vlast_prefix_arg) = Qnil;
1307 Vdeactivate_mark = Qnil; 1307 Vdeactivate_mark = Qnil;
1308 waiting_for_input = 0; 1308 waiting_for_input = 0;
1309 cancel_echoing (); 1309 cancel_echoing ();
@@ -1331,10 +1331,10 @@ command_loop_1 (void)
1331 } 1331 }
1332 1332
1333 /* Do this after running Vpost_command_hook, for consistency. */ 1333 /* Do this after running Vpost_command_hook, for consistency. */
1334 current_kboard->Vlast_command = Vthis_command; 1334 KVAR (current_kboard, Vlast_command) = Vthis_command;
1335 current_kboard->Vreal_last_command = real_this_command; 1335 KVAR (current_kboard, Vreal_last_command) = real_this_command;
1336 if (!CONSP (last_command_event)) 1336 if (!CONSP (last_command_event))
1337 current_kboard->Vlast_repeatable_command = real_this_command; 1337 KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
1338 1338
1339 while (1) 1339 while (1)
1340 { 1340 {
@@ -1504,9 +1504,9 @@ command_loop_1 (void)
1504 keys = Fkey_description (keys, Qnil); 1504 keys = Fkey_description (keys, Qnil);
1505 bitch_at_user (); 1505 bitch_at_user ();
1506 message_with_string ("%s is undefined", keys, 0); 1506 message_with_string ("%s is undefined", keys, 0);
1507 current_kboard->defining_kbd_macro = Qnil; 1507 KVAR (current_kboard, defining_kbd_macro) = Qnil;
1508 update_mode_lines = 1; 1508 update_mode_lines = 1;
1509 current_kboard->Vprefix_arg = Qnil; 1509 KVAR (current_kboard, Vprefix_arg) = Qnil;
1510 } 1510 }
1511 else 1511 else
1512 { 1512 {
@@ -1523,7 +1523,7 @@ command_loop_1 (void)
1523 } 1523 }
1524#endif 1524#endif
1525 1525
1526 if (NILP (current_kboard->Vprefix_arg)) /* FIXME: Why? --Stef */ 1526 if (NILP (KVAR (current_kboard, Vprefix_arg))) /* FIXME: Why? --Stef */
1527 Fundo_boundary (); 1527 Fundo_boundary ();
1528 Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); 1528 Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil);
1529 1529
@@ -1537,7 +1537,7 @@ command_loop_1 (void)
1537 unbind_to (scount, Qnil); 1537 unbind_to (scount, Qnil);
1538#endif 1538#endif
1539 } 1539 }
1540 current_kboard->Vlast_prefix_arg = Vcurrent_prefix_arg; 1540 KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg;
1541 1541
1542 /* Note that the value cell will never directly contain nil 1542 /* Note that the value cell will never directly contain nil
1543 if the symbol is a local variable. */ 1543 if the symbol is a local variable. */
@@ -1565,19 +1565,19 @@ command_loop_1 (void)
1565 If the command didn't actually create a prefix arg, 1565 If the command didn't actually create a prefix arg,
1566 but is merely a frame event that is transparent to prefix args, 1566 but is merely a frame event that is transparent to prefix args,
1567 then the above doesn't apply. */ 1567 then the above doesn't apply. */
1568 if (NILP (current_kboard->Vprefix_arg) || CONSP (last_command_event)) 1568 if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event))
1569 { 1569 {
1570 current_kboard->Vlast_command = Vthis_command; 1570 KVAR (current_kboard, Vlast_command) = Vthis_command;
1571 current_kboard->Vreal_last_command = real_this_command; 1571 KVAR (current_kboard, Vreal_last_command) = real_this_command;
1572 if (!CONSP (last_command_event)) 1572 if (!CONSP (last_command_event))
1573 current_kboard->Vlast_repeatable_command = real_this_command; 1573 KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
1574 cancel_echoing (); 1574 cancel_echoing ();
1575 this_command_key_count = 0; 1575 this_command_key_count = 0;
1576 this_command_key_count_reset = 0; 1576 this_command_key_count_reset = 0;
1577 this_single_command_key_start = 0; 1577 this_single_command_key_start = 0;
1578 } 1578 }
1579 1579
1580 if (!NILP (current_buffer->mark_active) 1580 if (!NILP (BVAR (current_buffer, mark_active))
1581 && !NILP (Vrun_hooks)) 1581 && !NILP (Vrun_hooks))
1582 { 1582 {
1583 /* In Emacs 22, setting transient-mark-mode to `only' was a 1583 /* In Emacs 22, setting transient-mark-mode to `only' was a
@@ -1599,7 +1599,7 @@ command_loop_1 (void)
1599 if (!NILP (Fwindow_system (Qnil)) 1599 if (!NILP (Fwindow_system (Qnil))
1600 /* Even if mark_active is non-nil, the actual buffer 1600 /* Even if mark_active is non-nil, the actual buffer
1601 marker may not have been set yet (Bug#7044). */ 1601 marker may not have been set yet (Bug#7044). */
1602 && XMARKER (current_buffer->mark)->buffer 1602 && XMARKER (BVAR (current_buffer, mark))->buffer
1603 && (EQ (Vselect_active_regions, Qonly) 1603 && (EQ (Vselect_active_regions, Qonly)
1604 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) 1604 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
1605 : (!NILP (Vselect_active_regions) 1605 : (!NILP (Vselect_active_regions)
@@ -1607,7 +1607,7 @@ command_loop_1 (void)
1607 && !EQ (Vthis_command, Qhandle_switch_frame)) 1607 && !EQ (Vthis_command, Qhandle_switch_frame))
1608 { 1608 {
1609 EMACS_INT beg = 1609 EMACS_INT beg =
1610 XINT (Fmarker_position (current_buffer->mark)); 1610 XINT (Fmarker_position (BVAR (current_buffer, mark)));
1611 EMACS_INT end = PT; 1611 EMACS_INT end = PT;
1612 if (beg < end) 1612 if (beg < end)
1613 call2 (Qx_set_selection, QPRIMARY, 1613 call2 (Qx_set_selection, QPRIMARY,
@@ -1649,8 +1649,8 @@ command_loop_1 (void)
1649 1649
1650 /* Install chars successfully executed in kbd macro. */ 1650 /* Install chars successfully executed in kbd macro. */
1651 1651
1652 if (!NILP (current_kboard->defining_kbd_macro) 1652 if (!NILP (KVAR (current_kboard, defining_kbd_macro))
1653 && NILP (current_kboard->Vprefix_arg)) 1653 && NILP (KVAR (current_kboard, Vprefix_arg)))
1654 finalize_kbd_macro_chars (); 1654 finalize_kbd_macro_chars ();
1655#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1655#if 0 /* This shouldn't be necessary anymore. --lorentey */
1656 if (!was_locked) 1656 if (!was_locked)
@@ -2461,7 +2461,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2461 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); 2461 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame));
2462 if (kb != current_kboard) 2462 if (kb != current_kboard)
2463 { 2463 {
2464 Lisp_Object link = kb->kbd_queue; 2464 Lisp_Object link = KVAR (kb, kbd_queue);
2465 /* We shouldn't get here if we were in single-kboard mode! */ 2465 /* We shouldn't get here if we were in single-kboard mode! */
2466 if (single_kboard) 2466 if (single_kboard)
2467 abort (); 2467 abort ();
@@ -2473,7 +2473,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2473 abort (); 2473 abort ();
2474 } 2474 }
2475 if (!CONSP (link)) 2475 if (!CONSP (link))
2476 kb->kbd_queue = Fcons (c, Qnil); 2476 KVAR (kb, kbd_queue) = Fcons (c, Qnil);
2477 else 2477 else
2478 XSETCDR (link, Fcons (c, Qnil)); 2478 XSETCDR (link, Fcons (c, Qnil));
2479 kb->kbd_queue_has_data = 1; 2479 kb->kbd_queue_has_data = 1;
@@ -2645,12 +2645,12 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2645 { 2645 {
2646 if (current_kboard->kbd_queue_has_data) 2646 if (current_kboard->kbd_queue_has_data)
2647 { 2647 {
2648 if (!CONSP (current_kboard->kbd_queue)) 2648 if (!CONSP (KVAR (current_kboard, kbd_queue)))
2649 abort (); 2649 abort ();
2650 c = XCAR (current_kboard->kbd_queue); 2650 c = XCAR (KVAR (current_kboard, kbd_queue));
2651 current_kboard->kbd_queue 2651 KVAR (current_kboard, kbd_queue)
2652 = XCDR (current_kboard->kbd_queue); 2652 = XCDR (KVAR (current_kboard, kbd_queue));
2653 if (NILP (current_kboard->kbd_queue)) 2653 if (NILP (KVAR (current_kboard, kbd_queue)))
2654 current_kboard->kbd_queue_has_data = 0; 2654 current_kboard->kbd_queue_has_data = 0;
2655 input_pending = readable_events (0); 2655 input_pending = readable_events (0);
2656 if (EVENT_HAS_PARAMETERS (c) 2656 if (EVENT_HAS_PARAMETERS (c)
@@ -2712,7 +2712,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2712 2712
2713 if (! NILP (c) && (kb != current_kboard)) 2713 if (! NILP (c) && (kb != current_kboard))
2714 { 2714 {
2715 Lisp_Object link = kb->kbd_queue; 2715 Lisp_Object link = KVAR (kb, kbd_queue);
2716 if (CONSP (link)) 2716 if (CONSP (link))
2717 { 2717 {
2718 while (CONSP (XCDR (link))) 2718 while (CONSP (XCDR (link)))
@@ -2721,7 +2721,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2721 abort (); 2721 abort ();
2722 } 2722 }
2723 if (!CONSP (link)) 2723 if (!CONSP (link))
2724 kb->kbd_queue = Fcons (c, Qnil); 2724 KVAR (kb, kbd_queue) = Fcons (c, Qnil);
2725 else 2725 else
2726 XSETCDR (link, Fcons (c, Qnil)); 2726 XSETCDR (link, Fcons (c, Qnil));
2727 kb->kbd_queue_has_data = 1; 2727 kb->kbd_queue_has_data = 1;
@@ -2829,15 +2829,15 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2829 if (XINT (c) == -1) 2829 if (XINT (c) == -1)
2830 goto exit; 2830 goto exit;
2831 2831
2832 if ((STRINGP (current_kboard->Vkeyboard_translate_table) 2832 if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table))
2833 && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) 2833 && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c))
2834 || (VECTORP (current_kboard->Vkeyboard_translate_table) 2834 || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table))
2835 && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) 2835 && XVECTOR (KVAR (current_kboard, Vkeyboard_translate_table))->size > (unsigned) XFASTINT (c))
2836 || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table) 2836 || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table))
2837 && CHARACTERP (c))) 2837 && CHARACTERP (c)))
2838 { 2838 {
2839 Lisp_Object d; 2839 Lisp_Object d;
2840 d = Faref (current_kboard->Vkeyboard_translate_table, c); 2840 d = Faref (KVAR (current_kboard, Vkeyboard_translate_table), c);
2841 /* nil in keyboard-translate-table means no translation. */ 2841 /* nil in keyboard-translate-table means no translation. */
2842 if (!NILP (d)) 2842 if (!NILP (d))
2843 c = d; 2843 c = d;
@@ -2918,7 +2918,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2918 /* Save the echo status. */ 2918 /* Save the echo status. */
2919 int saved_immediate_echo = current_kboard->immediate_echo; 2919 int saved_immediate_echo = current_kboard->immediate_echo;
2920 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; 2920 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause;
2921 Lisp_Object saved_echo_string = current_kboard->echo_string; 2921 Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string);
2922 int saved_echo_after_prompt = current_kboard->echo_after_prompt; 2922 int saved_echo_after_prompt = current_kboard->echo_after_prompt;
2923 2923
2924#if 0 2924#if 0
@@ -2973,7 +2973,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2973 2973
2974 cancel_echoing (); 2974 cancel_echoing ();
2975 ok_to_echo_at_next_pause = saved_ok_to_echo; 2975 ok_to_echo_at_next_pause = saved_ok_to_echo;
2976 current_kboard->echo_string = saved_echo_string; 2976 KVAR (current_kboard, echo_string) = saved_echo_string;
2977 current_kboard->echo_after_prompt = saved_echo_after_prompt; 2977 current_kboard->echo_after_prompt = saved_echo_after_prompt;
2978 if (saved_immediate_echo) 2978 if (saved_immediate_echo)
2979 echo_now (); 2979 echo_now ();
@@ -3459,7 +3459,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3459 3459
3460 if (single_kboard && kb != current_kboard) 3460 if (single_kboard && kb != current_kboard)
3461 { 3461 {
3462 kb->kbd_queue 3462 KVAR (kb, kbd_queue)
3463 = Fcons (make_lispy_switch_frame (event->frame_or_window), 3463 = Fcons (make_lispy_switch_frame (event->frame_or_window),
3464 Fcons (make_number (c), Qnil)); 3464 Fcons (make_number (c), Qnil));
3465 kb->kbd_queue_has_data = 1; 3465 kb->kbd_queue_has_data = 1;
@@ -5322,13 +5322,13 @@ make_lispy_event (struct input_event *event)
5322 { 5322 {
5323 /* We need to use an alist rather than a vector as the cache 5323 /* We need to use an alist rather than a vector as the cache
5324 since we can't make a vector long enuf. */ 5324 since we can't make a vector long enuf. */
5325 if (NILP (current_kboard->system_key_syms)) 5325 if (NILP (KVAR (current_kboard, system_key_syms)))
5326 current_kboard->system_key_syms = Fcons (Qnil, Qnil); 5326 KVAR (current_kboard, system_key_syms) = Fcons (Qnil, Qnil);
5327 return modify_event_symbol (event->code, 5327 return modify_event_symbol (event->code,
5328 event->modifiers, 5328 event->modifiers,
5329 Qfunction_key, 5329 Qfunction_key,
5330 current_kboard->Vsystem_key_alist, 5330 KVAR (current_kboard, Vsystem_key_alist),
5331 0, &current_kboard->system_key_syms, 5331 0, &KVAR (current_kboard, system_key_syms),
5332 (unsigned) -1); 5332 (unsigned) -1);
5333 } 5333 }
5334 5334
@@ -7360,8 +7360,8 @@ menu_bar_items (Lisp_Object old)
7360 /* Yes, use them (if non-nil) as well as the global map. */ 7360 /* Yes, use them (if non-nil) as well as the global map. */
7361 maps = (Lisp_Object *) alloca (3 * sizeof (maps[0])); 7361 maps = (Lisp_Object *) alloca (3 * sizeof (maps[0]));
7362 nmaps = 0; 7362 nmaps = 0;
7363 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 7363 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
7364 maps[nmaps++] = current_kboard->Voverriding_terminal_local_map; 7364 maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
7365 if (!NILP (Voverriding_local_map)) 7365 if (!NILP (Voverriding_local_map))
7366 maps[nmaps++] = Voverriding_local_map; 7366 maps[nmaps++] = Voverriding_local_map;
7367 } 7367 }
@@ -7903,8 +7903,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
7903 /* Yes, use them (if non-nil) as well as the global map. */ 7903 /* Yes, use them (if non-nil) as well as the global map. */
7904 maps = (Lisp_Object *) alloca (3 * sizeof (maps[0])); 7904 maps = (Lisp_Object *) alloca (3 * sizeof (maps[0]));
7905 nmaps = 0; 7905 nmaps = 0;
7906 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 7906 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
7907 maps[nmaps++] = current_kboard->Voverriding_terminal_local_map; 7907 maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
7908 if (!NILP (Voverriding_local_map)) 7908 if (!NILP (Voverriding_local_map))
7909 maps[nmaps++] = Voverriding_local_map; 7909 maps[nmaps++] = Voverriding_local_map;
7910 } 7910 }
@@ -8614,18 +8614,18 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
8614 8614
8615 /* Prompt with that and read response. */ 8615 /* Prompt with that and read response. */
8616 message2_nolog (menu, strlen (menu), 8616 message2_nolog (menu, strlen (menu),
8617 ! NILP (current_buffer->enable_multibyte_characters)); 8617 ! NILP (BVAR (current_buffer, enable_multibyte_characters)));
8618 8618
8619 /* Make believe its not a keyboard macro in case the help char 8619 /* Make believe its not a keyboard macro in case the help char
8620 is pressed. Help characters are not recorded because menu prompting 8620 is pressed. Help characters are not recorded because menu prompting
8621 is not used on replay. 8621 is not used on replay.
8622 */ 8622 */
8623 orig_defn_macro = current_kboard->defining_kbd_macro; 8623 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro);
8624 current_kboard->defining_kbd_macro = Qnil; 8624 KVAR (current_kboard, defining_kbd_macro) = Qnil;
8625 do 8625 do
8626 obj = read_char (commandflag, 0, 0, Qt, 0, NULL); 8626 obj = read_char (commandflag, 0, 0, Qt, 0, NULL);
8627 while (BUFFERP (obj)); 8627 while (BUFFERP (obj));
8628 current_kboard->defining_kbd_macro = orig_defn_macro; 8628 KVAR (current_kboard, defining_kbd_macro) = orig_defn_macro;
8629 8629
8630 if (!INTEGERP (obj)) 8630 if (!INTEGERP (obj))
8631 return obj; 8631 return obj;
@@ -8638,7 +8638,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
8638 && (!INTEGERP (menu_prompt_more_char) 8638 && (!INTEGERP (menu_prompt_more_char)
8639 || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char)))))) 8639 || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char))))))
8640 { 8640 {
8641 if (!NILP (current_kboard->defining_kbd_macro)) 8641 if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
8642 store_kbd_macro_char (obj); 8642 store_kbd_macro_char (obj);
8643 return obj; 8643 return obj;
8644 } 8644 }
@@ -8980,7 +8980,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8980 /* Install the string STR as the beginning of the string of 8980 /* Install the string STR as the beginning of the string of
8981 echoing, so that it serves as a prompt for the next 8981 echoing, so that it serves as a prompt for the next
8982 character. */ 8982 character. */
8983 current_kboard->echo_string = prompt; 8983 KVAR (current_kboard, echo_string) = prompt;
8984 current_kboard->echo_after_prompt = SCHARS (prompt); 8984 current_kboard->echo_after_prompt = SCHARS (prompt);
8985 echo_now (); 8985 echo_now ();
8986 } 8986 }
@@ -9018,8 +9018,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9018 happens if we switch keyboards between rescans. */ 9018 happens if we switch keyboards between rescans. */
9019 replay_entire_sequence: 9019 replay_entire_sequence:
9020 9020
9021 indec.map = indec.parent = current_kboard->Vinput_decode_map; 9021 indec.map = indec.parent = KVAR (current_kboard, Vinput_decode_map);
9022 fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map; 9022 fkey.map = fkey.parent = KVAR (current_kboard, Vlocal_function_key_map);
9023 keytran.map = keytran.parent = Vkey_translation_map; 9023 keytran.map = keytran.parent = Vkey_translation_map;
9024 indec.start = indec.end = 0; 9024 indec.start = indec.end = 0;
9025 fkey.start = fkey.end = 0; 9025 fkey.start = fkey.end = 0;
@@ -9040,7 +9040,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9040 the initial keymaps from the current buffer. */ 9040 the initial keymaps from the current buffer. */
9041 nmaps = 0; 9041 nmaps = 0;
9042 9042
9043 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 9043 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
9044 { 9044 {
9045 if (2 > nmaps_allocated) 9045 if (2 > nmaps_allocated)
9046 { 9046 {
@@ -9048,7 +9048,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9048 defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); 9048 defs = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
9049 nmaps_allocated = 2; 9049 nmaps_allocated = 2;
9050 } 9050 }
9051 submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map; 9051 submaps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
9052 } 9052 }
9053 else if (!NILP (Voverriding_local_map)) 9053 else if (!NILP (Voverriding_local_map))
9054 { 9054 {
@@ -9224,29 +9224,29 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9224 9224
9225 if (!NILP (delayed_switch_frame)) 9225 if (!NILP (delayed_switch_frame))
9226 { 9226 {
9227 interrupted_kboard->kbd_queue 9227 KVAR (interrupted_kboard, kbd_queue)
9228 = Fcons (delayed_switch_frame, 9228 = Fcons (delayed_switch_frame,
9229 interrupted_kboard->kbd_queue); 9229 KVAR (interrupted_kboard, kbd_queue));
9230 delayed_switch_frame = Qnil; 9230 delayed_switch_frame = Qnil;
9231 } 9231 }
9232 9232
9233 while (t > 0) 9233 while (t > 0)
9234 interrupted_kboard->kbd_queue 9234 KVAR (interrupted_kboard, kbd_queue)
9235 = Fcons (keybuf[--t], interrupted_kboard->kbd_queue); 9235 = Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue));
9236 9236
9237 /* If the side queue is non-empty, ensure it begins with a 9237 /* If the side queue is non-empty, ensure it begins with a
9238 switch-frame, so we'll replay it in the right context. */ 9238 switch-frame, so we'll replay it in the right context. */
9239 if (CONSP (interrupted_kboard->kbd_queue) 9239 if (CONSP (KVAR (interrupted_kboard, kbd_queue))
9240 && (key = XCAR (interrupted_kboard->kbd_queue), 9240 && (key = XCAR (KVAR (interrupted_kboard, kbd_queue)),
9241 !(EVENT_HAS_PARAMETERS (key) 9241 !(EVENT_HAS_PARAMETERS (key)
9242 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)), 9242 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)),
9243 Qswitch_frame)))) 9243 Qswitch_frame))))
9244 { 9244 {
9245 Lisp_Object frame; 9245 Lisp_Object frame;
9246 XSETFRAME (frame, interrupted_frame); 9246 XSETFRAME (frame, interrupted_frame);
9247 interrupted_kboard->kbd_queue 9247 KVAR (interrupted_kboard, kbd_queue)
9248 = Fcons (make_lispy_switch_frame (frame), 9248 = Fcons (make_lispy_switch_frame (frame),
9249 interrupted_kboard->kbd_queue); 9249 KVAR (interrupted_kboard, kbd_queue));
9250 } 9250 }
9251 mock_input = 0; 9251 mock_input = 0;
9252 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); 9252 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -9876,7 +9876,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9876 /* Treat uppercase keys as shifted. */ 9876 /* Treat uppercase keys as shifted. */
9877 || (INTEGERP (key) 9877 || (INTEGERP (key)
9878 && (KEY_TO_CHAR (key) 9878 && (KEY_TO_CHAR (key)
9879 < XCHAR_TABLE (current_buffer->downcase_table)->size) 9879 < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size)
9880 && UPPERCASEP (KEY_TO_CHAR (key)))) 9880 && UPPERCASEP (KEY_TO_CHAR (key))))
9881 { 9881 {
9882 Lisp_Object new_key 9882 Lisp_Object new_key
@@ -10121,9 +10121,9 @@ a special event, so ignore the prefix argument and don't clear it. */)
10121 10121
10122 if (NILP (special)) 10122 if (NILP (special))
10123 { 10123 {
10124 prefixarg = current_kboard->Vprefix_arg; 10124 prefixarg = KVAR (current_kboard, Vprefix_arg);
10125 Vcurrent_prefix_arg = prefixarg; 10125 Vcurrent_prefix_arg = prefixarg;
10126 current_kboard->Vprefix_arg = Qnil; 10126 KVAR (current_kboard, Vprefix_arg) = Qnil;
10127 } 10127 }
10128 else 10128 else
10129 prefixarg = Qnil; 10129 prefixarg = Qnil;
@@ -10257,7 +10257,7 @@ give to the command you invoke, if it asks for an argument. */)
10257 UNGCPRO; 10257 UNGCPRO;
10258 10258
10259 function = Fintern (function, Qnil); 10259 function = Fintern (function, Qnil);
10260 current_kboard->Vprefix_arg = prefixarg; 10260 KVAR (current_kboard, Vprefix_arg) = prefixarg;
10261 Vthis_command = function; 10261 Vthis_command = function;
10262 real_this_command = function; 10262 real_this_command = function;
10263 10263
@@ -10580,7 +10580,7 @@ DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0,
10580Also end any kbd macro being defined. */) 10580Also end any kbd macro being defined. */)
10581 (void) 10581 (void)
10582{ 10582{
10583 if (!NILP (current_kboard->defining_kbd_macro)) 10583 if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
10584 { 10584 {
10585 /* Discard the last command from the macro. */ 10585 /* Discard the last command from the macro. */
10586 Fcancel_kbd_macro_events (); 10586 Fcancel_kbd_macro_events ();
@@ -11230,30 +11230,30 @@ The `posn-' functions access elements of such lists. */)
11230void 11230void
11231init_kboard (KBOARD *kb) 11231init_kboard (KBOARD *kb)
11232{ 11232{
11233 kb->Voverriding_terminal_local_map = Qnil; 11233 KVAR (kb, Voverriding_terminal_local_map) = Qnil;
11234 kb->Vlast_command = Qnil; 11234 KVAR (kb, Vlast_command) = Qnil;
11235 kb->Vreal_last_command = Qnil; 11235 KVAR (kb, Vreal_last_command) = Qnil;
11236 kb->Vkeyboard_translate_table = Qnil; 11236 KVAR (kb, Vkeyboard_translate_table) = Qnil;
11237 kb->Vlast_repeatable_command = Qnil; 11237 KVAR (kb, Vlast_repeatable_command) = Qnil;
11238 kb->Vprefix_arg = Qnil; 11238 KVAR (kb, Vprefix_arg) = Qnil;
11239 kb->Vlast_prefix_arg = Qnil; 11239 KVAR (kb, Vlast_prefix_arg) = Qnil;
11240 kb->kbd_queue = Qnil; 11240 KVAR (kb, kbd_queue) = Qnil;
11241 kb->kbd_queue_has_data = 0; 11241 kb->kbd_queue_has_data = 0;
11242 kb->immediate_echo = 0; 11242 kb->immediate_echo = 0;
11243 kb->echo_string = Qnil; 11243 KVAR (kb, echo_string) = Qnil;
11244 kb->echo_after_prompt = -1; 11244 kb->echo_after_prompt = -1;
11245 kb->kbd_macro_buffer = 0; 11245 kb->kbd_macro_buffer = 0;
11246 kb->kbd_macro_bufsize = 0; 11246 kb->kbd_macro_bufsize = 0;
11247 kb->defining_kbd_macro = Qnil; 11247 KVAR (kb, defining_kbd_macro) = Qnil;
11248 kb->Vlast_kbd_macro = Qnil; 11248 KVAR (kb, Vlast_kbd_macro) = Qnil;
11249 kb->reference_count = 0; 11249 kb->reference_count = 0;
11250 kb->Vsystem_key_alist = Qnil; 11250 KVAR (kb, Vsystem_key_alist) = Qnil;
11251 kb->system_key_syms = Qnil; 11251 KVAR (kb, system_key_syms) = Qnil;
11252 kb->Vwindow_system = Qt; /* Unset. */ 11252 KVAR (kb, Vwindow_system) = Qt; /* Unset. */
11253 kb->Vinput_decode_map = Fmake_sparse_keymap (Qnil); 11253 KVAR (kb, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
11254 kb->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil); 11254 KVAR (kb, Vlocal_function_key_map) = Fmake_sparse_keymap (Qnil);
11255 Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map); 11255 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
11256 kb->Vdefault_minibuffer_frame = Qnil; 11256 KVAR (kb, Vdefault_minibuffer_frame) = Qnil;
11257} 11257}
11258 11258
11259/* 11259/*
@@ -11329,7 +11329,7 @@ init_keyboard (void)
11329 init_kboard (current_kboard); 11329 init_kboard (current_kboard);
11330 /* A value of nil for Vwindow_system normally means a tty, but we also use 11330 /* A value of nil for Vwindow_system normally means a tty, but we also use
11331 it for the initial terminal since there is no window system there. */ 11331 it for the initial terminal since there is no window system there. */
11332 current_kboard->Vwindow_system = Qnil; 11332 KVAR (current_kboard, Vwindow_system) = Qnil;
11333 11333
11334 if (!noninteractive) 11334 if (!noninteractive)
11335 { 11335 {
@@ -12272,23 +12272,23 @@ mark_kboards (void)
12272 if (kb->kbd_macro_buffer) 12272 if (kb->kbd_macro_buffer)
12273 for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++) 12273 for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++)
12274 mark_object (*p); 12274 mark_object (*p);
12275 mark_object (kb->Voverriding_terminal_local_map); 12275 mark_object (KVAR (kb, Voverriding_terminal_local_map));
12276 mark_object (kb->Vlast_command); 12276 mark_object (KVAR (kb, Vlast_command));
12277 mark_object (kb->Vreal_last_command); 12277 mark_object (KVAR (kb, Vreal_last_command));
12278 mark_object (kb->Vkeyboard_translate_table); 12278 mark_object (KVAR (kb, Vkeyboard_translate_table));
12279 mark_object (kb->Vlast_repeatable_command); 12279 mark_object (KVAR (kb, Vlast_repeatable_command));
12280 mark_object (kb->Vprefix_arg); 12280 mark_object (KVAR (kb, Vprefix_arg));
12281 mark_object (kb->Vlast_prefix_arg); 12281 mark_object (KVAR (kb, Vlast_prefix_arg));
12282 mark_object (kb->kbd_queue); 12282 mark_object (KVAR (kb, kbd_queue));
12283 mark_object (kb->defining_kbd_macro); 12283 mark_object (KVAR (kb, defining_kbd_macro));
12284 mark_object (kb->Vlast_kbd_macro); 12284 mark_object (KVAR (kb, Vlast_kbd_macro));
12285 mark_object (kb->Vsystem_key_alist); 12285 mark_object (KVAR (kb, Vsystem_key_alist));
12286 mark_object (kb->system_key_syms); 12286 mark_object (KVAR (kb, system_key_syms));
12287 mark_object (kb->Vwindow_system); 12287 mark_object (KVAR (kb, Vwindow_system));
12288 mark_object (kb->Vinput_decode_map); 12288 mark_object (KVAR (kb, Vinput_decode_map));
12289 mark_object (kb->Vlocal_function_key_map); 12289 mark_object (KVAR (kb, Vlocal_function_key_map));
12290 mark_object (kb->Vdefault_minibuffer_frame); 12290 mark_object (KVAR (kb, Vdefault_minibuffer_frame));
12291 mark_object (kb->echo_string); 12291 mark_object (KVAR (kb, echo_string));
12292 } 12292 }
12293 { 12293 {
12294 struct input_event *event; 12294 struct input_event *event;
diff --git a/src/keyboard.h b/src/keyboard.h
index 166b3c0e9d4..10bf16d5c5c 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -19,7 +19,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#include "systime.h" /* for EMACS_TIME */ 19#include "systime.h" /* for EMACS_TIME */
20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ 20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
21 21
22/* Length of echobuf field in each KBOARD. */ 22/* Lisp fields in struct keyboard are hidden from most code and accessed
23 via the KVAR macro, below. Only select pieces of code, like the GC,
24 are allowed to use KBOARD_INTERNAL_FIELD. */
25#define KBOARD_INTERNAL_FIELD(field) field ## _
26
27/* Most code should use this macro to access Lisp fields in struct
28 kboard. */
29#define KVAR(kboard, field) ((kboard)->KBOARD_INTERNAL_FIELD (field))
23 30
24/* Each KBOARD represents one logical input stream from which Emacs 31/* Each KBOARD represents one logical input stream from which Emacs
25 gets input. If we are using ordinary terminals, it has one KBOARD 32 gets input. If we are using ordinary terminals, it has one KBOARD
@@ -72,32 +79,32 @@ struct kboard
72 can effectively wait for input in the any-kboard state, and hence 79 can effectively wait for input in the any-kboard state, and hence
73 avoid blocking out the other KBOARDs. See universal-argument in 80 avoid blocking out the other KBOARDs. See universal-argument in
74 lisp/simple.el for an example. */ 81 lisp/simple.el for an example. */
75 Lisp_Object Voverriding_terminal_local_map; 82 Lisp_Object KBOARD_INTERNAL_FIELD (Voverriding_terminal_local_map);
76 83
77 /* Last command executed by the editor command loop, not counting 84 /* Last command executed by the editor command loop, not counting
78 commands that set the prefix argument. */ 85 commands that set the prefix argument. */
79 Lisp_Object Vlast_command; 86 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_command);
80 87
81 /* Normally same as last-command, but never modified by other commands. */ 88 /* Normally same as last-command, but never modified by other commands. */
82 Lisp_Object Vreal_last_command; 89 Lisp_Object KBOARD_INTERNAL_FIELD (Vreal_last_command);
83 90
84 /* User-supplied table to translate input characters through. */ 91 /* User-supplied table to translate input characters through. */
85 Lisp_Object Vkeyboard_translate_table; 92 Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table);
86 93
87 /* Last command that may be repeated by `repeat'. */ 94 /* Last command that may be repeated by `repeat'. */
88 Lisp_Object Vlast_repeatable_command; 95 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command);
89 96
90 /* The prefix argument for the next command, in raw form. */ 97 /* The prefix argument for the next command, in raw form. */
91 Lisp_Object Vprefix_arg; 98 Lisp_Object KBOARD_INTERNAL_FIELD (Vprefix_arg);
92 99
93 /* Saved prefix argument for the last command, in raw form. */ 100 /* Saved prefix argument for the last command, in raw form. */
94 Lisp_Object Vlast_prefix_arg; 101 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_prefix_arg);
95 102
96 /* Unread events specific to this kboard. */ 103 /* Unread events specific to this kboard. */
97 Lisp_Object kbd_queue; 104 Lisp_Object KBOARD_INTERNAL_FIELD (kbd_queue);
98 105
99 /* Non-nil while a kbd macro is being defined. */ 106 /* Non-nil while a kbd macro is being defined. */
100 Lisp_Object defining_kbd_macro; 107 Lisp_Object KBOARD_INTERNAL_FIELD (defining_kbd_macro);
101 108
102 /* The start of storage for the current keyboard macro. */ 109 /* The start of storage for the current keyboard macro. */
103 Lisp_Object *kbd_macro_buffer; 110 Lisp_Object *kbd_macro_buffer;
@@ -119,28 +126,28 @@ struct kboard
119 int kbd_macro_bufsize; 126 int kbd_macro_bufsize;
120 127
121 /* Last anonymous kbd macro defined. */ 128 /* Last anonymous kbd macro defined. */
122 Lisp_Object Vlast_kbd_macro; 129 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_kbd_macro);
123 130
124 /* Alist of system-specific X windows key symbols. */ 131 /* Alist of system-specific X windows key symbols. */
125 Lisp_Object Vsystem_key_alist; 132 Lisp_Object KBOARD_INTERNAL_FIELD (Vsystem_key_alist);
126 133
127 /* Cache for modify_event_symbol. */ 134 /* Cache for modify_event_symbol. */
128 Lisp_Object system_key_syms; 135 Lisp_Object KBOARD_INTERNAL_FIELD (system_key_syms);
129 136
130 /* The kind of display: x, w32, ... */ 137 /* The kind of display: x, w32, ... */
131 Lisp_Object Vwindow_system; 138 Lisp_Object KBOARD_INTERNAL_FIELD (Vwindow_system);
132 139
133 /* Keymap mapping keys to alternative preferred forms. 140 /* Keymap mapping keys to alternative preferred forms.
134 See the DEFVAR for more documentation. */ 141 See the DEFVAR for more documentation. */
135 Lisp_Object Vlocal_function_key_map; 142 Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map);
136 143
137 /* Keymap mapping ASCII function key sequences onto their preferred 144 /* Keymap mapping ASCII function key sequences onto their preferred
138 forms. Initialized by the terminal-specific lisp files. See the 145 forms. Initialized by the terminal-specific lisp files. See the
139 DEFVAR for more documentation. */ 146 DEFVAR for more documentation. */
140 Lisp_Object Vinput_decode_map; 147 Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map);
141 148
142 /* Minibufferless frames on this display use this frame's minibuffer. */ 149 /* Minibufferless frames on this display use this frame's minibuffer. */
143 Lisp_Object Vdefault_minibuffer_frame; 150 Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame);
144 151
145 /* Number of displays using this KBOARD. Normally 1, but can be 152 /* Number of displays using this KBOARD. Normally 1, but can be
146 larger when you have multiple screens on a single X display. */ 153 larger when you have multiple screens on a single X display. */
@@ -148,7 +155,7 @@ struct kboard
148 155
149 /* The text we're echoing in the modeline - partial key sequences, 156 /* The text we're echoing in the modeline - partial key sequences,
150 usually. This is nil when not echoing. */ 157 usually. This is nil when not echoing. */
151 Lisp_Object echo_string; 158 Lisp_Object KBOARD_INTERNAL_FIELD (echo_string);
152 159
153 /* This flag indicates that events were put into kbd_queue 160 /* This flag indicates that events were put into kbd_queue
154 while Emacs was running for some other KBOARD. 161 while Emacs was running for some other KBOARD.
diff --git a/src/keymap.c b/src/keymap.c
index 8ee4f41bd6f..0e4715e4b8b 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1565,8 +1565,8 @@ like in the respective argument of `key-binding'. */)
1565 1565
1566 if (!NILP (olp)) 1566 if (!NILP (olp))
1567 { 1567 {
1568 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 1568 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
1569 keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps); 1569 keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map), keymaps);
1570 /* The doc said that overriding-terminal-local-map should 1570 /* The doc said that overriding-terminal-local-map should
1571 override overriding-local-map. The code used them both, 1571 override overriding-local-map. The code used them both,
1572 but it seems clearer to use just one. rms, jan 2005. */ 1572 but it seems clearer to use just one. rms, jan 2005. */
@@ -1745,9 +1745,9 @@ specified buffer position instead of point are used.
1745 } 1745 }
1746 } 1746 }
1747 1747
1748 if (! NILP (current_kboard->Voverriding_terminal_local_map)) 1748 if (! NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
1749 { 1749 {
1750 value = Flookup_key (current_kboard->Voverriding_terminal_local_map, 1750 value = Flookup_key (KVAR (current_kboard, Voverriding_terminal_local_map),
1751 key, accept_default); 1751 key, accept_default);
1752 if (! NILP (value) && !INTEGERP (value)) 1752 if (! NILP (value) && !INTEGERP (value))
1753 goto done; 1753 goto done;
@@ -1883,7 +1883,7 @@ bindings; see the description of `lookup-key' for more details about this. */)
1883 (Lisp_Object keys, Lisp_Object accept_default) 1883 (Lisp_Object keys, Lisp_Object accept_default)
1884{ 1884{
1885 register Lisp_Object map; 1885 register Lisp_Object map;
1886 map = current_buffer->keymap; 1886 map = BVAR (current_buffer, keymap);
1887 if (NILP (map)) 1887 if (NILP (map))
1888 return Qnil; 1888 return Qnil;
1889 return Flookup_key (map, keys, accept_default); 1889 return Flookup_key (map, keys, accept_default);
@@ -1988,7 +1988,7 @@ If KEYMAP is nil, that means no local keymap. */)
1988 if (!NILP (keymap)) 1988 if (!NILP (keymap))
1989 keymap = get_keymap (keymap, 1, 1); 1989 keymap = get_keymap (keymap, 1, 1);
1990 1990
1991 current_buffer->keymap = keymap; 1991 BVAR (current_buffer, keymap) = keymap;
1992 1992
1993 return Qnil; 1993 return Qnil;
1994} 1994}
@@ -1998,7 +1998,7 @@ DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0,
1998Normally the local keymap is set by the major mode with `use-local-map'. */) 1998Normally the local keymap is set by the major mode with `use-local-map'. */)
1999 (void) 1999 (void)
2000{ 2000{
2001 return current_buffer->keymap; 2001 return BVAR (current_buffer, keymap);
2002} 2002}
2003 2003
2004DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, 2004DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0,
@@ -2379,7 +2379,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi
2379 *p++ = 'C'; 2379 *p++ = 'C';
2380 } 2380 }
2381 else if (c < 128 2381 else if (c < 128
2382 || (NILP (current_buffer->enable_multibyte_characters) 2382 || (NILP (BVAR (current_buffer, enable_multibyte_characters))
2383 && SINGLE_BYTE_CHAR_P (c) 2383 && SINGLE_BYTE_CHAR_P (c)
2384 && !force_multibyte)) 2384 && !force_multibyte))
2385 { 2385 {
@@ -2388,7 +2388,7 @@ push_key_description (register unsigned int c, register char *p, int force_multi
2388 else 2388 else
2389 { 2389 {
2390 /* Now we are sure that C is a valid character code. */ 2390 /* Now we are sure that C is a valid character code. */
2391 if (NILP (current_buffer->enable_multibyte_characters) 2391 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
2392 && ! force_multibyte) 2392 && ! force_multibyte)
2393 *p++ = multibyte_char_to_unibyte (c, Qnil); 2393 *p++ = multibyte_char_to_unibyte (c, Qnil);
2394 else 2394 else
@@ -2941,11 +2941,11 @@ You type Translation\n\
2941 outbuf = Fcurrent_buffer (); 2941 outbuf = Fcurrent_buffer ();
2942 2942
2943 /* Report on alternates for keys. */ 2943 /* Report on alternates for keys. */
2944 if (STRINGP (current_kboard->Vkeyboard_translate_table) && !NILP (prefix)) 2944 if (STRINGP (KVAR (current_kboard, Vkeyboard_translate_table)) && !NILP (prefix))
2945 { 2945 {
2946 int c; 2946 int c;
2947 const unsigned char *translate = SDATA (current_kboard->Vkeyboard_translate_table); 2947 const unsigned char *translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
2948 int translate_len = SCHARS (current_kboard->Vkeyboard_translate_table); 2948 int translate_len = SCHARS (KVAR (current_kboard, Vkeyboard_translate_table));
2949 2949
2950 for (c = 0; c < translate_len; c++) 2950 for (c = 0; c < translate_len; c++)
2951 if (translate[c] != c) 2951 if (translate[c] != c)
@@ -2968,7 +2968,7 @@ You type Translation\n\
2968 insert ("\n", 1); 2968 insert ("\n", 1);
2969 2969
2970 /* Insert calls signal_after_change which may GC. */ 2970 /* Insert calls signal_after_change which may GC. */
2971 translate = SDATA (current_kboard->Vkeyboard_translate_table); 2971 translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
2972 } 2972 }
2973 2973
2974 insert ("\n", 1); 2974 insert ("\n", 1);
@@ -2981,8 +2981,8 @@ You type Translation\n\
2981 2981
2982 /* Print the (major mode) local map. */ 2982 /* Print the (major mode) local map. */
2983 start1 = Qnil; 2983 start1 = Qnil;
2984 if (!NILP (current_kboard->Voverriding_terminal_local_map)) 2984 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
2985 start1 = current_kboard->Voverriding_terminal_local_map; 2985 start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
2986 else if (!NILP (Voverriding_local_map)) 2986 else if (!NILP (Voverriding_local_map))
2987 start1 = Voverriding_local_map; 2987 start1 = Voverriding_local_map;
2988 2988
@@ -3048,7 +3048,7 @@ You type Translation\n\
3048 XBUFFER (buffer), Qlocal_map); 3048 XBUFFER (buffer), Qlocal_map);
3049 if (!NILP (start1)) 3049 if (!NILP (start1))
3050 { 3050 {
3051 if (EQ (start1, XBUFFER (buffer)->keymap)) 3051 if (EQ (start1, BVAR (XBUFFER (buffer), keymap)))
3052 describe_map_tree (start1, 1, shadow, prefix, 3052 describe_map_tree (start1, 1, shadow, prefix,
3053 "\f\nMajor Mode Bindings", nomenu, 0, 0, 0); 3053 "\f\nMajor Mode Bindings", nomenu, 0, 0, 0);
3054 else 3054 else
@@ -3064,13 +3064,13 @@ You type Translation\n\
3064 "\f\nGlobal Bindings", nomenu, 0, 1, 0); 3064 "\f\nGlobal Bindings", nomenu, 0, 1, 0);
3065 3065
3066 /* Print the function-key-map translations under this prefix. */ 3066 /* Print the function-key-map translations under this prefix. */
3067 if (!NILP (current_kboard->Vlocal_function_key_map)) 3067 if (!NILP (KVAR (current_kboard, Vlocal_function_key_map)))
3068 describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, prefix, 3068 describe_map_tree (KVAR (current_kboard, Vlocal_function_key_map), 0, Qnil, prefix,
3069 "\f\nFunction key map translations", nomenu, 1, 0, 0); 3069 "\f\nFunction key map translations", nomenu, 1, 0, 0);
3070 3070
3071 /* Print the input-decode-map translations under this prefix. */ 3071 /* Print the input-decode-map translations under this prefix. */
3072 if (!NILP (current_kboard->Vinput_decode_map)) 3072 if (!NILP (KVAR (current_kboard, Vinput_decode_map)))
3073 describe_map_tree (current_kboard->Vinput_decode_map, 0, Qnil, prefix, 3073 describe_map_tree (KVAR (current_kboard, Vinput_decode_map), 0, Qnil, prefix,
3074 "\f\nInput decoding map translations", nomenu, 1, 0, 0); 3074 "\f\nInput decoding map translations", nomenu, 1, 0, 0);
3075 3075
3076 UNGCPRO; 3076 UNGCPRO;
diff --git a/src/lisp.h b/src/lisp.h
index 0e7eeebc9da..badeb4258fb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1908,7 +1908,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
1908#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \ 1908#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \
1909 do { \ 1909 do { \
1910 static struct Lisp_Objfwd o_fwd; \ 1910 static struct Lisp_Objfwd o_fwd; \
1911 defvar_lisp_nopro (&o_fwd, lname, &buffer_defaults.vname); \ 1911 defvar_lisp_nopro (&o_fwd, lname, &BVAR (&buffer_defaults, vname)); \
1912 } while (0) 1912 } while (0)
1913 1913
1914#define DEFVAR_KBOARD(lname, vname, doc) \ 1914#define DEFVAR_KBOARD(lname, vname, doc) \
@@ -1916,7 +1916,7 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
1916 static struct Lisp_Kboard_Objfwd ko_fwd; \ 1916 static struct Lisp_Kboard_Objfwd ko_fwd; \
1917 defvar_kboard (&ko_fwd, \ 1917 defvar_kboard (&ko_fwd, \
1918 lname, \ 1918 lname, \
1919 (int)((char *)(&current_kboard->vname) \ 1919 (int)((char *)(&current_kboard->vname ## _) \
1920 - (char *)current_kboard)); \ 1920 - (char *)current_kboard)); \
1921 } while (0) 1921 } while (0)
1922 1922
@@ -2073,11 +2073,11 @@ extern Lisp_Object case_temp2;
2073 2073
2074/* Current buffer's map from characters to lower-case characters. */ 2074/* Current buffer's map from characters to lower-case characters. */
2075 2075
2076#define DOWNCASE_TABLE current_buffer->downcase_table 2076#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table)
2077 2077
2078/* Current buffer's map from characters to upper-case characters. */ 2078/* Current buffer's map from characters to upper-case characters. */
2079 2079
2080#define UPCASE_TABLE current_buffer->upcase_table 2080#define UPCASE_TABLE BVAR (current_buffer, upcase_table)
2081 2081
2082/* Downcase a character, or make no change if that cannot be done. */ 2082/* Downcase a character, or make no change if that cannot be done. */
2083 2083
@@ -2171,6 +2171,11 @@ struct gcpro
2171#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE 2171#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
2172#endif 2172#endif
2173 2173
2174/* Whether we do the stack marking manually. */
2175#define BYTE_MARK_STACK !(GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \
2176 || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
2177
2178
2174#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS 2179#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
2175 2180
2176/* Do something silly with gcproN vars just so gcc shuts up. */ 2181/* Do something silly with gcproN vars just so gcc shuts up. */
@@ -3282,7 +3287,9 @@ extern Lisp_Object Qbytecode;
3282EXFUN (Fbyte_code, MANY); 3287EXFUN (Fbyte_code, MANY);
3283extern void syms_of_bytecode (void); 3288extern void syms_of_bytecode (void);
3284extern struct byte_stack *byte_stack_list; 3289extern struct byte_stack *byte_stack_list;
3290#ifdef BYTE_MARK_STACK
3285extern void mark_byte_stack (void); 3291extern void mark_byte_stack (void);
3292#endif
3286extern void unmark_byte_stack (void); 3293extern void unmark_byte_stack (void);
3287extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object, 3294extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
3288 Lisp_Object, int, Lisp_Object *); 3295 Lisp_Object, int, Lisp_Object *);
@@ -3438,11 +3445,6 @@ EXFUN (Fclear_face_cache, 1);
3438EXFUN (Fx_load_color_file, 1); 3445EXFUN (Fx_load_color_file, 1);
3439extern void syms_of_xfaces (void); 3446extern void syms_of_xfaces (void);
3440 3447
3441#ifndef HAVE_GETLOADAVG
3442/* Defined in getloadavg.c */
3443extern int getloadavg (double *, int);
3444#endif
3445
3446#ifdef HAVE_X_WINDOWS 3448#ifdef HAVE_X_WINDOWS
3447/* Defined in xfns.c */ 3449/* Defined in xfns.c */
3448extern void syms_of_xfns (void); 3450extern void syms_of_xfns (void);
diff --git a/src/lread.c b/src/lread.c
index 02b2fa39075..b30a75b67c3 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -212,7 +212,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
212 if (pt_byte >= BUF_ZV_BYTE (inbuffer)) 212 if (pt_byte >= BUF_ZV_BYTE (inbuffer))
213 return -1; 213 return -1;
214 214
215 if (! NILP (inbuffer->enable_multibyte_characters)) 215 if (! NILP (BVAR (inbuffer, enable_multibyte_characters)))
216 { 216 {
217 /* Fetch the character code from the buffer. */ 217 /* Fetch the character code from the buffer. */
218 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte); 218 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte);
@@ -241,7 +241,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
241 if (bytepos >= BUF_ZV_BYTE (inbuffer)) 241 if (bytepos >= BUF_ZV_BYTE (inbuffer))
242 return -1; 242 return -1;
243 243
244 if (! NILP (inbuffer->enable_multibyte_characters)) 244 if (! NILP (BVAR (inbuffer, enable_multibyte_characters)))
245 { 245 {
246 /* Fetch the character code from the buffer. */ 246 /* Fetch the character code from the buffer. */
247 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos); 247 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos);
@@ -373,7 +373,7 @@ unreadchar (Lisp_Object readcharfun, int c)
373 EMACS_INT bytepos = BUF_PT_BYTE (b); 373 EMACS_INT bytepos = BUF_PT_BYTE (b);
374 374
375 BUF_PT (b)--; 375 BUF_PT (b)--;
376 if (! NILP (b->enable_multibyte_characters)) 376 if (! NILP (BVAR (b, enable_multibyte_characters)))
377 BUF_DEC_POS (b, bytepos); 377 BUF_DEC_POS (b, bytepos);
378 else 378 else
379 bytepos--; 379 bytepos--;
@@ -386,7 +386,7 @@ unreadchar (Lisp_Object readcharfun, int c)
386 EMACS_INT bytepos = XMARKER (readcharfun)->bytepos; 386 EMACS_INT bytepos = XMARKER (readcharfun)->bytepos;
387 387
388 XMARKER (readcharfun)->charpos--; 388 XMARKER (readcharfun)->charpos--;
389 if (! NILP (b->enable_multibyte_characters)) 389 if (! NILP (BVAR (b, enable_multibyte_characters)))
390 BUF_DEC_POS (b, bytepos); 390 BUF_DEC_POS (b, bytepos);
391 else 391 else
392 bytepos--; 392 bytepos--;
@@ -1375,7 +1375,9 @@ If SUFFIXES is non-nil, it should be a list of suffixes to append to
1375file name when searching. 1375file name when searching.
1376If non-nil, PREDICATE is used instead of `file-readable-p'. 1376If non-nil, PREDICATE is used instead of `file-readable-p'.
1377PREDICATE can also be an integer to pass to the access(2) function, 1377PREDICATE can also be an integer to pass to the access(2) function,
1378in which case file-name-handlers are ignored. */) 1378in which case file-name-handlers are ignored.
1379This function will normally skip directories, so if you want it to find
1380directories, make sure the PREDICATE function returns `dir-ok' for them. */)
1379 (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) 1381 (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate)
1380{ 1382{
1381 Lisp_Object file; 1383 Lisp_Object file;
@@ -1385,6 +1387,7 @@ in which case file-name-handlers are ignored. */)
1385 return file; 1387 return file;
1386} 1388}
1387 1389
1390static Lisp_Object Qdir_ok;
1388 1391
1389/* Search for a file whose name is STR, looking in directories 1392/* Search for a file whose name is STR, looking in directories
1390 in the Lisp list PATH, and trying suffixes from SUFFIX. 1393 in the Lisp list PATH, and trying suffixes from SUFFIX.
@@ -1447,7 +1450,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1447 /* Of course, this could conceivably lose if luser sets 1450 /* Of course, this could conceivably lose if luser sets
1448 default-directory to be something non-absolute... */ 1451 default-directory to be something non-absolute... */
1449 { 1452 {
1450 filename = Fexpand_file_name (filename, current_buffer->directory); 1453 filename = Fexpand_file_name (filename, BVAR (current_buffer, directory));
1451 if (!complete_filename_p (filename)) 1454 if (!complete_filename_p (filename))
1452 /* Give up on this path element! */ 1455 /* Give up on this path element! */
1453 continue; 1456 continue;
@@ -1502,9 +1505,12 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1502 if (NILP (predicate)) 1505 if (NILP (predicate))
1503 exists = !NILP (Ffile_readable_p (string)); 1506 exists = !NILP (Ffile_readable_p (string));
1504 else 1507 else
1505 exists = !NILP (call1 (predicate, string)); 1508 {
1506 if (exists && !NILP (Ffile_directory_p (string))) 1509 Lisp_Object tmp = call1 (predicate, string);
1507 exists = 0; 1510 exists = !NILP (tmp)
1511 && (EQ (tmp, Qdir_ok)
1512 || !NILP (Ffile_directory_p (string)));
1513 }
1508 1514
1509 if (exists) 1515 if (exists)
1510 { 1516 {
@@ -1714,7 +1720,7 @@ readevalloop (Lisp_Object readcharfun,
1714 { 1720 {
1715 int count1 = SPECPDL_INDEX (); 1721 int count1 = SPECPDL_INDEX ();
1716 1722
1717 if (b != 0 && NILP (b->name)) 1723 if (b != 0 && NILP (BVAR (b, name)))
1718 error ("Reading from killed buffer"); 1724 error ("Reading from killed buffer");
1719 1725
1720 if (!NILP (start)) 1726 if (!NILP (start))
@@ -1854,7 +1860,7 @@ This function preserves the position of point. */)
1854 tem = printflag; 1860 tem = printflag;
1855 1861
1856 if (NILP (filename)) 1862 if (NILP (filename))
1857 filename = XBUFFER (buf)->filename; 1863 filename = BVAR (XBUFFER (buf), filename);
1858 1864
1859 specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list)); 1865 specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list));
1860 specbind (Qstandard_output, tem); 1866 specbind (Qstandard_output, tem);
@@ -1897,7 +1903,7 @@ This function does not move point. */)
1897 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); 1903 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list));
1898 1904
1899 /* readevalloop calls functions which check the type of start and end. */ 1905 /* readevalloop calls functions which check the type of start and end. */
1900 readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, 1906 readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename),
1901 !NILP (printflag), Qnil, read_function, 1907 !NILP (printflag), Qnil, read_function,
1902 start, end); 1908 start, end);
1903 1909
@@ -4542,6 +4548,9 @@ This variable is automatically set from the file variables of an interpreted
4542 Qfile_truename = intern_c_string ("file-truename"); 4548 Qfile_truename = intern_c_string ("file-truename");
4543 staticpro (&Qfile_truename) ; 4549 staticpro (&Qfile_truename) ;
4544 4550
4551 Qdir_ok = intern_c_string ("dir-ok");
4552 staticpro (&Qdir_ok);
4553
4545 Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation"); 4554 Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation");
4546 staticpro (&Qdo_after_load_evaluation) ; 4555 staticpro (&Qdo_after_load_evaluation) ;
4547 4556
diff --git a/src/m/alpha.h b/src/m/alpha.h
index 9ae089bfc5b..3a27cfd65d9 100644
--- a/src/m/alpha.h
+++ b/src/m/alpha.h
@@ -29,12 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29/* __alpha defined automatically */ 29/* __alpha defined automatically */
30 30
31 31
32/* Data type of load average, as read out of kmem. */
33#define LOAD_AVE_TYPE long
34
35/* Convert that into an integer that is 100 for a load average of 1.0 */
36#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
37
38#ifdef __ELF__ 32#ifdef __ELF__
39 33
40#if !defined(GNU_LINUX) && !defined(__NetBSD__) 34#if !defined(GNU_LINUX) && !defined(__NetBSD__)
@@ -57,4 +51,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
57 Define DBL_MIN_REPLACEMENT to be the next value larger than DBL_MIN: 51 Define DBL_MIN_REPLACEMENT to be the next value larger than DBL_MIN:
58 this avoids the assembler bug. */ 52 this avoids the assembler bug. */
59#define DBL_MIN_REPLACEMENT 2.2250738585072019e-308 53#define DBL_MIN_REPLACEMENT 2.2250738585072019e-308
60
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index 2ae5d07390f..441f41b4444 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -30,12 +30,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#define EMACS_INT long 30#define EMACS_INT long
31#define EMACS_UINT unsigned long 31#define EMACS_UINT unsigned long
32 32
33/* Data type of load average, as read out of kmem. */
34#define LOAD_AVE_TYPE long
35
36/* Convert that into an integer that is 100 for a load average of 1.0 */
37#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
38
39/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ 33/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
40#undef DATA_SEG_BITS 34#undef DATA_SEG_BITS
41
diff --git a/src/m/ia64.h b/src/m/ia64.h
index 48ba3005cd6..101d56e648b 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -30,12 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#define EMACS_INT long 30#define EMACS_INT long
31#define EMACS_UINT unsigned long 31#define EMACS_UINT unsigned long
32 32
33/* Data type of load average, as read out of kmem. */
34#define LOAD_AVE_TYPE long
35
36/* Convert that into an integer that is 100 for a load average of 1.0 */
37#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
38
39#ifdef REL_ALLOC 33#ifdef REL_ALLOC
40#ifndef _MALLOC_INTERNAL 34#ifndef _MALLOC_INTERNAL
41/* "char *" because ralloc.c defines it that way. gmalloc.c thinks it 35/* "char *" because ralloc.c defines it that way. gmalloc.c thinks it
@@ -45,4 +39,3 @@ extern char *r_alloc (), *r_re_alloc ();
45extern void r_alloc_free (); 39extern void r_alloc_free ();
46#endif /* not _MALLOC_INTERNAL */ 40#endif /* not _MALLOC_INTERNAL */
47#endif /* REL_ALLOC */ 41#endif /* REL_ALLOC */
48
diff --git a/src/m/ibms390.h b/src/m/ibms390.h
index f2aef1ba513..c309035dc5c 100644
--- a/src/m/ibms390.h
+++ b/src/m/ibms390.h
@@ -18,12 +18,6 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 20
21/* Data type of load average, as read out of kmem. */
22#define LOAD_AVE_TYPE long
23
24/* Convert that into an integer that is 100 for a load average of 1.0 */
25#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
26
27/* Define VIRT_ADDR_VARIES if the virtual addresses of 21/* Define VIRT_ADDR_VARIES if the virtual addresses of
28 pure and impure space as loaded can vary, and even their 22 pure and impure space as loaded can vary, and even their
29 relative order cannot be relied on. 23 relative order cannot be relied on.
@@ -31,4 +25,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31 Otherwise Emacs assumes that text space precedes data space, 25 Otherwise Emacs assumes that text space precedes data space,
32 numerically. */ 26 numerically. */
33#define VIRT_ADDR_VARIES 27#define VIRT_ADDR_VARIES
34
diff --git a/src/m/macppc.h b/src/m/macppc.h
index 5d78e39bdba..aef781e2c39 100644
--- a/src/m/macppc.h
+++ b/src/m/macppc.h
@@ -17,15 +17,8 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20/* Data type of load average, as read out of kmem. */
21#define LOAD_AVE_TYPE long
22
23/* Convert that into an integer that is 100 for a load average of 1.0 */
24#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
25
26#ifdef _ARCH_PPC64 20#ifdef _ARCH_PPC64
27#ifndef _LP64 21#ifndef _LP64
28#define _LP64 22#define _LP64
29#endif 23#endif
30#endif 24#endif
31
diff --git a/src/m/sparc.h b/src/m/sparc.h
index 50e56f0f3dc..99668043f30 100644
--- a/src/m/sparc.h
+++ b/src/m/sparc.h
@@ -19,12 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20/* __sparc__ is defined by the compiler by default. */ 20/* __sparc__ is defined by the compiler by default. */
21 21
22/* Data type of load average, as read out of kmem. */
23#define LOAD_AVE_TYPE long
24
25/* Convert that into an integer that is 100 for a load average of 1.0 */
26#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
27
28#ifdef __arch64__ /* GCC, 64-bit ABI. */ 22#ifdef __arch64__ /* GCC, 64-bit ABI. */
29 23
30#define BITS_PER_LONG 64 24#define BITS_PER_LONG 64
@@ -34,4 +28,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34#endif 28#endif
35 29
36#endif /* __arch64__ */ 30#endif /* __arch64__ */
37
diff --git a/src/m/template.h b/src/m/template.h
index f06f62b6cda..54fb0da9521 100644
--- a/src/m/template.h
+++ b/src/m/template.h
@@ -21,12 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 does not define it automatically. 21 does not define it automatically.
22 Ones defined so far include m68k and many others */ 22 Ones defined so far include m68k and many others */
23 23
24/* Data type of load average, as read out of kmem. */
25#define LOAD_AVE_TYPE long
26
27/* Convert that into an integer that is 100 for a load average of 1.0 */
28#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
29
30/* Define VIRT_ADDR_VARIES if the virtual addresses of 24/* Define VIRT_ADDR_VARIES if the virtual addresses of
31 pure and impure space as loaded can vary, and even their 25 pure and impure space as loaded can vary, and even their
32 relative order cannot be relied on. 26 relative order cannot be relied on.
@@ -46,4 +40,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46 If you've just fixed a problem in an existing configuration file, 40 If you've just fixed a problem in an existing configuration file,
47 you should also check `etc/MACHINES' to make sure its descriptions 41 you should also check `etc/MACHINES' to make sure its descriptions
48 of known problems in that configuration should be updated. */ 42 of known problems in that configuration should be updated. */
49
diff --git a/src/m/vax.h b/src/m/vax.h
index 2fecf17ca84..a375600cead 100644
--- a/src/m/vax.h
+++ b/src/m/vax.h
@@ -20,14 +20,4 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21/* #define vax -- appears to be done automatically */ 21/* #define vax -- appears to be done automatically */
22 22
23/* USG systems I know of running on Vaxes do not actually
24 support the load average, so disable it for them. */
25
26/* Data type of load average, as read out of kmem. */
27#define LOAD_AVE_TYPE double
28
29/* Convert that into an integer that is 100 for a load average of 1.0 */
30#define LOAD_AVE_CVT(x) ((int) ((x) * 100.0))
31
32#define HAVE_FTIME 23#define HAVE_FTIME
33
diff --git a/src/macros.c b/src/macros.c
index 34ac08c3284..d90b31b503f 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -56,7 +56,7 @@ If optional second arg, NO-EXEC, is non-nil, do not re-execute last
56macro before appending to it. */) 56macro before appending to it. */)
57 (Lisp_Object append, Lisp_Object no_exec) 57 (Lisp_Object append, Lisp_Object no_exec)
58{ 58{
59 if (!NILP (current_kboard->defining_kbd_macro)) 59 if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
60 error ("Already defining kbd macro"); 60 error ("Already defining kbd macro");
61 61
62 if (!current_kboard->kbd_macro_buffer) 62 if (!current_kboard->kbd_macro_buffer)
@@ -85,9 +85,9 @@ macro before appending to it. */)
85 int cvt; 85 int cvt;
86 86
87 /* Check the type of last-kbd-macro in case Lisp code changed it. */ 87 /* Check the type of last-kbd-macro in case Lisp code changed it. */
88 CHECK_VECTOR_OR_STRING (current_kboard->Vlast_kbd_macro); 88 CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro));
89 89
90 len = XINT (Flength (current_kboard->Vlast_kbd_macro)); 90 len = XINT (Flength (KVAR (current_kboard, Vlast_kbd_macro)));
91 91
92 /* Copy last-kbd-macro into the buffer, in case the Lisp code 92 /* Copy last-kbd-macro into the buffer, in case the Lisp code
93 has put another macro there. */ 93 has put another macro there. */
@@ -100,11 +100,11 @@ macro before appending to it. */)
100 } 100 }
101 101
102 /* Must convert meta modifier when copying string to vector. */ 102 /* Must convert meta modifier when copying string to vector. */
103 cvt = STRINGP (current_kboard->Vlast_kbd_macro); 103 cvt = STRINGP (KVAR (current_kboard, Vlast_kbd_macro));
104 for (i = 0; i < len; i++) 104 for (i = 0; i < len; i++)
105 { 105 {
106 Lisp_Object c; 106 Lisp_Object c;
107 c = Faref (current_kboard->Vlast_kbd_macro, make_number (i)); 107 c = Faref (KVAR (current_kboard, Vlast_kbd_macro), make_number (i));
108 if (cvt && NATNUMP (c) && (XFASTINT (c) & 0x80)) 108 if (cvt && NATNUMP (c) && (XFASTINT (c) & 0x80))
109 XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80)); 109 XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));
110 current_kboard->kbd_macro_buffer[i] = c; 110 current_kboard->kbd_macro_buffer[i] = c;
@@ -116,12 +116,12 @@ macro before appending to it. */)
116 /* Re-execute the macro we are appending to, 116 /* Re-execute the macro we are appending to,
117 for consistency of behavior. */ 117 for consistency of behavior. */
118 if (NILP (no_exec)) 118 if (NILP (no_exec))
119 Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, 119 Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro),
120 make_number (1), Qnil); 120 make_number (1), Qnil);
121 121
122 message ("Appending to kbd macro..."); 122 message ("Appending to kbd macro...");
123 } 123 }
124 current_kboard->defining_kbd_macro = Qt; 124 KVAR (current_kboard, defining_kbd_macro) = Qt;
125 125
126 return Qnil; 126 return Qnil;
127} 127}
@@ -131,9 +131,9 @@ macro before appending to it. */)
131void 131void
132end_kbd_macro (void) 132end_kbd_macro (void)
133{ 133{
134 current_kboard->defining_kbd_macro = Qnil; 134 KVAR (current_kboard, defining_kbd_macro) = Qnil;
135 update_mode_lines++; 135 update_mode_lines++;
136 current_kboard->Vlast_kbd_macro 136 KVAR (current_kboard, Vlast_kbd_macro)
137 = make_event_array ((current_kboard->kbd_macro_end 137 = make_event_array ((current_kboard->kbd_macro_end
138 - current_kboard->kbd_macro_buffer), 138 - current_kboard->kbd_macro_buffer),
139 current_kboard->kbd_macro_buffer); 139 current_kboard->kbd_macro_buffer);
@@ -154,7 +154,7 @@ In Lisp, optional second arg LOOPFUNC may be a function that is called prior to
154each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) 154each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
155 (Lisp_Object repeat, Lisp_Object loopfunc) 155 (Lisp_Object repeat, Lisp_Object loopfunc)
156{ 156{
157 if (NILP (current_kboard->defining_kbd_macro)) 157 if (NILP (KVAR (current_kboard, defining_kbd_macro)))
158 error ("Not defining kbd macro"); 158 error ("Not defining kbd macro");
159 159
160 if (NILP (repeat)) 160 if (NILP (repeat))
@@ -162,19 +162,19 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
162 else 162 else
163 CHECK_NUMBER (repeat); 163 CHECK_NUMBER (repeat);
164 164
165 if (!NILP (current_kboard->defining_kbd_macro)) 165 if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
166 { 166 {
167 end_kbd_macro (); 167 end_kbd_macro ();
168 message ("Keyboard macro defined"); 168 message ("Keyboard macro defined");
169 } 169 }
170 170
171 if (XFASTINT (repeat) == 0) 171 if (XFASTINT (repeat) == 0)
172 Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc); 172 Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc);
173 else 173 else
174 { 174 {
175 XSETINT (repeat, XINT (repeat)-1); 175 XSETINT (repeat, XINT (repeat)-1);
176 if (XINT (repeat) > 0) 176 if (XINT (repeat) > 0)
177 Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, repeat, loopfunc); 177 Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc);
178 } 178 }
179 return Qnil; 179 return Qnil;
180} 180}
@@ -186,7 +186,7 @@ store_kbd_macro_char (Lisp_Object c)
186{ 186{
187 struct kboard *kb = current_kboard; 187 struct kboard *kb = current_kboard;
188 188
189 if (!NILP (kb->defining_kbd_macro)) 189 if (!NILP (KVAR (kb, defining_kbd_macro)))
190 { 190 {
191 if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize) 191 if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize)
192 { 192 {
@@ -248,21 +248,21 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
248{ 248{
249 /* Don't interfere with recognition of the previous command 249 /* Don't interfere with recognition of the previous command
250 from before this macro started. */ 250 from before this macro started. */
251 Vthis_command = current_kboard->Vlast_command; 251 Vthis_command = KVAR (current_kboard, Vlast_command);
252 /* C-x z after the macro should repeat the macro. */ 252 /* C-x z after the macro should repeat the macro. */
253 real_this_command = current_kboard->Vlast_kbd_macro; 253 real_this_command = KVAR (current_kboard, Vlast_kbd_macro);
254 254
255 if (! NILP (current_kboard->defining_kbd_macro)) 255 if (! NILP (KVAR (current_kboard, defining_kbd_macro)))
256 error ("Can't execute anonymous macro while defining one"); 256 error ("Can't execute anonymous macro while defining one");
257 else if (NILP (current_kboard->Vlast_kbd_macro)) 257 else if (NILP (KVAR (current_kboard, Vlast_kbd_macro)))
258 error ("No kbd macro has been defined"); 258 error ("No kbd macro has been defined");
259 else 259 else
260 Fexecute_kbd_macro (current_kboard->Vlast_kbd_macro, prefix, loopfunc); 260 Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), prefix, loopfunc);
261 261
262 /* command_loop_1 sets this to nil before it returns; 262 /* command_loop_1 sets this to nil before it returns;
263 get back the last command within the macro 263 get back the last command within the macro
264 so that it can be last, again, after we return. */ 264 so that it can be last, again, after we return. */
265 Vthis_command = current_kboard->Vlast_command; 265 Vthis_command = KVAR (current_kboard, Vlast_command);
266 266
267 return Qnil; 267 return Qnil;
268} 268}
@@ -322,7 +322,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
322 executing_kbd_macro = final; 322 executing_kbd_macro = final;
323 executing_kbd_macro_index = 0; 323 executing_kbd_macro_index = 0;
324 324
325 current_kboard->Vprefix_arg = Qnil; 325 KVAR (current_kboard, Vprefix_arg) = Qnil;
326 326
327 if (!NILP (loopfunc)) 327 if (!NILP (loopfunc))
328 { 328 {
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index ce4b9f35de8..7a702fd45bf 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -72,7 +72,6 @@ OBJ1 = $(BLD)/alloc.$(O) \
72 $(BLD)/eval.$(O) \ 72 $(BLD)/eval.$(O) \
73 $(BLD)/fileio.$(O) \ 73 $(BLD)/fileio.$(O) \
74 $(BLD)/filelock.$(O) \ 74 $(BLD)/filelock.$(O) \
75 $(BLD)/filemode.$(O) \
76 $(BLD)/fns.$(O) \ 75 $(BLD)/fns.$(O) \
77 $(BLD)/indent.$(O) \ 76 $(BLD)/indent.$(O) \
78 $(BLD)/insdel.$(O) \ 77 $(BLD)/insdel.$(O) \
@@ -81,7 +80,6 @@ OBJ1 = $(BLD)/alloc.$(O) \
81 $(BLD)/lread.$(O) \ 80 $(BLD)/lread.$(O) \
82 $(BLD)/macros.$(O) \ 81 $(BLD)/macros.$(O) \
83 $(BLD)/marker.$(O) \ 82 $(BLD)/marker.$(O) \
84 $(BLD)/md5.$(O) \
85 $(BLD)/minibuf.$(O) \ 83 $(BLD)/minibuf.$(O) \
86 $(BLD)/w32.$(O) \ 84 $(BLD)/w32.$(O) \
87 $(BLD)/w32heap.$(O) \ 85 $(BLD)/w32heap.$(O) \
@@ -214,14 +212,14 @@ GLOBAL_SOURCES = dosfns.c msdos.c \
214 cm.c term.c terminal.c xfaces.c \ 212 cm.c term.c terminal.c xfaces.c \
215 emacs.c keyboard.c macros.c keymap.c sysdep.c \ 213 emacs.c keyboard.c macros.c keymap.c sysdep.c \
216 buffer.c filelock.c insdel.c marker.c \ 214 buffer.c filelock.c insdel.c marker.c \
217 minibuf.c fileio.c dired.c filemode.c \ 215 minibuf.c fileio.c dired.c \
218 cmds.c casetab.c casefiddle.c indent.c search.c regex.c undo.c \ 216 cmds.c casetab.c casefiddle.c indent.c search.c regex.c undo.c \
219 alloc.c data.c doc.c editfns.c callint.c \ 217 alloc.c data.c doc.c editfns.c callint.c \
220 eval.c floatfns.c fns.c print.c lread.c \ 218 eval.c floatfns.c fns.c print.c lread.c \
221 syntax.c bytecode.c \ 219 syntax.c bytecode.c \
222 process.c callproc.c unexw32.c \ 220 process.c callproc.c unexw32.c \
223 region-cache.c sound.c atimer.c \ 221 region-cache.c sound.c atimer.c \
224 doprnt.c intervals.c textprop.c composite.c md5.c 222 doprnt.c intervals.c textprop.c composite.c
225SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ 223SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
226 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o 224 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
227obj = $(GLOBAL_SOURCES:.c=.o) 225obj = $(GLOBAL_SOURCES:.c=.o)
@@ -664,6 +662,7 @@ $(BLD)/dired.$(O) : \
664 $(SRC)/coding.h \ 662 $(SRC)/coding.h \
665 $(SRC)/commands.h \ 663 $(SRC)/commands.h \
666 $(SRC)/composite.h \ 664 $(SRC)/composite.h \
665 $(EMACS_ROOT)/lib/filemode.h \
667 $(SRC)/ndir.h \ 666 $(SRC)/ndir.h \
668 $(SRC)/regex.h \ 667 $(SRC)/regex.h \
669 $(SRC)/systime.h 668 $(SRC)/systime.h
@@ -822,10 +821,6 @@ $(BLD)/filelock.$(O) : \
822 $(SRC)/composite.h \ 821 $(SRC)/composite.h \
823 $(SRC)/systime.h 822 $(SRC)/systime.h
824 823
825$(BLD)/filemode.$(O) : \
826 $(SRC)/filemode.c \
827 $(CONFIG_H)
828
829$(BLD)/firstfile.$(O) : \ 824$(BLD)/firstfile.$(O) : \
830 $(SRC)/firstfile.c \ 825 $(SRC)/firstfile.c \
831 $(CONFIG_H) 826 $(CONFIG_H)
@@ -843,6 +838,7 @@ $(BLD)/fns.$(O) : \
843 $(EMACS_ROOT)/nt/inc/nl_types.h \ 838 $(EMACS_ROOT)/nt/inc/nl_types.h \
844 $(EMACS_ROOT)/nt/inc/unistd.h \ 839 $(EMACS_ROOT)/nt/inc/unistd.h \
845 $(EMACS_ROOT)/nt/inc/sys/time.h \ 840 $(EMACS_ROOT)/nt/inc/sys/time.h \
841 $(EMACS_ROOT)/lib/md5.h \
846 $(LISP_H) \ 842 $(LISP_H) \
847 $(SRC)/atimer.h \ 843 $(SRC)/atimer.h \
848 $(SRC)/blockinput.h \ 844 $(SRC)/blockinput.h \
@@ -856,7 +852,6 @@ $(BLD)/fns.$(O) : \
856 $(SRC)/intervals.h \ 852 $(SRC)/intervals.h \
857 $(SRC)/keyboard.h \ 853 $(SRC)/keyboard.h \
858 $(SRC)/keymap.h \ 854 $(SRC)/keymap.h \
859 $(SRC)/md5.h \
860 $(SRC)/systime.h \ 855 $(SRC)/systime.h \
861 $(SRC)/w32gui.h \ 856 $(SRC)/w32gui.h \
862 $(SRC)/window.h 857 $(SRC)/window.h
@@ -1135,11 +1130,6 @@ $(BLD)/marker.$(O) : \
1135 $(SRC)/buffer.h \ 1130 $(SRC)/buffer.h \
1136 $(SRC)/character.h 1131 $(SRC)/character.h
1137 1132
1138$(BLD)/md5.$(O) : \
1139 $(SRC)/md5.c \
1140 $(CONFIG_H) \
1141 $(SRC)/md5.h
1142
1143$(BLD)/menu.$(O) : \ 1133$(BLD)/menu.$(O) : \
1144 $(SRC)/menu.c \ 1134 $(SRC)/menu.c \
1145 $(CONFIG_H) \ 1135 $(CONFIG_H) \
diff --git a/src/marker.c b/src/marker.c
index 1e0e1404fdb..72c564f420f 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -439,7 +439,7 @@ Returns nil if MARKER points into a dead buffer. */)
439 does not preserve the buffer from being GC'd (it's weak), so 439 does not preserve the buffer from being GC'd (it's weak), so
440 markers have to be unlinked from their buffer as soon as the buffer 440 markers have to be unlinked from their buffer as soon as the buffer
441 is killed. */ 441 is killed. */
442 eassert (!NILP (XBUFFER (buf)->name)); 442 eassert (!NILP (BVAR (XBUFFER (buf), name)));
443 return buf; 443 return buf;
444 } 444 }
445 return Qnil; 445 return Qnil;
@@ -488,7 +488,7 @@ Returns MARKER. */)
488 CHECK_BUFFER (buffer); 488 CHECK_BUFFER (buffer);
489 b = XBUFFER (buffer); 489 b = XBUFFER (buffer);
490 /* If buffer is dead, set marker to point nowhere. */ 490 /* If buffer is dead, set marker to point nowhere. */
491 if (EQ (b->name, Qnil)) 491 if (EQ (BVAR (b, name), Qnil))
492 { 492 {
493 unchain_marker (m); 493 unchain_marker (m);
494 return marker; 494 return marker;
@@ -563,7 +563,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
563 CHECK_BUFFER (buffer); 563 CHECK_BUFFER (buffer);
564 b = XBUFFER (buffer); 564 b = XBUFFER (buffer);
565 /* If buffer is dead, set marker to point nowhere. */ 565 /* If buffer is dead, set marker to point nowhere. */
566 if (EQ (b->name, Qnil)) 566 if (EQ (BVAR (b, name), Qnil))
567 { 567 {
568 unchain_marker (m); 568 unchain_marker (m);
569 return marker; 569 return marker;
@@ -628,7 +628,7 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMAC
628 CHECK_BUFFER (buffer); 628 CHECK_BUFFER (buffer);
629 b = XBUFFER (buffer); 629 b = XBUFFER (buffer);
630 /* If buffer is dead, set marker to point nowhere. */ 630 /* If buffer is dead, set marker to point nowhere. */
631 if (EQ (b->name, Qnil)) 631 if (EQ (BVAR (b, name), Qnil))
632 { 632 {
633 unchain_marker (m); 633 unchain_marker (m);
634 return marker; 634 return marker;
@@ -676,7 +676,7 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT ch
676 CHECK_BUFFER (buffer); 676 CHECK_BUFFER (buffer);
677 b = XBUFFER (buffer); 677 b = XBUFFER (buffer);
678 /* If buffer is dead, set marker to point nowhere. */ 678 /* If buffer is dead, set marker to point nowhere. */
679 if (EQ (b->name, Qnil)) 679 if (EQ (BVAR (b, name), Qnil))
680 { 680 {
681 unchain_marker (m); 681 unchain_marker (m);
682 return marker; 682 return marker;
@@ -731,7 +731,7 @@ unchain_marker (register struct Lisp_Marker *marker)
731 if (b == 0) 731 if (b == 0)
732 return; 732 return;
733 733
734 if (EQ (b->name, Qnil)) 734 if (EQ (BVAR (b, name), Qnil))
735 abort (); 735 abort ();
736 736
737 marker->buffer = 0; 737 marker->buffer = 0;
diff --git a/src/md5.c b/src/md5.c
deleted file mode 100644
index 9d9d7d8f14f..00000000000
--- a/src/md5.c
+++ /dev/null
@@ -1,430 +0,0 @@
1/* Functions to compute MD5 message digest of files or memory blocks.
2 according to the definition of MD5 in RFC 1321 from April 1992.
3 Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
5
6 This file is part of the GNU C Library.
7
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
12
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with the GNU C Library; see the file COPYING. If not, write to the
20 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
24
25#ifdef HAVE_CONFIG_H
26# include <config.h>
27#endif
28
29#include <sys/types.h>
30
31#if STDC_HEADERS || defined _LIBC
32# include <stdlib.h>
33# include <string.h>
34#else
35# ifndef HAVE_MEMCPY
36# define memcpy(d, s, n) bcopy ((s), (d), (n))
37# endif
38#endif
39
40#ifdef _LIBC
41# include <endian.h>
42# if __BYTE_ORDER == __BIG_ENDIAN
43# define WORDS_BIGENDIAN 1
44# endif
45/* We need to keep the namespace clean so define the MD5 function
46 protected using leading __ . */
47# define md5_init_ctx __md5_init_ctx
48# define md5_process_block __md5_process_block
49# define md5_process_bytes __md5_process_bytes
50# define md5_finish_ctx __md5_finish_ctx
51# define md5_read_ctx __md5_read_ctx
52# define md5_stream __md5_stream
53# define md5_buffer __md5_buffer
54#endif
55
56#include "md5.h"
57
58#ifdef WORDS_BIGENDIAN
59# define SWAP(n) \
60 (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
61#else
62# define SWAP(n) (n)
63#endif
64
65
66/* This array contains the bytes used to pad the buffer to the next
67 64-byte boundary. (RFC 1321, 3.1: Step 1) */
68static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
69
70
71/* Initialize structure containing state of computation.
72 (RFC 1321, 3.3: Step 3) */
73void
74md5_init_ctx (struct md5_ctx *ctx)
75{
76 ctx->A = 0x67452301;
77 ctx->B = 0xefcdab89;
78 ctx->C = 0x98badcfe;
79 ctx->D = 0x10325476;
80
81 ctx->total[0] = ctx->total[1] = 0;
82 ctx->buflen = 0;
83}
84
85/* Put result from CTX in first 16 bytes following RESBUF. The result
86 must be in little endian byte order.
87
88 IMPORTANT: On some systems it is required that RESBUF is correctly
89 aligned for a 32 bits value. */
90void *
91md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
92{
93 ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
94 ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
95 ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
96 ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
97
98 return resbuf;
99}
100
101/* Process the remaining bytes in the internal buffer and the usual
102 prolog according to the standard and write the result to RESBUF.
103
104 IMPORTANT: On some systems it is required that RESBUF is correctly
105 aligned for a 32 bits value. */
106void *
107md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
108{
109 /* Take yet unprocessed bytes into account. */
110 md5_uint32 bytes = ctx->buflen;
111 size_t pad;
112
113 /* Now count remaining bytes. */
114 ctx->total[0] += bytes;
115 if (ctx->total[0] < bytes)
116 ++ctx->total[1];
117
118 pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
119 memcpy (&ctx->buffer[bytes], fillbuf, pad);
120
121 /* Put the 64-bit file length in *bits* at the end of the buffer. */
122 *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
123 *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
124 (ctx->total[0] >> 29));
125
126 /* Process last bytes. */
127 md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
128
129 return md5_read_ctx (ctx, resbuf);
130}
131
132/* Compute MD5 message digest for bytes read from STREAM. The
133 resulting message digest number will be written into the 16 bytes
134 beginning at RESBLOCK. */
135int
136md5_stream (FILE *stream, void *resblock)
137{
138 /* Important: BLOCKSIZE must be a multiple of 64. */
139#define BLOCKSIZE 4096
140 struct md5_ctx ctx;
141 char buffer[BLOCKSIZE + 72];
142 size_t sum;
143
144 /* Initialize the computation context. */
145 md5_init_ctx (&ctx);
146
147 /* Iterate over full file contents. */
148 while (1)
149 {
150 /* We read the file in blocks of BLOCKSIZE bytes. One call of the
151 computation function processes the whole buffer so that with the
152 next round of the loop another block can be read. */
153 size_t n;
154 sum = 0;
155
156 /* Read block. Take care for partial reads. */
157 do
158 {
159 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
160
161 sum += n;
162 }
163 while (sum < BLOCKSIZE && n != 0);
164 if (n == 0 && ferror (stream))
165 return 1;
166
167 /* If end of file is reached, end the loop. */
168 if (n == 0)
169 break;
170
171 /* Process buffer with BLOCKSIZE bytes. Note that
172 BLOCKSIZE % 64 == 0
173 */
174 md5_process_block (buffer, BLOCKSIZE, &ctx);
175 }
176
177 /* Add the last bytes if necessary. */
178 if (sum > 0)
179 md5_process_bytes (buffer, sum, &ctx);
180
181 /* Construct result in desired memory. */
182 md5_finish_ctx (&ctx, resblock);
183 return 0;
184}
185
186/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
187 result is always in little endian byte order, so that a byte-wise
188 output yields to the wanted ASCII representation of the message
189 digest. */
190void *
191md5_buffer (const char *buffer, size_t len, void *resblock)
192{
193 struct md5_ctx ctx;
194
195 /* Initialize the computation context. */
196 md5_init_ctx (&ctx);
197
198 /* Process whole buffer but last len % 64 bytes. */
199 md5_process_bytes (buffer, len, &ctx);
200
201 /* Put result in desired memory area. */
202 return md5_finish_ctx (&ctx, resblock);
203}
204
205
206void
207md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
208{
209 /* const void aligned_buffer = buffer; */
210
211 /* When we already have some bits in our internal buffer concatenate
212 both inputs first. */
213 if (ctx->buflen != 0)
214 {
215 size_t left_over = ctx->buflen;
216 size_t add = 128 - left_over > len ? len : 128 - left_over;
217
218 /* Only put full words in the buffer. */
219 add -= add % __alignof__ (md5_uint32);
220
221 memcpy (&ctx->buffer[left_over], buffer, add);
222 ctx->buflen += add;
223
224 if (ctx->buflen > 64)
225 {
226 md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
227
228 ctx->buflen &= 63;
229 /* The regions in the following copy operation cannot overlap. */
230 memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
231 ctx->buflen);
232 }
233
234 buffer = (const char *) buffer + add;
235 len -= add;
236 }
237
238 /* Process available complete blocks. */
239 if (len > 64)
240 {
241 md5_process_block (buffer, len & ~63, ctx);
242 buffer = (const char *) buffer + (len & ~63);
243 len &= 63;
244 }
245
246 /* Move remaining bytes in internal buffer. */
247 if (len > 0)
248 {
249 size_t left_over = ctx->buflen;
250
251 memcpy (&ctx->buffer[left_over], buffer, len);
252 left_over += len;
253 if (left_over >= 64)
254 {
255 md5_process_block (ctx->buffer, 64, ctx);
256 left_over -= 64;
257 memcpy (ctx->buffer, &ctx->buffer[64], left_over);
258 }
259 ctx->buflen = left_over;
260 }
261}
262
263
264/* These are the four functions used in the four steps of the MD5 algorithm
265 and defined in the RFC 1321. The first function is a little bit optimized
266 (as found in Colin Plumbs public domain implementation). */
267/* #define FF(b, c, d) ((b & c) | (~b & d)) */
268#define FF(b, c, d) (d ^ (b & (c ^ d)))
269#define FG(b, c, d) FF (d, b, c)
270#define FH(b, c, d) (b ^ c ^ d)
271#define FI(b, c, d) (c ^ (b | ~d))
272
273/* Process LEN bytes of BUFFER, accumulating context into CTX.
274 It is assumed that LEN % 64 == 0. */
275
276void
277md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
278{
279 md5_uint32 correct_words[16];
280 const md5_uint32 *words = buffer;
281 size_t nwords = len / sizeof (md5_uint32);
282 const md5_uint32 *endp = words + nwords;
283 md5_uint32 A = ctx->A;
284 md5_uint32 B = ctx->B;
285 md5_uint32 C = ctx->C;
286 md5_uint32 D = ctx->D;
287
288 /* First increment the byte count. RFC 1321 specifies the possible
289 length of the file up to 2^64 bits. Here we only compute the
290 number of bytes. Do a double word increment. */
291 ctx->total[0] += len;
292 if (ctx->total[0] < len)
293 ++ctx->total[1];
294
295 /* Process all bytes in the buffer with 64 bytes in each round of
296 the loop. */
297 while (words < endp)
298 {
299 md5_uint32 *cwp = correct_words;
300 md5_uint32 A_save = A;
301 md5_uint32 B_save = B;
302 md5_uint32 C_save = C;
303 md5_uint32 D_save = D;
304
305 /* First round: using the given function, the context and a constant
306 the next context is computed. Because the algorithms processing
307 unit is a 32-bit word and it is determined to work on words in
308 little endian byte order we perhaps have to change the byte order
309 before the computation. To reduce the work for the next steps
310 we store the swapped words in the array CORRECT_WORDS. */
311
312#define OP(a, b, c, d, s, T) \
313 do \
314 { \
315 a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
316 ++words; \
317 CYCLIC (a, s); \
318 a += b; \
319 } \
320 while (0)
321
322 /* It is unfortunate that C does not provide an operator for
323 cyclic rotation. Hope the C compiler is smart enough. */
324#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
325
326 /* Before we start, one word to the strange constants.
327 They are defined in RFC 1321 as
328
329 T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
330 */
331
332 /* Round 1. */
333 OP (A, B, C, D, 7, 0xd76aa478);
334 OP (D, A, B, C, 12, 0xe8c7b756);
335 OP (C, D, A, B, 17, 0x242070db);
336 OP (B, C, D, A, 22, 0xc1bdceee);
337 OP (A, B, C, D, 7, 0xf57c0faf);
338 OP (D, A, B, C, 12, 0x4787c62a);
339 OP (C, D, A, B, 17, 0xa8304613);
340 OP (B, C, D, A, 22, 0xfd469501);
341 OP (A, B, C, D, 7, 0x698098d8);
342 OP (D, A, B, C, 12, 0x8b44f7af);
343 OP (C, D, A, B, 17, 0xffff5bb1);
344 OP (B, C, D, A, 22, 0x895cd7be);
345 OP (A, B, C, D, 7, 0x6b901122);
346 OP (D, A, B, C, 12, 0xfd987193);
347 OP (C, D, A, B, 17, 0xa679438e);
348 OP (B, C, D, A, 22, 0x49b40821);
349
350 /* For the second to fourth round we have the possibly swapped words
351 in CORRECT_WORDS. Redefine the macro to take an additional first
352 argument specifying the function to use. */
353#undef OP
354#define OP(f, a, b, c, d, k, s, T) \
355 do \
356 { \
357 a += f (b, c, d) + correct_words[k] + T; \
358 CYCLIC (a, s); \
359 a += b; \
360 } \
361 while (0)
362
363 /* Round 2. */
364 OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
365 OP (FG, D, A, B, C, 6, 9, 0xc040b340);
366 OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
367 OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
368 OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
369 OP (FG, D, A, B, C, 10, 9, 0x02441453);
370 OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
371 OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
372 OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
373 OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
374 OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
375 OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
376 OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
377 OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
378 OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
379 OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
380
381 /* Round 3. */
382 OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
383 OP (FH, D, A, B, C, 8, 11, 0x8771f681);
384 OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
385 OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
386 OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
387 OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
388 OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
389 OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
390 OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
391 OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
392 OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
393 OP (FH, B, C, D, A, 6, 23, 0x04881d05);
394 OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
395 OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
396 OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
397 OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
398
399 /* Round 4. */
400 OP (FI, A, B, C, D, 0, 6, 0xf4292244);
401 OP (FI, D, A, B, C, 7, 10, 0x432aff97);
402 OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
403 OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
404 OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
405 OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
406 OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
407 OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
408 OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
409 OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
410 OP (FI, C, D, A, B, 6, 15, 0xa3014314);
411 OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
412 OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
413 OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
414 OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
415 OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
416
417 /* Add the starting values of the context. */
418 A += A_save;
419 B += B_save;
420 C += C_save;
421 D += D_save;
422 }
423
424 /* Put checksum in context given as argument. */
425 ctx->A = A;
426 ctx->B = B;
427 ctx->C = C;
428 ctx->D = D;
429}
430
diff --git a/src/md5.h b/src/md5.h
deleted file mode 100644
index 8ab73050379..00000000000
--- a/src/md5.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/* Declaration of functions and data types used for MD5 sum computing
2 library functions.
3 Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
6
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
11
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public
18 License along with the GNU C Library; see the file COPYING. If not,
19 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
21
22#ifndef _MD5_H
23#define _MD5_H 1
24
25#include <stdio.h>
26
27#if defined HAVE_LIMITS_H || _LIBC
28# include <limits.h>
29#endif
30
31/* The following contortions are an attempt to use the C preprocessor
32 to determine an unsigned integral type that is 32 bits wide. An
33 alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
34 doing that would require that the configure script compile and *run*
35 the resulting executable. Locally running cross-compiled executables
36 is usually not possible. */
37
38#ifdef _LIBC
39# include <sys/types.h>
40typedef u_int32_t md5_uint32;
41#else
42# if defined __STDC__ && __STDC__
43# define UINT_MAX_32_BITS 4294967295U
44# else
45# define UINT_MAX_32_BITS 0xFFFFFFFF
46# endif
47
48/* If UINT_MAX isn't defined, assume it's a 32-bit type.
49 This should be valid for all systems GNU cares about because
50 that doesn't include 16-bit systems, and only modern systems
51 (that certainly have <limits.h>) have 64+-bit integral types. */
52
53# ifndef UINT_MAX
54# define UINT_MAX UINT_MAX_32_BITS
55# endif
56
57# if UINT_MAX == UINT_MAX_32_BITS
58 typedef unsigned int md5_uint32;
59# else
60# if USHRT_MAX == UINT_MAX_32_BITS
61 typedef unsigned short md5_uint32;
62# else
63# if ULONG_MAX == UINT_MAX_32_BITS
64 typedef unsigned long md5_uint32;
65# else
66 /* The following line is intended to evoke an error.
67 Using #error is not portable enough. */
68 "Cannot determine unsigned 32-bit data type."
69# endif
70# endif
71# endif
72#endif
73
74
75#ifndef __GNUC__
76#define __attribute__(X)
77#define __alignof__(X) 1
78#endif
79
80/* Structure to save state of computation between the single steps. */
81struct md5_ctx
82{
83 md5_uint32 A;
84 md5_uint32 B;
85 md5_uint32 C;
86 md5_uint32 D;
87
88 md5_uint32 total[2];
89 md5_uint32 buflen;
90 char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
91};
92
93/*
94 * The following three functions are build up the low level used in
95 * the functions `md5_stream' and `md5_buffer'.
96 */
97
98/* Initialize structure containing state of computation.
99 (RFC 1321, 3.3: Step 3) */
100extern void md5_init_ctx (struct md5_ctx *ctx);
101
102/* Starting with the result of former calls of this function (or the
103 initialization function update the context for the next LEN bytes
104 starting at BUFFER.
105 It is necessary that LEN is a multiple of 64!!! */
106extern void md5_process_block (const void *buffer, size_t len,
107 struct md5_ctx *ctx);
108
109/* Starting with the result of former calls of this function (or the
110 initialization function update the context for the next LEN bytes
111 starting at BUFFER.
112 It is NOT required that LEN is a multiple of 64. */
113extern void md5_process_bytes (const void *buffer, size_t len,
114 struct md5_ctx *ctx);
115
116/* Process the remaining bytes in the buffer and put result from CTX
117 in first 16 bytes following RESBUF. The result is always in little
118 endian byte order, so that a byte-wise output yields to the wanted
119 ASCII representation of the message digest.
120
121 IMPORTANT: On some systems it is required that RESBUF is correctly
122 aligned for a 32 bits value. */
123extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
124
125
126/* Put result from CTX in first 16 bytes following RESBUF. The result is
127 always in little endian byte order, so that a byte-wise output yields
128 to the wanted ASCII representation of the message digest.
129
130 IMPORTANT: On some systems it is required that RESBUF is correctly
131 aligned for a 32 bits value. */
132extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);
133
134
135/* Compute MD5 message digest for bytes read from STREAM. The
136 resulting message digest number will be written into the 16 bytes
137 beginning at RESBLOCK. */
138extern int md5_stream (FILE *stream, void *resblock);
139
140/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
141 result is always in little endian byte order, so that a byte-wise
142 output yields to the wanted ASCII representation of the message
143 digest. */
144extern void *md5_buffer (const char *buffer, size_t len,
145 void *resblock);
146
147#endif /* md5.h */
148
diff --git a/src/minibuf.c b/src/minibuf.c
index 67b4e824561..9852900b60b 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -415,7 +415,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
415 CHECK_STRING (initial); 415 CHECK_STRING (initial);
416 } 416 }
417 val = Qnil; 417 val = Qnil;
418 ambient_dir = current_buffer->directory; 418 ambient_dir = BVAR (current_buffer, directory);
419 input_method = Qnil; 419 input_method = Qnil;
420 enable_multibyte = Qnil; 420 enable_multibyte = Qnil;
421 421
@@ -525,7 +525,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
525 /* `current-input-method' is buffer local. So, remember it in 525 /* `current-input-method' is buffer local. So, remember it in
526 INPUT_METHOD before changing the current buffer. */ 526 INPUT_METHOD before changing the current buffer. */
527 input_method = Fsymbol_value (Qcurrent_input_method); 527 input_method = Fsymbol_value (Qcurrent_input_method);
528 enable_multibyte = current_buffer->enable_multibyte_characters; 528 enable_multibyte = BVAR (current_buffer, enable_multibyte_characters);
529 } 529 }
530 530
531 /* Switch to the minibuffer. */ 531 /* Switch to the minibuffer. */
@@ -535,7 +535,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
535 535
536 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ 536 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
537 if (inherit_input_method) 537 if (inherit_input_method)
538 current_buffer->enable_multibyte_characters = enable_multibyte; 538 BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte;
539 539
540 /* The current buffer's default directory is usually the right thing 540 /* The current buffer's default directory is usually the right thing
541 for our minibuffer here. However, if you're typing a command at 541 for our minibuffer here. However, if you're typing a command at
@@ -546,7 +546,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
546 you think of something better to do? Find another buffer with a 546 you think of something better to do? Find another buffer with a
547 better directory, and use that one instead. */ 547 better directory, and use that one instead. */
548 if (STRINGP (ambient_dir)) 548 if (STRINGP (ambient_dir))
549 current_buffer->directory = ambient_dir; 549 BVAR (current_buffer, directory) = ambient_dir;
550 else 550 else
551 { 551 {
552 Lisp_Object buf_list; 552 Lisp_Object buf_list;
@@ -558,9 +558,9 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
558 Lisp_Object other_buf; 558 Lisp_Object other_buf;
559 559
560 other_buf = XCDR (XCAR (buf_list)); 560 other_buf = XCDR (XCAR (buf_list));
561 if (STRINGP (XBUFFER (other_buf)->directory)) 561 if (STRINGP (BVAR (XBUFFER (other_buf), directory)))
562 { 562 {
563 current_buffer->directory = XBUFFER (other_buf)->directory; 563 BVAR (current_buffer, directory) = BVAR (XBUFFER (other_buf), directory);
564 break; 564 break;
565 } 565 }
566 } 566 }
@@ -603,7 +603,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
603 specbind (Qinhibit_modification_hooks, Qt); 603 specbind (Qinhibit_modification_hooks, Qt);
604 Ferase_buffer (); 604 Ferase_buffer ();
605 605
606 if (!NILP (current_buffer->enable_multibyte_characters) 606 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
607 && ! STRING_MULTIBYTE (minibuf_prompt)) 607 && ! STRING_MULTIBYTE (minibuf_prompt))
608 minibuf_prompt = Fstring_make_multibyte (minibuf_prompt); 608 minibuf_prompt = Fstring_make_multibyte (minibuf_prompt);
609 609
@@ -633,7 +633,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
633 } 633 }
634 634
635 clear_message (1, 1); 635 clear_message (1, 1);
636 current_buffer->keymap = map; 636 BVAR (current_buffer, keymap) = map;
637 637
638 /* Turn on an input method stored in INPUT_METHOD if any. */ 638 /* Turn on an input method stored in INPUT_METHOD if any. */
639 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) 639 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
@@ -647,7 +647,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
647 call1 (Vrun_hooks, Qminibuffer_setup_hook); 647 call1 (Vrun_hooks, Qminibuffer_setup_hook);
648 648
649 /* Don't allow the user to undo past this point. */ 649 /* Don't allow the user to undo past this point. */
650 current_buffer->undo_list = Qnil; 650 BVAR (current_buffer, undo_list) = Qnil;
651 651
652 recursive_edit_1 (); 652 recursive_edit_1 ();
653 653
@@ -764,7 +764,7 @@ get_minibuffer (int depth)
764 Vminibuffer_list = nconc2 (Vminibuffer_list, tail); 764 Vminibuffer_list = nconc2 (Vminibuffer_list, tail);
765 } 765 }
766 buf = Fcar (tail); 766 buf = Fcar (tail);
767 if (NILP (buf) || NILP (XBUFFER (buf)->name)) 767 if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name)))
768 { 768 {
769 sprintf (name, " *Minibuf-%d*", depth); 769 sprintf (name, " *Minibuf-%d*", depth);
770 buf = Fget_buffer_create (build_string (name)); 770 buf = Fget_buffer_create (build_string (name));
@@ -1097,7 +1097,7 @@ function, instead of the usual behavior. */)
1097 int count = SPECPDL_INDEX (); 1097 int count = SPECPDL_INDEX ();
1098 1098
1099 if (BUFFERP (def)) 1099 if (BUFFERP (def))
1100 def = XBUFFER (def)->name; 1100 def = BVAR (XBUFFER (def), name);
1101 1101
1102 specbind (Qcompletion_ignore_case, 1102 specbind (Qcompletion_ignore_case,
1103 read_buffer_completion_ignore_case ? Qt : Qnil); 1103 read_buffer_completion_ignore_case ? Qt : Qnil);
diff --git a/src/msdos.c b/src/msdos.c
index eb73f54838d..8f0f6776aaa 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1317,12 +1317,12 @@ IT_frame_up_to_date (struct frame *f)
1317 { 1317 {
1318 struct buffer *b = XBUFFER (sw->buffer); 1318 struct buffer *b = XBUFFER (sw->buffer);
1319 1319
1320 if (EQ (b->cursor_type, Qt)) 1320 if (EQ (BVAR (b,cursor_type), Qt))
1321 new_cursor = frame_desired_cursor; 1321 new_cursor = frame_desired_cursor;
1322 else if (NILP (b->cursor_type)) /* nil means no cursor */ 1322 else if (NILP (BVAR (b, cursor_type))) /* nil means no cursor */
1323 new_cursor = Fcons (Qbar, make_number (0)); 1323 new_cursor = Fcons (Qbar, make_number (0));
1324 else 1324 else
1325 new_cursor = b->cursor_type; 1325 new_cursor = BVAR (b, cursor_type);
1326 } 1326 }
1327 1327
1328 IT_set_cursor_type (f, new_cursor); 1328 IT_set_cursor_type (f, new_cursor);
@@ -1793,7 +1793,7 @@ internal_terminal_init (void)
1793 } 1793 }
1794 1794
1795 tty = FRAME_TTY (sf); 1795 tty = FRAME_TTY (sf);
1796 current_kboard->Vwindow_system = Qpc; 1796 KVAR (current_kboard, Vwindow_system) = Qpc;
1797 sf->output_method = output_msdos_raw; 1797 sf->output_method = output_msdos_raw;
1798 if (init_needed) 1798 if (init_needed)
1799 { 1799 {
diff --git a/src/nsfns.m b/src/nsfns.m
index f1bf8b65727..6a5adbd7bf3 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -605,8 +605,8 @@ ns_set_name_as_filename (struct frame *f)
605 605
606 BLOCK_INPUT; 606 BLOCK_INPUT;
607 pool = [[NSAutoreleasePool alloc] init]; 607 pool = [[NSAutoreleasePool alloc] init];
608 filename = XBUFFER (buf)->filename; 608 filename = BVAR (XBUFFER (buf), filename);
609 name = XBUFFER (buf)->name; 609 name = BVAR (XBUFFER (buf), name);
610 610
611 if (NILP (name)) 611 if (NILP (name))
612 { 612 {
@@ -1329,9 +1329,9 @@ be shared by the new frame. */)
1329 } 1329 }
1330 1330
1331 if (FRAME_HAS_MINIBUF_P (f) 1331 if (FRAME_HAS_MINIBUF_P (f)
1332 && (!FRAMEP (kb->Vdefault_minibuffer_frame) 1332 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
1333 || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))) 1333 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
1334 kb->Vdefault_minibuffer_frame = frame; 1334 KVAR (kb, Vdefault_minibuffer_frame) = frame;
1335 1335
1336 /* All remaining specified parameters, which have not been "used" 1336 /* All remaining specified parameters, which have not been "used"
1337 by x_get_arg and friends, now go in the misc. alist of the frame. */ 1337 by x_get_arg and friends, now go in the misc. alist of the frame. */
@@ -1428,7 +1428,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */)
1428 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil : 1428 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
1429 [NSString stringWithUTF8String: SDATA (prompt)]; 1429 [NSString stringWithUTF8String: SDATA (prompt)];
1430 NSString *dirS = NILP (dir) || !STRINGP (dir) ? 1430 NSString *dirS = NILP (dir) || !STRINGP (dir) ?
1431 [NSString stringWithUTF8String: SDATA (current_buffer->directory)] : 1431 [NSString stringWithUTF8String: SDATA (BVAR (current_buffer, directory))] :
1432 [NSString stringWithUTF8String: SDATA (dir)]; 1432 [NSString stringWithUTF8String: SDATA (dir)];
1433 NSString *initS = NILP (init) || !STRINGP (init) ? nil : 1433 NSString *initS = NILP (init) || !STRINGP (init) ? nil :
1434 [NSString stringWithUTF8String: SDATA (init)]; 1434 [NSString stringWithUTF8String: SDATA (init)];
diff --git a/src/nsterm.m b/src/nsterm.m
index e83b14748df..a09c95c7d01 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3762,7 +3762,7 @@ ns_term_init (Lisp_Object display_name)
3762 3762
3763 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 3763 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
3764 init_kboard (terminal->kboard); 3764 init_kboard (terminal->kboard);
3765 terminal->kboard->Vwindow_system = Qns; 3765 KVAR (terminal->kboard, Vwindow_system) = Qns;
3766 terminal->kboard->next_kboard = all_kboards; 3766 terminal->kboard->next_kboard = all_kboards;
3767 all_kboards = terminal->kboard; 3767 all_kboards = terminal->kboard;
3768 /* Don't let the initial kboard remain current longer than necessary. 3768 /* Don't let the initial kboard remain current longer than necessary.
@@ -5783,6 +5783,7 @@ ns_term_shutdown (int sig)
5783 win = nwin; 5783 win = nwin;
5784 condemned = NO; 5784 condemned = NO;
5785 pixel_height = NSHeight (r); 5785 pixel_height = NSHeight (r);
5786 if (pixel_height == 0) pixel_height = 1;
5786 min_portion = 20 / pixel_height; 5787 min_portion = 20 / pixel_height;
5787 5788
5788 frame = XFRAME (XWINDOW (win)->frame); 5789 frame = XFRAME (XWINDOW (win)->frame);
@@ -5812,6 +5813,7 @@ ns_term_shutdown (int sig)
5812 NSTRACE (EmacsScroller_setFrame); 5813 NSTRACE (EmacsScroller_setFrame);
5813/* BLOCK_INPUT; */ 5814/* BLOCK_INPUT; */
5814 pixel_height = NSHeight (newRect); 5815 pixel_height = NSHeight (newRect);
5816 if (pixel_height == 0) pixel_height = 1;
5815 min_portion = 20 / pixel_height; 5817 min_portion = 20 / pixel_height;
5816 [super setFrame: newRect]; 5818 [super setFrame: newRect];
5817 [self display]; 5819 [self display];
diff --git a/src/print.c b/src/print.c
index f48b618775d..11bce153ffc 100644
--- a/src/print.c
+++ b/src/print.c
@@ -111,7 +111,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
111 EMACS_INT old_point_byte = -1, start_point_byte = -1; \ 111 EMACS_INT old_point_byte = -1, start_point_byte = -1; \
112 int specpdl_count = SPECPDL_INDEX (); \ 112 int specpdl_count = SPECPDL_INDEX (); \
113 int free_print_buffer = 0; \ 113 int free_print_buffer = 0; \
114 int multibyte = !NILP (current_buffer->enable_multibyte_characters); \ 114 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \
115 Lisp_Object original 115 Lisp_Object original
116 116
117#define PRINTPREPARE \ 117#define PRINTPREPARE \
@@ -144,10 +144,10 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
144 if (NILP (printcharfun)) \ 144 if (NILP (printcharfun)) \
145 { \ 145 { \
146 Lisp_Object string; \ 146 Lisp_Object string; \
147 if (NILP (current_buffer->enable_multibyte_characters) \ 147 if (NILP (BVAR (current_buffer, enable_multibyte_characters)) \
148 && ! print_escape_multibyte) \ 148 && ! print_escape_multibyte) \
149 specbind (Qprint_escape_multibyte, Qt); \ 149 specbind (Qprint_escape_multibyte, Qt); \
150 if (! NILP (current_buffer->enable_multibyte_characters) \ 150 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)) \
151 && ! print_escape_nonascii) \ 151 && ! print_escape_nonascii) \
152 specbind (Qprint_escape_nonascii, Qt); \ 152 specbind (Qprint_escape_nonascii, Qt); \
153 if (print_buffer != 0) \ 153 if (print_buffer != 0) \
@@ -173,7 +173,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
173 if (NILP (printcharfun)) \ 173 if (NILP (printcharfun)) \
174 { \ 174 { \
175 if (print_buffer_pos != print_buffer_pos_byte \ 175 if (print_buffer_pos != print_buffer_pos_byte \
176 && NILP (current_buffer->enable_multibyte_characters)) \ 176 && NILP (BVAR (current_buffer, enable_multibyte_characters))) \
177 { \ 177 { \
178 unsigned char *temp \ 178 unsigned char *temp \
179 = (unsigned char *) alloca (print_buffer_pos + 1); \ 179 = (unsigned char *) alloca (print_buffer_pos + 1); \
@@ -250,7 +250,7 @@ printchar (unsigned int ch, Lisp_Object fun)
250 else 250 else
251 { 251 {
252 int multibyte_p 252 int multibyte_p
253 = !NILP (current_buffer->enable_multibyte_characters); 253 = !NILP (BVAR (current_buffer, enable_multibyte_characters));
254 254
255 setup_echo_area_for_printing (multibyte_p); 255 setup_echo_area_for_printing (multibyte_p);
256 insert_char (ch); 256 insert_char (ch);
@@ -302,7 +302,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
302 job. */ 302 job. */
303 int i; 303 int i;
304 int multibyte_p 304 int multibyte_p
305 = !NILP (current_buffer->enable_multibyte_characters); 305 = !NILP (BVAR (current_buffer, enable_multibyte_characters));
306 306
307 setup_echo_area_for_printing (multibyte_p); 307 setup_echo_area_for_printing (multibyte_p);
308 message_dolog (ptr, size_byte, 0, multibyte_p); 308 message_dolog (ptr, size_byte, 0, multibyte_p);
@@ -371,8 +371,8 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
371 chars = SCHARS (string); 371 chars = SCHARS (string);
372 else if (! print_escape_nonascii 372 else if (! print_escape_nonascii
373 && (EQ (printcharfun, Qt) 373 && (EQ (printcharfun, Qt)
374 ? ! NILP (buffer_defaults.enable_multibyte_characters) 374 ? ! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))
375 : ! NILP (current_buffer->enable_multibyte_characters))) 375 : ! NILP (BVAR (current_buffer, enable_multibyte_characters))))
376 { 376 {
377 /* If unibyte string STRING contains 8-bit codes, we must 377 /* If unibyte string STRING contains 8-bit codes, we must
378 convert STRING to a multibyte string containing the same 378 convert STRING to a multibyte string containing the same
@@ -504,14 +504,14 @@ temp_output_buffer_setup (const char *bufname)
504 504
505 Fkill_all_local_variables (); 505 Fkill_all_local_variables ();
506 delete_all_overlays (current_buffer); 506 delete_all_overlays (current_buffer);
507 current_buffer->directory = old->directory; 507 BVAR (current_buffer, directory) = BVAR (old, directory);
508 current_buffer->read_only = Qnil; 508 BVAR (current_buffer, read_only) = Qnil;
509 current_buffer->filename = Qnil; 509 BVAR (current_buffer, filename) = Qnil;
510 current_buffer->undo_list = Qt; 510 BVAR (current_buffer, undo_list) = Qt;
511 eassert (current_buffer->overlays_before == NULL); 511 eassert (current_buffer->overlays_before == NULL);
512 eassert (current_buffer->overlays_after == NULL); 512 eassert (current_buffer->overlays_after == NULL);
513 current_buffer->enable_multibyte_characters 513 BVAR (current_buffer, enable_multibyte_characters)
514 = buffer_defaults.enable_multibyte_characters; 514 = BVAR (&buffer_defaults, enable_multibyte_characters);
515 specbind (Qinhibit_read_only, Qt); 515 specbind (Qinhibit_read_only, Qt);
516 specbind (Qinhibit_modification_hooks, Qt); 516 specbind (Qinhibit_modification_hooks, Qt);
517 Ferase_buffer (); 517 Ferase_buffer ();
@@ -1009,7 +1009,10 @@ float_to_string (char *buf, double data)
1009 { 1009 {
1010 /* Generate the fewest number of digits that represent the 1010 /* Generate the fewest number of digits that represent the
1011 floating point value without losing information. */ 1011 floating point value without losing information. */
1012 dtoastr (buf, FLOAT_TO_STRING_BUFSIZE, 0, 0, data); 1012 dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data);
1013 /* The decimal point must be printed, or the byte compiler can
1014 get confused (Bug#8033). */
1015 width = 1;
1013 } 1016 }
1014 else /* oink oink */ 1017 else /* oink oink */
1015 { 1018 {
@@ -1064,8 +1067,7 @@ float_to_string (char *buf, double data)
1064 cp[1] = '0'; 1067 cp[1] = '0';
1065 cp[2] = 0; 1068 cp[2] = 0;
1066 } 1069 }
1067 1070 else if (*cp == 0)
1068 if (*cp == 0)
1069 { 1071 {
1070 *cp++ = '.'; 1072 *cp++ = '.';
1071 *cp++ = '0'; 1073 *cp++ = '0';
@@ -1801,7 +1803,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1801 if (!NILP (XWINDOW (obj)->buffer)) 1803 if (!NILP (XWINDOW (obj)->buffer))
1802 { 1804 {
1803 strout (" on ", -1, -1, printcharfun, 0); 1805 strout (" on ", -1, -1, printcharfun, 0);
1804 print_string (XBUFFER (XWINDOW (obj)->buffer)->name, printcharfun); 1806 print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun);
1805 } 1807 }
1806 PRINTCHAR ('>'); 1808 PRINTCHAR ('>');
1807 } 1809 }
@@ -1902,16 +1904,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1902 } 1904 }
1903 else if (BUFFERP (obj)) 1905 else if (BUFFERP (obj))
1904 { 1906 {
1905 if (NILP (XBUFFER (obj)->name)) 1907 if (NILP (BVAR (XBUFFER (obj), name)))
1906 strout ("#<killed buffer>", -1, -1, printcharfun, 0); 1908 strout ("#<killed buffer>", -1, -1, printcharfun, 0);
1907 else if (escapeflag) 1909 else if (escapeflag)
1908 { 1910 {
1909 strout ("#<buffer ", -1, -1, printcharfun, 0); 1911 strout ("#<buffer ", -1, -1, printcharfun, 0);
1910 print_string (XBUFFER (obj)->name, printcharfun); 1912 print_string (BVAR (XBUFFER (obj), name), printcharfun);
1911 PRINTCHAR ('>'); 1913 PRINTCHAR ('>');
1912 } 1914 }
1913 else 1915 else
1914 print_string (XBUFFER (obj)->name, printcharfun); 1916 print_string (BVAR (XBUFFER (obj), name), printcharfun);
1915 } 1917 }
1916 else if (WINDOW_CONFIGURATIONP (obj)) 1918 else if (WINDOW_CONFIGURATIONP (obj))
1917 { 1919 {
@@ -2023,7 +2025,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2023 sprintf (buf, "at %ld", (long)marker_position (obj)); 2025 sprintf (buf, "at %ld", (long)marker_position (obj));
2024 strout (buf, -1, -1, printcharfun, 0); 2026 strout (buf, -1, -1, printcharfun, 0);
2025 strout (" in ", -1, -1, printcharfun, 0); 2027 strout (" in ", -1, -1, printcharfun, 0);
2026 print_string (XMARKER (obj)->buffer->name, printcharfun); 2028 print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
2027 } 2029 }
2028 PRINTCHAR ('>'); 2030 PRINTCHAR ('>');
2029 break; 2031 break;
@@ -2038,7 +2040,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2038 (long)marker_position (OVERLAY_START (obj)), 2040 (long)marker_position (OVERLAY_START (obj)),
2039 (long)marker_position (OVERLAY_END (obj))); 2041 (long)marker_position (OVERLAY_END (obj)));
2040 strout (buf, -1, -1, printcharfun, 0); 2042 strout (buf, -1, -1, printcharfun, 0);
2041 print_string (XMARKER (OVERLAY_START (obj))->buffer->name, 2043 print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
2042 printcharfun); 2044 printcharfun);
2043 } 2045 }
2044 PRINTCHAR ('>'); 2046 PRINTCHAR ('>');
diff --git a/src/process.c b/src/process.c
index 80e70e49f8e..210287a85f1 100644
--- a/src/process.c
+++ b/src/process.c
@@ -719,7 +719,7 @@ get_process (register Lisp_Object name)
719 { 719 {
720 proc = Fget_buffer_process (obj); 720 proc = Fget_buffer_process (obj);
721 if (NILP (proc)) 721 if (NILP (proc))
722 error ("Buffer %s has no process", SDATA (XBUFFER (obj)->name)); 722 error ("Buffer %s has no process", SDATA (BVAR (XBUFFER (obj), name)));
723 } 723 }
724 else 724 else
725 { 725 {
@@ -1283,12 +1283,12 @@ list_processes_1 (Lisp_Object query_only)
1283 w_proc = i; 1283 w_proc = i;
1284 if (!NILP (p->buffer)) 1284 if (!NILP (p->buffer))
1285 { 1285 {
1286 if (NILP (XBUFFER (p->buffer)->name)) 1286 if (NILP (BVAR (XBUFFER (p->buffer), name)))
1287 { 1287 {
1288 if (w_buffer < 8) 1288 if (w_buffer < 8)
1289 w_buffer = 8; /* (Killed) */ 1289 w_buffer = 8; /* (Killed) */
1290 } 1290 }
1291 else if ((i = SCHARS (XBUFFER (p->buffer)->name), (i > w_buffer))) 1291 else if ((i = SCHARS (BVAR (XBUFFER (p->buffer), name)), (i > w_buffer)))
1292 w_buffer = i; 1292 w_buffer = i;
1293 } 1293 }
1294 if (STRINGP (p->tty_name) 1294 if (STRINGP (p->tty_name)
@@ -1312,9 +1312,9 @@ list_processes_1 (Lisp_Object query_only)
1312 XSETFASTINT (minspace, 1); 1312 XSETFASTINT (minspace, 1);
1313 1313
1314 set_buffer_internal (XBUFFER (Vstandard_output)); 1314 set_buffer_internal (XBUFFER (Vstandard_output));
1315 current_buffer->undo_list = Qt; 1315 BVAR (current_buffer, undo_list) = Qt;
1316 1316
1317 current_buffer->truncate_lines = Qt; 1317 BVAR (current_buffer, truncate_lines) = Qt;
1318 1318
1319 write_string ("Proc", -1); 1319 write_string ("Proc", -1);
1320 Findent_to (i_status, minspace); write_string ("Status", -1); 1320 Findent_to (i_status, minspace); write_string ("Status", -1);
@@ -1397,10 +1397,10 @@ list_processes_1 (Lisp_Object query_only)
1397 Findent_to (i_buffer, minspace); 1397 Findent_to (i_buffer, minspace);
1398 if (NILP (p->buffer)) 1398 if (NILP (p->buffer))
1399 insert_string ("(none)"); 1399 insert_string ("(none)");
1400 else if (NILP (XBUFFER (p->buffer)->name)) 1400 else if (NILP (BVAR (XBUFFER (p->buffer), name)))
1401 insert_string ("(Killed)"); 1401 insert_string ("(Killed)");
1402 else 1402 else
1403 Finsert (1, &XBUFFER (p->buffer)->name); 1403 Finsert (1, &BVAR (XBUFFER (p->buffer), name));
1404 1404
1405 if (!NILP (i_tty)) 1405 if (!NILP (i_tty))
1406 { 1406 {
@@ -1548,7 +1548,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1548 { 1548 {
1549 struct gcpro gcpro1, gcpro2; 1549 struct gcpro gcpro1, gcpro2;
1550 1550
1551 current_dir = current_buffer->directory; 1551 current_dir = BVAR (current_buffer, directory);
1552 1552
1553 GCPRO2 (buffer, current_dir); 1553 GCPRO2 (buffer, current_dir);
1554 1554
@@ -1560,7 +1560,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1560 current_dir = expand_and_dir_to_file (current_dir, Qnil); 1560 current_dir = expand_and_dir_to_file (current_dir, Qnil);
1561 if (NILP (Ffile_accessible_directory_p (current_dir))) 1561 if (NILP (Ffile_accessible_directory_p (current_dir)))
1562 report_file_error ("Setting current directory", 1562 report_file_error ("Setting current directory",
1563 Fcons (current_buffer->directory, Qnil)); 1563 Fcons (BVAR (current_buffer, directory), Qnil));
1564 1564
1565 UNGCPRO; 1565 UNGCPRO;
1566 } 1566 }
@@ -1660,9 +1660,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1660 } 1660 }
1661 1661
1662 1662
1663 XPROCESS (proc)->decoding_buf = make_uninit_string (0); 1663 XPROCESS (proc)->decoding_buf = empty_unibyte_string;
1664 XPROCESS (proc)->decoding_carryover = 0; 1664 XPROCESS (proc)->decoding_carryover = 0;
1665 XPROCESS (proc)->encoding_buf = make_uninit_string (0); 1665 XPROCESS (proc)->encoding_buf = empty_unibyte_string;
1666 1666
1667 XPROCESS (proc)->inherit_coding_system_flag 1667 XPROCESS (proc)->inherit_coding_system_flag
1668 = !(NILP (buffer) || !inherit_process_coding_system); 1668 = !(NILP (buffer) || !inherit_process_coding_system);
@@ -1786,6 +1786,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1786 sigset_t blocked; 1786 sigset_t blocked;
1787 struct sigaction sigint_action; 1787 struct sigaction sigint_action;
1788 struct sigaction sigquit_action; 1788 struct sigaction sigquit_action;
1789 struct sigaction sigpipe_action;
1789#ifdef AIX 1790#ifdef AIX
1790 struct sigaction sighup_action; 1791 struct sigaction sighup_action;
1791#endif 1792#endif
@@ -1898,6 +1899,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1898 and record the current handlers so they can be restored later. */ 1899 and record the current handlers so they can be restored later. */
1899 sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action ); 1900 sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action );
1900 sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action); 1901 sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action);
1902 sigaddset (&blocked, SIGPIPE); sigaction (SIGPIPE, 0, &sigpipe_action);
1901#ifdef AIX 1903#ifdef AIX
1902 sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action ); 1904 sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
1903#endif 1905#endif
@@ -2054,6 +2056,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2054 2056
2055 signal (SIGINT, SIG_DFL); 2057 signal (SIGINT, SIG_DFL);
2056 signal (SIGQUIT, SIG_DFL); 2058 signal (SIGQUIT, SIG_DFL);
2059 /* GConf causes us to ignore SIGPIPE, make sure it is restored
2060 in the child. */
2061 signal (SIGPIPE, SIG_DFL);
2057 2062
2058 /* Stop blocking signals in the child. */ 2063 /* Stop blocking signals in the child. */
2059 sigprocmask (SIG_SETMASK, &procmask, 0); 2064 sigprocmask (SIG_SETMASK, &procmask, 0);
@@ -2142,6 +2147,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2142 /* Restore the parent's signal handlers. */ 2147 /* Restore the parent's signal handlers. */
2143 sigaction (SIGINT, &sigint_action, 0); 2148 sigaction (SIGINT, &sigint_action, 0);
2144 sigaction (SIGQUIT, &sigquit_action, 0); 2149 sigaction (SIGQUIT, &sigquit_action, 0);
2150 sigaction (SIGPIPE, &sigpipe_action, 0);
2145#ifdef AIX 2151#ifdef AIX
2146 sigaction (SIGHUP, &sighup_action, 0); 2152 sigaction (SIGHUP, &sighup_action, 0);
2147#endif 2153#endif
@@ -2892,8 +2898,8 @@ usage: (make-serial-process &rest ARGS) */)
2892 } 2898 }
2893 else if (!NILP (Vcoding_system_for_read)) 2899 else if (!NILP (Vcoding_system_for_read))
2894 val = Vcoding_system_for_read; 2900 val = Vcoding_system_for_read;
2895 else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) 2901 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2896 || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) 2902 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2897 val = Qnil; 2903 val = Qnil;
2898 p->decode_coding_system = val; 2904 p->decode_coding_system = val;
2899 2905
@@ -2906,15 +2912,15 @@ usage: (make-serial-process &rest ARGS) */)
2906 } 2912 }
2907 else if (!NILP (Vcoding_system_for_write)) 2913 else if (!NILP (Vcoding_system_for_write))
2908 val = Vcoding_system_for_write; 2914 val = Vcoding_system_for_write;
2909 else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) 2915 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2910 || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) 2916 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2911 val = Qnil; 2917 val = Qnil;
2912 p->encode_coding_system = val; 2918 p->encode_coding_system = val;
2913 2919
2914 setup_process_coding_systems (proc); 2920 setup_process_coding_systems (proc);
2915 p->decoding_buf = make_uninit_string (0); 2921 p->decoding_buf = empty_unibyte_string;
2916 p->decoding_carryover = 0; 2922 p->decoding_carryover = 0;
2917 p->encoding_buf = make_uninit_string (0); 2923 p->encoding_buf = empty_unibyte_string;
2918 p->inherit_coding_system_flag 2924 p->inherit_coding_system_flag
2919 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 2925 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
2920 2926
@@ -3717,8 +3723,8 @@ usage: (make-network-process &rest ARGS) */)
3717 } 3723 }
3718 else if (!NILP (Vcoding_system_for_read)) 3724 else if (!NILP (Vcoding_system_for_read))
3719 val = Vcoding_system_for_read; 3725 val = Vcoding_system_for_read;
3720 else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) 3726 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
3721 || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) 3727 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
3722 /* We dare not decode end-of-line format by setting VAL to 3728 /* We dare not decode end-of-line format by setting VAL to
3723 Qraw_text, because the existing Emacs Lisp libraries 3729 Qraw_text, because the existing Emacs Lisp libraries
3724 assume that they receive bare code including a sequene of 3730 assume that they receive bare code including a sequene of
@@ -3753,7 +3759,7 @@ usage: (make-network-process &rest ARGS) */)
3753 } 3759 }
3754 else if (!NILP (Vcoding_system_for_write)) 3760 else if (!NILP (Vcoding_system_for_write))
3755 val = Vcoding_system_for_write; 3761 val = Vcoding_system_for_write;
3756 else if (NILP (current_buffer->enable_multibyte_characters)) 3762 else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
3757 val = Qnil; 3763 val = Qnil;
3758 else 3764 else
3759 { 3765 {
@@ -3781,9 +3787,9 @@ usage: (make-network-process &rest ARGS) */)
3781 } 3787 }
3782 setup_process_coding_systems (proc); 3788 setup_process_coding_systems (proc);
3783 3789
3784 p->decoding_buf = make_uninit_string (0); 3790 p->decoding_buf = empty_unibyte_string;
3785 p->decoding_carryover = 0; 3791 p->decoding_carryover = 0;
3786 p->encoding_buf = make_uninit_string (0); 3792 p->encoding_buf = empty_unibyte_string;
3787 3793
3788 p->inherit_coding_system_flag 3794 p->inherit_coding_system_flag
3789 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3795 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4358,9 +4364,9 @@ server_accept_connection (Lisp_Object server, int channel)
4358 p->encode_coding_system = ps->encode_coding_system; 4364 p->encode_coding_system = ps->encode_coding_system;
4359 setup_process_coding_systems (proc); 4365 setup_process_coding_systems (proc);
4360 4366
4361 p->decoding_buf = make_uninit_string (0); 4367 p->decoding_buf = empty_unibyte_string;
4362 p->decoding_carryover = 0; 4368 p->decoding_carryover = 0;
4363 p->encoding_buf = make_uninit_string (0); 4369 p->encoding_buf = empty_unibyte_string;
4364 4370
4365 p->inherit_coding_system_flag 4371 p->inherit_coding_system_flag
4366 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4372 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -5262,7 +5268,7 @@ read_process_output (Lisp_Object proc, register int channel)
5262 /* No need to gcpro these, because all we do with them later 5268 /* No need to gcpro these, because all we do with them later
5263 is test them for EQness, and none of them should be a string. */ 5269 is test them for EQness, and none of them should be a string. */
5264 XSETBUFFER (obuffer, current_buffer); 5270 XSETBUFFER (obuffer, current_buffer);
5265 okeymap = current_buffer->keymap; 5271 okeymap = BVAR (current_buffer, keymap);
5266 5272
5267 /* We inhibit quit here instead of just catching it so that 5273 /* We inhibit quit here instead of just catching it so that
5268 hitting ^G when a filter happens to be running won't screw 5274 hitting ^G when a filter happens to be running won't screw
@@ -5353,7 +5359,7 @@ read_process_output (Lisp_Object proc, register int channel)
5353 } 5359 }
5354 5360
5355 /* If no filter, write into buffer if it isn't dead. */ 5361 /* If no filter, write into buffer if it isn't dead. */
5356 else if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) 5362 else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name)))
5357 { 5363 {
5358 Lisp_Object old_read_only; 5364 Lisp_Object old_read_only;
5359 EMACS_INT old_begv, old_zv; 5365 EMACS_INT old_begv, old_zv;
@@ -5366,13 +5372,13 @@ read_process_output (Lisp_Object proc, register int channel)
5366 Fset_buffer (p->buffer); 5372 Fset_buffer (p->buffer);
5367 opoint = PT; 5373 opoint = PT;
5368 opoint_byte = PT_BYTE; 5374 opoint_byte = PT_BYTE;
5369 old_read_only = current_buffer->read_only; 5375 old_read_only = BVAR (current_buffer, read_only);
5370 old_begv = BEGV; 5376 old_begv = BEGV;
5371 old_zv = ZV; 5377 old_zv = ZV;
5372 old_begv_byte = BEGV_BYTE; 5378 old_begv_byte = BEGV_BYTE;
5373 old_zv_byte = ZV_BYTE; 5379 old_zv_byte = ZV_BYTE;
5374 5380
5375 current_buffer->read_only = Qnil; 5381 BVAR (current_buffer, read_only) = Qnil;
5376 5382
5377 /* Insert new output into buffer 5383 /* Insert new output into buffer
5378 at the current end-of-output marker, 5384 at the current end-of-output marker,
@@ -5417,7 +5423,7 @@ read_process_output (Lisp_Object proc, register int channel)
5417 p->decoding_carryover = coding->carryover_bytes; 5423 p->decoding_carryover = coding->carryover_bytes;
5418 } 5424 }
5419 /* Adjust the multibyteness of TEXT to that of the buffer. */ 5425 /* Adjust the multibyteness of TEXT to that of the buffer. */
5420 if (NILP (current_buffer->enable_multibyte_characters) 5426 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
5421 != ! STRING_MULTIBYTE (text)) 5427 != ! STRING_MULTIBYTE (text))
5422 text = (STRING_MULTIBYTE (text) 5428 text = (STRING_MULTIBYTE (text)
5423 ? Fstring_as_unibyte (text) 5429 ? Fstring_as_unibyte (text)
@@ -5461,7 +5467,7 @@ read_process_output (Lisp_Object proc, register int channel)
5461 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5467 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5462 5468
5463 5469
5464 current_buffer->read_only = old_read_only; 5470 BVAR (current_buffer, read_only) = old_read_only;
5465 SET_PT_BOTH (opoint, opoint_byte); 5471 SET_PT_BOTH (opoint, opoint_byte);
5466 } 5472 }
5467 /* Handling the process output should not deactivate the mark. */ 5473 /* Handling the process output should not deactivate the mark. */
@@ -5519,7 +5525,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5519 5525
5520 if ((STRINGP (object) && STRING_MULTIBYTE (object)) 5526 if ((STRINGP (object) && STRING_MULTIBYTE (object))
5521 || (BUFFERP (object) 5527 || (BUFFERP (object)
5522 && !NILP (XBUFFER (object)->enable_multibyte_characters)) 5528 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
5523 || EQ (object, Qt)) 5529 || EQ (object, Qt))
5524 { 5530 {
5525 p->encode_coding_system 5531 p->encode_coding_system
@@ -6558,7 +6564,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6558 is test them for EQness, and none of them should be a string. */ 6564 is test them for EQness, and none of them should be a string. */
6559 odeactivate = Vdeactivate_mark; 6565 odeactivate = Vdeactivate_mark;
6560 XSETBUFFER (obuffer, current_buffer); 6566 XSETBUFFER (obuffer, current_buffer);
6561 okeymap = current_buffer->keymap; 6567 okeymap = BVAR (current_buffer, keymap);
6562 6568
6563 /* There's no good reason to let sentinels change the current 6569 /* There's no good reason to let sentinels change the current
6564 buffer, and many callers of accept-process-output, sit-for, and 6570 buffer, and many callers of accept-process-output, sit-for, and
@@ -6708,7 +6714,7 @@ status_notify (struct Lisp_Process *deleting_process)
6708 6714
6709 /* Avoid error if buffer is deleted 6715 /* Avoid error if buffer is deleted
6710 (probably that's why the process is dead, too) */ 6716 (probably that's why the process is dead, too) */
6711 if (NILP (XBUFFER (buffer)->name)) 6717 if (NILP (BVAR (XBUFFER (buffer), name)))
6712 continue; 6718 continue;
6713 Fset_buffer (buffer); 6719 Fset_buffer (buffer);
6714 6720
@@ -6725,13 +6731,13 @@ status_notify (struct Lisp_Process *deleting_process)
6725 before = PT; 6731 before = PT;
6726 before_byte = PT_BYTE; 6732 before_byte = PT_BYTE;
6727 6733
6728 tem = current_buffer->read_only; 6734 tem = BVAR (current_buffer, read_only);
6729 current_buffer->read_only = Qnil; 6735 BVAR (current_buffer, read_only) = Qnil;
6730 insert_string ("\nProcess "); 6736 insert_string ("\nProcess ");
6731 Finsert (1, &p->name); 6737 Finsert (1, &p->name);
6732 insert_string (" "); 6738 insert_string (" ");
6733 Finsert (1, &msg); 6739 Finsert (1, &msg);
6734 current_buffer->read_only = tem; 6740 BVAR (current_buffer, read_only) = tem;
6735 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6741 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6736 6742
6737 if (opoint >= before) 6743 if (opoint >= before)
@@ -7130,7 +7136,7 @@ setup_process_coding_systems (Lisp_Object process)
7130 ; 7136 ;
7131 else if (BUFFERP (p->buffer)) 7137 else if (BUFFERP (p->buffer))
7132 { 7138 {
7133 if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters)) 7139 if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters)))
7134 coding_system = raw_text_coding_system (coding_system); 7140 coding_system = raw_text_coding_system (coding_system);
7135 } 7141 }
7136 setup_coding_system (coding_system, proc_decode_coding_system[inch]); 7142 setup_coding_system (coding_system, proc_decode_coding_system[inch]);
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index c62aee249c5..443fc034570 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -41,12 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41 41
42/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ 42/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */
43#define HAVE_SOCKETS 43#define HAVE_SOCKETS
44
45/* The file containing the kernel's symbol table is called /unix. */
46#define KERNEL_FILE "/unix"
47
48/* The kernel symbol where the load average is found is named avenrun. */
49#define LDAV_SYMBOL "avenrun"
50 44
51/* Special items needed to make Emacs run on this system. */ 45/* Special items needed to make Emacs run on this system. */
52 46
@@ -86,4 +80,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
86 Emacs currently calls xrealloc on the results of get_current_dir name, 80 Emacs currently calls xrealloc on the results of get_current_dir name,
87 to avoid a crash just use the Emacs implementation for that function. */ 81 to avoid a crash just use the Emacs implementation for that function. */
88#define BROKEN_GET_CURRENT_DIR_NAME 1 82#define BROKEN_GET_CURRENT_DIR_NAME 1
89
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
index 7d472c83ed1..0cca005b423 100644
--- a/src/s/bsd-common.h
+++ b/src/s/bsd-common.h
@@ -37,10 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#define TABDLY OXTABS 37#define TABDLY OXTABS
38#define TAB3 OXTABS 38#define TAB3 OXTABS
39 39
40/* These aren't needed, since we have getloadavg. */
41#undef KERNEL_FILE
42#undef LDAV_SYMBOL
43
44#define NO_TERMIO 40#define NO_TERMIO
45 41
46/* If the system's imake configuration file defines `NeedWidePrototypes' 42/* If the system's imake configuration file defines `NeedWidePrototypes'
@@ -72,12 +68,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
72 a file that someone else has modified in his Emacs. */ 68 a file that someone else has modified in his Emacs. */
73#define CLASH_DETECTION 69#define CLASH_DETECTION
74 70
75/* The file containing the kernel's symbol table is called /vmunix. */
76#define KERNEL_FILE "/vmunix"
77
78/* The kernel symbol where the load average is found is named _avenrun. */
79#define LDAV_SYMBOL "_avenrun"
80
81/* Send signals to subprocesses by "typing" special chars at them. */ 71/* Send signals to subprocesses by "typing" special chars at them. */
82#define SIGNALS_VIA_CHARACTERS 72#define SIGNALS_VIA_CHARACTERS
83
diff --git a/src/s/freebsd.h b/src/s/freebsd.h
index 222ebc91c4a..24b34e02f69 100644
--- a/src/s/freebsd.h
+++ b/src/s/freebsd.h
@@ -25,8 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25 25
26#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 26#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
27 27
28#define HAVE_GETLOADAVG 1
29
30/* This silences a few compilation warnings. */ 28/* This silences a few compilation warnings. */
31#undef BSD_SYSTEM 29#undef BSD_SYSTEM
32#if __FreeBSD__ == 1 30#if __FreeBSD__ == 1
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index d745f8d09c4..1cd91a41b55 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -47,9 +47,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
47 a file that someone else has modified in his Emacs. */ 47 a file that someone else has modified in his Emacs. */
48#define CLASH_DETECTION 48#define CLASH_DETECTION
49 49
50/* The symbol in the kernel where the load average is found
51 depends on the cpu type, so we let the m- files define LDAV_SYMBOL. */
52
53/* Special hacks needed to make Emacs run on this system. */ 50/* Special hacks needed to make Emacs run on this system. */
54 51
55/* In hpux, the symbol SIGIO is defined, but the feature 52/* In hpux, the symbol SIGIO is defined, but the feature
@@ -91,9 +88,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
91#undef random 88#undef random
92#undef HAVE_RANDOM 89#undef HAVE_RANDOM
93 90
94/* AlainF 20-Jul-1996 says this is right. */
95#define KERNEL_FILE "/stand/vmunix"
96
97 91
98/* Rainer Malzbender <rainer@displaytech.com> says definining 92/* Rainer Malzbender <rainer@displaytech.com> says definining
99 HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC. */ 93 HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC. */
@@ -119,18 +113,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
119#define DATA_SEG_BITS 0x40000000 113#define DATA_SEG_BITS 0x40000000
120 114
121#define DATA_START 0x40000000 115#define DATA_START 0x40000000
122
123/* Data type of load average, as read out of kmem. */
124#define LOAD_AVE_TYPE double
125
126/* Convert that into an integer that is 100 for a load average of 1.0 */
127#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
128
129/* The kernel symbol where the load average is found is named _avenrun.
130 At this time there are two major flavors of hp-ux (there is the s800
131 and s300 (s200) flavors). The differences are thusly moved to the
132 corresponding machine description file. */
133
134/* No underscore please. */
135#define LDAV_SYMBOL "avenrun"
136
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 4c3b84dfe4c..8b189baea46 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -181,8 +181,6 @@ struct sigaction {
181#define HAVE_MENUS 1 181#define HAVE_MENUS 1
182#endif 182#endif
183 183
184#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
185
186/* Get some redefinitions in place. */ 184/* Get some redefinitions in place. */
187 185
188#ifdef emacs 186#ifdef emacs
@@ -348,6 +346,8 @@ extern char *get_emacs_configuration_options (void);
348#endif 346#endif
349#include <string.h> 347#include <string.h>
350 348
349extern int getloadavg (double *, int);
350
351/* We need a little extra space, see ../../lisp/loadup.el. */ 351/* We need a little extra space, see ../../lisp/loadup.el. */
352#define SYSTEM_PURESIZE_EXTRA 50000 352#define SYSTEM_PURESIZE_EXTRA 50000
353 353
diff --git a/src/s/msdos.h b/src/s/msdos.h
index 88afaa83455..8debd28dccb 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -73,6 +73,15 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
73#define HAVE_INVERSE_HYPERBOLIC 73#define HAVE_INVERSE_HYPERBOLIC
74#define FLOAT_CHECK_DOMAIN 74#define FLOAT_CHECK_DOMAIN
75 75
76/* Start of gnulib-related stuff */
77
78/* lib/ftoastr.c wants strtold, but DJGPP only has _strtold. DJGPP >
79 2.03 has it, but it also has _strtold as a stub that jumps to
80 strtold, so use _strtold in all versions. */
81#define strtold _strtold
82
83/* End of gnulib-related stuff. */
84
76/* When $TERM is "internal" then this is substituted: */ 85/* When $TERM is "internal" then this is substituted: */
77#define INTERNAL_TERMINAL "pc|bios|IBM PC with color display:\ 86#define INTERNAL_TERMINAL "pc|bios|IBM PC with color display:\
78:co#80:li#25:Co#16:pa#256:km:ms:cm=<CM>:cl=<CL>:ce=<CE>:\ 87:co#80:li#25:Co#16:pa#256:km:ms:cm=<CM>:cl=<CL>:ce=<CE>:\
@@ -92,7 +101,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
92 101
93 102
94/* Mode line description of a buffer's type. */ 103/* Mode line description of a buffer's type. */
95#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") 104#define MODE_LINE_BINARY_TEXT(buf) (NILP(B_(buf,buffer_file_type)) ? "T" : "B")
96 105
97/* We have (the code to control) a mouse. */ 106/* We have (the code to control) a mouse. */
98#define HAVE_MOUSE 107#define HAVE_MOUSE
diff --git a/src/s/netbsd.h b/src/s/netbsd.h
index 8a639b93c84..52cda717a2d 100644
--- a/src/s/netbsd.h
+++ b/src/s/netbsd.h
@@ -21,8 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21/* Get most of the stuff from bsd-common. */ 21/* Get most of the stuff from bsd-common. */
22#include "bsd-common.h" 22#include "bsd-common.h"
23 23
24#define HAVE_GETLOADAVG 1
25
26#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 24#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
27 25
28#define DEFAULT_SOUND_DEVICE "/dev/audio" 26#define DEFAULT_SOUND_DEVICE "/dev/audio"
@@ -43,4 +41,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
43 41
44/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */ 42/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method. */
45#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 43#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
46
diff --git a/src/s/unixware.h b/src/s/unixware.h
index c6130669a9a..407282ff78c 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -49,14 +49,4 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
49 pty_name[sizeof(pty_name) - 1] = 0; \ 49 pty_name[sizeof(pty_name) - 1] = 0; \
50 } 50 }
51 51
52/* Data type of load average, as read out of kmem. */
53#define LOAD_AVE_TYPE long
54
55/* Convert that into an integer that is 100 for a load average of 1.0 */
56/* This is totally uncalibrated. */
57#define LOAD_AVE_CVT(x) ((int) (((double) (x)) * 100.0 / FSCALE))
58#define FSCALE 256.0
59
60
61#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base) 52#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
62
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index 12f73c1b3b5..aeedd7f4b15 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -30,12 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30 It sets the Lisp variable system-type. */ 30 It sets the Lisp variable system-type. */
31#define SYSTEM_TYPE "usg-unix-v" 31#define SYSTEM_TYPE "usg-unix-v"
32 32
33/* The file containing the kernel's symbol table is called /unix. */
34#define KERNEL_FILE "/unix"
35
36/* The kernel symbol where the load average is found is named avenrun. */
37#define LDAV_SYMBOL "avenrun"
38
39/* setjmp and longjmp can safely replace _setjmp and _longjmp, 33/* setjmp and longjmp can safely replace _setjmp and _longjmp,
40 but they will run slower. */ 34 but they will run slower. */
41#define _setjmp setjmp 35#define _setjmp setjmp
@@ -105,4 +99,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
105 99
106/* This definition was suggested for next release. So give it a try. */ 100/* This definition was suggested for next release. So give it a try. */
107#define HAVE_SOCKETS 101#define HAVE_SOCKETS
108
diff --git a/src/search.c b/src/search.c
index 09dae0ed0f5..1e2036f6dc2 100644
--- a/src/search.c
+++ b/src/search.c
@@ -157,7 +157,7 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object tra
157 157
158 /* If the compiled pattern hard codes some of the contents of the 158 /* If the compiled pattern hard codes some of the contents of the
159 syntax-table, it can only be reused with *this* syntax table. */ 159 syntax-table, it can only be reused with *this* syntax table. */
160 cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt; 160 cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt;
161 161
162 re_set_whitespace_regexp (NULL); 162 re_set_whitespace_regexp (NULL);
163 163
@@ -236,7 +236,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra
236 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) 236 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
237 && cp->posix == posix 237 && cp->posix == posix
238 && (EQ (cp->syntax_table, Qt) 238 && (EQ (cp->syntax_table, Qt)
239 || EQ (cp->syntax_table, current_buffer->syntax_table)) 239 || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table)))
240 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)) 240 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))
241 && cp->buf.charset_unibyte == charset_unibyte) 241 && cp->buf.charset_unibyte == charset_unibyte)
242 break; 242 break;
@@ -285,17 +285,17 @@ looking_at_1 (Lisp_Object string, int posix)
285 save_search_regs (); 285 save_search_regs ();
286 286
287 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 287 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
288 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] 288 XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2]
289 = current_buffer->case_eqv_table; 289 = BVAR (current_buffer, case_eqv_table);
290 290
291 CHECK_STRING (string); 291 CHECK_STRING (string);
292 bufp = compile_pattern (string, 292 bufp = compile_pattern (string,
293 (NILP (Vinhibit_changing_match_data) 293 (NILP (Vinhibit_changing_match_data)
294 ? &search_regs : NULL), 294 ? &search_regs : NULL),
295 (!NILP (current_buffer->case_fold_search) 295 (!NILP (BVAR (current_buffer, case_fold_search))
296 ? current_buffer->case_canon_table : Qnil), 296 ? BVAR (current_buffer, case_canon_table) : Qnil),
297 posix, 297 posix,
298 !NILP (current_buffer->enable_multibyte_characters)); 298 !NILP (BVAR (current_buffer, enable_multibyte_characters)));
299 299
300 immediate_quit = 1; 300 immediate_quit = 1;
301 QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */ 301 QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */
@@ -400,14 +400,14 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int p
400 } 400 }
401 401
402 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 402 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
403 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] 403 XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2]
404 = current_buffer->case_eqv_table; 404 = BVAR (current_buffer, case_eqv_table);
405 405
406 bufp = compile_pattern (regexp, 406 bufp = compile_pattern (regexp,
407 (NILP (Vinhibit_changing_match_data) 407 (NILP (Vinhibit_changing_match_data)
408 ? &search_regs : NULL), 408 ? &search_regs : NULL),
409 (!NILP (current_buffer->case_fold_search) 409 (!NILP (BVAR (current_buffer, case_fold_search))
410 ? current_buffer->case_canon_table : Qnil), 410 ? BVAR (current_buffer, case_canon_table) : Qnil),
411 posix, 411 posix,
412 STRING_MULTIBYTE (string)); 412 STRING_MULTIBYTE (string));
413 immediate_quit = 1; 413 immediate_quit = 1;
@@ -586,7 +586,7 @@ fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_IN
586 s2 = 0; 586 s2 = 0;
587 } 587 }
588 re_match_object = Qnil; 588 re_match_object = Qnil;
589 multibyte = ! NILP (current_buffer->enable_multibyte_characters); 589 multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
590 } 590 }
591 591
592 buf = compile_pattern (regexp, 0, Qnil, 0, multibyte); 592 buf = compile_pattern (regexp, 0, Qnil, 0, multibyte);
@@ -608,7 +608,7 @@ fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_IN
608static void 608static void
609newline_cache_on_off (struct buffer *buf) 609newline_cache_on_off (struct buffer *buf)
610{ 610{
611 if (NILP (buf->cache_long_line_scans)) 611 if (NILP (BVAR (buf, cache_long_line_scans)))
612 { 612 {
613 /* It should be off. */ 613 /* It should be off. */
614 if (buf->newline_cache) 614 if (buf->newline_cache)
@@ -996,15 +996,15 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
996 } 996 }
997 997
998 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 998 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
999 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] 999 XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2]
1000 = current_buffer->case_eqv_table; 1000 = BVAR (current_buffer, case_eqv_table);
1001 1001
1002 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, 1002 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,
1003 (!NILP (current_buffer->case_fold_search) 1003 (!NILP (BVAR (current_buffer, case_fold_search))
1004 ? current_buffer->case_canon_table 1004 ? BVAR (current_buffer, case_canon_table)
1005 : Qnil), 1005 : Qnil),
1006 (!NILP (current_buffer->case_fold_search) 1006 (!NILP (BVAR (current_buffer, case_fold_search))
1007 ? current_buffer->case_eqv_table 1007 ? BVAR (current_buffer, case_eqv_table)
1008 : Qnil), 1008 : Qnil),
1009 posix); 1009 posix);
1010 if (np <= 0) 1010 if (np <= 0)
@@ -1133,7 +1133,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1133 (NILP (Vinhibit_changing_match_data) 1133 (NILP (Vinhibit_changing_match_data)
1134 ? &search_regs : &search_regs_1), 1134 ? &search_regs : &search_regs_1),
1135 trt, posix, 1135 trt, posix,
1136 !NILP (current_buffer->enable_multibyte_characters)); 1136 !NILP (BVAR (current_buffer, enable_multibyte_characters)));
1137 1137
1138 immediate_quit = 1; /* Quit immediately if user types ^G, 1138 immediate_quit = 1; /* Quit immediately if user types ^G,
1139 because letting this function finish 1139 because letting this function finish
@@ -1254,7 +1254,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
1254 EMACS_INT raw_pattern_size; 1254 EMACS_INT raw_pattern_size;
1255 EMACS_INT raw_pattern_size_byte; 1255 EMACS_INT raw_pattern_size_byte;
1256 unsigned char *patbuf; 1256 unsigned char *patbuf;
1257 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 1257 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
1258 unsigned char *base_pat; 1258 unsigned char *base_pat;
1259 /* Set to positive if we find a non-ASCII char that need 1259 /* Set to positive if we find a non-ASCII char that need
1260 translation. Otherwise set to zero later. */ 1260 translation. Otherwise set to zero later. */
@@ -1451,7 +1451,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
1451 EMACS_INT pos, EMACS_INT pos_byte, 1451 EMACS_INT pos, EMACS_INT pos_byte,
1452 EMACS_INT lim, EMACS_INT lim_byte) 1452 EMACS_INT lim, EMACS_INT lim_byte)
1453{ 1453{
1454 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 1454 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
1455 int forward = n > 0; 1455 int forward = n > 0;
1456 /* Number of buffer bytes matched. Note that this may be different 1456 /* Number of buffer bytes matched. Note that this may be different
1457 from len_byte in a multibyte buffer. */ 1457 from len_byte in a multibyte buffer. */
@@ -1671,7 +1671,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1671 register EMACS_INT i; 1671 register EMACS_INT i;
1672 register int j; 1672 register int j;
1673 unsigned char *pat, *pat_end; 1673 unsigned char *pat, *pat_end;
1674 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 1674 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
1675 1675
1676 unsigned char simple_translate[0400]; 1676 unsigned char simple_translate[0400];
1677 /* These are set to the preceding bytes of a byte to be translated 1677 /* These are set to the preceding bytes of a byte to be translated
@@ -2639,7 +2639,7 @@ since only regular expressions have distinguished subexpressions. */)
2639 EMACS_INT length = SBYTES (newtext); 2639 EMACS_INT length = SBYTES (newtext);
2640 unsigned char *substed; 2640 unsigned char *substed;
2641 EMACS_INT substed_alloc_size, substed_len; 2641 EMACS_INT substed_alloc_size, substed_len;
2642 int buf_multibyte = !NILP (current_buffer->enable_multibyte_characters); 2642 int buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2643 int str_multibyte = STRING_MULTIBYTE (newtext); 2643 int str_multibyte = STRING_MULTIBYTE (newtext);
2644 Lisp_Object rev_tbl; 2644 Lisp_Object rev_tbl;
2645 int really_changed = 0; 2645 int really_changed = 0;
diff --git a/src/syntax.c b/src/syntax.c
index 2f47d73d695..707c2c19f31 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -277,7 +277,7 @@ update_syntax_table (EMACS_INT charpos, int count, int init,
277 else 277 else
278 { 278 {
279 gl_state.use_global = 0; 279 gl_state.use_global = 0;
280 gl_state.current_syntax_table = current_buffer->syntax_table; 280 gl_state.current_syntax_table = BVAR (current_buffer, syntax_table);
281 } 281 }
282 } 282 }
283 283
@@ -363,7 +363,7 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
363static INLINE EMACS_INT 363static INLINE EMACS_INT
364dec_bytepos (EMACS_INT bytepos) 364dec_bytepos (EMACS_INT bytepos)
365{ 365{
366 if (NILP (current_buffer->enable_multibyte_characters)) 366 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
367 return bytepos - 1; 367 return bytepos - 1;
368 368
369 DEC_POS (bytepos); 369 DEC_POS (bytepos);
@@ -779,7 +779,7 @@ DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
779This is the one specified by the current buffer. */) 779This is the one specified by the current buffer. */)
780 (void) 780 (void)
781{ 781{
782 return current_buffer->syntax_table; 782 return BVAR (current_buffer, syntax_table);
783} 783}
784 784
785DEFUN ("standard-syntax-table", Fstandard_syntax_table, 785DEFUN ("standard-syntax-table", Fstandard_syntax_table,
@@ -824,7 +824,7 @@ One argument, a syntax table. */)
824{ 824{
825 int idx; 825 int idx;
826 check_syntax_table (table); 826 check_syntax_table (table);
827 current_buffer->syntax_table = table; 827 BVAR (current_buffer, syntax_table) = table;
828 /* Indicate that this buffer now has a specified syntax table. */ 828 /* Indicate that this buffer now has a specified syntax table. */
829 idx = PER_BUFFER_VAR_IDX (syntax_table); 829 idx = PER_BUFFER_VAR_IDX (syntax_table);
830 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 830 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -1035,7 +1035,7 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */)
1035 CHECK_CHARACTER (c); 1035 CHECK_CHARACTER (c);
1036 1036
1037 if (NILP (syntax_table)) 1037 if (NILP (syntax_table))
1038 syntax_table = current_buffer->syntax_table; 1038 syntax_table = BVAR (current_buffer, syntax_table);
1039 else 1039 else
1040 check_syntax_table (syntax_table); 1040 check_syntax_table (syntax_table);
1041 1041
@@ -1450,7 +1450,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1450 if (XINT (lim) < BEGV) 1450 if (XINT (lim) < BEGV)
1451 XSETFASTINT (lim, BEGV); 1451 XSETFASTINT (lim, BEGV);
1452 1452
1453 multibyte = (!NILP (current_buffer->enable_multibyte_characters) 1453 multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
1454 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); 1454 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
1455 string_multibyte = SBYTES (string) > SCHARS (string); 1455 string_multibyte = SBYTES (string) > SCHARS (string);
1456 1456
@@ -1936,7 +1936,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
1936 if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim))) 1936 if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim)))
1937 return make_number (0); 1937 return make_number (0);
1938 1938
1939 multibyte = (!NILP (current_buffer->enable_multibyte_characters) 1939 multibyte = (!NILP (BVAR (current_buffer, enable_multibyte_characters))
1940 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); 1940 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
1941 1941
1942 memset (fastmap, 0, sizeof fastmap); 1942 memset (fastmap, 0, sizeof fastmap);
@@ -2703,7 +2703,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2703 while (from > stop) 2703 while (from > stop)
2704 { 2704 {
2705 temp_pos = from_byte; 2705 temp_pos = from_byte;
2706 if (! NILP (current_buffer->enable_multibyte_characters)) 2706 if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
2707 DEC_POS (temp_pos); 2707 DEC_POS (temp_pos);
2708 else 2708 else
2709 temp_pos--; 2709 temp_pos--;
diff --git a/src/syntax.h b/src/syntax.h
index bea66d1fada..e8726bb28a4 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -24,7 +24,7 @@ extern void update_syntax_table (EMACS_INT, int, int, Lisp_Object);
24 24
25/* The standard syntax table is stored where it will automatically 25/* The standard syntax table is stored where it will automatically
26 be used in all new buffers. */ 26 be used in all new buffers. */
27#define Vstandard_syntax_table buffer_defaults.syntax_table 27#define Vstandard_syntax_table BVAR (&buffer_defaults, syntax_table)
28 28
29/* A syntax table is a chartable whose elements are cons cells 29/* A syntax table is a chartable whose elements are cons cells
30 (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char 30 (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char
@@ -79,7 +79,7 @@ enum syntaxcode
79# define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table 79# define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table
80#else 80#else
81# define SYNTAX_ENTRY SYNTAX_ENTRY_INT 81# define SYNTAX_ENTRY SYNTAX_ENTRY_INT
82# define CURRENT_SYNTAX_TABLE current_buffer->syntax_table 82# define CURRENT_SYNTAX_TABLE BVAR (current_buffer, syntax_table)
83#endif 83#endif
84 84
85#define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c)) 85#define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c))
@@ -204,7 +204,7 @@ extern char syntax_code_spec[16];
204do \ 204do \
205 { \ 205 { \
206 gl_state.use_global = 0; \ 206 gl_state.use_global = 0; \
207 gl_state.current_syntax_table = current_buffer->syntax_table; \ 207 gl_state.current_syntax_table = BVAR (current_buffer, syntax_table); \
208 } while (0) 208 } while (0)
209 209
210/* This macro should be called with FROM at the start of forward 210/* This macro should be called with FROM at the start of forward
diff --git a/src/term.c b/src/term.c
index 1aefe02421f..f082bb40e89 100644
--- a/src/term.c
+++ b/src/term.c
@@ -112,10 +112,7 @@ static void vfatal (const char *str, va_list ap) NO_RETURN;
112#define OUTPUT_IF(tty, a) \ 112#define OUTPUT_IF(tty, a) \
113 do { \ 113 do { \
114 if (a) \ 114 if (a) \
115 emacs_tputs ((tty), a, \ 115 OUTPUT (tty, a); \
116 (int) (FRAME_LINES (XFRAME (selected_frame)) \
117 - curY (tty) ), \
118 cmputc); \
119 } while (0) 116 } while (0)
120 117
121#define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0) 118#define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
@@ -1350,14 +1347,14 @@ term_get_fkeys_1 (void)
1350 KBOARD *kboard = term_get_fkeys_kboard; 1347 KBOARD *kboard = term_get_fkeys_kboard;
1351 1348
1352 /* This can happen if CANNOT_DUMP or with strange options. */ 1349 /* This can happen if CANNOT_DUMP or with strange options. */
1353 if (!KEYMAPP (kboard->Vinput_decode_map)) 1350 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
1354 kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil); 1351 KVAR (kboard, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
1355 1352
1356 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) 1353 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
1357 { 1354 {
1358 char *sequence = tgetstr (keys[i].cap, address); 1355 char *sequence = tgetstr (keys[i].cap, address);
1359 if (sequence) 1356 if (sequence)
1360 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), 1357 Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
1361 Fmake_vector (make_number (1), 1358 Fmake_vector (make_number (1),
1362 intern (keys[i].name))); 1359 intern (keys[i].name)));
1363 } 1360 }
@@ -1377,13 +1374,13 @@ term_get_fkeys_1 (void)
1377 if (k0) 1374 if (k0)
1378 /* Define f0 first, so that f10 takes precedence in case the 1375 /* Define f0 first, so that f10 takes precedence in case the
1379 key sequences happens to be the same. */ 1376 key sequences happens to be the same. */
1380 Fdefine_key (kboard->Vinput_decode_map, build_string (k0), 1377 Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
1381 Fmake_vector (make_number (1), intern ("f0"))); 1378 Fmake_vector (make_number (1), intern ("f0")));
1382 Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi), 1379 Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi),
1383 Fmake_vector (make_number (1), intern ("f10"))); 1380 Fmake_vector (make_number (1), intern ("f10")));
1384 } 1381 }
1385 else if (k0) 1382 else if (k0)
1386 Fdefine_key (kboard->Vinput_decode_map, build_string (k0), 1383 Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
1387 Fmake_vector (make_number (1), intern (k0_name))); 1384 Fmake_vector (make_number (1), intern (k0_name)));
1388 } 1385 }
1389 1386
@@ -1406,7 +1403,7 @@ term_get_fkeys_1 (void)
1406 if (sequence) 1403 if (sequence)
1407 { 1404 {
1408 sprintf (fkey, "f%d", i); 1405 sprintf (fkey, "f%d", i);
1409 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), 1406 Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
1410 Fmake_vector (make_number (1), 1407 Fmake_vector (make_number (1),
1411 intern (fkey))); 1408 intern (fkey)));
1412 } 1409 }
@@ -1423,7 +1420,7 @@ term_get_fkeys_1 (void)
1423 { \ 1420 { \
1424 char *sequence = tgetstr (cap2, address); \ 1421 char *sequence = tgetstr (cap2, address); \
1425 if (sequence) \ 1422 if (sequence) \
1426 Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \ 1423 Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), \
1427 Fmake_vector (make_number (1), \ 1424 Fmake_vector (make_number (1), \
1428 intern (sym))); \ 1425 intern (sym))); \
1429 } 1426 }
@@ -3418,7 +3415,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3418 3415
3419 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 3416 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
3420 init_kboard (terminal->kboard); 3417 init_kboard (terminal->kboard);
3421 terminal->kboard->Vwindow_system = Qnil; 3418 KVAR (terminal->kboard, Vwindow_system) = Qnil;
3422 terminal->kboard->next_kboard = all_kboards; 3419 terminal->kboard->next_kboard = all_kboards;
3423 all_kboards = terminal->kboard; 3420 all_kboards = terminal->kboard;
3424 terminal->kboard->reference_count++; 3421 terminal->kboard->reference_count++;
diff --git a/src/termcap.c b/src/termcap.c
index 9e64d027640..69ce56d93b3 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -268,7 +268,6 @@ tputs (register char *str, int nlines, register int (*outfun) (/* ??? */))
268 register int padcount = 0; 268 register int padcount = 0;
269 register int speed; 269 register int speed;
270 270
271 extern EMACS_INT baud_rate;
272 speed = baud_rate; 271 speed = baud_rate;
273 /* For quite high speeds, convert to the smaller 272 /* For quite high speeds, convert to the smaller
274 units to avoid overflow. */ 273 units to avoid overflow. */
diff --git a/src/terminal.c b/src/terminal.c
index 09c57bc2b0c..309cc0095e8 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -223,6 +223,7 @@ struct terminal *
223create_terminal (void) 223create_terminal (void)
224{ 224{
225 struct terminal *terminal = allocate_terminal (); 225 struct terminal *terminal = allocate_terminal ();
226 Lisp_Object terminal_coding, keyboard_coding;
226 227
227 terminal->name = NULL; 228 terminal->name = NULL;
228 terminal->next_terminal = terminal_list; 229 terminal->next_terminal = terminal_list;
@@ -235,8 +236,24 @@ create_terminal (void)
235 terminal->terminal_coding = 236 terminal->terminal_coding =
236 (struct coding_system *) xmalloc (sizeof (struct coding_system)); 237 (struct coding_system *) xmalloc (sizeof (struct coding_system));
237 238
238 setup_coding_system (Qno_conversion, terminal->keyboard_coding); 239 /* If default coding systems for the terminal and the keyboard are
239 setup_coding_system (Qundecided, terminal->terminal_coding); 240 already defined, use them in preference to the defaults. This is
241 needed when Emacs runs in daemon mode. */
242 keyboard_coding =
243 find_symbol_value (intern ("default-keyboard-coding-system"));
244 if (NILP (keyboard_coding)
245 || EQ (keyboard_coding, Qunbound)
246 || NILP (Fcoding_system_p (keyboard_coding)))
247 keyboard_coding = Qno_conversion;
248 terminal_coding =
249 find_symbol_value (intern ("default-terminal-coding-system"));
250 if (NILP (terminal_coding)
251 || EQ (terminal_coding, Qunbound)
252 || NILP (Fcoding_system_p (terminal_coding)))
253 terminal_coding = Qundecided;
254
255 setup_coding_system (keyboard_coding, terminal->keyboard_coding);
256 setup_coding_system (terminal_coding, terminal->terminal_coding);
240 257
241 terminal->param_alist = Qnil; 258 terminal->param_alist = Qnil;
242 return terminal; 259 return terminal;
diff --git a/src/undo.c b/src/undo.c
index 933982ec30c..d11cd6f5570 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -73,12 +73,12 @@ record_point (EMACS_INT pt)
73 Fundo_boundary (); 73 Fundo_boundary ();
74 last_undo_buffer = current_buffer; 74 last_undo_buffer = current_buffer;
75 75
76 if (CONSP (current_buffer->undo_list)) 76 if (CONSP (BVAR (current_buffer, undo_list)))
77 { 77 {
78 /* Set AT_BOUNDARY to 1 only when we have nothing other than 78 /* Set AT_BOUNDARY to 1 only when we have nothing other than
79 marker adjustment before undo boundary. */ 79 marker adjustment before undo boundary. */
80 80
81 Lisp_Object tail = current_buffer->undo_list, elt; 81 Lisp_Object tail = BVAR (current_buffer, undo_list), elt;
82 82
83 while (1) 83 while (1)
84 { 84 {
@@ -103,8 +103,8 @@ record_point (EMACS_INT pt)
103 if (at_boundary 103 if (at_boundary
104 && current_buffer == last_boundary_buffer 104 && current_buffer == last_boundary_buffer
105 && last_boundary_position != pt) 105 && last_boundary_position != pt)
106 current_buffer->undo_list 106 BVAR (current_buffer, undo_list)
107 = Fcons (make_number (last_boundary_position), current_buffer->undo_list); 107 = Fcons (make_number (last_boundary_position), BVAR (current_buffer, undo_list));
108} 108}
109 109
110/* Record an insertion that just happened or is about to happen, 110/* Record an insertion that just happened or is about to happen,
@@ -117,17 +117,17 @@ record_insert (EMACS_INT beg, EMACS_INT length)
117{ 117{
118 Lisp_Object lbeg, lend; 118 Lisp_Object lbeg, lend;
119 119
120 if (EQ (current_buffer->undo_list, Qt)) 120 if (EQ (BVAR (current_buffer, undo_list), Qt))
121 return; 121 return;
122 122
123 record_point (beg); 123 record_point (beg);
124 124
125 /* If this is following another insertion and consecutive with it 125 /* If this is following another insertion and consecutive with it
126 in the buffer, combine the two. */ 126 in the buffer, combine the two. */
127 if (CONSP (current_buffer->undo_list)) 127 if (CONSP (BVAR (current_buffer, undo_list)))
128 { 128 {
129 Lisp_Object elt; 129 Lisp_Object elt;
130 elt = XCAR (current_buffer->undo_list); 130 elt = XCAR (BVAR (current_buffer, undo_list));
131 if (CONSP (elt) 131 if (CONSP (elt)
132 && INTEGERP (XCAR (elt)) 132 && INTEGERP (XCAR (elt))
133 && INTEGERP (XCDR (elt)) 133 && INTEGERP (XCDR (elt))
@@ -140,8 +140,8 @@ record_insert (EMACS_INT beg, EMACS_INT length)
140 140
141 XSETFASTINT (lbeg, beg); 141 XSETFASTINT (lbeg, beg);
142 XSETINT (lend, beg + length); 142 XSETINT (lend, beg + length);
143 current_buffer->undo_list = Fcons (Fcons (lbeg, lend), 143 BVAR (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend),
144 current_buffer->undo_list); 144 BVAR (current_buffer, undo_list));
145} 145}
146 146
147/* Record that a deletion is about to take place, 147/* Record that a deletion is about to take place,
@@ -152,7 +152,7 @@ record_delete (EMACS_INT beg, Lisp_Object string)
152{ 152{
153 Lisp_Object sbeg; 153 Lisp_Object sbeg;
154 154
155 if (EQ (current_buffer->undo_list, Qt)) 155 if (EQ (BVAR (current_buffer, undo_list), Qt))
156 return; 156 return;
157 157
158 if (PT == beg + SCHARS (string)) 158 if (PT == beg + SCHARS (string))
@@ -166,8 +166,8 @@ record_delete (EMACS_INT beg, Lisp_Object string)
166 record_point (beg); 166 record_point (beg);
167 } 167 }
168 168
169 current_buffer->undo_list 169 BVAR (current_buffer, undo_list)
170 = Fcons (Fcons (string, sbeg), current_buffer->undo_list); 170 = Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list));
171} 171}
172 172
173/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. 173/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -178,7 +178,7 @@ record_delete (EMACS_INT beg, Lisp_Object string)
178void 178void
179record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment) 179record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
180{ 180{
181 if (EQ (current_buffer->undo_list, Qt)) 181 if (EQ (BVAR (current_buffer, undo_list), Qt))
182 return; 182 return;
183 183
184 /* Allocate a cons cell to be the undo boundary after this command. */ 184 /* Allocate a cons cell to be the undo boundary after this command. */
@@ -189,9 +189,9 @@ record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
189 Fundo_boundary (); 189 Fundo_boundary ();
190 last_undo_buffer = current_buffer; 190 last_undo_buffer = current_buffer;
191 191
192 current_buffer->undo_list 192 BVAR (current_buffer, undo_list)
193 = Fcons (Fcons (marker, make_number (adjustment)), 193 = Fcons (Fcons (marker, make_number (adjustment)),
194 current_buffer->undo_list); 194 BVAR (current_buffer, undo_list));
195} 195}
196 196
197/* Record that a replacement is about to take place, 197/* Record that a replacement is about to take place,
@@ -215,7 +215,7 @@ record_first_change (void)
215 Lisp_Object high, low; 215 Lisp_Object high, low;
216 struct buffer *base_buffer = current_buffer; 216 struct buffer *base_buffer = current_buffer;
217 217
218 if (EQ (current_buffer->undo_list, Qt)) 218 if (EQ (BVAR (current_buffer, undo_list), Qt))
219 return; 219 return;
220 220
221 if (current_buffer != last_undo_buffer) 221 if (current_buffer != last_undo_buffer)
@@ -227,7 +227,7 @@ record_first_change (void)
227 227
228 XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff); 228 XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff);
229 XSETFASTINT (low, base_buffer->modtime & 0xffff); 229 XSETFASTINT (low, base_buffer->modtime & 0xffff);
230 current_buffer->undo_list = Fcons (Fcons (Qt, Fcons (high, low)), current_buffer->undo_list); 230 BVAR (current_buffer, undo_list) = Fcons (Fcons (Qt, Fcons (high, low)), BVAR (current_buffer, undo_list));
231} 231}
232 232
233/* Record a change in property PROP (whose old value was VAL) 233/* Record a change in property PROP (whose old value was VAL)
@@ -242,7 +242,7 @@ record_property_change (EMACS_INT beg, EMACS_INT length,
242 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); 242 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer);
243 int boundary = 0; 243 int boundary = 0;
244 244
245 if (EQ (buf->undo_list, Qt)) 245 if (EQ (BVAR (buf, undo_list), Qt))
246 return; 246 return;
247 247
248 /* Allocate a cons cell to be the undo boundary after this command. */ 248 /* Allocate a cons cell to be the undo boundary after this command. */
@@ -265,7 +265,7 @@ record_property_change (EMACS_INT beg, EMACS_INT length,
265 XSETINT (lbeg, beg); 265 XSETINT (lbeg, beg);
266 XSETINT (lend, beg + length); 266 XSETINT (lend, beg + length);
267 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); 267 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
268 current_buffer->undo_list = Fcons (entry, current_buffer->undo_list); 268 BVAR (current_buffer, undo_list) = Fcons (entry, BVAR (current_buffer, undo_list));
269 269
270 current_buffer = obuf; 270 current_buffer = obuf;
271} 271}
@@ -277,9 +277,9 @@ but another undo command will undo to the previous boundary. */)
277 (void) 277 (void)
278{ 278{
279 Lisp_Object tem; 279 Lisp_Object tem;
280 if (EQ (current_buffer->undo_list, Qt)) 280 if (EQ (BVAR (current_buffer, undo_list), Qt))
281 return Qnil; 281 return Qnil;
282 tem = Fcar (current_buffer->undo_list); 282 tem = Fcar (BVAR (current_buffer, undo_list));
283 if (!NILP (tem)) 283 if (!NILP (tem))
284 { 284 {
285 /* One way or another, cons nil onto the front of the undo list. */ 285 /* One way or another, cons nil onto the front of the undo list. */
@@ -287,12 +287,12 @@ but another undo command will undo to the previous boundary. */)
287 { 287 {
288 /* If we have preallocated the cons cell to use here, 288 /* If we have preallocated the cons cell to use here,
289 use that one. */ 289 use that one. */
290 XSETCDR (pending_boundary, current_buffer->undo_list); 290 XSETCDR (pending_boundary, BVAR (current_buffer, undo_list));
291 current_buffer->undo_list = pending_boundary; 291 BVAR (current_buffer, undo_list) = pending_boundary;
292 pending_boundary = Qnil; 292 pending_boundary = Qnil;
293 } 293 }
294 else 294 else
295 current_buffer->undo_list = Fcons (Qnil, current_buffer->undo_list); 295 BVAR (current_buffer, undo_list) = Fcons (Qnil, BVAR (current_buffer, undo_list));
296 } 296 }
297 last_boundary_position = PT; 297 last_boundary_position = PT;
298 last_boundary_buffer = current_buffer; 298 last_boundary_buffer = current_buffer;
@@ -321,7 +321,7 @@ truncate_undo_list (struct buffer *b)
321 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); 321 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
322 set_buffer_internal (b); 322 set_buffer_internal (b);
323 323
324 list = b->undo_list; 324 list = BVAR (b, undo_list);
325 325
326 prev = Qnil; 326 prev = Qnil;
327 next = list; 327 next = list;
@@ -433,7 +433,7 @@ truncate_undo_list (struct buffer *b)
433 XSETCDR (last_boundary, Qnil); 433 XSETCDR (last_boundary, Qnil);
434 /* There's nothing we decided to keep, so clear it out. */ 434 /* There's nothing we decided to keep, so clear it out. */
435 else 435 else
436 b->undo_list = Qnil; 436 BVAR (b, undo_list) = Qnil;
437 437
438 unbind_to (count, Qnil); 438 unbind_to (count, Qnil);
439} 439}
@@ -470,13 +470,13 @@ Return what remains of the list. */)
470 470
471 /* In a writable buffer, enable undoing read-only text that is so 471 /* In a writable buffer, enable undoing read-only text that is so
472 because of text properties. */ 472 because of text properties. */
473 if (NILP (current_buffer->read_only)) 473 if (NILP (BVAR (current_buffer, read_only)))
474 specbind (Qinhibit_read_only, Qt); 474 specbind (Qinhibit_read_only, Qt);
475 475
476 /* Don't let `intangible' properties interfere with undo. */ 476 /* Don't let `intangible' properties interfere with undo. */
477 specbind (Qinhibit_point_motion_hooks, Qt); 477 specbind (Qinhibit_point_motion_hooks, Qt);
478 478
479 oldlist = current_buffer->undo_list; 479 oldlist = BVAR (current_buffer, undo_list);
480 480
481 while (arg > 0) 481 while (arg > 0)
482 { 482 {
@@ -631,9 +631,9 @@ Return what remains of the list. */)
631 so the test in `undo' for continuing an undo series 631 so the test in `undo' for continuing an undo series
632 will work right. */ 632 will work right. */
633 if (did_apply 633 if (did_apply
634 && EQ (oldlist, current_buffer->undo_list)) 634 && EQ (oldlist, BVAR (current_buffer, undo_list)))
635 current_buffer->undo_list 635 BVAR (current_buffer, undo_list)
636 = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list); 636 = Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list));
637 637
638 UNGCPRO; 638 UNGCPRO;
639 return unbind_to (count, list); 639 return unbind_to (count, list);
diff --git a/src/w32fns.c b/src/w32fns.c
index b09bb0b5b5f..ec48397657a 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4348,9 +4348,9 @@ This function is an internal primitive--use `make-frame' instead. */)
4348 /* Initialize `default-minibuffer-frame' in case this is the first 4348 /* Initialize `default-minibuffer-frame' in case this is the first
4349 frame on this terminal. */ 4349 frame on this terminal. */
4350 if (FRAME_HAS_MINIBUF_P (f) 4350 if (FRAME_HAS_MINIBUF_P (f)
4351 && (!FRAMEP (kb->Vdefault_minibuffer_frame) 4351 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
4352 || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))) 4352 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
4353 kb->Vdefault_minibuffer_frame = frame; 4353 KVAR (kb, Vdefault_minibuffer_frame) = frame;
4354 4354
4355 /* All remaining specified parameters, which have not been "used" 4355 /* All remaining specified parameters, which have not been "used"
4356 by x_get_arg and friends, now go in the misc. alist of the frame. */ 4356 by x_get_arg and friends, now go in the misc. alist of the frame. */
@@ -5225,7 +5225,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5225 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); 5225 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
5226 old_buffer = current_buffer; 5226 old_buffer = current_buffer;
5227 set_buffer_internal_1 (XBUFFER (buffer)); 5227 set_buffer_internal_1 (XBUFFER (buffer));
5228 current_buffer->truncate_lines = Qnil; 5228 BVAR (current_buffer, truncate_lines) = Qnil;
5229 specbind (Qinhibit_read_only, Qt); 5229 specbind (Qinhibit_read_only, Qt);
5230 specbind (Qinhibit_modification_hooks, Qt); 5230 specbind (Qinhibit_modification_hooks, Qt);
5231 Ferase_buffer (); 5231 Ferase_buffer ();
@@ -5655,7 +5655,7 @@ Text larger than the specified size is clipped. */)
5655 /* Display the tooltip text in a temporary buffer. */ 5655 /* Display the tooltip text in a temporary buffer. */
5656 old_buffer = current_buffer; 5656 old_buffer = current_buffer;
5657 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5657 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5658 current_buffer->truncate_lines = Qnil; 5658 BVAR (current_buffer, truncate_lines) = Qnil;
5659 clear_glyph_matrix (w->desired_matrix); 5659 clear_glyph_matrix (w->desired_matrix);
5660 clear_glyph_matrix (w->current_matrix); 5660 clear_glyph_matrix (w->current_matrix);
5661 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5661 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -6162,7 +6162,7 @@ an integer representing a ShowWindow flag:
6162 CHECK_STRING (document); 6162 CHECK_STRING (document);
6163 6163
6164 /* Encode filename, current directory and parameters. */ 6164 /* Encode filename, current directory and parameters. */
6165 current_dir = ENCODE_FILE (current_buffer->directory); 6165 current_dir = ENCODE_FILE (BVAR (current_buffer, directory));
6166 document = ENCODE_FILE (document); 6166 document = ENCODE_FILE (document);
6167 if (STRINGP (parameters)) 6167 if (STRINGP (parameters))
6168 parameters = ENCODE_SYSTEM (parameters); 6168 parameters = ENCODE_SYSTEM (parameters);
diff --git a/src/w32term.c b/src/w32term.c
index cd4ee54fd2c..692130b5140 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6082,7 +6082,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6082 terminal like X does. */ 6082 terminal like X does. */
6083 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 6083 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
6084 init_kboard (terminal->kboard); 6084 init_kboard (terminal->kboard);
6085 terminal->kboard->Vwindow_system = intern ("w32"); 6085 KVAR (terminal->kboard, Vwindow_system) = intern ("w32");
6086 terminal->kboard->next_kboard = all_kboards; 6086 terminal->kboard->next_kboard = all_kboards;
6087 all_kboards = terminal->kboard; 6087 all_kboards = terminal->kboard;
6088 /* Don't let the initial kboard remain current longer than necessary. 6088 /* Don't let the initial kboard remain current longer than necessary.
diff --git a/src/window.c b/src/window.c
index d21cbb164ea..f0555d5c961 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1359,8 +1359,8 @@ window_display_table (struct window *w)
1359 { 1359 {
1360 struct buffer *b = XBUFFER (w->buffer); 1360 struct buffer *b = XBUFFER (w->buffer);
1361 1361
1362 if (DISP_TABLE_P (b->display_table)) 1362 if (DISP_TABLE_P (BVAR (b, display_table)))
1363 dp = XCHAR_TABLE (b->display_table); 1363 dp = XCHAR_TABLE (BVAR (b, display_table));
1364 else if (DISP_TABLE_P (Vstandard_display_table)) 1364 else if (DISP_TABLE_P (Vstandard_display_table))
1365 dp = XCHAR_TABLE (Vstandard_display_table); 1365 dp = XCHAR_TABLE (Vstandard_display_table);
1366 } 1366 }
@@ -1414,9 +1414,9 @@ unshow_buffer (register struct window *w)
1414 So don't clobber point in that buffer. */ 1414 So don't clobber point in that buffer. */
1415 if (! EQ (buf, XWINDOW (selected_window)->buffer) 1415 if (! EQ (buf, XWINDOW (selected_window)->buffer)
1416 /* This line helps to fix Horsley's testbug.el bug. */ 1416 /* This line helps to fix Horsley's testbug.el bug. */
1417 && !(WINDOWP (b->last_selected_window) 1417 && !(WINDOWP (BVAR (b, last_selected_window))
1418 && w != XWINDOW (b->last_selected_window) 1418 && w != XWINDOW (BVAR (b, last_selected_window))
1419 && EQ (buf, XWINDOW (b->last_selected_window)->buffer))) 1419 && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer)))
1420 temp_set_point_both (b, 1420 temp_set_point_both (b,
1421 clip_to_bounds (BUF_BEGV (b), 1421 clip_to_bounds (BUF_BEGV (b),
1422 XMARKER (w->pointm)->charpos, 1422 XMARKER (w->pointm)->charpos,
@@ -1425,9 +1425,9 @@ unshow_buffer (register struct window *w)
1425 marker_byte_position (w->pointm), 1425 marker_byte_position (w->pointm),
1426 BUF_ZV_BYTE (b))); 1426 BUF_ZV_BYTE (b)));
1427 1427
1428 if (WINDOWP (b->last_selected_window) 1428 if (WINDOWP (BVAR (b, last_selected_window))
1429 && w == XWINDOW (b->last_selected_window)) 1429 && w == XWINDOW (BVAR (b, last_selected_window)))
1430 b->last_selected_window = Qnil; 1430 BVAR (b, last_selected_window) = Qnil;
1431} 1431}
1432 1432
1433/* Put replacement into the window structure in place of old. */ 1433/* Put replacement into the window structure in place of old. */
@@ -2325,7 +2325,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2325 /* Check for a window that has a killed buffer. */ 2325 /* Check for a window that has a killed buffer. */
2326 case CHECK_ALL_WINDOWS: 2326 case CHECK_ALL_WINDOWS:
2327 if (! NILP (w->buffer) 2327 if (! NILP (w->buffer)
2328 && NILP (XBUFFER (w->buffer)->name)) 2328 && NILP (BVAR (XBUFFER (w->buffer), name)))
2329 abort (); 2329 abort ();
2330 break; 2330 break;
2331 2331
@@ -2729,7 +2729,7 @@ window_min_size_2 (struct window *w, int width_p, int safe_p)
2729 { 2729 {
2730 int safe_size = (MIN_SAFE_WINDOW_HEIGHT 2730 int safe_size = (MIN_SAFE_WINDOW_HEIGHT
2731 + ((BUFFERP (w->buffer) 2731 + ((BUFFERP (w->buffer)
2732 && !NILP (XBUFFER (w->buffer)->mode_line_format)) 2732 && !NILP (BVAR (XBUFFER (w->buffer), mode_line_format)))
2733 ? 1 : 0)); 2733 ? 1 : 0));
2734 2734
2735 return safe_p ? safe_size : max (window_min_height, safe_size); 2735 return safe_p ? safe_size : max (window_min_height, safe_size);
@@ -3360,15 +3360,15 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3360 w->buffer = buffer; 3360 w->buffer = buffer;
3361 3361
3362 if (EQ (window, selected_window)) 3362 if (EQ (window, selected_window))
3363 b->last_selected_window = window; 3363 BVAR (b, last_selected_window) = window;
3364 3364
3365 /* Let redisplay errors through. */ 3365 /* Let redisplay errors through. */
3366 b->display_error_modiff = 0; 3366 b->display_error_modiff = 0;
3367 3367
3368 /* Update time stamps of buffer display. */ 3368 /* Update time stamps of buffer display. */
3369 if (INTEGERP (b->display_count)) 3369 if (INTEGERP (BVAR (b, display_count)))
3370 XSETINT (b->display_count, XINT (b->display_count) + 1); 3370 XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1);
3371 b->display_time = Fcurrent_time (); 3371 BVAR (b, display_time) = Fcurrent_time ();
3372 3372
3373 XSETFASTINT (w->window_end_pos, 0); 3373 XSETFASTINT (w->window_end_pos, 0);
3374 XSETFASTINT (w->window_end_vpos, 0); 3374 XSETFASTINT (w->window_end_vpos, 0);
@@ -3421,18 +3421,18 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3421 w->left_margin_cols = w->right_margin_cols = Qnil; 3421 w->left_margin_cols = w->right_margin_cols = Qnil;
3422 3422
3423 Fset_window_fringes (window, 3423 Fset_window_fringes (window,
3424 b->left_fringe_width, b->right_fringe_width, 3424 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
3425 b->fringes_outside_margins); 3425 BVAR (b, fringes_outside_margins));
3426 3426
3427 Fset_window_scroll_bars (window, 3427 Fset_window_scroll_bars (window,
3428 b->scroll_bar_width, 3428 BVAR (b, scroll_bar_width),
3429 b->vertical_scroll_bar_type, Qnil); 3429 BVAR (b, vertical_scroll_bar_type), Qnil);
3430 3430
3431 w->left_margin_cols = save_left; 3431 w->left_margin_cols = save_left;
3432 w->right_margin_cols = save_right; 3432 w->right_margin_cols = save_right;
3433 3433
3434 Fset_window_margins (window, 3434 Fset_window_margins (window,
3435 b->left_margin_cols, b->right_margin_cols); 3435 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
3436 } 3436 }
3437 3437
3438 if (run_hooks_p) 3438 if (run_hooks_p)
@@ -3469,7 +3469,7 @@ This function runs `window-scroll-functions' before running
3469 XSETWINDOW (window, w); 3469 XSETWINDOW (window, w);
3470 buffer = Fget_buffer (buffer_or_name); 3470 buffer = Fget_buffer (buffer_or_name);
3471 CHECK_BUFFER (buffer); 3471 CHECK_BUFFER (buffer);
3472 if (NILP (XBUFFER (buffer)->name)) 3472 if (NILP (BVAR (XBUFFER (buffer), name)))
3473 error ("Attempt to display deleted buffer"); 3473 error ("Attempt to display deleted buffer");
3474 3474
3475 tem = w->buffer; 3475 tem = w->buffer;
@@ -3481,7 +3481,7 @@ This function runs `window-scroll-functions' before running
3481 if (EQ (tem, buffer)) 3481 if (EQ (tem, buffer))
3482 return Qnil; 3482 return Qnil;
3483 else if (EQ (w->dedicated, Qt)) 3483 else if (EQ (w->dedicated, Qt))
3484 error ("Window is dedicated to `%s'", SDATA (XBUFFER (tem)->name)); 3484 error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name)));
3485 else 3485 else
3486 w->dedicated = Qnil; 3486 w->dedicated = Qnil;
3487 3487
@@ -3517,7 +3517,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
3517 record_buffer (w->buffer); 3517 record_buffer (w->buffer);
3518 } 3518 }
3519 3519
3520 if (EQ (window, selected_window)) 3520 if (EQ (window, selected_window) && !inhibit_point_swap)
3521 return window; 3521 return window;
3522 3522
3523 sf = SELECTED_FRAME (); 3523 sf = SELECTED_FRAME ();
@@ -3552,7 +3552,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
3552 3552
3553 Fset_buffer (w->buffer); 3553 Fset_buffer (w->buffer);
3554 3554
3555 XBUFFER (w->buffer)->last_selected_window = window; 3555 BVAR (XBUFFER (w->buffer), last_selected_window) = window;
3556 3556
3557 /* Go to the point recorded in the window. 3557 /* Go to the point recorded in the window.
3558 This is important when the buffer is in more 3558 This is important when the buffer is in more
@@ -3640,7 +3640,7 @@ displaying that buffer. */)
3640 3640
3641 if (STRINGP (object)) 3641 if (STRINGP (object))
3642 object = Fget_buffer (object); 3642 object = Fget_buffer (object);
3643 if (BUFFERP (object) && !NILP (XBUFFER (object)->name)) 3643 if (BUFFERP (object) && !NILP (BVAR (XBUFFER (object), name)))
3644 { 3644 {
3645 /* Walk all windows looking for buffer, and force update 3645 /* Walk all windows looking for buffer, and force update
3646 of each of those windows. */ 3646 of each of those windows. */
@@ -3662,7 +3662,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3662 register Lisp_Object window; 3662 register Lisp_Object window;
3663 register struct window *w; 3663 register struct window *w;
3664 3664
3665 XBUFFER (buf)->directory = current_buffer->directory; 3665 BVAR (XBUFFER (buf), directory) = BVAR (current_buffer, directory);
3666 3666
3667 Fset_buffer (buf); 3667 Fset_buffer (buf);
3668 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; 3668 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
@@ -4843,8 +4843,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4843 possibility of point becoming "stuck" on a tall line when 4843 possibility of point becoming "stuck" on a tall line when
4844 scrolling by one line. */ 4844 scrolling by one line. */
4845 if (window_scroll_pixel_based_preserve_y < 0 4845 if (window_scroll_pixel_based_preserve_y < 0
4846 || !SYMBOLP (current_kboard->Vlast_command) 4846 || !SYMBOLP (KVAR (current_kboard, Vlast_command))
4847 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) 4847 || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command)))
4848 { 4848 {
4849 start_display (&it, w, start); 4849 start_display (&it, w, start);
4850 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4850 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5100,8 +5100,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
5100 if (!NILP (Vscroll_preserve_screen_position)) 5100 if (!NILP (Vscroll_preserve_screen_position))
5101 { 5101 {
5102 if (window_scroll_preserve_vpos <= 0 5102 if (window_scroll_preserve_vpos <= 0
5103 || !SYMBOLP (current_kboard->Vlast_command) 5103 || !SYMBOLP (KVAR (current_kboard, Vlast_command))
5104 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) 5104 || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command)))
5105 { 5105 {
5106 struct position posit 5106 struct position posit
5107 = *compute_motion (startpos, 0, 0, 0, 5107 = *compute_motion (startpos, 0, 0, 0,
@@ -5887,7 +5887,7 @@ the return value is nil. Otherwise the value is t. */)
5887 saved_windows = XVECTOR (data->saved_windows); 5887 saved_windows = XVECTOR (data->saved_windows);
5888 5888
5889 new_current_buffer = data->current_buffer; 5889 new_current_buffer = data->current_buffer;
5890 if (NILP (XBUFFER (new_current_buffer)->name)) 5890 if (NILP (BVAR (XBUFFER (new_current_buffer), name)))
5891 new_current_buffer = Qnil; 5891 new_current_buffer = Qnil;
5892 else 5892 else
5893 { 5893 {
@@ -6072,14 +6072,14 @@ the return value is nil. Otherwise the value is t. */)
6072 w->buffer = p->buffer; 6072 w->buffer = p->buffer;
6073 else 6073 else
6074 { 6074 {
6075 if (!NILP (XBUFFER (p->buffer)->name)) 6075 if (!NILP (BVAR (XBUFFER (p->buffer), name)))
6076 /* If saved buffer is alive, install it. */ 6076 /* If saved buffer is alive, install it. */
6077 { 6077 {
6078 w->buffer = p->buffer; 6078 w->buffer = p->buffer;
6079 w->start_at_line_beg = p->start_at_line_beg; 6079 w->start_at_line_beg = p->start_at_line_beg;
6080 set_marker_restricted (w->start, p->start, w->buffer); 6080 set_marker_restricted (w->start, p->start, w->buffer);
6081 set_marker_restricted (w->pointm, p->pointm, w->buffer); 6081 set_marker_restricted (w->pointm, p->pointm, w->buffer);
6082 Fset_marker (XBUFFER (w->buffer)->mark, 6082 Fset_marker (BVAR (XBUFFER (w->buffer), mark),
6083 p->mark, w->buffer); 6083 p->mark, w->buffer);
6084 6084
6085 /* As documented in Fcurrent_window_configuration, don't 6085 /* As documented in Fcurrent_window_configuration, don't
@@ -6089,7 +6089,7 @@ the return value is nil. Otherwise the value is t. */)
6089 && XBUFFER (p->buffer) == current_buffer) 6089 && XBUFFER (p->buffer) == current_buffer)
6090 Fgoto_char (w->pointm); 6090 Fgoto_char (w->pointm);
6091 } 6091 }
6092 else if (NILP (w->buffer) || NILP (XBUFFER (w->buffer)->name)) 6092 else if (NILP (w->buffer) || NILP (BVAR (XBUFFER (w->buffer), name)))
6093 /* Else unless window has a live buffer, get one. */ 6093 /* Else unless window has a live buffer, get one. */
6094 { 6094 {
6095 w->buffer = Fcdr (Fcar (Vbuffer_alist)); 6095 w->buffer = Fcdr (Fcar (Vbuffer_alist));
@@ -6130,7 +6130,7 @@ the return value is nil. Otherwise the value is t. */)
6130 has been restored into it. We already swapped out that point 6130 has been restored into it. We already swapped out that point
6131 from that window's old buffer. */ 6131 from that window's old buffer. */
6132 select_window (data->current_window, Qnil, 1); 6132 select_window (data->current_window, Qnil, 1);
6133 XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window 6133 BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window)
6134 = selected_window; 6134 = selected_window;
6135 6135
6136 if (NILP (data->focus_frame) 6136 if (NILP (data->focus_frame)
@@ -6331,7 +6331,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
6331 p->start = Fcopy_marker (w->start, Qnil); 6331 p->start = Fcopy_marker (w->start, Qnil);
6332 p->start_at_line_beg = w->start_at_line_beg; 6332 p->start_at_line_beg = w->start_at_line_beg;
6333 6333
6334 tem = XBUFFER (w->buffer)->mark; 6334 tem = BVAR (XBUFFER (w->buffer), mark);
6335 p->mark = Fcopy_marker (tem, Qnil); 6335 p->mark = Fcopy_marker (tem, Qnil);
6336 } 6336 }
6337 else 6337 else
diff --git a/src/xdisp.c b/src/xdisp.c
index 630c1dcda85..e144237d34e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -444,6 +444,12 @@ static int this_line_pixel_height;
444 444
445static int this_line_start_x; 445static int this_line_start_x;
446 446
447/* The smallest character position seen by move_it_* functions as they
448 move across display lines. Used to set MATRIX_ROW_START_CHARPOS of
449 hscrolled lines, see display_line. */
450
451static struct text_pos this_line_min_pos;
452
447/* Buffer that this_line_.* variables are referring to. */ 453/* Buffer that this_line_.* variables are referring to. */
448 454
449static struct buffer *this_line_buffer; 455static struct buffer *this_line_buffer;
@@ -1204,12 +1210,12 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1204 if (WINDOW_WANTS_MODELINE_P (w)) 1210 if (WINDOW_WANTS_MODELINE_P (w))
1205 current_mode_line_height 1211 current_mode_line_height
1206 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), 1212 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1207 current_buffer->mode_line_format); 1213 BVAR (current_buffer, mode_line_format));
1208 1214
1209 if (WINDOW_WANTS_HEADER_LINE_P (w)) 1215 if (WINDOW_WANTS_HEADER_LINE_P (w))
1210 current_header_line_height 1216 current_header_line_height
1211 = display_mode_line (w, HEADER_LINE_FACE_ID, 1217 = display_mode_line (w, HEADER_LINE_FACE_ID,
1212 current_buffer->header_line_format); 1218 BVAR (current_buffer, header_line_format));
1213 1219
1214 start_display (&it, w, top); 1220 start_display (&it, w, top);
1215 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, 1221 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
@@ -2399,10 +2405,10 @@ init_iterator (struct it *it, struct window *w,
2399 if (base_face_id == DEFAULT_FACE_ID 2405 if (base_face_id == DEFAULT_FACE_ID
2400 && FRAME_WINDOW_P (it->f)) 2406 && FRAME_WINDOW_P (it->f))
2401 { 2407 {
2402 if (NATNUMP (current_buffer->extra_line_spacing)) 2408 if (NATNUMP (BVAR (current_buffer, extra_line_spacing)))
2403 it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing); 2409 it->extra_line_spacing = XFASTINT (BVAR (current_buffer, extra_line_spacing));
2404 else if (FLOATP (current_buffer->extra_line_spacing)) 2410 else if (FLOATP (BVAR (current_buffer, extra_line_spacing)))
2405 it->extra_line_spacing = (XFLOAT_DATA (current_buffer->extra_line_spacing) 2411 it->extra_line_spacing = (XFLOAT_DATA (BVAR (current_buffer, extra_line_spacing))
2406 * FRAME_LINE_HEIGHT (it->f)); 2412 * FRAME_LINE_HEIGHT (it->f));
2407 else if (it->f->extra_line_spacing > 0) 2413 else if (it->f->extra_line_spacing > 0)
2408 it->extra_line_spacing = it->f->extra_line_spacing; 2414 it->extra_line_spacing = it->f->extra_line_spacing;
@@ -2425,36 +2431,36 @@ init_iterator (struct it *it, struct window *w,
2425 it->override_ascent = -1; 2431 it->override_ascent = -1;
2426 2432
2427 /* Are control characters displayed as `^C'? */ 2433 /* Are control characters displayed as `^C'? */
2428 it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow); 2434 it->ctl_arrow_p = !NILP (BVAR (current_buffer, ctl_arrow));
2429 2435
2430 /* -1 means everything between a CR and the following line end 2436 /* -1 means everything between a CR and the following line end
2431 is invisible. >0 means lines indented more than this value are 2437 is invisible. >0 means lines indented more than this value are
2432 invisible. */ 2438 invisible. */
2433 it->selective = (INTEGERP (current_buffer->selective_display) 2439 it->selective = (INTEGERP (BVAR (current_buffer, selective_display))
2434 ? XFASTINT (current_buffer->selective_display) 2440 ? XFASTINT (BVAR (current_buffer, selective_display))
2435 : (!NILP (current_buffer->selective_display) 2441 : (!NILP (BVAR (current_buffer, selective_display))
2436 ? -1 : 0)); 2442 ? -1 : 0));
2437 it->selective_display_ellipsis_p 2443 it->selective_display_ellipsis_p
2438 = !NILP (current_buffer->selective_display_ellipses); 2444 = !NILP (BVAR (current_buffer, selective_display_ellipses));
2439 2445
2440 /* Display table to use. */ 2446 /* Display table to use. */
2441 it->dp = window_display_table (w); 2447 it->dp = window_display_table (w);
2442 2448
2443 /* Are multibyte characters enabled in current_buffer? */ 2449 /* Are multibyte characters enabled in current_buffer? */
2444 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2450 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2445 2451
2446 /* Do we need to reorder bidirectional text? Not if this is a 2452 /* Do we need to reorder bidirectional text? Not if this is a
2447 unibyte buffer: by definition, none of the single-byte characters 2453 unibyte buffer: by definition, none of the single-byte characters
2448 are strong R2L, so no reordering is needed. And bidi.c doesn't 2454 are strong R2L, so no reordering is needed. And bidi.c doesn't
2449 support unibyte buffers anyway. */ 2455 support unibyte buffers anyway. */
2450 it->bidi_p 2456 it->bidi_p
2451 = !NILP (current_buffer->bidi_display_reordering) && it->multibyte_p; 2457 = !NILP (BVAR (current_buffer, bidi_display_reordering)) && it->multibyte_p;
2452 2458
2453 /* Non-zero if we should highlight the region. */ 2459 /* Non-zero if we should highlight the region. */
2454 highlight_region_p 2460 highlight_region_p
2455 = (!NILP (Vtransient_mark_mode) 2461 = (!NILP (Vtransient_mark_mode)
2456 && !NILP (current_buffer->mark_active) 2462 && !NILP (BVAR (current_buffer, mark_active))
2457 && XMARKER (current_buffer->mark)->buffer != 0); 2463 && XMARKER (BVAR (current_buffer, mark))->buffer != 0);
2458 2464
2459 /* Set IT->region_beg_charpos and IT->region_end_charpos to the 2465 /* Set IT->region_beg_charpos and IT->region_end_charpos to the
2460 start and end of a visible region in window IT->w. Set both to 2466 start and end of a visible region in window IT->w. Set both to
@@ -2471,7 +2477,7 @@ init_iterator (struct it *it, struct window *w,
2471 && WINDOWP (minibuf_selected_window) 2477 && WINDOWP (minibuf_selected_window)
2472 && w == XWINDOW (minibuf_selected_window)))) 2478 && w == XWINDOW (minibuf_selected_window))))
2473 { 2479 {
2474 EMACS_INT charpos = marker_position (current_buffer->mark); 2480 EMACS_INT charpos = marker_position (BVAR (current_buffer, mark));
2475 it->region_beg_charpos = min (PT, charpos); 2481 it->region_beg_charpos = min (PT, charpos);
2476 it->region_end_charpos = max (PT, charpos); 2482 it->region_end_charpos = max (PT, charpos);
2477 } 2483 }
@@ -2488,7 +2494,7 @@ init_iterator (struct it *it, struct window *w,
2488 it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger); 2494 it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger);
2489 2495
2490 /* Correct bogus values of tab_width. */ 2496 /* Correct bogus values of tab_width. */
2491 it->tab_width = XINT (current_buffer->tab_width); 2497 it->tab_width = XINT (BVAR (current_buffer, tab_width));
2492 if (it->tab_width <= 0 || it->tab_width > 1000) 2498 if (it->tab_width <= 0 || it->tab_width > 1000)
2493 it->tab_width = 8; 2499 it->tab_width = 8;
2494 2500
@@ -2502,8 +2508,8 @@ init_iterator (struct it *it, struct window *w,
2502 && (WINDOW_TOTAL_COLS (it->w) 2508 && (WINDOW_TOTAL_COLS (it->w)
2503 < XINT (Vtruncate_partial_width_windows)))))) 2509 < XINT (Vtruncate_partial_width_windows))))))
2504 it->line_wrap = TRUNCATE; 2510 it->line_wrap = TRUNCATE;
2505 else if (NILP (current_buffer->truncate_lines)) 2511 else if (NILP (BVAR (current_buffer, truncate_lines)))
2506 it->line_wrap = NILP (current_buffer->word_wrap) 2512 it->line_wrap = NILP (BVAR (current_buffer, word_wrap))
2507 ? WINDOW_WRAP : WORD_WRAP; 2513 ? WINDOW_WRAP : WORD_WRAP;
2508 else 2514 else
2509 it->line_wrap = TRUNCATE; 2515 it->line_wrap = TRUNCATE;
@@ -2605,9 +2611,9 @@ init_iterator (struct it *it, struct window *w,
2605 { 2611 {
2606 /* Note the paragraph direction that this buffer wants to 2612 /* Note the paragraph direction that this buffer wants to
2607 use. */ 2613 use. */
2608 if (EQ (current_buffer->bidi_paragraph_direction, Qleft_to_right)) 2614 if (EQ (BVAR (current_buffer, bidi_paragraph_direction), Qleft_to_right))
2609 it->paragraph_embedding = L2R; 2615 it->paragraph_embedding = L2R;
2610 else if (EQ (current_buffer->bidi_paragraph_direction, Qright_to_left)) 2616 else if (EQ (BVAR (current_buffer, bidi_paragraph_direction), Qright_to_left))
2611 it->paragraph_embedding = R2L; 2617 it->paragraph_embedding = R2L;
2612 else 2618 else
2613 it->paragraph_embedding = NEUTRAL_DIR; 2619 it->paragraph_embedding = NEUTRAL_DIR;
@@ -5405,7 +5411,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
5405 it->method = GET_FROM_BUFFER; 5411 it->method = GET_FROM_BUFFER;
5406 it->object = it->w->buffer; 5412 it->object = it->w->buffer;
5407 it->area = TEXT_AREA; 5413 it->area = TEXT_AREA;
5408 it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 5414 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
5409 it->sp = 0; 5415 it->sp = 0;
5410 it->string_from_display_prop_p = 0; 5416 it->string_from_display_prop_p = 0;
5411 it->face_before_selective_p = 0; 5417 it->face_before_selective_p = 0;
@@ -6909,6 +6915,9 @@ move_it_in_display_line_to (struct it *it,
6909 && it->current_y < it->last_visible_y) 6915 && it->current_y < it->last_visible_y)
6910 handle_line_prefix (it); 6916 handle_line_prefix (it);
6911 6917
6918 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
6919 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
6920
6912 while (1) 6921 while (1)
6913 { 6922 {
6914 int x, i, ascent = 0, descent = 0; 6923 int x, i, ascent = 0, descent = 0;
@@ -7013,6 +7022,9 @@ move_it_in_display_line_to (struct it *it,
7013 if (it->area != TEXT_AREA) 7022 if (it->area != TEXT_AREA)
7014 { 7023 {
7015 set_iterator_to_next (it, 1); 7024 set_iterator_to_next (it, 1);
7025 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7026 SET_TEXT_POS (this_line_min_pos,
7027 IT_CHARPOS (*it), IT_BYTEPOS (*it));
7016 continue; 7028 continue;
7017 } 7029 }
7018 7030
@@ -7121,6 +7133,9 @@ move_it_in_display_line_to (struct it *it,
7121 } 7133 }
7122 7134
7123 set_iterator_to_next (it, 1); 7135 set_iterator_to_next (it, 1);
7136 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7137 SET_TEXT_POS (this_line_min_pos,
7138 IT_CHARPOS (*it), IT_BYTEPOS (*it));
7124 /* On graphical terminals, newlines may 7139 /* On graphical terminals, newlines may
7125 "overflow" into the fringe if 7140 "overflow" into the fringe if
7126 overflow-newline-into-fringe is non-nil. 7141 overflow-newline-into-fringe is non-nil.
@@ -7219,6 +7234,8 @@ move_it_in_display_line_to (struct it *it,
7219 /* The current display element has been consumed. Advance 7234 /* The current display element has been consumed. Advance
7220 to the next. */ 7235 to the next. */
7221 set_iterator_to_next (it, 1); 7236 set_iterator_to_next (it, 1);
7237 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7238 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
7222 7239
7223 /* Stop if lines are truncated and IT's current x-position is 7240 /* Stop if lines are truncated and IT's current x-position is
7224 past the right edge of the window now. */ 7241 past the right edge of the window now. */
@@ -7902,7 +7919,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7902 old_deactivate_mark = Vdeactivate_mark; 7919 old_deactivate_mark = Vdeactivate_mark;
7903 oldbuf = current_buffer; 7920 oldbuf = current_buffer;
7904 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); 7921 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
7905 current_buffer->undo_list = Qt; 7922 BVAR (current_buffer, undo_list) = Qt;
7906 7923
7907 oldpoint = message_dolog_marker1; 7924 oldpoint = message_dolog_marker1;
7908 set_marker_restricted (oldpoint, make_number (PT), Qnil); 7925 set_marker_restricted (oldpoint, make_number (PT), Qnil);
@@ -7926,7 +7943,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7926 /* Insert the string--maybe converting multibyte to single byte 7943 /* Insert the string--maybe converting multibyte to single byte
7927 or vice versa, so that all the text fits the buffer. */ 7944 or vice versa, so that all the text fits the buffer. */
7928 if (multibyte 7945 if (multibyte
7929 && NILP (current_buffer->enable_multibyte_characters)) 7946 && NILP (BVAR (current_buffer, enable_multibyte_characters)))
7930 { 7947 {
7931 EMACS_INT i; 7948 EMACS_INT i;
7932 int c, char_bytes; 7949 int c, char_bytes;
@@ -7944,7 +7961,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7944 } 7961 }
7945 } 7962 }
7946 else if (! multibyte 7963 else if (! multibyte
7947 && ! NILP (current_buffer->enable_multibyte_characters)) 7964 && ! NILP (BVAR (current_buffer, enable_multibyte_characters)))
7948 { 7965 {
7949 EMACS_INT i; 7966 EMACS_INT i;
7950 int c, char_bytes; 7967 int c, char_bytes;
@@ -8443,7 +8460,7 @@ update_echo_area (void)
8443 Lisp_Object string; 8460 Lisp_Object string;
8444 string = Fcurrent_message (); 8461 string = Fcurrent_message ();
8445 message3 (string, SBYTES (string), 8462 message3 (string, SBYTES (string),
8446 !NILP (current_buffer->enable_multibyte_characters)); 8463 !NILP (BVAR (current_buffer, enable_multibyte_characters)));
8447 } 8464 }
8448} 8465}
8449 8466
@@ -8458,7 +8475,7 @@ ensure_echo_area_buffers (void)
8458 8475
8459 for (i = 0; i < 2; ++i) 8476 for (i = 0; i < 2; ++i)
8460 if (!BUFFERP (echo_buffer[i]) 8477 if (!BUFFERP (echo_buffer[i])
8461 || NILP (XBUFFER (echo_buffer[i])->name)) 8478 || NILP (BVAR (XBUFFER (echo_buffer[i]), name)))
8462 { 8479 {
8463 char name[30]; 8480 char name[30];
8464 Lisp_Object old_buffer; 8481 Lisp_Object old_buffer;
@@ -8467,7 +8484,7 @@ ensure_echo_area_buffers (void)
8467 old_buffer = echo_buffer[i]; 8484 old_buffer = echo_buffer[i];
8468 sprintf (name, " *Echo Area %d*", i); 8485 sprintf (name, " *Echo Area %d*", i);
8469 echo_buffer[i] = Fget_buffer_create (build_string (name)); 8486 echo_buffer[i] = Fget_buffer_create (build_string (name));
8470 XBUFFER (echo_buffer[i])->truncate_lines = Qnil; 8487 BVAR (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil;
8471 /* to force word wrap in echo area - 8488 /* to force word wrap in echo area -
8472 it was decided to postpone this*/ 8489 it was decided to postpone this*/
8473 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ 8490 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */
@@ -8560,8 +8577,8 @@ with_echo_area_buffer (struct window *w, int which,
8560 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); 8577 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
8561 } 8578 }
8562 8579
8563 current_buffer->undo_list = Qt; 8580 BVAR (current_buffer, undo_list) = Qt;
8564 current_buffer->read_only = Qnil; 8581 BVAR (current_buffer, read_only) = Qnil;
8565 specbind (Qinhibit_read_only, Qt); 8582 specbind (Qinhibit_read_only, Qt);
8566 specbind (Qinhibit_modification_hooks, Qt); 8583 specbind (Qinhibit_modification_hooks, Qt);
8567 8584
@@ -8674,7 +8691,7 @@ setup_echo_area_for_printing (int multibyte_p)
8674 8691
8675 /* Switch to that buffer and clear it. */ 8692 /* Switch to that buffer and clear it. */
8676 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 8693 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
8677 current_buffer->truncate_lines = Qnil; 8694 BVAR (current_buffer, truncate_lines) = Qnil;
8678 8695
8679 if (Z > BEG) 8696 if (Z > BEG)
8680 { 8697 {
@@ -8688,7 +8705,7 @@ setup_echo_area_for_printing (int multibyte_p)
8688 8705
8689 /* Set up the buffer for the multibyteness we need. */ 8706 /* Set up the buffer for the multibyteness we need. */
8690 if (multibyte_p 8707 if (multibyte_p
8691 != !NILP (current_buffer->enable_multibyte_characters)) 8708 != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
8692 Fset_buffer_multibyte (multibyte_p ? Qt : Qnil); 8709 Fset_buffer_multibyte (multibyte_p ? Qt : Qnil);
8693 8710
8694 /* Raise the frame containing the echo area. */ 8711 /* Raise the frame containing the echo area. */
@@ -8717,7 +8734,7 @@ setup_echo_area_for_printing (int multibyte_p)
8717 { 8734 {
8718 /* Someone switched buffers between print requests. */ 8735 /* Someone switched buffers between print requests. */
8719 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 8736 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
8720 current_buffer->truncate_lines = Qnil; 8737 BVAR (current_buffer, truncate_lines) = Qnil;
8721 } 8738 }
8722 } 8739 }
8723} 8740}
@@ -9160,12 +9177,12 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9160 9177
9161 /* Change multibyteness of the echo buffer appropriately. */ 9178 /* Change multibyteness of the echo buffer appropriately. */
9162 if (message_enable_multibyte 9179 if (message_enable_multibyte
9163 != !NILP (current_buffer->enable_multibyte_characters)) 9180 != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
9164 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); 9181 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
9165 9182
9166 current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil; 9183 BVAR (current_buffer, truncate_lines) = message_truncate_lines ? Qt : Qnil;
9167 if (!NILP (current_buffer->bidi_display_reordering)) 9184 if (!NILP (BVAR (current_buffer, bidi_display_reordering)))
9168 current_buffer->bidi_paragraph_direction = Qleft_to_right; 9185 BVAR (current_buffer, bidi_paragraph_direction) = Qleft_to_right;
9169 9186
9170 /* Insert new message at BEG. */ 9187 /* Insert new message at BEG. */
9171 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 9188 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -9188,7 +9205,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9188 if (nbytes == 0) 9205 if (nbytes == 0)
9189 nbytes = strlen (s); 9206 nbytes = strlen (s);
9190 9207
9191 if (multibyte_p && NILP (current_buffer->enable_multibyte_characters)) 9208 if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters)))
9192 { 9209 {
9193 /* Convert from multi-byte to single-byte. */ 9210 /* Convert from multi-byte to single-byte. */
9194 EMACS_INT i; 9211 EMACS_INT i;
@@ -9206,7 +9223,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9206 } 9223 }
9207 } 9224 }
9208 else if (!multibyte_p 9225 else if (!multibyte_p
9209 && !NILP (current_buffer->enable_multibyte_characters)) 9226 && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
9210 { 9227 {
9211 /* Convert from single-byte to multi-byte. */ 9228 /* Convert from single-byte to multi-byte. */
9212 EMACS_INT i; 9229 EMACS_INT i;
@@ -9791,7 +9808,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
9791 < BUF_MODIFF (XBUFFER (w->buffer))) 9808 < BUF_MODIFF (XBUFFER (w->buffer)))
9792 != !NILP (w->last_had_star)) 9809 != !NILP (w->last_had_star))
9793 || ((!NILP (Vtransient_mark_mode) 9810 || ((!NILP (Vtransient_mark_mode)
9794 && !NILP (XBUFFER (w->buffer)->mark_active)) 9811 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
9795 != !NILP (w->region_showing))) 9812 != !NILP (w->region_showing)))
9796 { 9813 {
9797 struct buffer *prev = current_buffer; 9814 struct buffer *prev = current_buffer;
@@ -9989,7 +10006,7 @@ update_tool_bar (struct frame *f, int save_match_data)
9989 < BUF_MODIFF (XBUFFER (w->buffer))) 10006 < BUF_MODIFF (XBUFFER (w->buffer)))
9990 != !NILP (w->last_had_star)) 10007 != !NILP (w->last_had_star))
9991 || ((!NILP (Vtransient_mark_mode) 10008 || ((!NILP (Vtransient_mark_mode)
9992 && !NILP (XBUFFER (w->buffer)->mark_active)) 10009 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
9993 != !NILP (w->region_showing))) 10010 != !NILP (w->region_showing)))
9994 { 10011 {
9995 struct buffer *prev = current_buffer; 10012 struct buffer *prev = current_buffer;
@@ -11080,8 +11097,8 @@ text_outside_line_unchanged_p (struct window *w,
11080 /* If selective display, can't optimize if changes start at the 11097 /* If selective display, can't optimize if changes start at the
11081 beginning of the line. */ 11098 beginning of the line. */
11082 if (unchanged_p 11099 if (unchanged_p
11083 && INTEGERP (current_buffer->selective_display) 11100 && INTEGERP (BVAR (current_buffer, selective_display))
11084 && XINT (current_buffer->selective_display) > 0 11101 && XINT (BVAR (current_buffer, selective_display)) > 0
11085 && (BEG_UNCHANGED < start || GPT <= start)) 11102 && (BEG_UNCHANGED < start || GPT <= start))
11086 unchanged_p = 0; 11103 unchanged_p = 0;
11087 11104
@@ -11109,8 +11126,8 @@ text_outside_line_unchanged_p (struct window *w,
11109 require to redisplay the whole paragraph. It might be worthwhile 11126 require to redisplay the whole paragraph. It might be worthwhile
11110 to find the paragraph limits and widen the range of redisplayed 11127 to find the paragraph limits and widen the range of redisplayed
11111 lines to that, but for now just give up this optimization. */ 11128 lines to that, but for now just give up this optimization. */
11112 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) 11129 if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
11113 && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction)) 11130 && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction)))
11114 unchanged_p = 0; 11131 unchanged_p = 0;
11115 } 11132 }
11116 11133
@@ -11402,6 +11419,7 @@ static void
11402redisplay_internal (int preserve_echo_area) 11419redisplay_internal (int preserve_echo_area)
11403{ 11420{
11404 struct window *w = XWINDOW (selected_window); 11421 struct window *w = XWINDOW (selected_window);
11422 struct window *sw;
11405 struct frame *f; 11423 struct frame *f;
11406 int pause; 11424 int pause;
11407 int must_finish = 0; 11425 int must_finish = 0;
@@ -11462,6 +11480,9 @@ redisplay_internal (int preserve_echo_area)
11462 } 11480 }
11463 11481
11464 retry: 11482 retry:
11483 /* Remember the currently selected window. */
11484 sw = w;
11485
11465 if (!EQ (old_frame, selected_frame) 11486 if (!EQ (old_frame, selected_frame)
11466 && FRAME_LIVE_P (XFRAME (old_frame))) 11487 && FRAME_LIVE_P (XFRAME (old_frame)))
11467 /* When running redisplay, we play a bit fast-and-loose and allow e.g. 11488 /* When running redisplay, we play a bit fast-and-loose and allow e.g.
@@ -11529,6 +11550,14 @@ redisplay_internal (int preserve_echo_area)
11529 /* Notice any pending interrupt request to change frame size. */ 11550 /* Notice any pending interrupt request to change frame size. */
11530 do_pending_window_change (1); 11551 do_pending_window_change (1);
11531 11552
11553 /* do_pending_window_change could change the selected_window due to
11554 frame resizing which makes the selected window too small. */
11555 if (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw)
11556 {
11557 sw = w;
11558 reconsider_clip_changes (w, current_buffer);
11559 }
11560
11532 /* Clear frames marked as garbaged. */ 11561 /* Clear frames marked as garbaged. */
11533 if (frame_garbaged) 11562 if (frame_garbaged)
11534 clear_garbaged_frames (); 11563 clear_garbaged_frames ();
@@ -11645,11 +11674,11 @@ redisplay_internal (int preserve_echo_area)
11645 the whole window. The assignment to this_line_start_pos prevents 11674 the whole window. The assignment to this_line_start_pos prevents
11646 the optimization directly below this if-statement. */ 11675 the optimization directly below this if-statement. */
11647 if (((!NILP (Vtransient_mark_mode) 11676 if (((!NILP (Vtransient_mark_mode)
11648 && !NILP (XBUFFER (w->buffer)->mark_active)) 11677 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11649 != !NILP (w->region_showing)) 11678 != !NILP (w->region_showing))
11650 || (!NILP (w->region_showing) 11679 || (!NILP (w->region_showing)
11651 && !EQ (w->region_showing, 11680 && !EQ (w->region_showing,
11652 Fmarker_position (XBUFFER (w->buffer)->mark)))) 11681 Fmarker_position (BVAR (XBUFFER (w->buffer), mark)))))
11653 CHARPOS (this_line_start_pos) = 0; 11682 CHARPOS (this_line_start_pos) = 0;
11654 11683
11655 /* Optimize the case that only the line containing the cursor in the 11684 /* Optimize the case that only the line containing the cursor in the
@@ -11798,6 +11827,10 @@ redisplay_internal (int preserve_echo_area)
11798 if (!must_finish) 11827 if (!must_finish)
11799 { 11828 {
11800 do_pending_window_change (1); 11829 do_pending_window_change (1);
11830 /* If selected_window changed, redisplay again. */
11831 if (WINDOWP (selected_window)
11832 && (w = XWINDOW (selected_window)) != sw)
11833 goto retry;
11801 11834
11802 /* We used to always goto end_of_redisplay here, but this 11835 /* We used to always goto end_of_redisplay here, but this
11803 isn't enough if we have a blinking cursor. */ 11836 isn't enough if we have a blinking cursor. */
@@ -11809,8 +11842,8 @@ redisplay_internal (int preserve_echo_area)
11809 /* If highlighting the region, or if the cursor is in the echo area, 11842 /* If highlighting the region, or if the cursor is in the echo area,
11810 then we can't just move the cursor. */ 11843 then we can't just move the cursor. */
11811 else if (! (!NILP (Vtransient_mark_mode) 11844 else if (! (!NILP (Vtransient_mark_mode)
11812 && !NILP (current_buffer->mark_active)) 11845 && !NILP (BVAR (current_buffer, mark_active)))
11813 && (EQ (selected_window, current_buffer->last_selected_window) 11846 && (EQ (selected_window, BVAR (current_buffer, last_selected_window))
11814 || highlight_nonselected_windows) 11847 || highlight_nonselected_windows)
11815 && NILP (w->region_showing) 11848 && NILP (w->region_showing)
11816 && NILP (Vshow_trailing_whitespace) 11849 && NILP (Vshow_trailing_whitespace)
@@ -12092,8 +12125,9 @@ redisplay_internal (int preserve_echo_area)
12092 do_pending_window_change (1); 12125 do_pending_window_change (1);
12093 12126
12094 /* If we just did a pending size change, or have additional 12127 /* If we just did a pending size change, or have additional
12095 visible frames, redisplay again. */ 12128 visible frames, or selected_window changed, redisplay again. */
12096 if (windows_or_buffers_changed && !pause) 12129 if ((windows_or_buffers_changed && !pause)
12130 || (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw))
12097 goto retry; 12131 goto retry;
12098 12132
12099 /* Clear the face and image caches. 12133 /* Clear the face and image caches.
@@ -13016,8 +13050,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13016 scroll_max = (max (scroll_step, 13050 scroll_max = (max (scroll_step,
13017 max (arg_scroll_conservatively, temp_scroll_step)) 13051 max (arg_scroll_conservatively, temp_scroll_step))
13018 * FRAME_LINE_HEIGHT (f)); 13052 * FRAME_LINE_HEIGHT (f));
13019 else if (NUMBERP (current_buffer->scroll_down_aggressively) 13053 else if (NUMBERP (BVAR (current_buffer, scroll_down_aggressively))
13020 || NUMBERP (current_buffer->scroll_up_aggressively)) 13054 || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)))
13021 /* We're trying to scroll because of aggressive scrolling but no 13055 /* We're trying to scroll because of aggressive scrolling but no
13022 scroll_step is set. Choose an arbitrary one. */ 13056 scroll_step is set. Choose an arbitrary one. */
13023 scroll_max = 10 * FRAME_LINE_HEIGHT (f); 13057 scroll_max = 10 * FRAME_LINE_HEIGHT (f);
@@ -13082,7 +13116,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13082 amount_to_scroll = scroll_max; 13116 amount_to_scroll = scroll_max;
13083 else 13117 else
13084 { 13118 {
13085 aggressive = current_buffer->scroll_up_aggressively; 13119 aggressive = BVAR (current_buffer, scroll_up_aggressively);
13086 height = WINDOW_BOX_TEXT_HEIGHT (w); 13120 height = WINDOW_BOX_TEXT_HEIGHT (w);
13087 if (NUMBERP (aggressive)) 13121 if (NUMBERP (aggressive))
13088 { 13122 {
@@ -13165,7 +13199,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13165 amount_to_scroll = scroll_max; 13199 amount_to_scroll = scroll_max;
13166 else 13200 else
13167 { 13201 {
13168 aggressive = current_buffer->scroll_down_aggressively; 13202 aggressive = BVAR (current_buffer, scroll_down_aggressively);
13169 height = WINDOW_BOX_TEXT_HEIGHT (w); 13203 height = WINDOW_BOX_TEXT_HEIGHT (w);
13170 if (NUMBERP (aggressive)) 13204 if (NUMBERP (aggressive))
13171 { 13205 {
@@ -13346,7 +13380,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13346 region exists, cursor movement has to do more than just 13380 region exists, cursor movement has to do more than just
13347 set the cursor. */ 13381 set the cursor. */
13348 && !(!NILP (Vtransient_mark_mode) 13382 && !(!NILP (Vtransient_mark_mode)
13349 && !NILP (current_buffer->mark_active)) 13383 && !NILP (BVAR (current_buffer, mark_active)))
13350 && NILP (w->region_showing) 13384 && NILP (w->region_showing)
13351 && NILP (Vshow_trailing_whitespace) 13385 && NILP (Vshow_trailing_whitespace)
13352 /* Right after splitting windows, last_point may be nil. */ 13386 /* Right after splitting windows, last_point may be nil. */
@@ -13501,7 +13535,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13501 must_scroll = 1; 13535 must_scroll = 1;
13502 } 13536 }
13503 else if (rc != CURSOR_MOVEMENT_SUCCESS 13537 else if (rc != CURSOR_MOVEMENT_SUCCESS
13504 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 13538 && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
13505 { 13539 {
13506 /* If rows are bidi-reordered and point moved, back up 13540 /* If rows are bidi-reordered and point moved, back up
13507 until we find a row that does not belong to a 13541 until we find a row that does not belong to a
@@ -13559,7 +13593,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13559 else if (scroll_p) 13593 else if (scroll_p)
13560 rc = CURSOR_MOVEMENT_MUST_SCROLL; 13594 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13561 else if (rc != CURSOR_MOVEMENT_SUCCESS 13595 else if (rc != CURSOR_MOVEMENT_SUCCESS
13562 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 13596 && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
13563 { 13597 {
13564 /* With bidi-reordered rows, there could be more than 13598 /* With bidi-reordered rows, there could be more than
13565 one candidate row whose start and end positions 13599 one candidate row whose start and end positions
@@ -13859,7 +13893,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13859 struct Lisp_Char_Table *disptab = buffer_display_table (); 13893 struct Lisp_Char_Table *disptab = buffer_display_table ();
13860 13894
13861 if (! disptab_matches_widthtab (disptab, 13895 if (! disptab_matches_widthtab (disptab,
13862 XVECTOR (current_buffer->width_table))) 13896 XVECTOR (BVAR (current_buffer, width_table))))
13863 { 13897 {
13864 invalidate_region_cache (current_buffer, 13898 invalidate_region_cache (current_buffer,
13865 current_buffer->width_run_cache, 13899 current_buffer->width_run_cache,
@@ -13981,7 +14015,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13981 /* If we are highlighting the region, then we just changed 14015 /* If we are highlighting the region, then we just changed
13982 the region, so redisplay to show it. */ 14016 the region, so redisplay to show it. */
13983 if (!NILP (Vtransient_mark_mode) 14017 if (!NILP (Vtransient_mark_mode)
13984 && !NILP (current_buffer->mark_active)) 14018 && !NILP (BVAR (current_buffer, mark_active)))
13985 { 14019 {
13986 clear_glyph_matrix (w->desired_matrix); 14020 clear_glyph_matrix (w->desired_matrix);
13987 if (!try_window (window, startp, 0)) 14021 if (!try_window (window, startp, 0))
@@ -14144,8 +14178,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14144 if ((scroll_conservatively 14178 if ((scroll_conservatively
14145 || emacs_scroll_step 14179 || emacs_scroll_step
14146 || temp_scroll_step 14180 || temp_scroll_step
14147 || NUMBERP (current_buffer->scroll_up_aggressively) 14181 || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
14148 || NUMBERP (current_buffer->scroll_down_aggressively)) 14182 || NUMBERP (BVAR (current_buffer, scroll_down_aggressively)))
14149 && !current_buffer->clip_changed 14183 && !current_buffer->clip_changed
14150 && CHARPOS (startp) >= BEGV 14184 && CHARPOS (startp) >= BEGV
14151 && CHARPOS (startp) <= ZV) 14185 && CHARPOS (startp) <= ZV)
@@ -14588,7 +14622,7 @@ try_window_reusing_current_matrix (struct window *w)
14588 14622
14589 /* Can't do this if region may have changed. */ 14623 /* Can't do this if region may have changed. */
14590 if ((!NILP (Vtransient_mark_mode) 14624 if ((!NILP (Vtransient_mark_mode)
14591 && !NILP (current_buffer->mark_active)) 14625 && !NILP (BVAR (current_buffer, mark_active)))
14592 || !NILP (w->region_showing) 14626 || !NILP (w->region_showing)
14593 || !NILP (Vshow_trailing_whitespace)) 14627 || !NILP (Vshow_trailing_whitespace))
14594 return 0; 14628 return 0;
@@ -14931,7 +14965,7 @@ try_window_reusing_current_matrix (struct window *w)
14931 14965
14932 /* Can't use this optimization with bidi-reordered glyph 14966 /* Can't use this optimization with bidi-reordered glyph
14933 rows, unless cursor is already at point. */ 14967 rows, unless cursor is already at point. */
14934 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 14968 if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
14935 { 14969 {
14936 if (!(w->cursor.hpos >= 0 14970 if (!(w->cursor.hpos >= 0
14937 && w->cursor.hpos < row->used[TEXT_AREA] 14971 && w->cursor.hpos < row->used[TEXT_AREA]
@@ -15245,7 +15279,7 @@ row_containing_pos (struct window *w, EMACS_INT charpos,
15245 { 15279 {
15246 struct glyph *g; 15280 struct glyph *g;
15247 15281
15248 if (NILP (XBUFFER (w->buffer)->bidi_display_reordering) 15282 if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
15249 || (!best_row && !row->continued_p)) 15283 || (!best_row && !row->continued_p))
15250 return row; 15284 return row;
15251 /* In bidi-reordered rows, there could be several rows 15285 /* In bidi-reordered rows, there could be several rows
@@ -15392,7 +15426,7 @@ try_window_id (struct window *w)
15392 /* Can't use this if highlighting a region because a cursor movement 15426 /* Can't use this if highlighting a region because a cursor movement
15393 will do more than just set the cursor. */ 15427 will do more than just set the cursor. */
15394 if (!NILP (Vtransient_mark_mode) 15428 if (!NILP (Vtransient_mark_mode)
15395 && !NILP (current_buffer->mark_active)) 15429 && !NILP (BVAR (current_buffer, mark_active)))
15396 GIVE_UP (9); 15430 GIVE_UP (9);
15397 15431
15398 /* Likewise if highlighting trailing whitespace. */ 15432 /* Likewise if highlighting trailing whitespace. */
@@ -15412,7 +15446,7 @@ try_window_id (struct window *w)
15412 wrapped line can change the wrap position, altering the line 15446 wrapped line can change the wrap position, altering the line
15413 above it. It might be worthwhile to handle this more 15447 above it. It might be worthwhile to handle this more
15414 intelligently, but for now just redisplay from scratch. */ 15448 intelligently, but for now just redisplay from scratch. */
15415 if (!NILP (XBUFFER (w->buffer)->word_wrap)) 15449 if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap)))
15416 GIVE_UP (21); 15450 GIVE_UP (21);
15417 15451
15418 /* Under bidi reordering, adding or deleting a character in the 15452 /* Under bidi reordering, adding or deleting a character in the
@@ -15423,8 +15457,8 @@ try_window_id (struct window *w)
15423 to find the paragraph limits and widen the range of redisplayed 15457 to find the paragraph limits and widen the range of redisplayed
15424 lines to that, but for now just give up this optimization and 15458 lines to that, but for now just give up this optimization and
15425 redisplay from scratch. */ 15459 redisplay from scratch. */
15426 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) 15460 if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))
15427 && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction)) 15461 && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction)))
15428 GIVE_UP (22); 15462 GIVE_UP (22);
15429 15463
15430 /* Make sure beg_unchanged and end_unchanged are up to date. Do it 15464 /* Make sure beg_unchanged and end_unchanged are up to date. Do it
@@ -16395,7 +16429,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
16395 it.glyph_row->used[TEXT_AREA] = 0; 16429 it.glyph_row->used[TEXT_AREA] = 0;
16396 SET_TEXT_POS (it.position, 0, 0); 16430 SET_TEXT_POS (it.position, 0, 0);
16397 16431
16398 multibyte_p = !NILP (buffer->enable_multibyte_characters); 16432 multibyte_p = !NILP (BVAR (buffer, enable_multibyte_characters));
16399 p = arrow_string; 16433 p = arrow_string;
16400 while (p < arrow_end) 16434 while (p < arrow_end)
16401 { 16435 {
@@ -17139,18 +17173,15 @@ find_row_edges (struct it *it, struct glyph_row *row,
17139 if (min_pos <= ZV) 17173 if (min_pos <= ZV)
17140 SET_TEXT_POS (row->minpos, min_pos, min_bpos); 17174 SET_TEXT_POS (row->minpos, min_pos, min_bpos);
17141 else 17175 else
17142 { 17176 /* We didn't find _any_ valid buffer positions in any of the
17143 /* We didn't find _any_ valid buffer positions in any of the 17177 glyphs, so we must trust the iterator's computed positions. */
17144 glyphs, so we must trust the iterator's computed
17145 positions. */
17146 row->minpos = row->start.pos; 17178 row->minpos = row->start.pos;
17179 if (max_pos <= 0)
17180 {
17147 max_pos = CHARPOS (it->current.pos); 17181 max_pos = CHARPOS (it->current.pos);
17148 max_bpos = BYTEPOS (it->current.pos); 17182 max_bpos = BYTEPOS (it->current.pos);
17149 } 17183 }
17150 17184
17151 if (!max_pos)
17152 abort ();
17153
17154 /* Here are the various use-cases for ending the row, and the 17185 /* Here are the various use-cases for ending the row, and the
17155 corresponding values for ROW->maxpos: 17186 corresponding values for ROW->maxpos:
17156 17187
@@ -17263,8 +17294,18 @@ display_line (struct it *it)
17263 if the first glyph is partially visible or if we hit a line end. */ 17294 if the first glyph is partially visible or if we hit a line end. */
17264 if (it->current_x < it->first_visible_x) 17295 if (it->current_x < it->first_visible_x)
17265 { 17296 {
17297 this_line_min_pos = row->start.pos;
17266 move_it_in_display_line_to (it, ZV, it->first_visible_x, 17298 move_it_in_display_line_to (it, ZV, it->first_visible_x,
17267 MOVE_TO_POS | MOVE_TO_X); 17299 MOVE_TO_POS | MOVE_TO_X);
17300 /* Record the smallest positions seen while we moved over
17301 display elements that are not visible. This is needed by
17302 redisplay_internal for optimizing the case where the cursor
17303 stays inside the same line. The rest of this function only
17304 considers positions that are actually displayed, so
17305 RECORD_MAX_MIN_POS will not otherwise record positions that
17306 are hscrolled to the left of the left edge of the window. */
17307 min_pos = CHARPOS (this_line_min_pos);
17308 min_bpos = BYTEPOS (this_line_min_pos);
17268 } 17309 }
17269 else 17310 else
17270 { 17311 {
@@ -17323,7 +17364,7 @@ display_line (struct it *it)
17323 row->glyphs[TEXT_AREA]->charpos = -1; 17364 row->glyphs[TEXT_AREA]->charpos = -1;
17324 row->displays_text_p = 0; 17365 row->displays_text_p = 0;
17325 17366
17326 if (!NILP (XBUFFER (it->w->buffer)->indicate_empty_lines) 17367 if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines))
17327 && (!MINI_WINDOW_P (it->w) 17368 && (!MINI_WINDOW_P (it->w)
17328 || (minibuf_level && EQ (it->window, minibuf_window)))) 17369 || (minibuf_level && EQ (it->window, minibuf_window))))
17329 row->indicate_empty_line_p = 1; 17370 row->indicate_empty_line_p = 1;
@@ -17901,10 +17942,10 @@ See also `bidi-paragraph-direction'. */)
17901 old = current_buffer; 17942 old = current_buffer;
17902 } 17943 }
17903 17944
17904 if (NILP (buf->bidi_display_reordering)) 17945 if (NILP (BVAR (buf, bidi_display_reordering)))
17905 return Qleft_to_right; 17946 return Qleft_to_right;
17906 else if (!NILP (buf->bidi_paragraph_direction)) 17947 else if (!NILP (BVAR (buf, bidi_paragraph_direction)))
17907 return buf->bidi_paragraph_direction; 17948 return BVAR (buf, bidi_paragraph_direction);
17908 else 17949 else
17909 { 17950 {
17910 /* Determine the direction from buffer text. We could try to 17951 /* Determine the direction from buffer text. We could try to
@@ -18163,14 +18204,14 @@ display_mode_lines (struct window *w)
18163 18204
18164 /* Select mode line face based on the real selected window. */ 18205 /* Select mode line face based on the real selected window. */
18165 display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w), 18206 display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w),
18166 current_buffer->mode_line_format); 18207 BVAR (current_buffer, mode_line_format));
18167 ++n; 18208 ++n;
18168 } 18209 }
18169 18210
18170 if (WINDOW_WANTS_HEADER_LINE_P (w)) 18211 if (WINDOW_WANTS_HEADER_LINE_P (w))
18171 { 18212 {
18172 display_mode_line (w, HEADER_LINE_FACE_ID, 18213 display_mode_line (w, HEADER_LINE_FACE_ID,
18173 current_buffer->header_line_format); 18214 BVAR (current_buffer, header_line_format));
18174 ++n; 18215 ++n;
18175 } 18216 }
18176 18217
@@ -19105,7 +19146,7 @@ static char *
19105decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag) 19146decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag)
19106{ 19147{
19107 Lisp_Object val; 19148 Lisp_Object val;
19108 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 19149 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
19109 const unsigned char *eol_str; 19150 const unsigned char *eol_str;
19110 int eol_str_len; 19151 int eol_str_len;
19111 /* The EOL conversion we are using. */ 19152 /* The EOL conversion we are using. */
@@ -19201,7 +19242,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19201 switch (c) 19242 switch (c)
19202 { 19243 {
19203 case '*': 19244 case '*':
19204 if (!NILP (b->read_only)) 19245 if (!NILP (BVAR (b, read_only)))
19205 return "%"; 19246 return "%";
19206 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 19247 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
19207 return "*"; 19248 return "*";
@@ -19211,7 +19252,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19211 /* This differs from %* only for a modified read-only buffer. */ 19252 /* This differs from %* only for a modified read-only buffer. */
19212 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 19253 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
19213 return "*"; 19254 return "*";
19214 if (!NILP (b->read_only)) 19255 if (!NILP (BVAR (b, read_only)))
19215 return "%"; 19256 return "%";
19216 return "-"; 19257 return "-";
19217 19258
@@ -19273,7 +19314,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19273 } 19314 }
19274 19315
19275 case 'b': 19316 case 'b':
19276 obj = b->name; 19317 obj = BVAR (b, name);
19277 break; 19318 break;
19278 19319
19279 case 'c': 19320 case 'c':
@@ -19313,7 +19354,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19313 return "Emacs"; 19354 return "Emacs";
19314 19355
19315 case 'f': 19356 case 'f':
19316 obj = b->filename; 19357 obj = BVAR (b, filename);
19317 break; 19358 break;
19318 19359
19319 case 'i': 19360 case 'i':
@@ -19449,7 +19490,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19449 break; 19490 break;
19450 19491
19451 case 'm': 19492 case 'm':
19452 obj = b->mode_name; 19493 obj = BVAR (b, mode_name);
19453 break; 19494 break;
19454 19495
19455 case 'n': 19496 case 'n':
@@ -19534,7 +19575,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19534 { 19575 {
19535 int count = inhibit_garbage_collection (); 19576 int count = inhibit_garbage_collection ();
19536 Lisp_Object val = call1 (intern ("file-remote-p"), 19577 Lisp_Object val = call1 (intern ("file-remote-p"),
19537 current_buffer->directory); 19578 BVAR (current_buffer, directory));
19538 unbind_to (count, Qnil); 19579 unbind_to (count, Qnil);
19539 19580
19540 if (NILP (val)) 19581 if (NILP (val))
@@ -19544,11 +19585,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19544 } 19585 }
19545 19586
19546 case 't': /* indicate TEXT or BINARY */ 19587 case 't': /* indicate TEXT or BINARY */
19547#ifdef MODE_LINE_BINARY_TEXT
19548 return MODE_LINE_BINARY_TEXT (b);
19549#else
19550 return "T"; 19588 return "T";
19551#endif
19552 19589
19553 case 'z': 19590 case 'z':
19554 /* coding-system (not including end-of-line format) */ 19591 /* coding-system (not including end-of-line format) */
@@ -19569,7 +19606,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19569 (FRAME_TERMINAL_CODING (f)->id), 19606 (FRAME_TERMINAL_CODING (f)->id),
19570 p, 0); 19607 p, 0);
19571 } 19608 }
19572 p = decode_mode_spec_coding (b->buffer_file_coding_system, 19609 p = decode_mode_spec_coding (BVAR (b, buffer_file_coding_system),
19573 p, eol_flag); 19610 p, eol_flag);
19574 19611
19575#if 0 /* This proves to be annoying; I think we can do without. -- rms. */ 19612#if 0 /* This proves to be annoying; I think we can do without. -- rms. */
@@ -19619,8 +19656,8 @@ display_count_lines (EMACS_INT start, EMACS_INT start_byte,
19619 19656
19620 /* If we are not in selective display mode, 19657 /* If we are not in selective display mode,
19621 check only for newlines. */ 19658 check only for newlines. */
19622 int selective_display = (!NILP (current_buffer->selective_display) 19659 int selective_display = (!NILP (BVAR (current_buffer, selective_display))
19623 && !INTEGERP (current_buffer->selective_display)); 19660 && !INTEGERP (BVAR (current_buffer, selective_display)));
19624 19661
19625 if (count > 0) 19662 if (count > 0)
19626 { 19663 {
@@ -23267,13 +23304,13 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23267 { 23304 {
23268 if (w == XWINDOW (echo_area_window)) 23305 if (w == XWINDOW (echo_area_window))
23269 { 23306 {
23270 if (EQ (b->cursor_type, Qt) || NILP (b->cursor_type)) 23307 if (EQ (BVAR (b, cursor_type), Qt) || NILP (BVAR (b, cursor_type)))
23271 { 23308 {
23272 *width = FRAME_CURSOR_WIDTH (f); 23309 *width = FRAME_CURSOR_WIDTH (f);
23273 return FRAME_DESIRED_CURSOR (f); 23310 return FRAME_DESIRED_CURSOR (f);
23274 } 23311 }
23275 else 23312 else
23276 return get_specified_cursor_type (b->cursor_type, width); 23313 return get_specified_cursor_type (BVAR (b, cursor_type), width);
23277 } 23314 }
23278 23315
23279 *active_cursor = 0; 23316 *active_cursor = 0;
@@ -23293,23 +23330,23 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23293 } 23330 }
23294 23331
23295 /* Never display a cursor in a window in which cursor-type is nil. */ 23332 /* Never display a cursor in a window in which cursor-type is nil. */
23296 if (NILP (b->cursor_type)) 23333 if (NILP (BVAR (b, cursor_type)))
23297 return NO_CURSOR; 23334 return NO_CURSOR;
23298 23335
23299 /* Get the normal cursor type for this window. */ 23336 /* Get the normal cursor type for this window. */
23300 if (EQ (b->cursor_type, Qt)) 23337 if (EQ (BVAR (b, cursor_type), Qt))
23301 { 23338 {
23302 cursor_type = FRAME_DESIRED_CURSOR (f); 23339 cursor_type = FRAME_DESIRED_CURSOR (f);
23303 *width = FRAME_CURSOR_WIDTH (f); 23340 *width = FRAME_CURSOR_WIDTH (f);
23304 } 23341 }
23305 else 23342 else
23306 cursor_type = get_specified_cursor_type (b->cursor_type, width); 23343 cursor_type = get_specified_cursor_type (BVAR (b, cursor_type), width);
23307 23344
23308 /* Use cursor-in-non-selected-windows instead 23345 /* Use cursor-in-non-selected-windows instead
23309 for non-selected window or frame. */ 23346 for non-selected window or frame. */
23310 if (non_selected) 23347 if (non_selected)
23311 { 23348 {
23312 alt_cursor = b->cursor_in_non_selected_windows; 23349 alt_cursor = BVAR (b, cursor_in_non_selected_windows);
23313 if (!EQ (Qt, alt_cursor)) 23350 if (!EQ (Qt, alt_cursor))
23314 return get_specified_cursor_type (alt_cursor, width); 23351 return get_specified_cursor_type (alt_cursor, width);
23315 /* t means modify the normal cursor type. */ 23352 /* t means modify the normal cursor type. */
@@ -23356,7 +23393,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
23356 /* Cursor is blinked off, so determine how to "toggle" it. */ 23393 /* Cursor is blinked off, so determine how to "toggle" it. */
23357 23394
23358 /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */ 23395 /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */
23359 if ((alt_cursor = Fassoc (b->cursor_type, Vblink_cursor_alist), !NILP (alt_cursor))) 23396 if ((alt_cursor = Fassoc (BVAR (b, cursor_type), Vblink_cursor_alist), !NILP (alt_cursor)))
23360 return get_specified_cursor_type (XCDR (alt_cursor), width); 23397 return get_specified_cursor_type (XCDR (alt_cursor), width);
23361 23398
23362 /* Then see if frame has specified a specific blink off cursor type. */ 23399 /* Then see if frame has specified a specific blink off cursor type. */
@@ -25472,11 +25509,11 @@ note_mouse_highlight (struct frame *f, int x, int y)
25472 necessarily display the character whose position 25509 necessarily display the character whose position
25473 is the smallest. */ 25510 is the smallest. */
25474 Lisp_Object lim1 = 25511 Lisp_Object lim1 =
25475 NILP (XBUFFER (buffer)->bidi_display_reordering) 25512 NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
25476 ? Fmarker_position (w->start) 25513 ? Fmarker_position (w->start)
25477 : Qnil; 25514 : Qnil;
25478 Lisp_Object lim2 = 25515 Lisp_Object lim2 =
25479 NILP (XBUFFER (buffer)->bidi_display_reordering) 25516 NILP (BVAR (XBUFFER (buffer), bidi_display_reordering))
25480 ? make_number (BUF_Z (XBUFFER (buffer)) 25517 ? make_number (BUF_Z (XBUFFER (buffer))
25481 - XFASTINT (w->window_end_pos)) 25518 - XFASTINT (w->window_end_pos))
25482 : Qnil; 25519 : Qnil;
diff --git a/src/xfaces.c b/src/xfaces.c
index 82ad0b9aeb6..4cc47c85050 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5970,7 +5970,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
5970{ 5970{
5971 int face_id; 5971 int face_id;
5972 5972
5973 if (NILP (current_buffer->enable_multibyte_characters)) 5973 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
5974 ch = 0; 5974 ch = 0;
5975 5975
5976 if (NILP (prop)) 5976 if (NILP (prop))
diff --git a/src/xfns.c b/src/xfns.c
index ce2d91e0df1..deb0e192a54 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3473,9 +3473,9 @@ This function is an internal primitive--use `make-frame' instead. */)
3473 /* Initialize `default-minibuffer-frame' in case this is the first 3473 /* Initialize `default-minibuffer-frame' in case this is the first
3474 frame on this terminal. */ 3474 frame on this terminal. */
3475 if (FRAME_HAS_MINIBUF_P (f) 3475 if (FRAME_HAS_MINIBUF_P (f)
3476 && (!FRAMEP (kb->Vdefault_minibuffer_frame) 3476 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
3477 || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame)))) 3477 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
3478 kb->Vdefault_minibuffer_frame = frame; 3478 KVAR (kb, Vdefault_minibuffer_frame) = frame;
3479 3479
3480 /* All remaining specified parameters, which have not been "used" 3480 /* All remaining specified parameters, which have not been "used"
3481 by x_get_arg and friends, now go in the misc. alist of the frame. */ 3481 by x_get_arg and friends, now go in the misc. alist of the frame. */
@@ -4610,7 +4610,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4610 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); 4610 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
4611 old_buffer = current_buffer; 4611 old_buffer = current_buffer;
4612 set_buffer_internal_1 (XBUFFER (buffer)); 4612 set_buffer_internal_1 (XBUFFER (buffer));
4613 current_buffer->truncate_lines = Qnil; 4613 BVAR (current_buffer, truncate_lines) = Qnil;
4614 specbind (Qinhibit_read_only, Qt); 4614 specbind (Qinhibit_read_only, Qt);
4615 specbind (Qinhibit_modification_hooks, Qt); 4615 specbind (Qinhibit_modification_hooks, Qt);
4616 Ferase_buffer (); 4616 Ferase_buffer ();
@@ -5106,7 +5106,7 @@ Text larger than the specified size is clipped. */)
5106 /* Display the tooltip text in a temporary buffer. */ 5106 /* Display the tooltip text in a temporary buffer. */
5107 old_buffer = current_buffer; 5107 old_buffer = current_buffer;
5108 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5108 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5109 current_buffer->truncate_lines = Qnil; 5109 BVAR (current_buffer, truncate_lines) = Qnil;
5110 clear_glyph_matrix (w->desired_matrix); 5110 clear_glyph_matrix (w->desired_matrix);
5111 clear_glyph_matrix (w->current_matrix); 5111 clear_glyph_matrix (w->current_matrix);
5112 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5112 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
diff --git a/src/xftfont.c b/src/xftfont.c
index 084ca735171..695527c4236 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -187,17 +187,20 @@ xftfont_fix_match (FcPattern *pat, FcPattern *match)
187 double dpi; 187 double dpi;
188 188
189 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b); 189 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b);
190 if (! b) 190 if (! b)
191 { 191 {
192 FcPatternDel (match, FC_ANTIALIAS); 192 FcPatternDel (match, FC_ANTIALIAS);
193 FcPatternAddBool (match, FC_ANTIALIAS, FcFalse); 193 FcPatternAddBool (match, FC_ANTIALIAS, FcFalse);
194 } 194 }
195 FcPatternGetBool (pat, FC_HINTING, 0, &b); 195 FcPatternGetBool (pat, FC_HINTING, 0, &b);
196 if (! b) 196 if (! b)
197 { 197 {
198 FcPatternDel (match, FC_HINTING); 198 FcPatternDel (match, FC_HINTING);
199 FcPatternAddBool (match, FC_HINTING, FcFalse); 199 FcPatternAddBool (match, FC_HINTING, FcFalse);
200 } 200 }
201#ifndef FC_HINT_STYLE
202# define FC_HINT_STYLE "hintstyle"
203#endif
201 if (FcResultMatch == FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i)) 204 if (FcResultMatch == FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i))
202 { 205 {
203 FcPatternDel (match, FC_HINT_STYLE); 206 FcPatternDel (match, FC_HINT_STYLE);
@@ -781,4 +784,3 @@ syms_of_xftfont (void)
781 784
782 register_font_driver (&xftfont_driver, NULL); 785 register_font_driver (&xftfont_driver, NULL);
783} 786}
784
diff --git a/src/xmenu.c b/src/xmenu.c
index ad1a764eab8..934db0f0406 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -887,31 +887,26 @@ apply_systemfont_to_dialog (Widget w)
887 { 887 {
888 XrmDatabase db = XtDatabase (XtDisplay (w)); 888 XrmDatabase db = XtDatabase (XtDisplay (w));
889 if (db) 889 if (db)
890 XrmPutStringResource (&db, "*dialog.faceName", fn); 890 XrmPutStringResource (&db, "*dialog.font", fn);
891 } 891 }
892} 892}
893 893
894static void 894static void
895apply_systemfont_to_menu (Widget w) 895apply_systemfont_to_menu (struct frame *f, Widget w)
896{ 896{
897 const char *fn = xsettings_get_system_normal_font (); 897 const char *fn = xsettings_get_system_normal_font ();
898 int defflt;
899 898
900 if (!fn) return; 899 if (fn)
901
902 if (XtIsShell (w)) /* popup menu */
903 { 900 {
904 Widget *childs = NULL; 901 XrmDatabase db = XtDatabase (XtDisplay (w));
905 902 if (db)
906 XtVaGetValues (w, XtNchildren, &childs, NULL); 903 {
907 if (*childs) w = *childs; 904 XrmPutStringResource (&db, "*menubar*font", fn);
905 XrmPutStringResource (&db, "*popup*font", fn);
906 }
908 } 907 }
909
910 /* Only use system font if the default is used for the menu. */
911 XtVaGetValues (w, XtNdefaultFace, &defflt, NULL);
912 if (defflt)
913 XtVaSetValues (w, XtNfaceName, fn, NULL);
914} 908}
909
915#endif 910#endif
916 911
917/* Set the contents of the menubar widgets of frame F. 912/* Set the contents of the menubar widgets of frame F.
@@ -1210,7 +1205,11 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1210 char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()"; 1205 char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()";
1211 XtTranslations override = XtParseTranslationTable (menuOverride); 1206 XtTranslations override = XtParseTranslationTable (menuOverride);
1212 1207
1213 menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, 1208#ifdef USE_LUCID
1209 apply_systemfont_to_menu (f, f->output_data.x->column_widget);
1210#endif
1211 menubar_widget = lw_create_widget ("menubar", "menubar", id,
1212 first_wv,
1214 f->output_data.x->column_widget, 1213 f->output_data.x->column_widget,
1215 0, 1214 0,
1216 popup_activate_callback, 1215 popup_activate_callback,
@@ -1221,9 +1220,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1221 1220
1222 /* Make menu pop down on C-g. */ 1221 /* Make menu pop down on C-g. */
1223 XtOverrideTranslations (menubar_widget, override); 1222 XtOverrideTranslations (menubar_widget, override);
1224#ifdef USE_LUCID
1225 apply_systemfont_to_menu (menubar_widget);
1226#endif
1227 } 1223 }
1228 1224
1229 { 1225 {
@@ -1542,6 +1538,10 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1542 if (! FRAME_X_P (f)) 1538 if (! FRAME_X_P (f))
1543 abort (); 1539 abort ();
1544 1540
1541#ifdef USE_LUCID
1542 apply_systemfont_to_menu (f, f->output_data.x->widget);
1543#endif
1544
1545 menu_id = widget_id_tick++; 1545 menu_id = widget_id_tick++;
1546 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, 1546 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
1547 f->output_data.x->widget, 1, 0, 1547 f->output_data.x->widget, 1, 0,
@@ -1549,10 +1549,6 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1549 popup_deactivate_callback, 1549 popup_deactivate_callback,
1550 menu_highlight_callback); 1550 menu_highlight_callback);
1551 1551
1552#ifdef USE_LUCID
1553 apply_systemfont_to_menu (menu);
1554#endif
1555
1556 dummy.type = ButtonPress; 1552 dummy.type = ButtonPress;
1557 dummy.serial = 0; 1553 dummy.serial = 0;
1558 dummy.send_event = 0; 1554 dummy.send_event = 0;
diff --git a/src/xrdb.c b/src/xrdb.c
index 90afe32bb66..01714900752 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -546,12 +546,14 @@ x_load_resources (Display *display, const char *xrm_string,
546 546
547#else /* not USE_MOTIF */ 547#else /* not USE_MOTIF */
548 548
549 sprintf (line, "Emacs.dialog*.font: %s", helv);
550 XrmPutLineResource (&rdb, line);
551 sprintf (line, "Emacs.dialog*.background: grey75"); 549 sprintf (line, "Emacs.dialog*.background: grey75");
552 XrmPutLineResource (&rdb, line); 550 XrmPutLineResource (&rdb, line);
551#if !defined (HAVE_XFT) || !defined (USE_LUCID)
552 sprintf (line, "Emacs.dialog*.font: %s", helv);
553 XrmPutLineResource (&rdb, line);
553 sprintf (line, "*XlwMenu*font: %s", helv); 554 sprintf (line, "*XlwMenu*font: %s", helv);
554 XrmPutLineResource (&rdb, line); 555 XrmPutLineResource (&rdb, line);
556#endif
555 sprintf (line, "*XlwMenu*background: grey75"); 557 sprintf (line, "*XlwMenu*background: grey75");
556 XrmPutLineResource (&rdb, line); 558 XrmPutLineResource (&rdb, line);
557 sprintf (line, "Emacs*verticalScrollBar.background: grey75"); 559 sprintf (line, "Emacs*verticalScrollBar.background: grey75");
diff --git a/src/xsettings.c b/src/xsettings.c
index e3d2c6e9efb..097b2477e03 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -75,7 +75,7 @@ enum {
75 SEEN_FONT = 0x40, 75 SEEN_FONT = 0x40,
76 SEEN_TB_STYLE = 0x80, 76 SEEN_TB_STYLE = 0x80,
77}; 77};
78struct xsettings 78struct xsettings
79{ 79{
80#ifdef HAVE_XFT 80#ifdef HAVE_XFT
81 FcBool aa, hinting; 81 FcBool aa, hinting;
@@ -104,7 +104,7 @@ something_changedCB (GConfClient *client,
104 gpointer user_data) 104 gpointer user_data)
105{ 105{
106 GConfValue *v = gconf_entry_get_value (entry); 106 GConfValue *v = gconf_entry_get_value (entry);
107 107
108 if (!v) return; 108 if (!v) return;
109 if (v->type == GCONF_VALUE_STRING) 109 if (v->type == GCONF_VALUE_STRING)
110 { 110 {
@@ -196,7 +196,7 @@ get_prop_window (struct x_display_info *dpyinfo)
196 4 CARD32 last-change-serial 196 4 CARD32 last-change-serial
197 197
198 and then the value, For string: 198 and then the value, For string:
199 199
200 bytes type what 200 bytes type what
201 ------------------------------------ 201 ------------------------------------
202 4 CARD32 n = value-length 202 4 CARD32 n = value-length
@@ -280,7 +280,7 @@ parse_settings (unsigned char *prop,
280 (strcmp (XSETTINGS_FONT_NAME, name) == 0) 280 (strcmp (XSETTINGS_FONT_NAME, name) == 0)
281 || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0); 281 || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0);
282 282
283 switch (type) 283 switch (type)
284 { 284 {
285 case 0: /* Integer */ 285 case 0: /* Integer */
286 if (bytes_parsed+4 > bytes) return BadLength; 286 if (bytes_parsed+4 > bytes) return BadLength;
@@ -310,14 +310,14 @@ parse_settings (unsigned char *prop,
310 case 2: /* RGB value */ 310 case 2: /* RGB value */
311 /* No need to parse this */ 311 /* No need to parse this */
312 if (bytes_parsed+8 > bytes) return BadLength; 312 if (bytes_parsed+8 > bytes) return BadLength;
313 bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */ 313 bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */
314 break; 314 break;
315 315
316 default: /* Parse Error */ 316 default: /* Parse Error */
317 return BadValue; 317 return BadValue;
318 } 318 }
319 319
320 if (want_this) 320 if (want_this)
321 { 321 {
322 ++settings_seen; 322 ++settings_seen;
323 if (strcmp (name, XSETTINGS_FONT_NAME) == 0) 323 if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
@@ -341,6 +341,7 @@ parse_settings (unsigned char *prop,
341 settings->seen |= SEEN_HINTING; 341 settings->seen |= SEEN_HINTING;
342 settings->hinting = ival != 0; 342 settings->hinting = ival != 0;
343 } 343 }
344# ifdef FC_HINT_STYLE
344 else if (strcmp (name, "Xft/HintStyle") == 0) 345 else if (strcmp (name, "Xft/HintStyle") == 0)
345 { 346 {
346 settings->seen |= SEEN_HINTSTYLE; 347 settings->seen |= SEEN_HINTSTYLE;
@@ -355,6 +356,7 @@ parse_settings (unsigned char *prop,
355 else 356 else
356 settings->seen &= ~SEEN_HINTSTYLE; 357 settings->seen &= ~SEEN_HINTSTYLE;
357 } 358 }
359# endif
358 else if (strcmp (name, "Xft/RGBA") == 0) 360 else if (strcmp (name, "Xft/RGBA") == 0)
359 { 361 {
360 settings->seen |= SEEN_RGBA; 362 settings->seen |= SEEN_RGBA;
@@ -442,7 +444,9 @@ apply_xft_settings (struct x_display_info *dpyinfo,
442 pat); 444 pat);
443 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa); 445 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa);
444 FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting); 446 FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting);
447# ifdef FC_HINT_STYLE
445 FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle); 448 FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle);
449# endif
446 FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter); 450 FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter);
447 FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba); 451 FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
448 FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi); 452 FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
@@ -488,6 +492,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
488 if (strlen (buf) > 0) strcat (buf, ", "); 492 if (strlen (buf) > 0) strcat (buf, ", ");
489 sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter); 493 sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter);
490 494
495# ifdef FC_HINT_STYLE
491 if ((settings->seen & SEEN_HINTSTYLE) != 0 496 if ((settings->seen & SEEN_HINTSTYLE) != 0
492 && oldsettings.hintstyle != settings->hintstyle) 497 && oldsettings.hintstyle != settings->hintstyle)
493 { 498 {
@@ -496,6 +501,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
496 ++changed; 501 ++changed;
497 oldsettings.hintstyle = settings->hintstyle; 502 oldsettings.hintstyle = settings->hintstyle;
498 } 503 }
504# endif
499 if (strlen (buf) > 0) strcat (buf, ", "); 505 if (strlen (buf) > 0) strcat (buf, ", ");
500 sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle); 506 sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle);
501 507
@@ -508,7 +514,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
508 FcPatternAddDouble (pat, FC_DPI, settings->dpi); 514 FcPatternAddDouble (pat, FC_DPI, settings->dpi);
509 ++changed; 515 ++changed;
510 oldsettings.dpi = settings->dpi; 516 oldsettings.dpi = settings->dpi;
511 517
512 /* Change the DPI on this display and all frames on the display. */ 518 /* Change the DPI on this display and all frames on the display. */
513 dpyinfo->resy = dpyinfo->resx = settings->dpi; 519 dpyinfo->resy = dpyinfo->resx = settings->dpi;
514 FOR_EACH_FRAME (tail, frame) 520 FOR_EACH_FRAME (tail, frame)
@@ -565,7 +571,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
565 571
566 if (settings.seen & SEEN_FONT) 572 if (settings.seen & SEEN_FONT)
567 { 573 {
568 if (!current_font || strcmp (current_font, settings.font) != 0) 574 if (!current_font || strcmp (current_font, settings.font) != 0)
569 { 575 {
570 free (current_font); 576 free (current_font);
571 current_font = settings.font; 577 current_font = settings.font;
@@ -774,4 +780,3 @@ If this variable is nil, Emacs ignores system font changes. */);
774 780
775 Fprovide (intern_c_string ("dynamic-setting"), Qnil); 781 Fprovide (intern_c_string ("dynamic-setting"), Qnil);
776} 782}
777
diff --git a/src/xterm.c b/src/xterm.c
index 31f002fa05c..909b6978f5a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -488,17 +488,16 @@ x_set_frame_alpha (struct frame *f)
488 488
489 if (rc == Success && actual != None) 489 if (rc == Success && actual != None)
490 { 490 {
491 unsigned long value = *(unsigned long *)data;
491 XFree ((void *) data); 492 XFree ((void *) data);
492 if (*(unsigned long *)data == opac) 493 if (value == opac)
493 { 494 {
494 x_uncatch_errors (); 495 x_uncatch_errors ();
495 return; 496 return;
496 } 497 }
497 } 498 }
498 x_uncatch_errors ();
499 } 499 }
500 500
501 x_catch_errors (dpy);
502 XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 501 XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
503 XA_CARDINAL, 32, PropModeReplace, 502 XA_CARDINAL, 32, PropModeReplace,
504 (unsigned char *) &opac, 1L); 503 (unsigned char *) &opac, 1L);
@@ -7728,7 +7727,7 @@ x_connection_closed (Display *dpy, const char *error_message)
7728 { 7727 {
7729 /* Set this to t so that delete_frame won't get confused 7728 /* Set this to t so that delete_frame won't get confused
7730 trying to find a replacement. */ 7729 trying to find a replacement. */
7731 FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt; 7730 KVAR (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame) = Qt;
7732 delete_frame (frame, Qnoelisp); 7731 delete_frame (frame, Qnoelisp);
7733 } 7732 }
7734 7733
@@ -9967,7 +9966,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9967 { 9966 {
9968 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 9967 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
9969 init_kboard (terminal->kboard); 9968 init_kboard (terminal->kboard);
9970 terminal->kboard->Vwindow_system = Qx; 9969 KVAR (terminal->kboard, Vwindow_system) = Qx;
9971 9970
9972 /* Add the keyboard to the list before running Lisp code (via 9971 /* Add the keyboard to the list before running Lisp code (via
9973 Qvendor_specific_keysyms below), since these are not traced 9972 Qvendor_specific_keysyms below), since these are not traced
@@ -9989,7 +9988,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9989 /* Temporarily hide the partially initialized terminal. */ 9988 /* Temporarily hide the partially initialized terminal. */
9990 terminal_list = terminal->next_terminal; 9989 terminal_list = terminal->next_terminal;
9991 UNBLOCK_INPUT; 9990 UNBLOCK_INPUT;
9992 terminal->kboard->Vsystem_key_alist 9991 KVAR (terminal->kboard, Vsystem_key_alist)
9993 = call1 (Qvendor_specific_keysyms, 9992 = call1 (Qvendor_specific_keysyms,
9994 vendor ? build_string (vendor) : empty_unibyte_string); 9993 vendor ? build_string (vendor) : empty_unibyte_string);
9995 BLOCK_INPUT; 9994 BLOCK_INPUT;