aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2012-08-19 02:44:11 +0200
committerJoakim Verona2012-08-19 02:44:11 +0200
commit5436d1df5e2ba0b4d4f72b03a1cd09b20403654b (patch)
tree532faa27319b3bb199d414dc85e63a58246d30b0 /src
parentd02344322b0d2fea8dd9ad9dd0a6c70e058f967b (diff)
parente757f1c6f393cf82057dbee0a4325b07f0fd55c4 (diff)
downloademacs-5436d1df5e2ba0b4d4f72b03a1cd09b20403654b.tar.gz
emacs-5436d1df5e2ba0b4d4f72b03a1cd09b20403654b.zip
upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog322
-rw-r--r--src/alloc.c6
-rw-r--r--src/buffer.c583
-rw-r--r--src/buffer.h117
-rw-r--r--src/callint.c4
-rw-r--r--src/casetab.c24
-rw-r--r--src/category.c35
-rw-r--r--src/charset.c4
-rw-r--r--src/chartab.c112
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c16
-rw-r--r--src/data.c75
-rw-r--r--src/dispnew.c51
-rw-r--r--src/doc.c7
-rw-r--r--src/doprnt.c1
-rw-r--r--src/dosfns.c2
-rw-r--r--src/editfns.c21
-rw-r--r--src/eval.c18
-rw-r--r--src/fileio.c53
-rw-r--r--src/fns.c10
-rw-r--r--src/font.c9
-rw-r--r--src/font.h12
-rw-r--r--src/fontset.c4
-rw-r--r--src/frame.c119
-rw-r--r--src/frame.h114
-rw-r--r--src/gnutls.c2
-rw-r--r--src/gtkutil.c13
-rw-r--r--src/image.c34
-rw-r--r--src/indent.c10
-rw-r--r--src/insdel.c20
-rw-r--r--src/intervals.c229
-rw-r--r--src/intervals.h39
-rw-r--r--src/keyboard.c182
-rw-r--r--src/keyboard.h49
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h136
-rw-r--r--src/lread.c8
-rw-r--r--src/macros.c15
-rw-r--r--src/makefile.w32-in13
-rw-r--r--src/minibuf.c14
-rw-r--r--src/msdos.c6
-rw-r--r--src/nsfns.m24
-rw-r--r--src/nsfont.m64
-rw-r--r--src/nsimage.m3
-rw-r--r--src/nsmenu.m4
-rw-r--r--src/nsterm.h5
-rw-r--r--src/nsterm.m18
-rw-r--r--src/print.c22
-rw-r--r--src/process.c292
-rw-r--r--src/process.h27
-rw-r--r--src/search.c12
-rw-r--r--src/syntax.c12
-rw-r--r--src/sysdep.c9
-rw-r--r--src/term.c5
-rw-r--r--src/termhooks.h23
-rw-r--r--src/terminal.c12
-rw-r--r--src/textprop.c26
-rw-r--r--src/undo.c45
-rw-r--r--src/w32.c2
-rw-r--r--src/w32fns.c46
-rw-r--r--src/w32menu.c6
-rw-r--r--src/w32term.c20
-rw-r--r--src/window.c973
-rw-r--r--src/window.h91
-rw-r--r--src/xdisp.c247
-rw-r--r--src/xfaces.c57
-rw-r--r--src/xfns.c53
-rw-r--r--src/xfont.c1
-rw-r--r--src/xftfont.c19
-rw-r--r--src/xmenu.c6
-rw-r--r--src/xselect.c9
-rw-r--r--src/xterm.c30
72 files changed, 3062 insertions, 1594 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6e49dd44fde..1956d602e6a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,312 @@
12012-08-18 Paul Eggert <eggert@cs.ucla.edu>
2
3 port new setting code to Sun C 5.8 2005/10/13
4 * chartab.c, lisp.h (char_table_set, char_table_set_range):
5 Return void, not Lisp_Object. Otherwise, the compiler
6 complains about (A?B:C) where B is void and C is Lisp_Object
7 when compiling CHAR_TABLE_SET, due to the recent change to
8 the API of sub_char_table_set_contents.
9
102012-08-18 Chong Yidong <cyd@gnu.org>
11
12 * xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE
13 for the string case (Bug#3874).
14
152012-08-18 Paul Eggert <eggert@cs.ucla.edu>
16
17 * buffer.h (BSET): Remove (Bug#12215).
18 Replace all uses with calls to new setter functions.
19 (bset_bidi_paragraph_direction, bset_case_canon_table)
20 (bset_case_eqv_table, bset_directory, bset_display_count)
21 (bset_display_time, bset_downcase_table)
22 (bset_enable_multibyte_characters, bset_filename, bset_keymap)
23 (bset_last_selected_window, bset_local_var_alist)
24 (bset_mark_active, bset_point_before_scroll, bset_read_only)
25 (bset_truncate_lines, bset_undo_list, bset_upcase_table)
26 (bset_width_table):
27 * buffer.c (bset_abbrev_mode, bset_abbrev_table)
28 (bset_auto_fill_function, bset_auto_save_file_format)
29 (bset_auto_save_file_name, bset_backed_up, bset_begv_marker)
30 (bset_bidi_display_reordering, bset_buffer_file_coding_system)
31 (bset_cache_long_line_scans, bset_case_fold_search)
32 (bset_ctl_arrow, bset_cursor_in_non_selected_windows)
33 (bset_cursor_type, bset_display_table, bset_extra_line_spacing)
34 (bset_file_format, bset_file_truename, bset_fringe_cursor_alist)
35 (bset_fringe_indicator_alist, bset_fringes_outside_margins)
36 (bset_header_line_format, bset_indicate_buffer_boundaries)
37 (bset_indicate_empty_lines, bset_invisibility_spec)
38 (bset_left_fringe_width, bset_major_mode, bset_mark)
39 (bset_minor_modes, bset_mode_line_format, bset_mode_name)
40 (bset_name, bset_overwrite_mode, bset_pt_marker)
41 (bset_right_fringe_width, bset_save_length)
42 (bset_scroll_bar_width, bset_scroll_down_aggressively)
43 (bset_scroll_up_aggressively, bset_selective_display)
44 (bset_selective_display_ellipses, bset_vertical_scroll_bar_type)
45 (bset_word_wrap, bset_zv_marker):
46 * category.c (bset_category_table):
47 * syntax.c (bset_syntax_table):
48 New setter functions.
49
50 * process.h (PSET): Remove (Bug#12215).
51 Replace all uses with calls to new setter functions.
52 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
53 (PROCESS_INLINE): New macro.
54 (pset_childp): New setter function.
55 (pset_gnutls_cred_type) [HAVE_GNUTLS]: New setter function.
56 * process.c (PROCESS_INLINE):
57 Define to EXTERN_INLINE, so that the corresponding functions
58 are compiled into code.
59 (pset_buffer, pset_command, pset_decode_coding_system)
60 (pset_decoding_buf, pset_encode_coding_system)
61 (pset_encoding_buf, pset_filter, pset_log, pset_mark, pset_name)
62 (pset_plist, pset_sentinel, pset_status, pset_tty_name)
63 (pset_type, pset_write_queue): New setter functions.
64
65 * window.h (WSET): Remove (Bug#12215).
66 Replace all uses with calls to new setter functions.
67 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
68 (WINDOW_INLINE): New macro.
69 (wset_buffer, wset_frame, wset_left_col, wset_next, wset_prev)
70 (wset_redisplay_end_trigger, wset_top_line, wset_total_cols)
71 (wset_total_lines, wset_vertical_scroll_bar)
72 (wset_window_end_pos, wset_window_end_valid)
73 (wset_window_end_vpos): New setter functions.
74 * window.c (WINDOW_INLINE):
75 Define to EXTERN_INLINE, so that the corresponding functions
76 are compiled into code.
77 (wset_combination_limit, wset_dedicated, wset_display_table)
78 (wset_hchild, wset_left_fringe_width, wset_left_margin_cols)
79 (wset_new_normal, wset_new_total, wset_next_buffers)
80 (wset_normal_cols, wset_normal_lines, wset_parent, wset_pointm)
81 (wset_prev_buffers, wset_right_fringe_width)
82 (wset_right_margin_cols, wset_scroll_bar_width, wset_start)
83 (wset_temslot, wset_vchild, wset_vertical_scroll_bar_type)
84 (wset_window_parameters):
85 * xdisp.c (wset_base_line_number, wset_base_line_pos)
86 (wset_column_number_displayed, wset_region_showing):
87 New setter functions.
88
89 * termhooks.h (TSET): Remove (Bug#12215).
90 Replace all uses with calls to new setter functions.
91 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
92 (TERMHOOKS_INLINE): New macro.
93 (tset_charset_list, tset_selection_alist): New setter functions.
94 * terminal.c (TERMHOOKS_INLINE):
95 Define to EXTERN_INLINE, so that the corresponding functions
96 are compiled into code.
97 (tset_param_alist): New setter function.
98
992012-08-17 Paul Eggert <eggert@cs.ucla.edu>
100
101 * keyboard.h (KSET): Remove (Bug#12215).
102 Replace all uses with calls to new setter functions.
103 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
104 (KEYBOARD_INLINE): New macro.
105 (kset_default_minibuffer_frame, kset_defining_kbd_macro)
106 (kset_input_decode_map, kset_last_command, kset_last_kbd_macro)
107 (kset_prefix_arg, kset_system_key_alist, kset_window_system):
108 New setter functions.
109 * keyboard.c (KEYBOARD_INLINE):
110 Define to EXTERN_INLINE, so that the corresponding functions
111 are compiled into code.
112 (kset_echo_string, kset_kbd_queue)
113 (kset_keyboard_translate_table, kset_last_prefix_arg)
114 (kset_last_repeatable_command, kset_local_function_key_map)
115 (kset_overriding_terminal_local_map, kset_real_last_command)
116 (kset_system_key_syms): New setter functions.
117
118 * frame.h (FSET): Remove (Bug#12215).
119 Replace all uses with calls to new setter functions.
120 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
121 (FRAME_INLINE): New macro.
122 (fset_buffer_list, fset_buried_buffer_list, fset_condemned_scroll_bars)
123 (fset_current_tool_bar_string, fset_desired_tool_bar_string)
124 (fset_face_alist, fset_focus_frame, fset_icon_name, fset_menu_bar_items)
125 (fset_menu_bar_vector, fset_menu_bar_window, fset_name)
126 (fset_param_alist, fset_root_window, fset_scroll_bars)
127 (fset_selected_window, fset_title, fset_tool_bar_items)
128 (fset_tool_bar_position, fset_tool_bar_window): New functions.
129 * frame.c (FRAME_INLINE):
130 Define to EXTERN_INLINE, so that the corresponding functions
131 are compiled into code.
132 (fset_buffer_predicate, fset_minibuffer_window): New setter functions.
133
134 A few more naming-convention fixes for getters and setters.
135 * buffer.c (set_buffer_overlays_before): Move here from buffer.h,
136 and rename from buffer_overlays_set_before.
137 (set_buffer_overlays_after): Move here from buffer.h, and rename
138 from buffer_overlays_set_after.
139 * buffer.h (buffer_intervals): Rename from buffer_get_intervals.
140 All uses changed.
141 (set_buffer_intervals): Rename from buffer_set_intervals.
142 * intervals.c (set_interval_object): Move here from intervals.h,
143 and rename from interval_set_object.
144 (set_interval_left): Move here from intervals.h, and rename from
145 interval_set_left.
146 (set_interval_right): Move here from intervals.h, and rename from
147 interval_set_right.
148 (copy_interval_parent): Move here from intervals.h, and rename from
149 interval_copy_parent.
150 * intervals.h (set_interval_parent): Rename from interval_set_parent.
151 (set_interval_plist): Rename from interval_set_plist.
152 Return void, not Lisp_Object, since no caller uses the result.
153 * lisp.h (string_intervals): Rename from string_get_intervals.
154 (set_string_intervals): Rename from string_set_intervals.
155
156 * lisp.h (set_char_table_extras): Rename from char_table_set_extras.
157 (set_char_table_contents): Rename from char_table_set_contents.
158 (set_sub_char_table_contents): Rename from sub_char_table_set_contents.
159 All uses changed. See the end of
160 <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00549.html>.
161
162 * lisp.h (CSET): Remove (Bug#12215).
163 (set_char_table_ascii, set_char_table_defalt, set_char_table_parent)
164 (set_char_table_purpose): New functions,
165 replacing CSET. All uses changed. For example, replace
166 "CSET (XCHAR_TABLE (char_table), parent, parent);" with
167 "set_char_table_parent (char_table, parent);".
168 The old version was confusing because it used the same name
169 'parent' for two different things.
170
1712012-08-17 Dmitry Antipov <dmantipov@yandex.ru>
172
173 Functions to get and set Lisp_Object fields of buffer-local variables.
174 * lisp.h (blv_found, set_blv_found, blv_value, set_blv_value)
175 (set_blv_where, set_blv_defcell, set_blv_valcell): New functions.
176 (BLV_FOUND, SET_BLV_FOUND, BLV_VALUE, SET_BLV_VALUE): Remove.
177 * data.c, eval.c, frame.c: Adjust users.
178
1792012-08-17 Chong Yidong <cyd@gnu.org>
180
181 * xfaces.c (merge_face_vectors): If the target font specfies a
182 font spec, make the font's attributes take precedence over
183 directly-specified attributes.
184 (merge_face_ref): Recognize :font.
185
1862012-08-17 Dmitry Antipov <dmantipov@yandex.ru>
187
188 Do not use memcpy for copying intervals.
189 * intervals.c (reproduce_interval): New function.
190 (reproduce_tree, reproduce_tree_obj): Use it.
191 (reproduce_tree_obj): Remove prototype.
192
1932012-08-17 Paul Eggert <eggert@cs.ucla.edu>
194
195 * lisp.h (duration_to_sec_usec): Remove unused decl.
196
1972012-08-17 Alp Aker <alp.tekin.aker@gmail.com>
198
199 * nsfont.m (ns_ascii_average_width): Send initWithFormat selector
200 to an allocated instance of NSString, not to the class itself.
201
2022012-08-17 Juanma Barranquero <lekktu@gmail.com>
203
204 * makefile.w32-in (C_CTYPE_H): New macro.
205 (LISP_H, $(BLD)/ccl.$(O), $(BLD)/doc.$(O), $(BLD)/w32console.$(O)):
206 ($(BLD)/fontset.$(O), $(BLD)/frame.$(O), $(BLD)/composite.$(O)):
207 ($(BLD)/sysdep.$(O), $(BLD)/w32uniscribe.$(O)): Update dependencies.
208
2092012-08-16 Paul Eggert <eggert@cs.ucla.edu>
210
211 Use ASCII tests for character types.
212 * category.c, dispnew.c, doprnt.c, editfns.c, syntax.c, term.c:
213 * xfns.c, xterm.c:
214 Don't include <ctype.h>; was not needed.
215 * charset.c, doc.c, fileio.c, font.c, frame.c, gtkutil.c, image.c:
216 * sysdep.c, xfaces.c:
217 Include <c-ctype.h> instead of <ctype.h>.
218 * nsterm.m: Include <c-ctype.h>.
219 * charset.c (read_hex):
220 * doc.c (Fsnarf_documentation):
221 * fileio.c (IS_DRIVE) [WINDOWSNT]:
222 (DRIVE_LETTER) [DOS_NT]:
223 (Ffile_name_directory, Fexpand_file_name)
224 (Fsubstitute_in_file_name):
225 * font.c (font_parse_xlfd, font_parse_fcname):
226 * frame.c (x_set_font_backend):
227 * gtkutil.c (xg_get_font):
228 * image.c (xbm_scan, xpm_scan, pbm_scan_number):
229 * nsimage.m (hexchar):
230 * nsterm.m (ns_xlfd_to_fontname):
231 * sysdep.c (system_process_attributes):
232 * xfaces.c (hash_string_case_insensitive):
233 Use C-locale tests instead of locale-specific tests for character
234 types, since we want the ASCII interpretation here, not the
235 interpretation suitable for whatever happens to be the current locale.
236
2372012-08-16 Martin Rudalics <rudalics@gmx.at>
238
239 Consistently check windows for validity/liveness
240 (Bug#11984, Bug#12025, Bug#12026).
241 * lisp.h (CHECK_VALID_WINDOW): New macro.
242 * window.c (decode_window): Rename to decode_live_window.
243 (decode_valid_window, Fwindow_valid_p): New functions.
244 (Fwindow_frame, Fframe_root_window, Fwindow_minibuffer_p)
245 (Fframe_first_window, Fframe_selected_window, Fwindow_parent)
246 (Fwindow_top_child, Fwindow_left_child, Fwindow_next_sibling)
247 (Fwindow_prev_sibling, Fwindow_combination_limit)
248 (Fset_window_combination_limit, Fwindow_use_time)
249 (Fwindow_total_height, Fwindow_total_width, Fwindow_new_total)
250 (Fwindow_normal_size, Fwindow_new_normal, Fwindow_left_column)
251 (Fwindow_top_line, Fwindow_body_height, Fwindow_body_width)
252 (Fwindow_hscroll, Fset_window_hscroll)
253 (Fwindow_redisplay_end_trigger)
254 (Fset_window_redisplay_end_trigger, Fwindow_edges)
255 (Fwindow_pixel_edges, Fwindow_absolute_pixel_edges)
256 (Fwindow_inside_edges, Fwindow_inside_pixel_edges)
257 (Fcoordinates_in_window_p, Fwindow_point, Fwindow_start)
258 (Fwindow_end, Fset_window_point, Fset_window_start)
259 (Fpos_visible_in_window_p, Fwindow_line_height)
260 (Fwindow_dedicated_p, Fset_window_dedicated_p)
261 (Fwindow_prev_buffers, Fset_window_prev_buffers)
262 (Fwindow_next_buffers, Fwindow_parameters, Fwindow_parameter)
263 (Fset_window_parameter, Fwindow_display_table)
264 (Fset_window_display_table, Fdelete_other_windows_internal)
265 (Fset_window_buffer, Fset_window_new_total)
266 (Fset_window_new_normal, Fdelete_window_internal)
267 (Fwindow_text_height, Fset_window_margins, Fwindow_margins)
268 (Fset_window_fringes, Fwindow_fringes, Fset_window_scroll_bars)
269 (Fwindow_scroll_bars): Check whether argument window is a valid or
270 live window. Update doc-strings.
271 (syms_of_window): New symbol Qwindow_valid_p.
272 * keyboard.c (Fposn_at_x_y): Check whether argument
273 frame_or_window denotes a valid window.
274
2752012-08-16 Dmitry Antipov <dmantipov@yandex.ru>
276
277 Fix previous char table change.
278 * lisp.h (CHAR_TABLE_SET): Use sub_char_table_set_contents.
279 * chartab.c (optimize_sub_char_table): Likewise.
280
2812012-08-16 Chong Yidong <cyd@gnu.org>
282
283 * gtkutil.c (xg_get_font): Demand an Xft font (Bug#3228).
284
285 * xfont.c (xfont_open):
286 * xftfont.c (xftfont_open): Set the font's max_width field.
287
288 * nsfont.m (nsfont_open): Similar to the Xft backend, set
289 min_width to space_width and average_width to the average over
290 printable ASCII characters.
291 (ns_char_width): Code cleanup.
292 (ns_ascii_average_width): New utility function.
293
294 * font.h (struct font): Update comments.
295
2962012-08-16 Dmitry Antipov <dmantipov@yandex.ru>
297
298 Simple interface to set Lisp_Object fields of character tables.
299 * lisp.h (CSET): New macro.
300 (char_table_set_extras, char_table_set_contents)
301 (sub_char_table_set_contents): New function.
302 * casetab.c, category.c, chartab.c, fns.c, fontset.c, search.c:
303 * syntax.c: Adjust users.
304
3052012-08-16 Stefan Monnier <monnier@iro.umontreal.ca>
306
307 * eval.c (eval_sub): Bind lexical-binding.
308 * lread.c (Qlexical_binding): Make non-static.
309
12012-08-15 Jan Djärv <jan.h.d@swipnet.se> 3102012-08-15 Jan Djärv <jan.h.d@swipnet.se>
2 311
3 * nsmenu.m (popupSession): Remove. 312 * nsmenu.m (popupSession): Remove.
@@ -44,8 +353,8 @@
44 353
45 Generalize and cleanup font subsystem checks. 354 Generalize and cleanup font subsystem checks.
46 * font.h (FONT_DEBUG, font_assert): Remove. 355 * font.h (FONT_DEBUG, font_assert): Remove.
47 * font.c, fontset.c, w32font.c, xfont.c, xftfont.c: Change 356 * font.c, fontset.c, w32font.c, xfont.c, xftfont.c:
48 font_assert to eassert. Use eassert where appropriate. 357 Change font_assert to eassert. Use eassert where appropriate.
49 358
502012-08-15 Dmitry Antipov <dmantipov@yandex.ru> 3592012-08-15 Dmitry Antipov <dmantipov@yandex.ru>
51 360
@@ -53,10 +362,10 @@
53 362
542012-08-15 Chong Yidong <cyd@gnu.org> 3632012-08-15 Chong Yidong <cyd@gnu.org>
55 364
56 * gtkutil.c (xg_get_font): Rename from xg_get_font_name. When 365 * gtkutil.c (xg_get_font): Rename from xg_get_font_name.
57 using the new font chooser, use gtk_font_chooser_get_font_desc to 366 When using the new font chooser, use gtk_font_chooser_get_font_desc to
58 extract the font descriptor instead of just the font name. In 367 extract the font descriptor instead of just the font name.
59 that case, return a font spec instead of a string. 368 In that case, return a font spec instead of a string.
60 (x_last_font_name): Move to this file from xfns.c. 369 (x_last_font_name): Move to this file from xfns.c.
61 370
62 * xfns.c (Fx_select_font): The return value can also be a font 371 * xfns.c (Fx_select_font): The return value can also be a font
@@ -3338,6 +3647,7 @@
3338 has at least microseconds now. All uses removed. 3647 has at least microseconds now. All uses removed.
3339 (update_frame, update_single_window, update_window, update_frame_1) 3648 (update_frame, update_single_window, update_window, update_frame_1)
3340 (Fsleep_for, sit_for): Port to higher-resolution time stamps. 3649 (Fsleep_for, sit_for): Port to higher-resolution time stamps.
3650 (duration_to_sec_usec): Remove; no longer needed.
3341 3651
3342 * editfns.c (time_overflow): Now extern. 3652 * editfns.c (time_overflow): Now extern.
3343 (Fcurrent_time, Fget_internal_run_time, make_time, lisp_time_argument) 3653 (Fcurrent_time, Fget_internal_run_time, make_time, lisp_time_argument)
diff --git a/src/alloc.c b/src/alloc.c
index 1d484d4a322..522f33f5379 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5836,7 +5836,7 @@ mark_buffer (struct buffer *buffer)
5836 5836
5837 /* ...but there are some buffer-specific things. */ 5837 /* ...but there are some buffer-specific things. */
5838 5838
5839 MARK_INTERVAL_TREE (buffer_get_intervals (buffer)); 5839 MARK_INTERVAL_TREE (buffer_intervals (buffer));
5840 5840
5841 /* For now, we just don't mark the undo_list. It's done later in 5841 /* For now, we just don't mark the undo_list. It's done later in
5842 a special way just before the sweep phase, and after stripping 5842 a special way just before the sweep phase, and after stripping
@@ -6090,7 +6090,7 @@ mark_object (Lisp_Object arg)
6090 } 6090 }
6091 if (!PURE_POINTER_P (XSTRING (ptr->name))) 6091 if (!PURE_POINTER_P (XSTRING (ptr->name)))
6092 MARK_STRING (XSTRING (ptr->name)); 6092 MARK_STRING (XSTRING (ptr->name));
6093 MARK_INTERVAL_TREE (string_get_intervals (ptr->name)); 6093 MARK_INTERVAL_TREE (string_intervals (ptr->name));
6094 6094
6095 ptr = ptr->next; 6095 ptr = ptr->next;
6096 if (ptr) 6096 if (ptr)
@@ -6405,7 +6405,7 @@ gc_sweep (void)
6405 { 6405 {
6406 if (!iblk->intervals[i].gcmarkbit) 6406 if (!iblk->intervals[i].gcmarkbit)
6407 { 6407 {
6408 interval_set_parent (&iblk->intervals[i], interval_free_list); 6408 set_interval_parent (&iblk->intervals[i], interval_free_list);
6409 interval_free_list = &iblk->intervals[i]; 6409 interval_free_list = &iblk->intervals[i];
6410 this_free++; 6410 this_free++;
6411 } 6411 }
diff --git a/src/buffer.c b/src/buffer.c
index 56d6231f5f8..9373e3cd363 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -157,6 +157,228 @@ static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay
157static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); 157static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
158static Lisp_Object buffer_lisp_local_variables (struct buffer *, int); 158static Lisp_Object buffer_lisp_local_variables (struct buffer *, int);
159 159
160/* These setters are used only in this file, so they can be private. */
161static inline void
162bset_abbrev_mode (struct buffer *b, Lisp_Object val)
163{
164 b->INTERNAL_FIELD (abbrev_mode) = val;
165}
166static inline void
167bset_abbrev_table (struct buffer *b, Lisp_Object val)
168{
169 b->INTERNAL_FIELD (abbrev_table) = val;
170}
171static inline void
172bset_auto_fill_function (struct buffer *b, Lisp_Object val)
173{
174 b->INTERNAL_FIELD (auto_fill_function) = val;
175}
176static inline void
177bset_auto_save_file_format (struct buffer *b, Lisp_Object val)
178{
179 b->INTERNAL_FIELD (auto_save_file_format) = val;
180}
181static inline void
182bset_auto_save_file_name (struct buffer *b, Lisp_Object val)
183{
184 b->INTERNAL_FIELD (auto_save_file_name) = val;
185}
186static inline void
187bset_backed_up (struct buffer *b, Lisp_Object val)
188{
189 b->INTERNAL_FIELD (backed_up) = val;
190}
191static inline void
192bset_begv_marker (struct buffer *b, Lisp_Object val)
193{
194 b->INTERNAL_FIELD (begv_marker) = val;
195}
196static inline void
197bset_bidi_display_reordering (struct buffer *b, Lisp_Object val)
198{
199 b->INTERNAL_FIELD (bidi_display_reordering) = val;
200}
201static inline void
202bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
203{
204 b->INTERNAL_FIELD (buffer_file_coding_system) = val;
205}
206static inline void
207bset_cache_long_line_scans (struct buffer *b, Lisp_Object val)
208{
209 b->INTERNAL_FIELD (cache_long_line_scans) = val;
210}
211static inline void
212bset_case_fold_search (struct buffer *b, Lisp_Object val)
213{
214 b->INTERNAL_FIELD (case_fold_search) = val;
215}
216static inline void
217bset_ctl_arrow (struct buffer *b, Lisp_Object val)
218{
219 b->INTERNAL_FIELD (ctl_arrow) = val;
220}
221static inline void
222bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val)
223{
224 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val;
225}
226static inline void
227bset_cursor_type (struct buffer *b, Lisp_Object val)
228{
229 b->INTERNAL_FIELD (cursor_type) = val;
230}
231static inline void
232bset_display_table (struct buffer *b, Lisp_Object val)
233{
234 b->INTERNAL_FIELD (display_table) = val;
235}
236static inline void
237bset_extra_line_spacing (struct buffer *b, Lisp_Object val)
238{
239 b->INTERNAL_FIELD (extra_line_spacing) = val;
240}
241static inline void
242bset_file_format (struct buffer *b, Lisp_Object val)
243{
244 b->INTERNAL_FIELD (file_format) = val;
245}
246static inline void
247bset_file_truename (struct buffer *b, Lisp_Object val)
248{
249 b->INTERNAL_FIELD (file_truename) = val;
250}
251static inline void
252bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val)
253{
254 b->INTERNAL_FIELD (fringe_cursor_alist) = val;
255}
256static inline void
257bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val)
258{
259 b->INTERNAL_FIELD (fringe_indicator_alist) = val;
260}
261static inline void
262bset_fringes_outside_margins (struct buffer *b, Lisp_Object val)
263{
264 b->INTERNAL_FIELD (fringes_outside_margins) = val;
265}
266static inline void
267bset_header_line_format (struct buffer *b, Lisp_Object val)
268{
269 b->INTERNAL_FIELD (header_line_format) = val;
270}
271static inline void
272bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
273{
274 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val;
275}
276static inline void
277bset_indicate_empty_lines (struct buffer *b, Lisp_Object val)
278{
279 b->INTERNAL_FIELD (indicate_empty_lines) = val;
280}
281static inline void
282bset_invisibility_spec (struct buffer *b, Lisp_Object val)
283{
284 b->INTERNAL_FIELD (invisibility_spec) = val;
285}
286static inline void
287bset_left_fringe_width (struct buffer *b, Lisp_Object val)
288{
289 b->INTERNAL_FIELD (left_fringe_width) = val;
290}
291static inline void
292bset_major_mode (struct buffer *b, Lisp_Object val)
293{
294 b->INTERNAL_FIELD (major_mode) = val;
295}
296static inline void
297bset_mark (struct buffer *b, Lisp_Object val)
298{
299 b->INTERNAL_FIELD (mark) = val;
300}
301static inline void
302bset_minor_modes (struct buffer *b, Lisp_Object val)
303{
304 b->INTERNAL_FIELD (minor_modes) = val;
305}
306static inline void
307bset_mode_line_format (struct buffer *b, Lisp_Object val)
308{
309 b->INTERNAL_FIELD (mode_line_format) = val;
310}
311static inline void
312bset_mode_name (struct buffer *b, Lisp_Object val)
313{
314 b->INTERNAL_FIELD (mode_name) = val;
315}
316static inline void
317bset_name (struct buffer *b, Lisp_Object val)
318{
319 b->INTERNAL_FIELD (name) = val;
320}
321static inline void
322bset_overwrite_mode (struct buffer *b, Lisp_Object val)
323{
324 b->INTERNAL_FIELD (overwrite_mode) = val;
325}
326static inline void
327bset_pt_marker (struct buffer *b, Lisp_Object val)
328{
329 b->INTERNAL_FIELD (pt_marker) = val;
330}
331static inline void
332bset_right_fringe_width (struct buffer *b, Lisp_Object val)
333{
334 b->INTERNAL_FIELD (right_fringe_width) = val;
335}
336static inline void
337bset_save_length (struct buffer *b, Lisp_Object val)
338{
339 b->INTERNAL_FIELD (save_length) = val;
340}
341static inline void
342bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
343{
344 b->INTERNAL_FIELD (scroll_bar_width) = val;
345}
346static inline void
347bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val)
348{
349 b->INTERNAL_FIELD (scroll_down_aggressively) = val;
350}
351static inline void
352bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val)
353{
354 b->INTERNAL_FIELD (scroll_up_aggressively) = val;
355}
356static inline void
357bset_selective_display (struct buffer *b, Lisp_Object val)
358{
359 b->INTERNAL_FIELD (selective_display) = val;
360}
361static inline void
362bset_selective_display_ellipses (struct buffer *b, Lisp_Object val)
363{
364 b->INTERNAL_FIELD (selective_display_ellipses) = val;
365}
366static inline void
367bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val)
368{
369 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val;
370}
371static inline void
372bset_word_wrap (struct buffer *b, Lisp_Object val)
373{
374 b->INTERNAL_FIELD (word_wrap) = val;
375}
376static inline void
377bset_zv_marker (struct buffer *b, Lisp_Object val)
378{
379 b->INTERNAL_FIELD (zv_marker) = val;
380}
381
160/* For debugging; temporary. See set_buffer_internal. */ 382/* For debugging; temporary. See set_buffer_internal. */
161/* Lisp_Object Qlisp_mode, Vcheck_symbol; */ 383/* Lisp_Object Qlisp_mode, Vcheck_symbol; */
162 384
@@ -360,7 +582,7 @@ even if it is dead. The return value is never nil. */)
360 BUF_CHARS_MODIFF (b) = 1; 582 BUF_CHARS_MODIFF (b) = 1;
361 BUF_OVERLAY_MODIFF (b) = 1; 583 BUF_OVERLAY_MODIFF (b) = 1;
362 BUF_SAVE_MODIFF (b) = 1; 584 BUF_SAVE_MODIFF (b) = 1;
363 buffer_set_intervals (b, NULL); 585 set_buffer_intervals (b, NULL);
364 BUF_UNCHANGED_MODIFIED (b) = 1; 586 BUF_UNCHANGED_MODIFIED (b) = 1;
365 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1; 587 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
366 BUF_END_UNCHANGED (b) = 0; 588 BUF_END_UNCHANGED (b) = 0;
@@ -370,7 +592,7 @@ even if it is dead. The return value is never nil. */)
370 592
371 b->newline_cache = 0; 593 b->newline_cache = 0;
372 b->width_run_cache = 0; 594 b->width_run_cache = 0;
373 BSET (b, width_table, Qnil); 595 bset_width_table (b, Qnil);
374 b->prevent_redisplay_optimizations_p = 1; 596 b->prevent_redisplay_optimizations_p = 1;
375 597
376 /* Put this on the chain of all buffers including killed ones. */ 598 /* Put this on the chain of all buffers including killed ones. */
@@ -379,20 +601,20 @@ even if it is dead. The return value is never nil. */)
379 601
380 /* An ordinary buffer normally doesn't need markers 602 /* An ordinary buffer normally doesn't need markers
381 to handle BEGV and ZV. */ 603 to handle BEGV and ZV. */
382 BSET (b, pt_marker, Qnil); 604 bset_pt_marker (b, Qnil);
383 BSET (b, begv_marker, Qnil); 605 bset_begv_marker (b, Qnil);
384 BSET (b, zv_marker, Qnil); 606 bset_zv_marker (b, Qnil);
385 607
386 name = Fcopy_sequence (buffer_or_name); 608 name = Fcopy_sequence (buffer_or_name);
387 string_set_intervals (name, NULL); 609 set_string_intervals (name, NULL);
388 BSET (b, name, name); 610 bset_name (b, name);
389 611
390 BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt); 612 bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt);
391 613
392 reset_buffer (b); 614 reset_buffer (b);
393 reset_buffer_local_variables (b, 1); 615 reset_buffer_local_variables (b, 1);
394 616
395 BSET (b, mark, Fmake_marker ()); 617 bset_mark (b, Fmake_marker ());
396 BUF_MARKERS (b) = NULL; 618 BUF_MARKERS (b) = NULL;
397 619
398 /* Put this in the alist of all live buffers. */ 620 /* Put this in the alist of all live buffers. */
@@ -439,6 +661,19 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
439 return result; 661 return result;
440} 662}
441 663
664/* Set an appropriate overlay of B. */
665
666static inline void
667set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
668{
669 b->overlays_before = o;
670}
671
672static inline void
673set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
674{
675 b->overlays_after = o;
676}
442 677
443/* Clone per-buffer values of buffer FROM. 678/* Clone per-buffer values of buffer FROM.
444 679
@@ -474,12 +709,12 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
474 709
475 memcpy (to->local_flags, from->local_flags, sizeof to->local_flags); 710 memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
476 711
477 buffer_set_overlays_before (to, copy_overlays (to, from->overlays_before)); 712 set_buffer_overlays_before (to, copy_overlays (to, from->overlays_before));
478 buffer_set_overlays_after (to, copy_overlays (to, from->overlays_after)); 713 set_buffer_overlays_after (to, copy_overlays (to, from->overlays_after));
479 714
480 /* Get (a copy of) the alist of Lisp-level local variables of FROM 715 /* Get (a copy of) the alist of Lisp-level local variables of FROM
481 and install that in TO. */ 716 and install that in TO. */
482 BSET (to, local_var_alist, buffer_lisp_local_variables (from, 1)); 717 bset_local_var_alist (to, buffer_lisp_local_variables (from, 1));
483} 718}
484 719
485 720
@@ -582,15 +817,15 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
582 817
583 b->newline_cache = 0; 818 b->newline_cache = 0;
584 b->width_run_cache = 0; 819 b->width_run_cache = 0;
585 BSET (b, width_table, Qnil); 820 bset_width_table (b, Qnil);
586 821
587 /* Put this on the chain of all buffers including killed ones. */ 822 /* Put this on the chain of all buffers including killed ones. */
588 b->header.next.buffer = all_buffers; 823 b->header.next.buffer = all_buffers;
589 all_buffers = b; 824 all_buffers = b;
590 825
591 name = Fcopy_sequence (name); 826 name = Fcopy_sequence (name);
592 string_set_intervals (name, NULL); 827 set_string_intervals (name, NULL);
593 BSET (b, name, name); 828 bset_name (b, name);
594 829
595 reset_buffer (b); 830 reset_buffer (b);
596 reset_buffer_local_variables (b, 1); 831 reset_buffer_local_variables (b, 1);
@@ -599,10 +834,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
599 XSETBUFFER (buf, b); 834 XSETBUFFER (buf, b);
600 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 835 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
601 836
602 BSET (b, mark, Fmake_marker ()); 837 bset_mark (b, Fmake_marker ());
603 838
604 /* The multibyte status belongs to the base buffer. */ 839 /* The multibyte status belongs to the base buffer. */
605 BSET (b, enable_multibyte_characters, BVAR (b->base_buffer, enable_multibyte_characters)); 840 bset_enable_multibyte_characters
841 (b, BVAR (b->base_buffer, enable_multibyte_characters));
606 842
607 /* Make sure the base buffer has markers for its narrowing. */ 843 /* Make sure the base buffer has markers for its narrowing. */
608 if (NILP (BVAR (b->base_buffer, pt_marker))) 844 if (NILP (BVAR (b->base_buffer, pt_marker)))
@@ -610,14 +846,17 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
610 eassert (NILP (BVAR (b->base_buffer, begv_marker))); 846 eassert (NILP (BVAR (b->base_buffer, begv_marker)));
611 eassert (NILP (BVAR (b->base_buffer, zv_marker))); 847 eassert (NILP (BVAR (b->base_buffer, zv_marker)));
612 848
613 BSET (b->base_buffer, pt_marker, 849 bset_pt_marker (b->base_buffer,
614 build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte)); 850 build_marker (b->base_buffer, b->base_buffer->pt,
851 b->base_buffer->pt_byte));
615 852
616 BSET (b->base_buffer, begv_marker, 853 bset_begv_marker (b->base_buffer,
617 build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte)); 854 build_marker (b->base_buffer, b->base_buffer->begv,
855 b->base_buffer->begv_byte));
618 856
619 BSET (b->base_buffer, zv_marker, 857 bset_zv_marker (b->base_buffer,
620 build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte)); 858 build_marker (b->base_buffer, b->base_buffer->zv,
859 b->base_buffer->zv_byte));
621 860
622 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; 861 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
623 } 862 }
@@ -625,9 +864,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
625 if (NILP (clone)) 864 if (NILP (clone))
626 { 865 {
627 /* Give the indirect buffer markers for its narrowing. */ 866 /* Give the indirect buffer markers for its narrowing. */
628 BSET (b, pt_marker, build_marker (b, b->pt, b->pt_byte)); 867 bset_pt_marker (b, build_marker (b, b->pt, b->pt_byte));
629 BSET (b, begv_marker, build_marker (b, b->begv, b->begv_byte)); 868 bset_begv_marker (b, build_marker (b, b->begv, b->begv_byte));
630 BSET (b, zv_marker, build_marker (b, b->zv, b->zv_byte)); 869 bset_zv_marker (b, build_marker (b, b->zv, b->zv_byte));
631 XMARKER (BVAR (b, zv_marker))->insertion_type = 1; 870 XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
632 } 871 }
633 else 872 else
@@ -635,11 +874,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
635 struct buffer *old_b = current_buffer; 874 struct buffer *old_b = current_buffer;
636 875
637 clone_per_buffer_values (b->base_buffer, b); 876 clone_per_buffer_values (b->base_buffer, b);
638 BSET (b, filename, Qnil); 877 bset_filename (b, Qnil);
639 BSET (b, file_truename, Qnil); 878 bset_file_truename (b, Qnil);
640 BSET (b, display_count, make_number (0)); 879 bset_display_count (b, make_number (0));
641 BSET (b, backed_up, Qnil); 880 bset_backed_up (b, Qnil);
642 BSET (b, auto_save_file_name, Qnil); 881 bset_auto_save_file_name (b, Qnil);
643 set_buffer_internal_1 (b); 882 set_buffer_internal_1 (b);
644 Fset (intern ("buffer-save-without-query"), Qnil); 883 Fset (intern ("buffer-save-without-query"), Qnil);
645 Fset (intern ("buffer-file-number"), Qnil); 884 Fset (intern ("buffer-file-number"), Qnil);
@@ -688,8 +927,8 @@ delete_all_overlays (struct buffer *b)
688 ov->next = NULL; 927 ov->next = NULL;
689 } 928 }
690 929
691 buffer_set_overlays_before (b, NULL); 930 set_buffer_overlays_before (b, NULL);
692 buffer_set_overlays_after (b, NULL); 931 set_buffer_overlays_after (b, NULL);
693} 932}
694 933
695/* Reinitialize everything about a buffer except its name and contents 934/* Reinitialize everything about a buffer except its name and contents
@@ -702,10 +941,9 @@ delete_all_overlays (struct buffer *b)
702void 941void
703reset_buffer (register struct buffer *b) 942reset_buffer (register struct buffer *b)
704{ 943{
705 BSET (b, filename, Qnil); 944 bset_filename (b, Qnil);
706 BSET (b, file_truename, Qnil); 945 bset_file_truename (b, Qnil);
707 BSET (b, directory, 946 bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil);
708 (current_buffer) ? BVAR (current_buffer, directory) : Qnil);
709 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); 947 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS);
710 b->modtime_size = -1; 948 b->modtime_size = -1;
711 XSETFASTINT (BVAR (b, save_length), 0); 949 XSETFASTINT (BVAR (b, save_length), 0);
@@ -713,25 +951,25 @@ reset_buffer (register struct buffer *b)
713 /* It is more conservative to start out "changed" than "unchanged". */ 951 /* It is more conservative to start out "changed" than "unchanged". */
714 b->clip_changed = 0; 952 b->clip_changed = 0;
715 b->prevent_redisplay_optimizations_p = 1; 953 b->prevent_redisplay_optimizations_p = 1;
716 BSET (b, backed_up, Qnil); 954 bset_backed_up (b, Qnil);
717 BUF_AUTOSAVE_MODIFF (b) = 0; 955 BUF_AUTOSAVE_MODIFF (b) = 0;
718 b->auto_save_failure_time = 0; 956 b->auto_save_failure_time = 0;
719 BSET (b, auto_save_file_name, Qnil); 957 bset_auto_save_file_name (b, Qnil);
720 BSET (b, read_only, Qnil); 958 bset_read_only (b, Qnil);
721 buffer_set_overlays_before (b, NULL); 959 set_buffer_overlays_before (b, NULL);
722 buffer_set_overlays_after (b, NULL); 960 set_buffer_overlays_after (b, NULL);
723 b->overlay_center = BEG; 961 b->overlay_center = BEG;
724 BSET (b, mark_active, Qnil); 962 bset_mark_active (b, Qnil);
725 BSET (b, point_before_scroll, Qnil); 963 bset_point_before_scroll (b, Qnil);
726 BSET (b, file_format, Qnil); 964 bset_file_format (b, Qnil);
727 BSET (b, auto_save_file_format, Qt); 965 bset_auto_save_file_format (b, Qt);
728 BSET (b, last_selected_window, Qnil); 966 bset_last_selected_window (b, Qnil);
729 BSET (b, display_count, make_number (0)); 967 bset_display_count (b, make_number (0));
730 BSET (b, display_time, Qnil); 968 bset_display_time (b, Qnil);
731 BSET (b, enable_multibyte_characters, 969 bset_enable_multibyte_characters
732 BVAR (&buffer_defaults, enable_multibyte_characters)); 970 (b, BVAR (&buffer_defaults, enable_multibyte_characters));
733 BSET (b, cursor_type, BVAR (&buffer_defaults, cursor_type)); 971 bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type));
734 BSET (b, extra_line_spacing, BVAR (&buffer_defaults, extra_line_spacing)); 972 bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing));
735 973
736 b->display_error_modiff = 0; 974 b->display_error_modiff = 0;
737} 975}
@@ -755,10 +993,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
755 things that depend on the major mode. 993 things that depend on the major mode.
756 default-major-mode is handled at a higher level. 994 default-major-mode is handled at a higher level.
757 We ignore it here. */ 995 We ignore it here. */
758 BSET (b, major_mode, Qfundamental_mode); 996 bset_major_mode (b, Qfundamental_mode);
759 BSET (b, keymap, Qnil); 997 bset_keymap (b, Qnil);
760 BSET (b, mode_name, QSFundamental); 998 bset_mode_name (b, QSFundamental);
761 BSET (b, minor_modes, Qnil); 999 bset_minor_modes (b, Qnil);
762 1000
763 /* If the standard case table has been altered and invalidated, 1001 /* If the standard case table has been altered and invalidated,
764 fix up its insides first. */ 1002 fix up its insides first. */
@@ -767,15 +1005,15 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
767 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) 1005 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
768 Fset_standard_case_table (Vascii_downcase_table); 1006 Fset_standard_case_table (Vascii_downcase_table);
769 1007
770 BSET (b, downcase_table, Vascii_downcase_table); 1008 bset_downcase_table (b, Vascii_downcase_table);
771 BSET (b, upcase_table, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); 1009 bset_upcase_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[0]);
772 BSET (b, case_canon_table, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); 1010 bset_case_canon_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[1]);
773 BSET (b, case_eqv_table, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); 1011 bset_case_eqv_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[2]);
774 BSET (b, invisibility_spec, Qt); 1012 bset_invisibility_spec (b, Qt);
775 1013
776 /* Reset all (or most) per-buffer variables to their defaults. */ 1014 /* Reset all (or most) per-buffer variables to their defaults. */
777 if (permanent_too) 1015 if (permanent_too)
778 BSET (b, local_var_alist, Qnil); 1016 bset_local_var_alist (b, Qnil);
779 else 1017 else
780 { 1018 {
781 Lisp_Object tmp, prop, last = Qnil; 1019 Lisp_Object tmp, prop, last = Qnil;
@@ -809,7 +1047,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
809 } 1047 }
810 /* Delete this local variable. */ 1048 /* Delete this local variable. */
811 else if (NILP (last)) 1049 else if (NILP (last))
812 BSET (b, local_var_alist, XCDR (tmp)); 1050 bset_local_var_alist (b, XCDR (tmp));
813 else 1051 else
814 XSETCDR (last, XCDR (tmp)); 1052 XSETCDR (last, XCDR (tmp));
815 } 1053 }
@@ -1286,7 +1524,7 @@ This does not change the name of the visited file (if any). */)
1286 error ("Buffer name `%s' is in use", SDATA (newname)); 1524 error ("Buffer name `%s' is in use", SDATA (newname));
1287 } 1525 }
1288 1526
1289 BSET (current_buffer, name, newname); 1527 bset_name (current_buffer, newname);
1290 1528
1291 /* Catch redisplay's attention. Unless we do this, the mode lines for 1529 /* Catch redisplay's attention. Unless we do this, the mode lines for
1292 any windows displaying current_buffer will stay unchanged. */ 1530 any windows displaying current_buffer will stay unchanged. */
@@ -1431,7 +1669,7 @@ No argument or nil as argument means do this for the current buffer. */)
1431 } 1669 }
1432 1670
1433 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) 1671 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt))
1434 BSET (XBUFFER (real_buffer), undo_list, Qnil); 1672 bset_undo_list (XBUFFER (real_buffer), Qnil);
1435 1673
1436 return Qnil; 1674 return Qnil;
1437} 1675}
@@ -1691,7 +1929,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1691 m = next; 1929 m = next;
1692 } 1930 }
1693 BUF_MARKERS (b) = NULL; 1931 BUF_MARKERS (b) = NULL;
1694 buffer_set_intervals (b, NULL); 1932 set_buffer_intervals (b, NULL);
1695 1933
1696 /* Perhaps we should explicitly free the interval tree here... */ 1934 /* Perhaps we should explicitly free the interval tree here... */
1697 } 1935 }
@@ -1703,7 +1941,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1703 swap_out_buffer_local_variables (b); 1941 swap_out_buffer_local_variables (b);
1704 reset_buffer_local_variables (b, 1); 1942 reset_buffer_local_variables (b, 1);
1705 1943
1706 BSET (b, name, Qnil); 1944 bset_name (b, Qnil);
1707 1945
1708 BLOCK_INPUT; 1946 BLOCK_INPUT;
1709 if (b->base_buffer) 1947 if (b->base_buffer)
@@ -1727,9 +1965,9 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1727 free_region_cache (b->width_run_cache); 1965 free_region_cache (b->width_run_cache);
1728 b->width_run_cache = 0; 1966 b->width_run_cache = 0;
1729 } 1967 }
1730 BSET (b, width_table, Qnil); 1968 bset_width_table (b, Qnil);
1731 UNBLOCK_INPUT; 1969 UNBLOCK_INPUT;
1732 BSET (b, undo_list, Qnil); 1970 bset_undo_list (b, Qnil);
1733 1971
1734 /* Run buffer-list-update-hook. */ 1972 /* Run buffer-list-update-hook. */
1735 if (!NILP (Vrun_hooks)) 1973 if (!NILP (Vrun_hooks))
@@ -1770,8 +2008,8 @@ record_buffer (Lisp_Object buffer)
1770 Vinhibit_quit = tem; 2008 Vinhibit_quit = tem;
1771 2009
1772 /* Update buffer list of selected frame. */ 2010 /* Update buffer list of selected frame. */
1773 FSET (f, buffer_list, Fcons (buffer, Fdelq (buffer, f->buffer_list))); 2011 fset_buffer_list (f, Fcons (buffer, Fdelq (buffer, f->buffer_list)));
1774 FSET (f, buried_buffer_list, Fdelq (buffer, f->buried_buffer_list)); 2012 fset_buried_buffer_list (f, Fdelq (buffer, f->buried_buffer_list));
1775 2013
1776 /* Run buffer-list-update-hook. */ 2014 /* Run buffer-list-update-hook. */
1777 if (!NILP (Vrun_hooks)) 2015 if (!NILP (Vrun_hooks))
@@ -1808,9 +2046,9 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal,
1808 Vinhibit_quit = tem; 2046 Vinhibit_quit = tem;
1809 2047
1810 /* Update buffer lists of selected frame. */ 2048 /* Update buffer lists of selected frame. */
1811 FSET (f, buffer_list, Fdelq (buffer, f->buffer_list)); 2049 fset_buffer_list (f, Fdelq (buffer, f->buffer_list));
1812 FSET (f, buried_buffer_list, 2050 fset_buried_buffer_list
1813 Fcons (buffer, Fdelq (buffer, f->buried_buffer_list))); 2051 (f, Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)));
1814 2052
1815 /* Run buffer-list-update-hook. */ 2053 /* Run buffer-list-update-hook. */
1816 if (!NILP (Vrun_hooks)) 2054 if (!NILP (Vrun_hooks))
@@ -1910,7 +2148,7 @@ set_buffer_internal_1 (register struct buffer *b)
1910 /* Put the undo list back in the base buffer, so that it appears 2148 /* Put the undo list back in the base buffer, so that it appears
1911 that an indirect buffer shares the undo list of its base. */ 2149 that an indirect buffer shares the undo list of its base. */
1912 if (old_buf->base_buffer) 2150 if (old_buf->base_buffer)
1913 BSET (old_buf->base_buffer, undo_list, BVAR (old_buf, undo_list)); 2151 bset_undo_list (old_buf->base_buffer, BVAR (old_buf, undo_list));
1914 2152
1915 /* If the old current buffer has markers to record PT, BEGV and ZV 2153 /* If the old current buffer has markers to record PT, BEGV and ZV
1916 when it is not current, update them now. */ 2154 when it is not current, update them now. */
@@ -1920,7 +2158,7 @@ set_buffer_internal_1 (register struct buffer *b)
1920 /* Get the undo list from the base buffer, so that it appears 2158 /* Get the undo list from the base buffer, so that it appears
1921 that an indirect buffer shares the undo list of its base. */ 2159 that an indirect buffer shares the undo list of its base. */
1922 if (b->base_buffer) 2160 if (b->base_buffer)
1923 BSET (b, undo_list, BVAR (b->base_buffer, undo_list)); 2161 bset_undo_list (b, BVAR (b->base_buffer, undo_list));
1924 2162
1925 /* If the new current buffer has markers to record PT, BEGV and ZV 2163 /* If the new current buffer has markers to record PT, BEGV and ZV
1926 when it is not current, fetch them now. */ 2164 when it is not current, fetch them now. */
@@ -2118,8 +2356,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2118#define swapfield_(field, type) \ 2356#define swapfield_(field, type) \
2119 do { \ 2357 do { \
2120 type tmp##field = BVAR (other_buffer, field); \ 2358 type tmp##field = BVAR (other_buffer, field); \
2121 BSET (other_buffer, field, BVAR (current_buffer, field)); \ 2359 bset_##field (other_buffer, BVAR (current_buffer, field)); \
2122 BSET (current_buffer, field, tmp##field); \ 2360 bset_##field (current_buffer, tmp##field); \
2123 } while (0) 2361 } while (0)
2124 2362
2125 swapfield (own_text, struct buffer_text); 2363 swapfield (own_text, struct buffer_text);
@@ -2159,8 +2397,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2159 swapfield_ (pt_marker, Lisp_Object); 2397 swapfield_ (pt_marker, Lisp_Object);
2160 swapfield_ (begv_marker, Lisp_Object); 2398 swapfield_ (begv_marker, Lisp_Object);
2161 swapfield_ (zv_marker, Lisp_Object); 2399 swapfield_ (zv_marker, Lisp_Object);
2162 BSET (current_buffer, point_before_scroll, Qnil); 2400 bset_point_before_scroll (current_buffer, Qnil);
2163 BSET (other_buffer, point_before_scroll, Qnil); 2401 bset_point_before_scroll (other_buffer, Qnil);
2164 2402
2165 current_buffer->text->modiff++; other_buffer->text->modiff++; 2403 current_buffer->text->modiff++; other_buffer->text->modiff++;
2166 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2404 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++;
@@ -2249,7 +2487,7 @@ current buffer is cleared. */)
2249 2487
2250 /* Don't record these buffer changes. We will put a special undo entry 2488 /* Don't record these buffer changes. We will put a special undo entry
2251 instead. */ 2489 instead. */
2252 BSET (current_buffer, undo_list, Qt); 2490 bset_undo_list (current_buffer, Qt);
2253 2491
2254 /* If the cached position is for this buffer, clear it out. */ 2492 /* If the cached position is for this buffer, clear it out. */
2255 clear_charpos_cache (current_buffer); 2493 clear_charpos_cache (current_buffer);
@@ -2271,7 +2509,7 @@ current buffer is cleared. */)
2271 to calculate the old correspondences. */ 2509 to calculate the old correspondences. */
2272 set_intervals_multibyte (0); 2510 set_intervals_multibyte (0);
2273 2511
2274 BSET (current_buffer, enable_multibyte_characters, Qnil); 2512 bset_enable_multibyte_characters (current_buffer, Qnil);
2275 2513
2276 Z = Z_BYTE; 2514 Z = Z_BYTE;
2277 BEGV = BEGV_BYTE; 2515 BEGV = BEGV_BYTE;
@@ -2409,7 +2647,7 @@ current buffer is cleared. */)
2409 2647
2410 /* Do this first, so that chars_in_text asks the right question. 2648 /* Do this first, so that chars_in_text asks the right question.
2411 set_intervals_multibyte needs it too. */ 2649 set_intervals_multibyte needs it too. */
2412 BSET (current_buffer, enable_multibyte_characters, Qt); 2650 bset_enable_multibyte_characters (current_buffer, Qt);
2413 2651
2414 GPT_BYTE = advance_to_char_boundary (GPT_BYTE); 2652 GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
2415 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; 2653 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2467,11 +2705,11 @@ current buffer is cleared. */)
2467 if (!EQ (old_undo, Qt)) 2705 if (!EQ (old_undo, Qt))
2468 { 2706 {
2469 /* Represent all the above changes by a special undo entry. */ 2707 /* Represent all the above changes by a special undo entry. */
2470 BSET (current_buffer, undo_list, 2708 bset_undo_list (current_buffer,
2471 Fcons (list3 (Qapply, 2709 Fcons (list3 (Qapply,
2472 intern ("set-buffer-multibyte"), 2710 intern ("set-buffer-multibyte"),
2473 NILP (flag) ? Qt : Qnil), 2711 NILP (flag) ? Qt : Qnil),
2474 old_undo)); 2712 old_undo));
2475 } 2713 }
2476 2714
2477 UNGCPRO; 2715 UNGCPRO;
@@ -3238,7 +3476,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3238 if (prev) 3476 if (prev)
3239 prev->next = next; 3477 prev->next = next;
3240 else 3478 else
3241 buffer_set_overlays_before (buf, next); 3479 set_buffer_overlays_before (buf, next);
3242 3480
3243 /* Search thru overlays_after for where to put it. */ 3481 /* Search thru overlays_after for where to put it. */
3244 other_prev = NULL; 3482 other_prev = NULL;
@@ -3260,7 +3498,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3260 if (other_prev) 3498 if (other_prev)
3261 other_prev->next = tail; 3499 other_prev->next = tail;
3262 else 3500 else
3263 buffer_set_overlays_after (buf, tail); 3501 set_buffer_overlays_after (buf, tail);
3264 tail = prev; 3502 tail = prev;
3265 } 3503 }
3266 else 3504 else
@@ -3296,7 +3534,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3296 if (prev) 3534 if (prev)
3297 prev->next = next; 3535 prev->next = next;
3298 else 3536 else
3299 buffer_set_overlays_after (buf, next); 3537 set_buffer_overlays_after (buf, next);
3300 3538
3301 /* Search thru overlays_before for where to put it. */ 3539 /* Search thru overlays_before for where to put it. */
3302 other_prev = NULL; 3540 other_prev = NULL;
@@ -3318,7 +3556,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3318 if (other_prev) 3556 if (other_prev)
3319 other_prev->next = tail; 3557 other_prev->next = tail;
3320 else 3558 else
3321 buffer_set_overlays_before (buf, tail); 3559 set_buffer_overlays_before (buf, tail);
3322 tail = prev; 3560 tail = prev;
3323 } 3561 }
3324 } 3562 }
@@ -3423,7 +3661,7 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3423 beforep = tail; 3661 beforep = tail;
3424 } 3662 }
3425 if (!parent) 3663 if (!parent)
3426 buffer_set_overlays_before (current_buffer, tail->next); 3664 set_buffer_overlays_before (current_buffer, tail->next);
3427 else 3665 else
3428 parent->next = tail->next; 3666 parent->next = tail->next;
3429 tail = tail->next; 3667 tail = tail->next;
@@ -3469,7 +3707,7 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3469 beforep = tail; 3707 beforep = tail;
3470 } 3708 }
3471 if (!parent) 3709 if (!parent)
3472 buffer_set_overlays_after (current_buffer, tail->next); 3710 set_buffer_overlays_after (current_buffer, tail->next);
3473 else 3711 else
3474 parent->next = tail->next; 3712 parent->next = tail->next;
3475 tail = tail->next; 3713 tail = tail->next;
@@ -3483,14 +3721,14 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3483 if (beforep) 3721 if (beforep)
3484 { 3722 {
3485 beforep->next = current_buffer->overlays_before; 3723 beforep->next = current_buffer->overlays_before;
3486 buffer_set_overlays_before (current_buffer, before_list); 3724 set_buffer_overlays_before (current_buffer, before_list);
3487 } 3725 }
3488 recenter_overlay_lists (current_buffer, current_buffer->overlay_center); 3726 recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
3489 3727
3490 if (afterp) 3728 if (afterp)
3491 { 3729 {
3492 afterp->next = current_buffer->overlays_after; 3730 afterp->next = current_buffer->overlays_after;
3493 buffer_set_overlays_after (current_buffer, after_list); 3731 set_buffer_overlays_after (current_buffer, after_list);
3494 } 3732 }
3495 recenter_overlay_lists (current_buffer, current_buffer->overlay_center); 3733 recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
3496} 3734}
@@ -3567,7 +3805,7 @@ fix_overlays_before (struct buffer *bp, ptrdiff_t prev, ptrdiff_t pos)
3567 if (!right_pair) 3805 if (!right_pair)
3568 { 3806 {
3569 found->next = bp->overlays_before; 3807 found->next = bp->overlays_before;
3570 buffer_set_overlays_before (bp, found); 3808 set_buffer_overlays_before (bp, found);
3571 } 3809 }
3572 else 3810 else
3573 { 3811 {
@@ -3645,13 +3883,13 @@ for the rear of the overlay advance when text is inserted there
3645 { 3883 {
3646 if (b->overlays_after) 3884 if (b->overlays_after)
3647 XOVERLAY (overlay)->next = b->overlays_after; 3885 XOVERLAY (overlay)->next = b->overlays_after;
3648 buffer_set_overlays_after (b, XOVERLAY (overlay)); 3886 set_buffer_overlays_after (b, XOVERLAY (overlay));
3649 } 3887 }
3650 else 3888 else
3651 { 3889 {
3652 if (b->overlays_before) 3890 if (b->overlays_before)
3653 XOVERLAY (overlay)->next = b->overlays_before; 3891 XOVERLAY (overlay)->next = b->overlays_before;
3654 buffer_set_overlays_before (b, XOVERLAY (overlay)); 3892 set_buffer_overlays_before (b, XOVERLAY (overlay));
3655 } 3893 }
3656 3894
3657 /* This puts it in the right list, and in the right order. */ 3895 /* This puts it in the right list, and in the right order. */
@@ -3716,8 +3954,8 @@ unchain_both (struct buffer *b, Lisp_Object overlay)
3716{ 3954{
3717 struct Lisp_Overlay *ov = XOVERLAY (overlay); 3955 struct Lisp_Overlay *ov = XOVERLAY (overlay);
3718 3956
3719 buffer_set_overlays_before (b, unchain_overlay (b->overlays_before, ov)); 3957 set_buffer_overlays_before (b, unchain_overlay (b->overlays_before, ov));
3720 buffer_set_overlays_after (b, unchain_overlay (b->overlays_after, ov)); 3958 set_buffer_overlays_after (b, unchain_overlay (b->overlays_after, ov));
3721 eassert (XOVERLAY (overlay)->next == NULL); 3959 eassert (XOVERLAY (overlay)->next == NULL);
3722} 3960}
3723 3961
@@ -3812,12 +4050,12 @@ buffer. */)
3812 if (n_end < b->overlay_center) 4050 if (n_end < b->overlay_center)
3813 { 4051 {
3814 XOVERLAY (overlay)->next = b->overlays_after; 4052 XOVERLAY (overlay)->next = b->overlays_after;
3815 buffer_set_overlays_after (b, XOVERLAY (overlay)); 4053 set_buffer_overlays_after (b, XOVERLAY (overlay));
3816 } 4054 }
3817 else 4055 else
3818 { 4056 {
3819 XOVERLAY (overlay)->next = b->overlays_before; 4057 XOVERLAY (overlay)->next = b->overlays_before;
3820 buffer_set_overlays_before (b, XOVERLAY (overlay)); 4058 set_buffer_overlays_before (b, XOVERLAY (overlay));
3821 } 4059 }
3822 4060
3823 /* This puts it in the right list, and in the right order. */ 4061 /* This puts it in the right list, and in the right order. */
@@ -4913,8 +5151,8 @@ init_buffer_once (void)
4913 /* No one will share the text with these buffers, but let's play it safe. */ 5151 /* No one will share the text with these buffers, but let's play it safe. */
4914 buffer_defaults.indirections = 0; 5152 buffer_defaults.indirections = 0;
4915 buffer_local_symbols.indirections = 0; 5153 buffer_local_symbols.indirections = 0;
4916 buffer_set_intervals (&buffer_defaults, NULL); 5154 set_buffer_intervals (&buffer_defaults, NULL);
4917 buffer_set_intervals (&buffer_local_symbols, NULL); 5155 set_buffer_intervals (&buffer_local_symbols, NULL);
4918 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); 5156 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
4919 XSETBUFFER (Vbuffer_defaults, &buffer_defaults); 5157 XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
4920 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); 5158 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
@@ -4924,55 +5162,55 @@ init_buffer_once (void)
4924 /* Must do these before making the first buffer! */ 5162 /* Must do these before making the first buffer! */
4925 5163
4926 /* real setup is done in bindings.el */ 5164 /* real setup is done in bindings.el */
4927 BSET (&buffer_defaults, mode_line_format, build_pure_c_string ("%-")); 5165 bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-"));
4928 BSET (&buffer_defaults, header_line_format, Qnil); 5166 bset_header_line_format (&buffer_defaults, Qnil);
4929 BSET (&buffer_defaults, abbrev_mode, Qnil); 5167 bset_abbrev_mode (&buffer_defaults, Qnil);
4930 BSET (&buffer_defaults, overwrite_mode, Qnil); 5168 bset_overwrite_mode (&buffer_defaults, Qnil);
4931 BSET (&buffer_defaults, case_fold_search, Qt); 5169 bset_case_fold_search (&buffer_defaults, Qt);
4932 BSET (&buffer_defaults, auto_fill_function, Qnil); 5170 bset_auto_fill_function (&buffer_defaults, Qnil);
4933 BSET (&buffer_defaults, selective_display, Qnil); 5171 bset_selective_display (&buffer_defaults, Qnil);
4934 BSET (&buffer_defaults, selective_display_ellipses, Qt); 5172 bset_selective_display_ellipses (&buffer_defaults, Qt);
4935 BSET (&buffer_defaults, abbrev_table, Qnil); 5173 bset_abbrev_table (&buffer_defaults, Qnil);
4936 BSET (&buffer_defaults, display_table, Qnil); 5174 bset_display_table (&buffer_defaults, Qnil);
4937 BSET (&buffer_defaults, undo_list, Qnil); 5175 bset_undo_list (&buffer_defaults, Qnil);
4938 BSET (&buffer_defaults, mark_active, Qnil); 5176 bset_mark_active (&buffer_defaults, Qnil);
4939 BSET (&buffer_defaults, file_format, Qnil); 5177 bset_file_format (&buffer_defaults, Qnil);
4940 BSET (&buffer_defaults, auto_save_file_format, Qt); 5178 bset_auto_save_file_format (&buffer_defaults, Qt);
4941 buffer_set_overlays_before (&buffer_defaults, NULL); 5179 set_buffer_overlays_before (&buffer_defaults, NULL);
4942 buffer_set_overlays_after (&buffer_defaults, NULL); 5180 set_buffer_overlays_after (&buffer_defaults, NULL);
4943 buffer_defaults.overlay_center = BEG; 5181 buffer_defaults.overlay_center = BEG;
4944 5182
4945 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); 5183 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
4946 BSET (&buffer_defaults, truncate_lines, Qnil); 5184 bset_truncate_lines (&buffer_defaults, Qnil);
4947 BSET (&buffer_defaults, word_wrap, Qnil); 5185 bset_word_wrap (&buffer_defaults, Qnil);
4948 BSET (&buffer_defaults, ctl_arrow, Qt); 5186 bset_ctl_arrow (&buffer_defaults, Qt);
4949 BSET (&buffer_defaults, bidi_display_reordering, Qt); 5187 bset_bidi_display_reordering (&buffer_defaults, Qt);
4950 BSET (&buffer_defaults, bidi_paragraph_direction, Qnil); 5188 bset_bidi_paragraph_direction (&buffer_defaults, Qnil);
4951 BSET (&buffer_defaults, cursor_type, Qt); 5189 bset_cursor_type (&buffer_defaults, Qt);
4952 BSET (&buffer_defaults, extra_line_spacing, Qnil); 5190 bset_extra_line_spacing (&buffer_defaults, Qnil);
4953 BSET (&buffer_defaults, cursor_in_non_selected_windows, Qt); 5191 bset_cursor_in_non_selected_windows (&buffer_defaults, Qt);
4954 5192
4955 BSET (&buffer_defaults, enable_multibyte_characters, Qt); 5193 bset_enable_multibyte_characters (&buffer_defaults, Qt);
4956 BSET (&buffer_defaults, buffer_file_coding_system, Qnil); 5194 bset_buffer_file_coding_system (&buffer_defaults, Qnil);
4957 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); 5195 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
4958 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); 5196 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
4959 BSET (&buffer_defaults, cache_long_line_scans, Qnil); 5197 bset_cache_long_line_scans (&buffer_defaults, Qnil);
4960 BSET (&buffer_defaults, file_truename, Qnil); 5198 bset_file_truename (&buffer_defaults, Qnil);
4961 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); 5199 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
4962 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); 5200 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
4963 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); 5201 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
4964 BSET (&buffer_defaults, left_fringe_width, Qnil); 5202 bset_left_fringe_width (&buffer_defaults, Qnil);
4965 BSET (&buffer_defaults, right_fringe_width, Qnil); 5203 bset_right_fringe_width (&buffer_defaults, Qnil);
4966 BSET (&buffer_defaults, fringes_outside_margins, Qnil); 5204 bset_fringes_outside_margins (&buffer_defaults, Qnil);
4967 BSET (&buffer_defaults, scroll_bar_width, Qnil); 5205 bset_scroll_bar_width (&buffer_defaults, Qnil);
4968 BSET (&buffer_defaults, vertical_scroll_bar_type, Qt); 5206 bset_vertical_scroll_bar_type (&buffer_defaults, Qt);
4969 BSET (&buffer_defaults, indicate_empty_lines, Qnil); 5207 bset_indicate_empty_lines (&buffer_defaults, Qnil);
4970 BSET (&buffer_defaults, indicate_buffer_boundaries, Qnil); 5208 bset_indicate_buffer_boundaries (&buffer_defaults, Qnil);
4971 BSET (&buffer_defaults, fringe_indicator_alist, Qnil); 5209 bset_fringe_indicator_alist (&buffer_defaults, Qnil);
4972 BSET (&buffer_defaults, fringe_cursor_alist, Qnil); 5210 bset_fringe_cursor_alist (&buffer_defaults, Qnil);
4973 BSET (&buffer_defaults, scroll_up_aggressively, Qnil); 5211 bset_scroll_up_aggressively (&buffer_defaults, Qnil);
4974 BSET (&buffer_defaults, scroll_down_aggressively, Qnil); 5212 bset_scroll_down_aggressively (&buffer_defaults, Qnil);
4975 BSET (&buffer_defaults, display_time, Qnil); 5213 bset_display_time (&buffer_defaults, Qnil);
4976 5214
4977 /* Assign the local-flags to the slots that have default values. 5215 /* Assign the local-flags to the slots that have default values.
4978 The local flag is a bit that is used in the buffer 5216 The local flag is a bit that is used in the buffer
@@ -4984,24 +5222,24 @@ init_buffer_once (void)
4984 5222
4985 /* 0 means not a lisp var, -1 means always local, else mask */ 5223 /* 0 means not a lisp var, -1 means always local, else mask */
4986 memset (&buffer_local_flags, 0, sizeof buffer_local_flags); 5224 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
4987 BSET (&buffer_local_flags, filename, make_number (-1)); 5225 bset_filename (&buffer_local_flags, make_number (-1));
4988 BSET (&buffer_local_flags, directory, make_number (-1)); 5226 bset_directory (&buffer_local_flags, make_number (-1));
4989 BSET (&buffer_local_flags, backed_up, make_number (-1)); 5227 bset_backed_up (&buffer_local_flags, make_number (-1));
4990 BSET (&buffer_local_flags, save_length, make_number (-1)); 5228 bset_save_length (&buffer_local_flags, make_number (-1));
4991 BSET (&buffer_local_flags, auto_save_file_name, make_number (-1)); 5229 bset_auto_save_file_name (&buffer_local_flags, make_number (-1));
4992 BSET (&buffer_local_flags, read_only, make_number (-1)); 5230 bset_read_only (&buffer_local_flags, make_number (-1));
4993 BSET (&buffer_local_flags, major_mode, make_number (-1)); 5231 bset_major_mode (&buffer_local_flags, make_number (-1));
4994 BSET (&buffer_local_flags, mode_name, make_number (-1)); 5232 bset_mode_name (&buffer_local_flags, make_number (-1));
4995 BSET (&buffer_local_flags, undo_list, make_number (-1)); 5233 bset_undo_list (&buffer_local_flags, make_number (-1));
4996 BSET (&buffer_local_flags, mark_active, make_number (-1)); 5234 bset_mark_active (&buffer_local_flags, make_number (-1));
4997 BSET (&buffer_local_flags, point_before_scroll, make_number (-1)); 5235 bset_point_before_scroll (&buffer_local_flags, make_number (-1));
4998 BSET (&buffer_local_flags, file_truename, make_number (-1)); 5236 bset_file_truename (&buffer_local_flags, make_number (-1));
4999 BSET (&buffer_local_flags, invisibility_spec, make_number (-1)); 5237 bset_invisibility_spec (&buffer_local_flags, make_number (-1));
5000 BSET (&buffer_local_flags, file_format, make_number (-1)); 5238 bset_file_format (&buffer_local_flags, make_number (-1));
5001 BSET (&buffer_local_flags, auto_save_file_format, make_number (-1)); 5239 bset_auto_save_file_format (&buffer_local_flags, make_number (-1));
5002 BSET (&buffer_local_flags, display_count, make_number (-1)); 5240 bset_display_count (&buffer_local_flags, make_number (-1));
5003 BSET (&buffer_local_flags, display_time, make_number (-1)); 5241 bset_display_time (&buffer_local_flags, make_number (-1));
5004 BSET (&buffer_local_flags, enable_multibyte_characters, make_number (-1)); 5242 bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1));
5005 5243
5006 idx = 1; 5244 idx = 1;
5007 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; 5245 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
@@ -5057,7 +5295,7 @@ init_buffer_once (void)
5057 QSFundamental = build_pure_c_string ("Fundamental"); 5295 QSFundamental = build_pure_c_string ("Fundamental");
5058 5296
5059 Qfundamental_mode = intern_c_string ("fundamental-mode"); 5297 Qfundamental_mode = intern_c_string ("fundamental-mode");
5060 BSET (&buffer_defaults, major_mode, Qfundamental_mode); 5298 bset_major_mode (&buffer_defaults, Qfundamental_mode);
5061 5299
5062 Qmode_class = intern_c_string ("mode-class"); 5300 Qmode_class = intern_c_string ("mode-class");
5063 5301
@@ -5120,13 +5358,13 @@ init_buffer (void)
5120 len++; 5358 len++;
5121 } 5359 }
5122 5360
5123 BSET (current_buffer, directory, make_unibyte_string (pwd, len)); 5361 bset_directory (current_buffer, make_unibyte_string (pwd, len));
5124 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) 5362 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5125 /* At this moment, we still don't know how to decode the 5363 /* At this moment, we still don't know how to decode the
5126 directory name. So, we keep the bytes in multibyte form so 5364 directory name. So, we keep the bytes in multibyte form so
5127 that ENCODE_FILE correctly gets the original bytes. */ 5365 that ENCODE_FILE correctly gets the original bytes. */
5128 BSET (current_buffer, directory, 5366 bset_directory
5129 string_to_multibyte (BVAR (current_buffer, directory))); 5367 (current_buffer, string_to_multibyte (BVAR (current_buffer, directory)));
5130 5368
5131 /* Add /: to the front of the name 5369 /* Add /: to the front of the name
5132 if it would otherwise be treated as magic. */ 5370 if it would otherwise be treated as magic. */
@@ -5137,11 +5375,12 @@ init_buffer (void)
5137 However, it is not necessary to turn / into /:/. 5375 However, it is not necessary to turn / into /:/.
5138 So avoid doing that. */ 5376 So avoid doing that. */
5139 && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) 5377 && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
5140 BSET (current_buffer, directory, 5378 bset_directory
5141 concat2 (build_string ("/:"), BVAR (current_buffer, directory))); 5379 (current_buffer,
5380 concat2 (build_string ("/:"), BVAR (current_buffer, directory)));
5142 5381
5143 temp = get_minibuffer (0); 5382 temp = get_minibuffer (0);
5144 BSET (XBUFFER (temp), directory, BVAR (current_buffer, directory)); 5383 bset_directory (XBUFFER (temp), BVAR (current_buffer, directory));
5145 5384
5146 free (pwd); 5385 free (pwd);
5147} 5386}
diff --git a/src/buffer.h b/src/buffer.h
index 7a6bddee5ec..510a8e55682 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -477,7 +477,6 @@ struct buffer_text
477/* Most code should use this macro to access Lisp fields in struct buffer. */ 477/* Most code should use this macro to access Lisp fields in struct buffer. */
478 478
479#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) 479#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field))
480#define BSET(buf, field, value) ((buf)->INTERNAL_FIELD (field) = (value))
481 480
482/* This is the structure that the buffer Lisp object points to. */ 481/* This is the structure that the buffer Lisp object points to. */
483 482
@@ -862,6 +861,104 @@ struct buffer
862 Lisp_Object INTERNAL_FIELD (undo_list); 861 Lisp_Object INTERNAL_FIELD (undo_list);
863}; 862};
864 863
864/* Most code should use these functions to set Lisp fields in struct
865 buffer. */
866BUFFER_INLINE void
867bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val)
868{
869 b->INTERNAL_FIELD (bidi_paragraph_direction) = val;
870}
871BUFFER_INLINE void
872bset_case_canon_table (struct buffer *b, Lisp_Object val)
873{
874 b->INTERNAL_FIELD (case_canon_table) = val;
875}
876BUFFER_INLINE void
877bset_case_eqv_table (struct buffer *b, Lisp_Object val)
878{
879 b->INTERNAL_FIELD (case_eqv_table) = val;
880}
881BUFFER_INLINE void
882bset_directory (struct buffer *b, Lisp_Object val)
883{
884 b->INTERNAL_FIELD (directory) = val;
885}
886BUFFER_INLINE void
887bset_display_count (struct buffer *b, Lisp_Object val)
888{
889 b->INTERNAL_FIELD (display_count) = val;
890}
891BUFFER_INLINE void
892bset_display_time (struct buffer *b, Lisp_Object val)
893{
894 b->INTERNAL_FIELD (display_time) = val;
895}
896BUFFER_INLINE void
897bset_downcase_table (struct buffer *b, Lisp_Object val)
898{
899 b->INTERNAL_FIELD (downcase_table) = val;
900}
901BUFFER_INLINE void
902bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val)
903{
904 b->INTERNAL_FIELD (enable_multibyte_characters) = val;
905}
906BUFFER_INLINE void
907bset_filename (struct buffer *b, Lisp_Object val)
908{
909 b->INTERNAL_FIELD (filename) = val;
910}
911BUFFER_INLINE void
912bset_keymap (struct buffer *b, Lisp_Object val)
913{
914 b->INTERNAL_FIELD (keymap) = val;
915}
916BUFFER_INLINE void
917bset_last_selected_window (struct buffer *b, Lisp_Object val)
918{
919 b->INTERNAL_FIELD (last_selected_window) = val;
920}
921BUFFER_INLINE void
922bset_local_var_alist (struct buffer *b, Lisp_Object val)
923{
924 b->INTERNAL_FIELD (local_var_alist) = val;
925}
926BUFFER_INLINE void
927bset_mark_active (struct buffer *b, Lisp_Object val)
928{
929 b->INTERNAL_FIELD (mark_active) = val;
930}
931BUFFER_INLINE void
932bset_point_before_scroll (struct buffer *b, Lisp_Object val)
933{
934 b->INTERNAL_FIELD (point_before_scroll) = val;
935}
936BUFFER_INLINE void
937bset_read_only (struct buffer *b, Lisp_Object val)
938{
939 b->INTERNAL_FIELD (read_only) = val;
940}
941BUFFER_INLINE void
942bset_truncate_lines (struct buffer *b, Lisp_Object val)
943{
944 b->INTERNAL_FIELD (truncate_lines) = val;
945}
946BUFFER_INLINE void
947bset_undo_list (struct buffer *b, Lisp_Object val)
948{
949 b->INTERNAL_FIELD (undo_list) = val;
950}
951BUFFER_INLINE void
952bset_upcase_table (struct buffer *b, Lisp_Object val)
953{
954 b->INTERNAL_FIELD (upcase_table) = val;
955}
956BUFFER_INLINE void
957bset_width_table (struct buffer *b, Lisp_Object val)
958{
959 b->INTERNAL_FIELD (width_table) = val;
960}
961
865 962
866/* Chain of all buffers, including killed ones. */ 963/* Chain of all buffers, including killed ones. */
867 964
@@ -953,7 +1050,7 @@ extern Lisp_Object Qfirst_change_hook;
953/* Get text properties of B. */ 1050/* Get text properties of B. */
954 1051
955BUFFER_INLINE INTERVAL 1052BUFFER_INLINE INTERVAL
956buffer_get_intervals (struct buffer *b) 1053buffer_intervals (struct buffer *b)
957{ 1054{
958 eassert (b->text != NULL); 1055 eassert (b->text != NULL);
959 return b->text->intervals; 1056 return b->text->intervals;
@@ -962,26 +1059,12 @@ buffer_get_intervals (struct buffer *b)
962/* Set text properties of B to I. */ 1059/* Set text properties of B to I. */
963 1060
964BUFFER_INLINE void 1061BUFFER_INLINE void
965buffer_set_intervals (struct buffer *b, INTERVAL i) 1062set_buffer_intervals (struct buffer *b, INTERVAL i)
966{ 1063{
967 eassert (b->text != NULL); 1064 eassert (b->text != NULL);
968 b->text->intervals = i; 1065 b->text->intervals = i;
969} 1066}
970 1067
971/* Set an appropriate overlay of B. */
972
973BUFFER_INLINE void
974buffer_set_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
975{
976 b->overlays_before = o;
977}
978
979BUFFER_INLINE void
980buffer_set_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
981{
982 b->overlays_after = o;
983}
984
985/* Non-zero if current buffer has overlays. */ 1068/* Non-zero if current buffer has overlays. */
986 1069
987BUFFER_INLINE int 1070BUFFER_INLINE int
diff --git a/src/callint.c b/src/callint.c
index e0133864674..36a59e812f2 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -372,7 +372,7 @@ invoke it. If KEYS is omitted or nil, the return value of
372 Vthis_command = save_this_command; 372 Vthis_command = save_this_command;
373 Vthis_original_command = save_this_original_command; 373 Vthis_original_command = save_this_original_command;
374 Vreal_this_command = save_real_this_command; 374 Vreal_this_command = save_real_this_command;
375 KSET (current_kboard, Vlast_command, save_last_command); 375 kset_last_command (current_kboard, save_last_command);
376 376
377 temporarily_switch_to_single_kboard (NULL); 377 temporarily_switch_to_single_kboard (NULL);
378 return unbind_to (speccount, apply1 (function, specs)); 378 return unbind_to (speccount, apply1 (function, specs));
@@ -843,7 +843,7 @@ invoke it. If KEYS is omitted or nil, the return value of
843 Vthis_command = save_this_command; 843 Vthis_command = save_this_command;
844 Vthis_original_command = save_this_original_command; 844 Vthis_original_command = save_this_original_command;
845 Vreal_this_command = save_real_this_command; 845 Vreal_this_command = save_real_this_command;
846 KSET (current_kboard, Vlast_command, save_last_command); 846 kset_last_command (current_kboard, save_last_command);
847 847
848 { 848 {
849 Lisp_Object val; 849 Lisp_Object val;
diff --git a/src/casetab.c b/src/casetab.c
index 4b29c091ca9..a163d5204f8 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -128,13 +128,13 @@ set_case_table (Lisp_Object table, int standard)
128 up = Fmake_char_table (Qcase_table, Qnil); 128 up = Fmake_char_table (Qcase_table, Qnil);
129 map_char_table (set_identity, Qnil, table, up); 129 map_char_table (set_identity, Qnil, table, up);
130 map_char_table (shuffle, Qnil, table, up); 130 map_char_table (shuffle, Qnil, table, up);
131 XCHAR_TABLE (table)->extras[0] = up; 131 set_char_table_extras (table, 0, up);
132 } 132 }
133 133
134 if (NILP (canon)) 134 if (NILP (canon))
135 { 135 {
136 canon = Fmake_char_table (Qcase_table, Qnil); 136 canon = Fmake_char_table (Qcase_table, Qnil);
137 XCHAR_TABLE (table)->extras[1] = canon; 137 set_char_table_extras (table, 1, canon);
138 map_char_table (set_canon, Qnil, table, table); 138 map_char_table (set_canon, Qnil, table, table);
139 } 139 }
140 140
@@ -143,11 +143,11 @@ set_case_table (Lisp_Object table, int standard)
143 eqv = Fmake_char_table (Qcase_table, Qnil); 143 eqv = Fmake_char_table (Qcase_table, Qnil);
144 map_char_table (set_identity, Qnil, canon, eqv); 144 map_char_table (set_identity, Qnil, canon, eqv);
145 map_char_table (shuffle, Qnil, canon, eqv); 145 map_char_table (shuffle, Qnil, canon, eqv);
146 XCHAR_TABLE (table)->extras[2] = eqv; 146 set_char_table_extras (table, 2, eqv);
147 } 147 }
148 148
149 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 149 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
150 XCHAR_TABLE (canon)->extras[2] = eqv; 150 set_char_table_extras (canon, 2, eqv);
151 151
152 if (standard) 152 if (standard)
153 { 153 {
@@ -158,10 +158,10 @@ set_case_table (Lisp_Object table, int standard)
158 } 158 }
159 else 159 else
160 { 160 {
161 BSET (current_buffer, downcase_table, table); 161 bset_downcase_table (current_buffer, table);
162 BSET (current_buffer, upcase_table, up); 162 bset_upcase_table (current_buffer, up);
163 BSET (current_buffer, case_canon_table, canon); 163 bset_case_canon_table (current_buffer, canon);
164 BSET (current_buffer, case_eqv_table, eqv); 164 bset_case_eqv_table (current_buffer, eqv);
165 } 165 }
166 166
167 return table; 167 return table;
@@ -260,7 +260,7 @@ init_casetab_once (void)
260 260
261 down = Fmake_char_table (Qcase_table, Qnil); 261 down = Fmake_char_table (Qcase_table, Qnil);
262 Vascii_downcase_table = down; 262 Vascii_downcase_table = down;
263 XCHAR_TABLE (down)->purpose = Qcase_table; 263 set_char_table_purpose (down, Qcase_table);
264 264
265 for (i = 0; i < 128; i++) 265 for (i = 0; i < 128; i++)
266 { 266 {
@@ -268,10 +268,10 @@ init_casetab_once (void)
268 CHAR_TABLE_SET (down, i, make_number (c)); 268 CHAR_TABLE_SET (down, i, make_number (c));
269 } 269 }
270 270
271 XCHAR_TABLE (down)->extras[1] = Fcopy_sequence (down); 271 set_char_table_extras (down, 1, Fcopy_sequence (down));
272 272
273 up = Fmake_char_table (Qcase_table, Qnil); 273 up = Fmake_char_table (Qcase_table, Qnil);
274 XCHAR_TABLE (down)->extras[0] = up; 274 set_char_table_extras (down, 0, up);
275 275
276 for (i = 0; i < 128; i++) 276 for (i = 0; i < 128; i++)
277 { 277 {
@@ -281,7 +281,7 @@ init_casetab_once (void)
281 CHAR_TABLE_SET (up, i, make_number (c)); 281 CHAR_TABLE_SET (up, i, make_number (c));
282 } 282 }
283 283
284 XCHAR_TABLE (down)->extras[2] = Fcopy_sequence (up); 284 set_char_table_extras (down, 2, Fcopy_sequence (up));
285 285
286 /* Fill in what isn't filled in. */ 286 /* Fill in what isn't filled in. */
287 set_case_table (down, 1); 287 set_case_table (down, 1);
diff --git a/src/category.c b/src/category.c
index 13c6e46d283..a9bbf596abc 100644
--- a/src/category.c
+++ b/src/category.c
@@ -32,7 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32 32
33#define CATEGORY_INLINE EXTERN_INLINE 33#define CATEGORY_INLINE EXTERN_INLINE
34 34
35#include <ctype.h>
36#include <setjmp.h> 35#include <setjmp.h>
37#include "lisp.h" 36#include "lisp.h"
38#include "character.h" 37#include "character.h"
@@ -41,6 +40,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41#include "category.h" 40#include "category.h"
42#include "keymap.h" 41#include "keymap.h"
43 42
43/* This setter is used only in this file, so it can be private. */
44static inline void
45bset_category_table (struct buffer *b, Lisp_Object val)
46{
47 b->INTERNAL_FIELD (category_table) = val;
48}
49
44/* The version number of the latest category table. Each category 50/* The version number of the latest category table. Each category
45 table has a unique version number. It is assigned a new number 51 table has a unique version number. It is assigned a new number
46 also when it is modified. When a regular expression is compiled 52 also when it is modified. When a regular expression is compiled
@@ -71,11 +77,12 @@ hash_get_category_set (Lisp_Object table, Lisp_Object category_set)
71 EMACS_UINT hash; 77 EMACS_UINT hash;
72 78
73 if (NILP (XCHAR_TABLE (table)->extras[1])) 79 if (NILP (XCHAR_TABLE (table)->extras[1]))
74 XCHAR_TABLE (table)->extras[1] 80 set_char_table_extras
75 = make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), 81 (table, 1,
76 make_float (DEFAULT_REHASH_SIZE), 82 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
77 make_float (DEFAULT_REHASH_THRESHOLD), 83 make_float (DEFAULT_REHASH_SIZE),
78 Qnil, Qnil, Qnil); 84 make_float (DEFAULT_REHASH_THRESHOLD),
85 Qnil, Qnil, Qnil));
79 h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]); 86 h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]);
80 i = hash_lookup (h, category_set, &hash); 87 i = hash_lookup (h, category_set, &hash);
81 if (i >= 0) 88 if (i >= 0)
@@ -238,10 +245,10 @@ copy_category_table (Lisp_Object table)
238 table = copy_char_table (table); 245 table = copy_char_table (table);
239 246
240 if (! NILP (XCHAR_TABLE (table)->defalt)) 247 if (! NILP (XCHAR_TABLE (table)->defalt))
241 XCHAR_TABLE (table)->defalt 248 set_char_table_defalt (table,
242 = Fcopy_sequence (XCHAR_TABLE (table)->defalt); 249 Fcopy_sequence (XCHAR_TABLE (table)->defalt));
243 XCHAR_TABLE (table)->extras[0] 250 set_char_table_extras
244 = Fcopy_sequence (XCHAR_TABLE (table)->extras[0]); 251 (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0]));
245 map_char_table (copy_category_entry, Qnil, table, table); 252 map_char_table (copy_category_entry, Qnil, table, table);
246 253
247 return table; 254 return table;
@@ -270,9 +277,9 @@ DEFUN ("make-category-table", Fmake_category_table, Smake_category_table,
270 int i; 277 int i;
271 278
272 val = Fmake_char_table (Qcategory_table, Qnil); 279 val = Fmake_char_table (Qcategory_table, Qnil);
273 XCHAR_TABLE (val)->defalt = MAKE_CATEGORY_SET; 280 set_char_table_defalt (val, MAKE_CATEGORY_SET);
274 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) 281 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
275 XCHAR_TABLE (val)->contents[i] = MAKE_CATEGORY_SET; 282 set_char_table_contents (val, i, MAKE_CATEGORY_SET);
276 Fset_char_table_extra_slot (val, make_number (0), 283 Fset_char_table_extra_slot (val, make_number (0),
277 Fmake_vector (make_number (95), Qnil)); 284 Fmake_vector (make_number (95), Qnil));
278 return val; 285 return val;
@@ -285,7 +292,7 @@ Return TABLE. */)
285{ 292{
286 int idx; 293 int idx;
287 table = check_category_table (table); 294 table = check_category_table (table);
288 BSET (current_buffer, category_table, table); 295 bset_category_table (current_buffer, table);
289 /* Indicate that this buffer now has a specified category table. */ 296 /* Indicate that this buffer now has a specified category table. */
290 idx = PER_BUFFER_VAR_IDX (category_table); 297 idx = PER_BUFFER_VAR_IDX (category_table);
291 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 298 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -466,7 +473,7 @@ init_category_once (void)
466 473
467 Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil); 474 Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil);
468 /* Set a category set which contains nothing to the default. */ 475 /* Set a category set which contains nothing to the default. */
469 XCHAR_TABLE (Vstandard_category_table)->defalt = MAKE_CATEGORY_SET; 476 set_char_table_defalt (Vstandard_category_table, MAKE_CATEGORY_SET);
470 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0), 477 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0),
471 Fmake_vector (make_number (95), Qnil)); 478 Fmake_vector (make_number (95), Qnil));
472} 479}
diff --git a/src/charset.c b/src/charset.c
index fbbcefc4915..87c16e12008 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -30,10 +30,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30 30
31#include <stdio.h> 31#include <stdio.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <ctype.h>
34#include <limits.h> 33#include <limits.h>
35#include <sys/types.h> 34#include <sys/types.h>
36#include <setjmp.h> 35#include <setjmp.h>
36#include <c-ctype.h>
37#include "lisp.h" 37#include "lisp.h"
38#include "character.h" 38#include "character.h"
39#include "charset.h" 39#include "charset.h"
@@ -446,7 +446,7 @@ read_hex (FILE *fp, int *eof, int *overflow)
446 return 0; 446 return 0;
447 } 447 }
448 n = 0; 448 n = 0;
449 while (isxdigit (c = getc (fp))) 449 while (c_isxdigit (c = getc (fp)))
450 { 450 {
451 if (UINT_MAX >> 4 < n) 451 if (UINT_MAX >> 4 < n)
452 *overflow = 1; 452 *overflow = 1;
diff --git a/src/chartab.c b/src/chartab.c
index c022bc03e66..711a49ed397 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -115,8 +115,8 @@ the char-table has no extra slot. */)
115 size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras; 115 size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras;
116 vector = Fmake_vector (make_number (size), init); 116 vector = Fmake_vector (make_number (size), init);
117 XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE); 117 XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
118 XCHAR_TABLE (vector)->parent = Qnil; 118 set_char_table_parent (vector, Qnil);
119 XCHAR_TABLE (vector)->purpose = purpose; 119 set_char_table_purpose (vector, purpose);
120 XSETCHAR_TABLE (vector, XCHAR_TABLE (vector)); 120 XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
121 return vector; 121 return vector;
122} 122}
@@ -155,21 +155,17 @@ char_table_ascii (Lisp_Object table)
155static Lisp_Object 155static Lisp_Object
156copy_sub_char_table (Lisp_Object table) 156copy_sub_char_table (Lisp_Object table)
157{ 157{
158 Lisp_Object copy;
159 int depth = XINT (XSUB_CHAR_TABLE (table)->depth); 158 int depth = XINT (XSUB_CHAR_TABLE (table)->depth);
160 int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char); 159 int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char);
161 Lisp_Object val; 160 Lisp_Object copy = make_sub_char_table (depth, min_char, Qnil);
162 int i; 161 int i;
163 162
164 copy = make_sub_char_table (depth, min_char, Qnil);
165 /* Recursively copy any sub char-tables. */ 163 /* Recursively copy any sub char-tables. */
166 for (i = 0; i < chartab_size[depth]; i++) 164 for (i = 0; i < chartab_size[depth]; i++)
167 { 165 {
168 val = XSUB_CHAR_TABLE (table)->contents[i]; 166 Lisp_Object val = XSUB_CHAR_TABLE (table)->contents[i];
169 if (SUB_CHAR_TABLE_P (val)) 167 set_sub_char_table_contents
170 XSUB_CHAR_TABLE (copy)->contents[i] = copy_sub_char_table (val); 168 (copy, i, SUB_CHAR_TABLE_P (val) ? copy_sub_char_table (val) : val);
171 else
172 XSUB_CHAR_TABLE (copy)->contents[i] = val;
173 } 169 }
174 170
175 return copy; 171 return copy;
@@ -185,18 +181,19 @@ copy_char_table (Lisp_Object table)
185 181
186 copy = Fmake_vector (make_number (size), Qnil); 182 copy = Fmake_vector (make_number (size), Qnil);
187 XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE); 183 XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
188 XCHAR_TABLE (copy)->defalt = XCHAR_TABLE (table)->defalt; 184 set_char_table_defalt (copy, XCHAR_TABLE (table)->defalt);
189 XCHAR_TABLE (copy)->parent = XCHAR_TABLE (table)->parent; 185 set_char_table_parent (copy, XCHAR_TABLE (table)->parent);
190 XCHAR_TABLE (copy)->purpose = XCHAR_TABLE (table)->purpose; 186 set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose);
191 for (i = 0; i < chartab_size[0]; i++) 187 for (i = 0; i < chartab_size[0]; i++)
192 XCHAR_TABLE (copy)->contents[i] 188 set_char_table_contents
193 = (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i]) 189 (copy, i,
194 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i]) 190 (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
195 : XCHAR_TABLE (table)->contents[i]); 191 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i])
196 XCHAR_TABLE (copy)->ascii = char_table_ascii (copy); 192 : XCHAR_TABLE (table)->contents[i]));
193 set_char_table_ascii (copy, char_table_ascii (copy));
197 size -= VECSIZE (struct Lisp_Char_Table) - 1; 194 size -= VECSIZE (struct Lisp_Char_Table) - 1;
198 for (i = 0; i < size; i++) 195 for (i = 0; i < size; i++)
199 XCHAR_TABLE (copy)->extras[i] = XCHAR_TABLE (table)->extras[i]; 196 set_char_table_extras (copy, i, XCHAR_TABLE (table)->extras[i]);
200 197
201 XSETCHAR_TABLE (copy, XCHAR_TABLE (copy)); 198 XSETCHAR_TABLE (copy, XCHAR_TABLE (copy));
202 return copy; 199 return copy;
@@ -394,7 +391,7 @@ sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
394 Lisp_Object sub; 391 Lisp_Object sub;
395 392
396 if (depth == 3) 393 if (depth == 3)
397 tbl->contents[i] = val; 394 set_sub_char_table_contents (table, i, val);
398 else 395 else
399 { 396 {
400 sub = tbl->contents[i]; 397 sub = tbl->contents[i];
@@ -407,23 +404,21 @@ sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
407 sub = make_sub_char_table (depth + 1, 404 sub = make_sub_char_table (depth + 1,
408 min_char + i * chartab_chars[depth], 405 min_char + i * chartab_chars[depth],
409 sub); 406 sub);
410 tbl->contents[i] = sub; 407 set_sub_char_table_contents (table, i, sub);
411 } 408 }
412 } 409 }
413 sub_char_table_set (sub, c, val, is_uniprop); 410 sub_char_table_set (sub, c, val, is_uniprop);
414 } 411 }
415} 412}
416 413
417Lisp_Object 414void
418char_table_set (Lisp_Object table, int c, Lisp_Object val) 415char_table_set (Lisp_Object table, int c, Lisp_Object val)
419{ 416{
420 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); 417 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
421 418
422 if (ASCII_CHAR_P (c) 419 if (ASCII_CHAR_P (c)
423 && SUB_CHAR_TABLE_P (tbl->ascii)) 420 && SUB_CHAR_TABLE_P (tbl->ascii))
424 { 421 set_sub_char_table_contents (tbl->ascii, c, val);
425 XSUB_CHAR_TABLE (tbl->ascii)->contents[c] = val;
426 }
427 else 422 else
428 { 423 {
429 int i = CHARTAB_IDX (c, 0, 0); 424 int i = CHARTAB_IDX (c, 0, 0);
@@ -433,13 +428,12 @@ char_table_set (Lisp_Object table, int c, Lisp_Object val)
433 if (! SUB_CHAR_TABLE_P (sub)) 428 if (! SUB_CHAR_TABLE_P (sub))
434 { 429 {
435 sub = make_sub_char_table (1, i * chartab_chars[0], sub); 430 sub = make_sub_char_table (1, i * chartab_chars[0], sub);
436 tbl->contents[i] = sub; 431 set_char_table_contents (table, i, sub);
437 } 432 }
438 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table)); 433 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table));
439 if (ASCII_CHAR_P (c)) 434 if (ASCII_CHAR_P (c))
440 tbl->ascii = char_table_ascii (table); 435 set_char_table_ascii (table, char_table_ascii (table));
441 } 436 }
442 return val;
443} 437}
444 438
445static void 439static void
@@ -461,7 +455,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
461 if (c > to) 455 if (c > to)
462 break; 456 break;
463 if (from <= c && c + chars_in_block - 1 <= to) 457 if (from <= c && c + chars_in_block - 1 <= to)
464 tbl->contents[i] = val; 458 set_sub_char_table_contents (table, i, val);
465 else 459 else
466 { 460 {
467 Lisp_Object sub = tbl->contents[i]; 461 Lisp_Object sub = tbl->contents[i];
@@ -472,7 +466,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
472 else 466 else
473 { 467 {
474 sub = make_sub_char_table (depth + 1, c, sub); 468 sub = make_sub_char_table (depth + 1, c, sub);
475 tbl->contents[i] = sub; 469 set_sub_char_table_contents (table, i, sub);
476 } 470 }
477 } 471 }
478 sub_char_table_set_range (sub, from, to, val, is_uniprop); 472 sub_char_table_set_range (sub, from, to, val, is_uniprop);
@@ -481,7 +475,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
481} 475}
482 476
483 477
484Lisp_Object 478void
485char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val) 479char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
486{ 480{
487 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); 481 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
@@ -500,22 +494,21 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
500 if (c > to) 494 if (c > to)
501 break; 495 break;
502 if (from <= c && c + chartab_chars[0] - 1 <= to) 496 if (from <= c && c + chartab_chars[0] - 1 <= to)
503 tbl->contents[i] = val; 497 set_char_table_contents (table, i, val);
504 else 498 else
505 { 499 {
506 Lisp_Object sub = tbl->contents[i]; 500 Lisp_Object sub = tbl->contents[i];
507 if (! SUB_CHAR_TABLE_P (sub)) 501 if (! SUB_CHAR_TABLE_P (sub))
508 { 502 {
509 sub = make_sub_char_table (1, i * chartab_chars[0], sub); 503 sub = make_sub_char_table (1, i * chartab_chars[0], sub);
510 tbl->contents[i] = sub; 504 set_char_table_contents (table, i, sub);
511 } 505 }
512 sub_char_table_set_range (sub, from, to, val, is_uniprop); 506 sub_char_table_set_range (sub, from, to, val, is_uniprop);
513 } 507 }
514 } 508 }
515 if (ASCII_CHAR_P (from)) 509 if (ASCII_CHAR_P (from))
516 tbl->ascii = char_table_ascii (table); 510 set_char_table_ascii (table, char_table_ascii (table));
517 } 511 }
518 return val;
519} 512}
520 513
521 514
@@ -563,7 +556,7 @@ Return PARENT. PARENT must be either nil or another char-table. */)
563 error ("Attempt to make a chartable be its own parent"); 556 error ("Attempt to make a chartable be its own parent");
564 } 557 }
565 558
566 XCHAR_TABLE (char_table)->parent = parent; 559 set_char_table_parent (char_table, parent);
567 560
568 return parent; 561 return parent;
569} 562}
@@ -594,7 +587,8 @@ DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot,
594 || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table))) 587 || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
595 args_out_of_range (char_table, n); 588 args_out_of_range (char_table, n);
596 589
597 return XCHAR_TABLE (char_table)->extras[XINT (n)] = value; 590 set_char_table_extras (char_table, XINT (n), value);
591 return value;
598} 592}
599 593
600DEFUN ("char-table-range", Fchar_table_range, Schar_table_range, 594DEFUN ("char-table-range", Fchar_table_range, Schar_table_range,
@@ -640,12 +634,12 @@ or a character code. Return VALUE. */)
640 { 634 {
641 int i; 635 int i;
642 636
643 XCHAR_TABLE (char_table)->ascii = value; 637 set_char_table_ascii (char_table, value);
644 for (i = 0; i < chartab_size[0]; i++) 638 for (i = 0; i < chartab_size[0]; i++)
645 XCHAR_TABLE (char_table)->contents[i] = value; 639 set_char_table_contents (char_table, i, value);
646 } 640 }
647 else if (EQ (range, Qnil)) 641 else if (EQ (range, Qnil))
648 XCHAR_TABLE (char_table)->defalt = value; 642 set_char_table_defalt (char_table, value);
649 else if (CHARACTERP (range)) 643 else if (CHARACTERP (range))
650 char_table_set (char_table, XINT (range), value); 644 char_table_set (char_table, XINT (range), value);
651 else if (CONSP (range)) 645 else if (CONSP (range))
@@ -693,15 +687,19 @@ optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
693 687
694 elt = XSUB_CHAR_TABLE (table)->contents[0]; 688 elt = XSUB_CHAR_TABLE (table)->contents[0];
695 if (SUB_CHAR_TABLE_P (elt)) 689 if (SUB_CHAR_TABLE_P (elt))
696 elt = XSUB_CHAR_TABLE (table)->contents[0] 690 {
697 = optimize_sub_char_table (elt, test); 691 elt = optimize_sub_char_table (elt, test);
692 set_sub_char_table_contents (table, 0, elt);
693 }
698 optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1; 694 optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1;
699 for (i = 1; i < chartab_size[depth]; i++) 695 for (i = 1; i < chartab_size[depth]; i++)
700 { 696 {
701 this = XSUB_CHAR_TABLE (table)->contents[i]; 697 this = XSUB_CHAR_TABLE (table)->contents[i];
702 if (SUB_CHAR_TABLE_P (this)) 698 if (SUB_CHAR_TABLE_P (this))
703 this = XSUB_CHAR_TABLE (table)->contents[i] 699 {
704 = optimize_sub_char_table (this, test); 700 this = optimize_sub_char_table (this, test);
701 set_sub_char_table_contents (table, i, this);
702 }
705 if (optimizable 703 if (optimizable
706 && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ 704 && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */
707 : EQ (test, Qeq) ? !EQ (this, elt) /* Optimize `eq' case. */ 705 : EQ (test, Qeq) ? !EQ (this, elt) /* Optimize `eq' case. */
@@ -728,11 +726,11 @@ equivalent and can be merged. It defaults to `equal'. */)
728 { 726 {
729 elt = XCHAR_TABLE (char_table)->contents[i]; 727 elt = XCHAR_TABLE (char_table)->contents[i];
730 if (SUB_CHAR_TABLE_P (elt)) 728 if (SUB_CHAR_TABLE_P (elt))
731 XCHAR_TABLE (char_table)->contents[i] 729 set_char_table_contents
732 = optimize_sub_char_table (elt, test); 730 (char_table, i, optimize_sub_char_table (elt, test));
733 } 731 }
734 /* Reset the `ascii' cache, in case it got optimized away. */ 732 /* Reset the `ascii' cache, in case it got optimized away. */
735 XCHAR_TABLE (char_table)->ascii = char_table_ascii (char_table); 733 set_char_table_ascii (char_table, char_table_ascii (char_table));
736 734
737 return Qnil; 735 return Qnil;
738} 736}
@@ -824,9 +822,9 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
824 822
825 /* This is to get a value of FROM in PARENT 823 /* This is to get a value of FROM in PARENT
826 without checking the parent of PARENT. */ 824 without checking the parent of PARENT. */
827 XCHAR_TABLE (parent)->parent = Qnil; 825 set_char_table_parent (parent, Qnil);
828 val = CHAR_TABLE_REF (parent, from); 826 val = CHAR_TABLE_REF (parent, from);
829 XCHAR_TABLE (parent)->parent = temp; 827 set_char_table_parent (parent, temp);
830 XSETCDR (range, make_number (c - 1)); 828 XSETCDR (range, make_number (c - 1));
831 val = map_sub_char_table (c_function, function, 829 val = map_sub_char_table (c_function, function,
832 parent, arg, val, range, 830 parent, arg, val, range,
@@ -906,9 +904,9 @@ map_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
906 temp = XCHAR_TABLE (parent)->parent; 904 temp = XCHAR_TABLE (parent)->parent;
907 /* This is to get a value of FROM in PARENT without checking the 905 /* This is to get a value of FROM in PARENT without checking the
908 parent of PARENT. */ 906 parent of PARENT. */
909 XCHAR_TABLE (parent)->parent = Qnil; 907 set_char_table_parent (parent, Qnil);
910 val = CHAR_TABLE_REF (parent, from); 908 val = CHAR_TABLE_REF (parent, from);
911 XCHAR_TABLE (parent)->parent = temp; 909 set_char_table_parent (parent, temp);
912 val = map_sub_char_table (c_function, function, parent, arg, val, range, 910 val = map_sub_char_table (c_function, function, parent, arg, val, range,
913 parent); 911 parent);
914 table = parent; 912 table = parent;
@@ -1143,10 +1141,9 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1143 int min_char = (XINT (XSUB_CHAR_TABLE (table)->min_char) 1141 int min_char = (XINT (XSUB_CHAR_TABLE (table)->min_char)
1144 + chartab_chars[2] * idx); 1142 + chartab_chars[2] * idx);
1145 Lisp_Object sub = make_sub_char_table (3, min_char, Qnil); 1143 Lisp_Object sub = make_sub_char_table (3, min_char, Qnil);
1146 struct Lisp_Sub_Char_Table *subtbl = XSUB_CHAR_TABLE (sub);
1147 const unsigned char *p, *pend; 1144 const unsigned char *p, *pend;
1148 1145
1149 XSUB_CHAR_TABLE (table)->contents[idx] = sub; 1146 set_sub_char_table_contents (table, idx, sub);
1150 p = SDATA (val), pend = p + SBYTES (val); 1147 p = SDATA (val), pend = p + SBYTES (val);
1151 if (*p == 1) 1148 if (*p == 1)
1152 { 1149 {
@@ -1156,7 +1153,8 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1156 while (p < pend && idx < chartab_chars[2]) 1153 while (p < pend && idx < chartab_chars[2])
1157 { 1154 {
1158 int v = STRING_CHAR_ADVANCE (p); 1155 int v = STRING_CHAR_ADVANCE (p);
1159 subtbl->contents[idx++] = v > 0 ? make_number (v) : Qnil; 1156 set_sub_char_table_contents
1157 (sub, idx++, v > 0 ? make_number (v) : Qnil);
1160 } 1158 }
1161 } 1159 }
1162 else if (*p == 2) 1160 else if (*p == 2)
@@ -1181,7 +1179,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1181 } 1179 }
1182 } 1180 }
1183 while (count-- > 0) 1181 while (count-- > 0)
1184 subtbl->contents[idx++] = make_number (v); 1182 set_sub_char_table_contents (sub, idx++, make_number (v));
1185 } 1183 }
1186 } 1184 }
1187/* It seems that we don't need this function because C code won't need 1185/* It seems that we don't need this function because C code won't need
@@ -1284,7 +1282,7 @@ uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value)
1284 1282
1285 args[0] = XCHAR_TABLE (table)->extras[4]; 1283 args[0] = XCHAR_TABLE (table)->extras[4];
1286 args[1] = Fmake_vector (make_number (1), value); 1284 args[1] = Fmake_vector (make_number (1), value);
1287 XCHAR_TABLE (table)->extras[4] = Fvconcat (2, args); 1285 set_char_table_extras (table, 4, Fvconcat (2, args));
1288 } 1286 }
1289 return make_number (i); 1287 return make_number (i);
1290} 1288}
@@ -1346,7 +1344,7 @@ uniprop_table (Lisp_Object prop)
1346 : ! NILP (val)) 1344 : ! NILP (val))
1347 return Qnil; 1345 return Qnil;
1348 /* Prepare ASCII values in advance for CHAR_TABLE_REF. */ 1346 /* Prepare ASCII values in advance for CHAR_TABLE_REF. */
1349 XCHAR_TABLE (table)->ascii = char_table_ascii (table); 1347 set_char_table_ascii (table, char_table_ascii (table));
1350 return table; 1348 return table;
1351} 1349}
1352 1350
diff --git a/src/cmds.c b/src/cmds.c
index 24778fae6e3..b416135ee9e 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -301,7 +301,7 @@ At the end, it runs `post-self-insert-hook'. */)
301 added be explicit calls to undo-boundary. */ 301 added be explicit calls to undo-boundary. */
302 && EQ (BVAR (current_buffer, undo_list), last_undo_boundary)) 302 && EQ (BVAR (current_buffer, undo_list), last_undo_boundary))
303 /* Remove the undo_boundary that was just pushed. */ 303 /* Remove the undo_boundary that was just pushed. */
304 BSET (current_buffer, undo_list, XCDR (BVAR (current_buffer, undo_list))); 304 bset_undo_list (current_buffer, XCDR (BVAR (current_buffer, undo_list)));
305 305
306 /* Barf if the key that invoked this was not a character. */ 306 /* Barf if the key that invoked this was not a character. */
307 if (!CHARACTERP (last_command_event)) 307 if (!CHARACTERP (last_command_event))
diff --git a/src/coding.c b/src/coding.c
index c601a18b26e..971686dc180 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7112,7 +7112,7 @@ decode_coding (struct coding_system *coding)
7112 record_first_change (); 7112 record_first_change ();
7113 7113
7114 undo_list = BVAR (current_buffer, undo_list); 7114 undo_list = BVAR (current_buffer, undo_list);
7115 BSET (current_buffer, undo_list, Qt); 7115 bset_undo_list (current_buffer, Qt);
7116 } 7116 }
7117 7117
7118 coding->consumed = coding->consumed_char = 0; 7118 coding->consumed = coding->consumed_char = 0;
@@ -7209,7 +7209,7 @@ decode_coding (struct coding_system *coding)
7209 decode_eol (coding); 7209 decode_eol (coding);
7210 if (BUFFERP (coding->dst_object)) 7210 if (BUFFERP (coding->dst_object))
7211 { 7211 {
7212 BSET (current_buffer, undo_list, undo_list); 7212 bset_undo_list (current_buffer, undo_list);
7213 record_insert (coding->dst_pos, coding->produced_char); 7213 record_insert (coding->dst_pos, coding->produced_char);
7214 } 7214 }
7215 return coding->result; 7215 return coding->result;
@@ -7577,8 +7577,8 @@ make_conversion_work_buffer (int multibyte)
7577 doesn't compile new regexps. */ 7577 doesn't compile new regexps. */
7578 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); 7578 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
7579 Ferase_buffer (); 7579 Ferase_buffer ();
7580 BSET (current_buffer, undo_list, Qt); 7580 bset_undo_list (current_buffer, Qt);
7581 BSET (current_buffer, enable_multibyte_characters, multibyte ? Qt : Qnil); 7581 bset_enable_multibyte_characters (current_buffer, multibyte ? Qt : Qnil);
7582 set_buffer_internal (current); 7582 set_buffer_internal (current);
7583 return workbuf; 7583 return workbuf;
7584} 7584}
@@ -9302,10 +9302,10 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern
9302 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; 9302 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
9303 terminal_coding->src_multibyte = 1; 9303 terminal_coding->src_multibyte = 1;
9304 terminal_coding->dst_multibyte = 0; 9304 terminal_coding->dst_multibyte = 0;
9305 if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) 9305 tset_charset_list
9306 TSET (term, charset_list, coding_charset_list (terminal_coding)); 9306 (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK
9307 else 9307 ? coding_charset_list (terminal_coding)
9308 TSET (term, charset_list, Fcons (make_number (charset_ascii), Qnil)); 9308 : Fcons (make_number (charset_ascii), Qnil)));
9309 return Qnil; 9309 return Qnil;
9310} 9310}
9311 9311
diff --git a/src/data.c b/src/data.c
index d0ef5734abc..ea511824e6d 100644
--- a/src/data.c
+++ b/src/data.c
@@ -543,7 +543,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
543 else 543 else
544 { 544 {
545 swap_in_symval_forwarding (sym, blv); 545 swap_in_symval_forwarding (sym, blv);
546 valcontents = BLV_VALUE (blv); 546 valcontents = blv_value (blv);
547 } 547 }
548 break; 548 break;
549 } 549 }
@@ -964,16 +964,16 @@ swap_in_global_binding (struct Lisp_Symbol *symbol)
964 964
965 /* Unload the previously loaded binding. */ 965 /* Unload the previously loaded binding. */
966 if (blv->fwd) 966 if (blv->fwd)
967 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 967 set_blv_value (blv, do_symval_forwarding (blv->fwd));
968 968
969 /* Select the global binding in the symbol. */ 969 /* Select the global binding in the symbol. */
970 blv->valcell = blv->defcell; 970 set_blv_valcell (blv, blv->defcell);
971 if (blv->fwd) 971 if (blv->fwd)
972 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL); 972 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL);
973 973
974 /* Indicate that the global binding is set up now. */ 974 /* Indicate that the global binding is set up now. */
975 blv->where = Qnil; 975 set_blv_where (blv, Qnil);
976 SET_BLV_FOUND (blv, 0); 976 set_blv_found (blv, 0);
977} 977}
978 978
979/* Set up the buffer-local symbol SYMBOL for validity in the current buffer. 979/* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
@@ -1001,7 +1001,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1001 /* Unload the previously loaded binding. */ 1001 /* Unload the previously loaded binding. */
1002 tem1 = blv->valcell; 1002 tem1 = blv->valcell;
1003 if (blv->fwd) 1003 if (blv->fwd)
1004 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1004 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1005 /* Choose the new binding. */ 1005 /* Choose the new binding. */
1006 { 1006 {
1007 Lisp_Object var; 1007 Lisp_Object var;
@@ -1009,7 +1009,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1009 if (blv->frame_local) 1009 if (blv->frame_local)
1010 { 1010 {
1011 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); 1011 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
1012 blv->where = selected_frame; 1012 set_blv_where (blv, selected_frame);
1013 } 1013 }
1014 else 1014 else
1015 { 1015 {
@@ -1021,9 +1021,9 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1021 tem1 = blv->defcell; 1021 tem1 = blv->defcell;
1022 1022
1023 /* Load the new binding. */ 1023 /* Load the new binding. */
1024 blv->valcell = tem1; 1024 set_blv_valcell (blv, tem1);
1025 if (blv->fwd) 1025 if (blv->fwd)
1026 store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL); 1026 store_symval_forwarding (blv->fwd, blv_value (blv), NULL);
1027 } 1027 }
1028} 1028}
1029 1029
@@ -1050,7 +1050,7 @@ find_symbol_value (Lisp_Object symbol)
1050 { 1050 {
1051 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 1051 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1052 swap_in_symval_forwarding (sym, blv); 1052 swap_in_symval_forwarding (sym, blv);
1053 return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv); 1053 return blv->fwd ? do_symval_forwarding (blv->fwd) : blv_value (blv);
1054 } 1054 }
1055 /* FALLTHROUGH */ 1055 /* FALLTHROUGH */
1056 case SYMBOL_FORWARDED: 1056 case SYMBOL_FORWARDED:
@@ -1175,7 +1175,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1175 1175
1176 /* Write out `realvalue' to the old loaded binding. */ 1176 /* Write out `realvalue' to the old loaded binding. */
1177 if (blv->fwd) 1177 if (blv->fwd)
1178 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1178 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1179 1179
1180 /* Find the new binding. */ 1180 /* Find the new binding. */
1181 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ 1181 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
@@ -1183,8 +1183,8 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1183 (blv->frame_local 1183 (blv->frame_local
1184 ? XFRAME (where)->param_alist 1184 ? XFRAME (where)->param_alist
1185 : BVAR (XBUFFER (where), local_var_alist))); 1185 : BVAR (XBUFFER (where), local_var_alist)));
1186 blv->where = where; 1186 set_blv_where (blv, where);
1187 blv->found = 1; 1187 set_blv_found (blv, 1);
1188 1188
1189 if (NILP (tem1)) 1189 if (NILP (tem1))
1190 { 1190 {
@@ -1199,7 +1199,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1199 if (bindflag || !blv->local_if_set 1199 if (bindflag || !blv->local_if_set
1200 || let_shadows_buffer_binding_p (sym)) 1200 || let_shadows_buffer_binding_p (sym))
1201 { 1201 {
1202 blv->found = 0; 1202 set_blv_found (blv, 0);
1203 tem1 = blv->defcell; 1203 tem1 = blv->defcell;
1204 } 1204 }
1205 /* If it's a local_if_set, being set not bound, 1205 /* If it's a local_if_set, being set not bound,
@@ -1213,17 +1213,18 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1213 bindings, not for frame-local bindings. */ 1213 bindings, not for frame-local bindings. */
1214 eassert (!blv->frame_local); 1214 eassert (!blv->frame_local);
1215 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1215 tem1 = Fcons (symbol, XCDR (blv->defcell));
1216 BSET (XBUFFER (where), local_var_alist, 1216 bset_local_var_alist
1217 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); 1217 (XBUFFER (where),
1218 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)));
1218 } 1219 }
1219 } 1220 }
1220 1221
1221 /* Record which binding is now loaded. */ 1222 /* Record which binding is now loaded. */
1222 blv->valcell = tem1; 1223 set_blv_valcell (blv, tem1);
1223 } 1224 }
1224 1225
1225 /* Store the new value in the cons cell. */ 1226 /* Store the new value in the cons cell. */
1226 SET_BLV_VALUE (blv, newval); 1227 set_blv_value (blv, newval);
1227 1228
1228 if (blv->fwd) 1229 if (blv->fwd)
1229 { 1230 {
@@ -1479,12 +1480,12 @@ make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents
1479 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd))); 1480 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd)));
1480 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); 1481 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
1481 blv->fwd = forwarded ? valcontents.fwd : NULL; 1482 blv->fwd = forwarded ? valcontents.fwd : NULL;
1482 blv->where = Qnil; 1483 set_blv_where (blv, Qnil);
1483 blv->frame_local = 0; 1484 blv->frame_local = 0;
1484 blv->local_if_set = 0; 1485 blv->local_if_set = 0;
1485 blv->defcell = tem; 1486 set_blv_defcell (blv, tem);
1486 blv->valcell = tem; 1487 set_blv_valcell (blv, tem);
1487 SET_BLV_FOUND (blv, 0); 1488 set_blv_found (blv, 0);
1488 return blv; 1489 return blv;
1489} 1490}
1490 1491
@@ -1653,17 +1654,16 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1653 default value. */ 1654 default value. */
1654 find_symbol_value (variable); 1655 find_symbol_value (variable);
1655 1656
1656 BSET (current_buffer, local_var_alist, 1657 bset_local_var_alist
1657 Fcons (Fcons (variable, XCDR (blv->defcell)), 1658 (current_buffer,
1658 BVAR (current_buffer, local_var_alist))); 1659 Fcons (Fcons (variable, XCDR (blv->defcell)),
1660 BVAR (current_buffer, local_var_alist)));
1659 1661
1660 /* Make sure symbol does not think it is set up for this buffer; 1662 /* Make sure symbol does not think it is set up for this buffer;
1661 force it to look once again for this buffer's value. */ 1663 force it to look once again for this buffer's value. */
1662 if (current_buffer == XBUFFER (blv->where)) 1664 if (current_buffer == XBUFFER (blv->where))
1663 blv->where = Qnil; 1665 set_blv_where (blv, Qnil);
1664 /* blv->valcell = blv->defcell; 1666 set_blv_found (blv, 0);
1665 * SET_BLV_FOUND (blv, 0); */
1666 blv->found = 0;
1667 } 1667 }
1668 1668
1669 /* If the symbol forwards into a C variable, then load the binding 1669 /* If the symbol forwards into a C variable, then load the binding
@@ -1723,8 +1723,9 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1723 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1723 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1724 tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); 1724 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1725 if (!NILP (tem)) 1725 if (!NILP (tem))
1726 BSET (current_buffer, local_var_alist, 1726 bset_local_var_alist
1727 Fdelq (tem, BVAR (current_buffer, local_var_alist))); 1727 (current_buffer,
1728 Fdelq (tem, BVAR (current_buffer, local_var_alist)));
1728 1729
1729 /* If the symbol is set up with the current buffer's binding 1730 /* If the symbol is set up with the current buffer's binding
1730 loaded, recompute its value. We have to do it now, or else 1731 loaded, recompute its value. We have to do it now, or else
@@ -1733,10 +1734,8 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1733 Lisp_Object buf; XSETBUFFER (buf, current_buffer); 1734 Lisp_Object buf; XSETBUFFER (buf, current_buffer);
1734 if (EQ (buf, blv->where)) 1735 if (EQ (buf, blv->where))
1735 { 1736 {
1736 blv->where = Qnil; 1737 set_blv_where (blv, Qnil);
1737 /* blv->valcell = blv->defcell; 1738 set_blv_found (blv, 0);
1738 * SET_BLV_FOUND (blv, 0); */
1739 blv->found = 0;
1740 find_symbol_value (variable); 1739 find_symbol_value (variable);
1741 } 1740 }
1742 } 1741 }
@@ -1857,11 +1856,11 @@ BUFFER defaults to the current buffer. */)
1857 if (EQ (variable, XCAR (elt))) 1856 if (EQ (variable, XCAR (elt)))
1858 { 1857 {
1859 eassert (!blv->frame_local); 1858 eassert (!blv->frame_local);
1860 eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1859 eassert (blv_found (blv) || !EQ (blv->where, tmp));
1861 return Qt; 1860 return Qt;
1862 } 1861 }
1863 } 1862 }
1864 eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1863 eassert (!blv_found (blv) || !EQ (blv->where, tmp));
1865 return Qnil; 1864 return Qnil;
1866 } 1865 }
1867 case SYMBOL_FORWARDED: 1866 case SYMBOL_FORWARDED:
@@ -1951,7 +1950,7 @@ If the current binding is global (the default), the value is nil. */)
1951 if (!NILP (Flocal_variable_p (variable, Qnil))) 1950 if (!NILP (Flocal_variable_p (variable, Qnil)))
1952 return Fcurrent_buffer (); 1951 return Fcurrent_buffer ();
1953 else if (sym->redirect == SYMBOL_LOCALIZED 1952 else if (sym->redirect == SYMBOL_LOCALIZED
1954 && BLV_FOUND (SYMBOL_BLV (sym))) 1953 && blv_found (SYMBOL_BLV (sym)))
1955 return SYMBOL_BLV (sym)->where; 1954 return SYMBOL_BLV (sym)->where;
1956 else 1955 else
1957 return Qnil; 1956 return Qnil;
diff --git a/src/dispnew.c b/src/dispnew.c
index 506e174850e..1078ebcb0b0 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include <signal.h> 23#include <signal.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <ctype.h>
26#include <setjmp.h> 25#include <setjmp.h>
27#include <unistd.h> 26#include <unistd.h>
28 27
@@ -626,7 +625,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
626 are invalidated below. */ 625 are invalidated below. */
627 if (INTEGERP (w->window_end_vpos) 626 if (INTEGERP (w->window_end_vpos)
628 && XFASTINT (w->window_end_vpos) >= i) 627 && XFASTINT (w->window_end_vpos) >= i)
629 WSET (w, window_end_valid, Qnil); 628 wset_window_end_valid (w, Qnil);
630 629
631 while (i < matrix->nrows) 630 while (i < matrix->nrows)
632 matrix->rows[i++].enabled_p = 0; 631 matrix->rows[i++].enabled_p = 0;
@@ -883,7 +882,7 @@ clear_window_matrices (struct window *w, int desired_p)
883 else 882 else
884 { 883 {
885 clear_glyph_matrix (w->current_matrix); 884 clear_glyph_matrix (w->current_matrix);
886 WSET (w, window_end_valid, Qnil); 885 wset_window_end_valid (w, Qnil);
887 } 886 }
888 } 887 }
889 888
@@ -1892,14 +1891,14 @@ adjust_frame_glyphs_initially (void)
1892 int top_margin = FRAME_TOP_MARGIN (sf); 1891 int top_margin = FRAME_TOP_MARGIN (sf);
1893 1892
1894 /* Do it for the root window. */ 1893 /* Do it for the root window. */
1895 WSET (root, top_line, make_number (top_margin)); 1894 wset_top_line (root, make_number (top_margin));
1896 WSET (root, total_lines, make_number (frame_lines - 1 - top_margin)); 1895 wset_total_lines (root, make_number (frame_lines - 1 - top_margin));
1897 WSET (root, total_cols, make_number (frame_cols)); 1896 wset_total_cols (root, make_number (frame_cols));
1898 1897
1899 /* Do it for the mini-buffer window. */ 1898 /* Do it for the mini-buffer window. */
1900 WSET (mini, top_line, make_number (frame_lines - 1)); 1899 wset_top_line (mini, make_number (frame_lines - 1));
1901 WSET (mini, total_lines, make_number (1)); 1900 wset_total_lines (mini, make_number (1));
1902 WSET (mini, total_cols, make_number (frame_cols)); 1901 wset_total_cols (mini, make_number (frame_cols));
1903 1902
1904 adjust_frame_glyphs (sf); 1903 adjust_frame_glyphs (sf);
1905 glyphs_initialized_initially_p = 1; 1904 glyphs_initialized_initially_p = 1;
@@ -2171,10 +2170,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2171 if (NILP (f->menu_bar_window)) 2170 if (NILP (f->menu_bar_window))
2172 { 2171 {
2173 Lisp_Object frame; 2172 Lisp_Object frame;
2174 FSET (f, menu_bar_window, make_window ()); 2173 fset_menu_bar_window (f, make_window ());
2175 w = XWINDOW (f->menu_bar_window); 2174 w = XWINDOW (f->menu_bar_window);
2176 XSETFRAME (frame, f); 2175 XSETFRAME (frame, f);
2177 WSET (w, frame, frame); 2176 wset_frame (w, frame);
2178 w->pseudo_window_p = 1; 2177 w->pseudo_window_p = 1;
2179 } 2178 }
2180 else 2179 else
@@ -2182,10 +2181,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2182 2181
2183 /* Set window dimensions to frame dimensions and allocate or 2182 /* Set window dimensions to frame dimensions and allocate or
2184 adjust glyph matrices of W. */ 2183 adjust glyph matrices of W. */
2185 WSET (w, top_line, make_number (0)); 2184 wset_top_line (w, make_number (0));
2186 WSET (w, left_col, make_number (0)); 2185 wset_left_col (w, make_number (0));
2187 WSET (w, total_lines, make_number (FRAME_MENU_BAR_LINES (f))); 2186 wset_total_lines (w, make_number (FRAME_MENU_BAR_LINES (f)));
2188 WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); 2187 wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f)));
2189 allocate_matrices_for_window_redisplay (w); 2188 allocate_matrices_for_window_redisplay (w);
2190 } 2189 }
2191#endif /* not USE_X_TOOLKIT && not USE_GTK */ 2190#endif /* not USE_X_TOOLKIT && not USE_GTK */
@@ -2199,19 +2198,19 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2199 if (NILP (f->tool_bar_window)) 2198 if (NILP (f->tool_bar_window))
2200 { 2199 {
2201 Lisp_Object frame; 2200 Lisp_Object frame;
2202 FSET (f, tool_bar_window, make_window ()); 2201 fset_tool_bar_window (f, make_window ());
2203 w = XWINDOW (f->tool_bar_window); 2202 w = XWINDOW (f->tool_bar_window);
2204 XSETFRAME (frame, f); 2203 XSETFRAME (frame, f);
2205 WSET (w, frame, frame); 2204 wset_frame (w, frame);
2206 w->pseudo_window_p = 1; 2205 w->pseudo_window_p = 1;
2207 } 2206 }
2208 else 2207 else
2209 w = XWINDOW (f->tool_bar_window); 2208 w = XWINDOW (f->tool_bar_window);
2210 2209
2211 WSET (w, top_line, make_number (FRAME_MENU_BAR_LINES (f))); 2210 wset_top_line (w, make_number (FRAME_MENU_BAR_LINES (f)));
2212 WSET (w, left_col, make_number (0)); 2211 wset_left_col (w, make_number (0));
2213 WSET (w, total_lines, make_number (FRAME_TOOL_BAR_LINES (f))); 2212 wset_total_lines (w, make_number (FRAME_TOOL_BAR_LINES (f)));
2214 WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); 2213 wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f)));
2215 allocate_matrices_for_window_redisplay (w); 2214 allocate_matrices_for_window_redisplay (w);
2216 } 2215 }
2217#endif 2216#endif
@@ -2277,7 +2276,7 @@ free_glyphs (struct frame *f)
2277 free_glyph_matrix (w->desired_matrix); 2276 free_glyph_matrix (w->desired_matrix);
2278 free_glyph_matrix (w->current_matrix); 2277 free_glyph_matrix (w->current_matrix);
2279 w->desired_matrix = w->current_matrix = NULL; 2278 w->desired_matrix = w->current_matrix = NULL;
2280 FSET (f, menu_bar_window, Qnil); 2279 fset_menu_bar_window (f, Qnil);
2281 } 2280 }
2282 2281
2283 /* Free the tool bar window and its glyph matrices. */ 2282 /* Free the tool bar window and its glyph matrices. */
@@ -2287,7 +2286,7 @@ free_glyphs (struct frame *f)
2287 free_glyph_matrix (w->desired_matrix); 2286 free_glyph_matrix (w->desired_matrix);
2288 free_glyph_matrix (w->current_matrix); 2287 free_glyph_matrix (w->current_matrix);
2289 w->desired_matrix = w->current_matrix = NULL; 2288 w->desired_matrix = w->current_matrix = NULL;
2290 FSET (f, tool_bar_window, Qnil); 2289 fset_tool_bar_window (f, Qnil);
2291 } 2290 }
2292 2291
2293 /* Release frame glyph matrices. Reset fields to zero in 2292 /* Release frame glyph matrices. Reset fields to zero in
@@ -3225,8 +3224,8 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
3225 /* Swap tool-bar strings. We swap because we want to 3224 /* Swap tool-bar strings. We swap because we want to
3226 reuse strings. */ 3225 reuse strings. */
3227 tem = f->current_tool_bar_string; 3226 tem = f->current_tool_bar_string;
3228 FSET (f, current_tool_bar_string, f->desired_tool_bar_string); 3227 fset_current_tool_bar_string (f, f->desired_tool_bar_string);
3229 FSET (f, desired_tool_bar_string, tem); 3228 fset_desired_tool_bar_string (f, tem);
3230 } 3229 }
3231 } 3230 }
3232 3231
@@ -5758,7 +5757,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
5758 FrameCols (FRAME_TTY (f)) = newwidth; 5757 FrameCols (FRAME_TTY (f)) = newwidth;
5759 5758
5760 if (WINDOWP (f->tool_bar_window)) 5759 if (WINDOWP (f->tool_bar_window))
5761 WSET (XWINDOW (f->tool_bar_window), total_cols, make_number (newwidth)); 5760 wset_total_cols (XWINDOW (f->tool_bar_window), make_number (newwidth));
5762 } 5761 }
5763 5762
5764 FRAME_LINES (f) = newheight; 5763 FRAME_LINES (f) = newheight;
diff --git a/src/doc.c b/src/doc.c
index d17e90f11c0..ed311d918d7 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -22,11 +22,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include <sys/types.h> 23#include <sys/types.h>
24#include <sys/file.h> /* Must be after sys/types.h for USG*/ 24#include <sys/file.h> /* Must be after sys/types.h for USG*/
25#include <ctype.h>
26#include <setjmp.h> 25#include <setjmp.h>
27#include <fcntl.h> 26#include <fcntl.h>
28#include <unistd.h> 27#include <unistd.h>
29 28
29#include <c-ctype.h>
30
30#include "lisp.h" 31#include "lisp.h"
31#include "character.h" 32#include "character.h"
32#include "buffer.h" 33#include "buffer.h"
@@ -597,9 +598,9 @@ the same file name is found in the `doc-directory'. */)
597 { 598 {
598 ptrdiff_t len; 599 ptrdiff_t len;
599 600
600 while (*beg && isspace (*beg)) ++beg; 601 while (*beg && c_isspace (*beg)) ++beg;
601 602
602 for (end = beg; *end && ! isspace (*end); ++end) 603 for (end = beg; *end && ! c_isspace (*end); ++end)
603 if (*end == '/') beg = end+1; /* skip directory part */ 604 if (*end == '/') beg = end+1; /* skip directory part */
604 605
605 len = end - beg; 606 len = end - beg;
diff --git a/src/doprnt.c b/src/doprnt.c
index 63f05cb74e2..b36e946005d 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -102,7 +102,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
102 102
103#include <config.h> 103#include <config.h>
104#include <stdio.h> 104#include <stdio.h>
105#include <ctype.h>
106#include <setjmp.h> 105#include <setjmp.h>
107#include <float.h> 106#include <float.h>
108#include <unistd.h> 107#include <unistd.h>
diff --git a/src/dosfns.c b/src/dosfns.c
index e3adf25d79f..21676f4b4f5 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -473,7 +473,7 @@ x_set_title (struct frame *f, Lisp_Object name)
473 473
474 update_mode_lines = 1; 474 update_mode_lines = 1;
475 475
476 FSET (f, title, name); 476 fset_title (f, name);
477 477
478 if (NILP (name)) 478 if (NILP (name))
479 name = f->name; 479 name = f->name;
diff --git a/src/editfns.c b/src/editfns.c
index 5ac012c8378..c4725aa0ff3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -44,7 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44#include <sys/resource.h> 44#include <sys/resource.h>
45#endif 45#endif
46 46
47#include <ctype.h>
48#include <float.h> 47#include <float.h>
49#include <limits.h> 48#include <limits.h>
50#include <intprops.h> 49#include <intprops.h>
@@ -882,7 +881,7 @@ save_excursion_restore (Lisp_Object info)
882 info = XCDR (info); 881 info = XCDR (info);
883 tem = XCAR (info); 882 tem = XCAR (info);
884 tem1 = BVAR (current_buffer, mark_active); 883 tem1 = BVAR (current_buffer, mark_active);
885 BSET (current_buffer, mark_active, tem); 884 bset_mark_active (current_buffer, tem);
886 885
887 /* If mark is active now, and either was not active 886 /* If mark is active now, and either was not active
888 or was at a different place, run the activate hook. */ 887 or was at a different place, run the activate hook. */
@@ -2816,13 +2815,15 @@ determines whether case is significant or ignored. */)
2816static Lisp_Object 2815static Lisp_Object
2817subst_char_in_region_unwind (Lisp_Object arg) 2816subst_char_in_region_unwind (Lisp_Object arg)
2818{ 2817{
2819 return BSET (current_buffer, undo_list, arg); 2818 bset_undo_list (current_buffer, arg);
2819 return arg;
2820} 2820}
2821 2821
2822static Lisp_Object 2822static Lisp_Object
2823subst_char_in_region_unwind_1 (Lisp_Object arg) 2823subst_char_in_region_unwind_1 (Lisp_Object arg)
2824{ 2824{
2825 return BSET (current_buffer, filename, arg); 2825 bset_filename (current_buffer, arg);
2826 return arg;
2826} 2827}
2827 2828
2828DEFUN ("subst-char-in-region", Fsubst_char_in_region, 2829DEFUN ("subst-char-in-region", Fsubst_char_in_region,
@@ -2896,11 +2897,11 @@ Both characters must have the same length of multi-byte form. */)
2896 { 2897 {
2897 record_unwind_protect (subst_char_in_region_unwind, 2898 record_unwind_protect (subst_char_in_region_unwind,
2898 BVAR (current_buffer, undo_list)); 2899 BVAR (current_buffer, undo_list));
2899 BSET (current_buffer, undo_list, Qt); 2900 bset_undo_list (current_buffer, Qt);
2900 /* Don't do file-locking. */ 2901 /* Don't do file-locking. */
2901 record_unwind_protect (subst_char_in_region_unwind_1, 2902 record_unwind_protect (subst_char_in_region_unwind_1,
2902 BVAR (current_buffer, filename)); 2903 BVAR (current_buffer, filename));
2903 BSET (current_buffer, filename, Qnil); 2904 bset_filename (current_buffer, Qnil);
2904 } 2905 }
2905 2906
2906 if (pos_byte < GPT_BYTE) 2907 if (pos_byte < GPT_BYTE)
@@ -2982,7 +2983,7 @@ Both characters must have the same length of multi-byte form. */)
2982 INC_POS (pos_byte_next); 2983 INC_POS (pos_byte_next);
2983 2984
2984 if (! NILP (noundo)) 2985 if (! NILP (noundo))
2985 BSET (current_buffer, undo_list, tem); 2986 bset_undo_list (current_buffer, tem);
2986 2987
2987 UNGCPRO; 2988 UNGCPRO;
2988 } 2989 }
@@ -3937,7 +3938,7 @@ usage: (format STRING &rest OBJECTS) */)
3937 3938
3938 /* If this argument has text properties, record where 3939 /* If this argument has text properties, record where
3939 in the result string it appears. */ 3940 in the result string it appears. */
3940 if (string_get_intervals (args[n])) 3941 if (string_intervals (args[n]))
3941 info[n].intervals = arg_intervals = 1; 3942 info[n].intervals = arg_intervals = 1;
3942 3943
3943 continue; 3944 continue;
@@ -4281,7 +4282,7 @@ usage: (format STRING &rest OBJECTS) */)
4281 arguments has text properties, set up text properties of the 4282 arguments has text properties, set up text properties of the
4282 result string. */ 4283 result string. */
4283 4284
4284 if (string_get_intervals (args[0]) || arg_intervals) 4285 if (string_intervals (args[0]) || arg_intervals)
4285 { 4286 {
4286 Lisp_Object len, new_len, props; 4287 Lisp_Object len, new_len, props;
4287 struct gcpro gcpro1; 4288 struct gcpro gcpro1;
@@ -4531,7 +4532,7 @@ Transposing beyond buffer boundaries is an error. */)
4531 Lisp_Object buf; 4532 Lisp_Object buf;
4532 4533
4533 XSETBUFFER (buf, current_buffer); 4534 XSETBUFFER (buf, current_buffer);
4534 cur_intv = buffer_get_intervals (current_buffer); 4535 cur_intv = buffer_intervals (current_buffer);
4535 4536
4536 validate_region (&startr1, &endr1); 4537 validate_region (&startr1, &endr1);
4537 validate_region (&startr2, &endr2); 4538 validate_region (&startr2, &endr2);
diff --git a/src/eval.c b/src/eval.c
index b531f790cc5..771cd7b160a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2217,7 +2217,19 @@ eval_sub (Lisp_Object form)
2217 goto retry; 2217 goto retry;
2218 } 2218 }
2219 if (EQ (funcar, Qmacro)) 2219 if (EQ (funcar, Qmacro))
2220 val = eval_sub (apply1 (Fcdr (fun), original_args)); 2220 {
2221 ptrdiff_t count = SPECPDL_INDEX ();
2222 extern Lisp_Object Qlexical_binding;
2223 Lisp_Object exp;
2224 /* Bind lexical-binding during expansion of the macro, so the
2225 macro can know reliably if the code it outputs will be
2226 interpreted using lexical-binding or not. */
2227 specbind (Qlexical_binding,
2228 NILP (Vinternal_interpreter_environment) ? Qnil : Qt);
2229 exp = apply1 (Fcdr (fun), original_args);
2230 unbind_to (count, Qnil);
2231 val = eval_sub (exp);
2232 }
2221 else if (EQ (funcar, Qlambda) 2233 else if (EQ (funcar, Qlambda)
2222 || EQ (funcar, Qclosure)) 2234 || EQ (funcar, Qclosure))
2223 val = apply_lambda (fun, original_args); 2235 val = apply_lambda (fun, original_args);
@@ -3157,12 +3169,12 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3157 if (!NILP (Flocal_variable_p (symbol, Qnil))) 3169 if (!NILP (Flocal_variable_p (symbol, Qnil)))
3158 { 3170 {
3159 eassert (sym->redirect != SYMBOL_LOCALIZED 3171 eassert (sym->redirect != SYMBOL_LOCALIZED
3160 || (BLV_FOUND (SYMBOL_BLV (sym)) 3172 || (blv_found (SYMBOL_BLV (sym))
3161 && EQ (cur_buf, SYMBOL_BLV (sym)->where))); 3173 && EQ (cur_buf, SYMBOL_BLV (sym)->where)));
3162 where = cur_buf; 3174 where = cur_buf;
3163 } 3175 }
3164 else if (sym->redirect == SYMBOL_LOCALIZED 3176 else if (sym->redirect == SYMBOL_LOCALIZED
3165 && BLV_FOUND (SYMBOL_BLV (sym))) 3177 && blv_found (SYMBOL_BLV (sym)))
3166 where = SYMBOL_BLV (sym)->where; 3178 where = SYMBOL_BLV (sym)->where;
3167 else 3179 else
3168 where = Qnil; 3180 where = Qnil;
diff --git a/src/fileio.c b/src/fileio.c
index eba157ea042..2f4a2ad2314 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#include <pwd.h> 30#include <pwd.h>
31#endif 31#endif
32 32
33#include <ctype.h>
34#include <errno.h> 33#include <errno.h>
35 34
36#ifdef HAVE_LIBSELINUX 35#ifdef HAVE_LIBSELINUX
@@ -38,6 +37,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#include <selinux/context.h> 37#include <selinux/context.h>
39#endif 38#endif
40 39
40#include <c-ctype.h>
41
41#include "lisp.h" 42#include "lisp.h"
42#include "intervals.h" 43#include "intervals.h"
43#include "character.h" 44#include "character.h"
@@ -67,12 +68,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
67#define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z') 68#define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z')
68#endif 69#endif
69#ifdef WINDOWSNT 70#ifdef WINDOWSNT
70#define IS_DRIVE(x) isalpha ((unsigned char) (x)) 71#define IS_DRIVE(x) c_isalpha (x)
71#endif 72#endif
72/* Need to lower-case the drive letter, or else expanded 73/* Need to lower-case the drive letter, or else expanded
73 filenames will sometimes compare unequal, because 74 filenames will sometimes compare unequal, because
74 `expand-file-name' doesn't always down-case the drive letter. */ 75 `expand-file-name' doesn't always down-case the drive letter. */
75#define DRIVE_LETTER(x) (tolower ((unsigned char) (x))) 76#define DRIVE_LETTER(x) c_tolower (x)
76#endif 77#endif
77 78
78#include "systime.h" 79#include "systime.h"
@@ -364,7 +365,7 @@ Given a Unix syntax file name, returns a string ending in slash. */)
364 r += 2; 365 r += 2;
365 } 366 }
366 367
367 if (getdefdir (toupper ((unsigned char) *beg) - 'A' + 1, r)) 368 if (getdefdir (c_toupper (*beg) - 'A' + 1, r))
368 { 369 {
369 if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) 370 if (!IS_DIRECTORY_SEP (res[strlen (res) - 1]))
370 strcat (res, "/"); 371 strcat (res, "/");
@@ -1053,7 +1054,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1053 if (!IS_DIRECTORY_SEP (nm[0])) 1054 if (!IS_DIRECTORY_SEP (nm[0]))
1054 { 1055 {
1055 adir = alloca (MAXPATHLEN + 1); 1056 adir = alloca (MAXPATHLEN + 1);
1056 if (!getdefdir (toupper (drive) - 'A' + 1, adir)) 1057 if (!getdefdir (c_toupper (drive) - 'A' + 1, adir))
1057 adir = NULL; 1058 adir = NULL;
1058 } 1059 }
1059 if (!adir) 1060 if (!adir)
@@ -1129,7 +1130,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1129 adir = alloca (MAXPATHLEN + 1); 1130 adir = alloca (MAXPATHLEN + 1);
1130 if (drive) 1131 if (drive)
1131 { 1132 {
1132 if (!getdefdir (toupper (drive) - 'A' + 1, adir)) 1133 if (!getdefdir (c_toupper (drive) - 'A' + 1, adir))
1133 newdir = "/"; 1134 newdir = "/";
1134 } 1135 }
1135 else 1136 else
@@ -1635,7 +1636,7 @@ those `/' is discarded. */)
1635 else 1636 else
1636 { 1637 {
1637 o = p; 1638 o = p;
1638 while (p != endp && (isalnum (*p) || *p == '_')) p++; 1639 while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
1639 s = p; 1640 s = p;
1640 } 1641 }
1641 1642
@@ -1698,7 +1699,7 @@ those `/' is discarded. */)
1698 else 1699 else
1699 { 1700 {
1700 o = p; 1701 o = p;
1701 while (p != endp && (isalnum (*p) || *p == '_')) p++; 1702 while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
1702 s = p; 1703 s = p;
1703 } 1704 }
1704 1705
@@ -3145,12 +3146,12 @@ decide_coding_unwind (Lisp_Object unwind_data)
3145 set_buffer_internal (XBUFFER (buffer)); 3146 set_buffer_internal (XBUFFER (buffer));
3146 adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); 3147 adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE);
3147 adjust_overlays_for_delete (BEG, Z - BEG); 3148 adjust_overlays_for_delete (BEG, Z - BEG);
3148 buffer_set_intervals (current_buffer, NULL); 3149 set_buffer_intervals (current_buffer, NULL);
3149 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3150 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
3150 3151
3151 /* Now we are safe to change the buffer's multibyteness directly. */ 3152 /* Now we are safe to change the buffer's multibyteness directly. */
3152 BSET (current_buffer, enable_multibyte_characters, multibyte); 3153 bset_enable_multibyte_characters (current_buffer, multibyte);
3153 BSET (current_buffer, undo_list, undo_list); 3154 bset_undo_list (current_buffer, undo_list);
3154 3155
3155 return Qnil; 3156 return Qnil;
3156} 3157}
@@ -3486,16 +3487,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
3486 buf = XBUFFER (workbuf); 3487 buf = XBUFFER (workbuf);
3487 3488
3488 delete_all_overlays (buf); 3489 delete_all_overlays (buf);
3489 BSET (buf, directory, BVAR (current_buffer, directory)); 3490 bset_directory (buf, BVAR (current_buffer, directory));
3490 BSET (buf, read_only, Qnil); 3491 bset_read_only (buf, Qnil);
3491 BSET (buf, filename, Qnil); 3492 bset_filename (buf, Qnil);
3492 BSET (buf, undo_list, Qt); 3493 bset_undo_list (buf, Qt);
3493 eassert (buf->overlays_before == NULL); 3494 eassert (buf->overlays_before == NULL);
3494 eassert (buf->overlays_after == NULL); 3495 eassert (buf->overlays_after == NULL);
3495 3496
3496 set_buffer_internal (buf); 3497 set_buffer_internal (buf);
3497 Ferase_buffer (); 3498 Ferase_buffer ();
3498 BSET (buf, enable_multibyte_characters, Qnil); 3499 bset_enable_multibyte_characters (buf, Qnil);
3499 3500
3500 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); 3501 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
3501 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3502 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -4104,8 +4105,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
4104 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), 4105 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
4105 Fcons (BVAR (current_buffer, undo_list), 4106 Fcons (BVAR (current_buffer, undo_list),
4106 Fcurrent_buffer ())); 4107 Fcurrent_buffer ()));
4107 BSET (current_buffer, enable_multibyte_characters, Qnil); 4108 bset_enable_multibyte_characters (current_buffer, Qnil);
4108 BSET (current_buffer, undo_list, Qt); 4109 bset_undo_list (current_buffer, Qt);
4109 record_unwind_protect (decide_coding_unwind, unwind_data); 4110 record_unwind_protect (decide_coding_unwind, unwind_data);
4110 4111
4111 if (inserted > 0 && ! NILP (Vset_auto_coding_function)) 4112 if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4153,7 +4154,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4153 && NILP (replace)) 4154 && NILP (replace))
4154 /* Visiting a file with these coding system makes the buffer 4155 /* Visiting a file with these coding system makes the buffer
4155 unibyte. */ 4156 unibyte. */
4156 BSET (current_buffer, enable_multibyte_characters, Qnil); 4157 bset_enable_multibyte_characters (current_buffer, Qnil);
4157 } 4158 }
4158 4159
4159 coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 4160 coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
@@ -4196,13 +4197,13 @@ variable `last-coding-system-used' to the coding system actually used. */)
4196 if (!NILP (visit)) 4197 if (!NILP (visit))
4197 { 4198 {
4198 if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) 4199 if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
4199 BSET (current_buffer, undo_list, Qnil); 4200 bset_undo_list (current_buffer, Qnil);
4200 4201
4201 if (NILP (handler)) 4202 if (NILP (handler))
4202 { 4203 {
4203 current_buffer->modtime = mtime; 4204 current_buffer->modtime = mtime;
4204 current_buffer->modtime_size = st.st_size; 4205 current_buffer->modtime_size = st.st_size;
4205 BSET (current_buffer, filename, orig_filename); 4206 bset_filename (current_buffer, orig_filename);
4206 } 4207 }
4207 4208
4208 SAVE_MODIFF = MODIFF; 4209 SAVE_MODIFF = MODIFF;
@@ -4247,7 +4248,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4247 4248
4248 /* Save old undo list and don't record undo for decoding. */ 4249 /* Save old undo list and don't record undo for decoding. */
4249 old_undo = BVAR (current_buffer, undo_list); 4250 old_undo = BVAR (current_buffer, undo_list);
4250 BSET (current_buffer, undo_list, Qt); 4251 bset_undo_list (current_buffer, Qt);
4251 4252
4252 if (NILP (replace)) 4253 if (NILP (replace))
4253 { 4254 {
@@ -4339,7 +4340,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4339 4340
4340 if (NILP (visit)) 4341 if (NILP (visit))
4341 { 4342 {
4342 BSET (current_buffer, undo_list, old_undo); 4343 bset_undo_list (current_buffer, old_undo);
4343 if (CONSP (old_undo) && inserted != old_inserted) 4344 if (CONSP (old_undo) && inserted != old_inserted)
4344 { 4345 {
4345 /* Adjust the last undo record for the size change during 4346 /* Adjust the last undo record for the size change during
@@ -4354,7 +4355,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4354 else 4355 else
4355 /* If undo_list was Qt before, keep it that way. 4356 /* If undo_list was Qt before, keep it that way.
4356 Otherwise start with an empty undo_list. */ 4357 Otherwise start with an empty undo_list. */
4357 BSET (current_buffer, undo_list, EQ (old_undo, Qt) ? Qt : Qnil); 4358 bset_undo_list (current_buffer, EQ (old_undo, Qt) ? Qt : Qnil);
4358 4359
4359 unbind_to (count1, Qnil); 4360 unbind_to (count1, Qnil);
4360 } 4361 }
@@ -4594,7 +4595,7 @@ This calls `write-region-annotate-functions' at the start, and
4594 { 4595 {
4595 SAVE_MODIFF = MODIFF; 4596 SAVE_MODIFF = MODIFF;
4596 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 4597 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4597 BSET (current_buffer, filename, visit_file); 4598 bset_filename (current_buffer, visit_file);
4598 } 4599 }
4599 UNGCPRO; 4600 UNGCPRO;
4600 return val; 4601 return val;
@@ -4810,7 +4811,7 @@ This calls `write-region-annotate-functions' at the start, and
4810 { 4811 {
4811 SAVE_MODIFF = MODIFF; 4812 SAVE_MODIFF = MODIFF;
4812 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 4813 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4813 BSET (current_buffer, filename, visit_file); 4814 bset_filename (current_buffer, visit_file);
4814 update_mode_lines++; 4815 update_mode_lines++;
4815 } 4816 }
4816 else if (quietly) 4817 else if (quietly)
diff --git a/src/fns.c b/src/fns.c
index 12dca917e62..443e98b2f04 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -628,7 +628,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
628 ptrdiff_t thislen_byte = SBYTES (this); 628 ptrdiff_t thislen_byte = SBYTES (this);
629 629
630 memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); 630 memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
631 if (string_get_intervals (this)) 631 if (string_intervals (this))
632 { 632 {
633 textprops[num_textprops].argnum = argnum; 633 textprops[num_textprops].argnum = argnum;
634 textprops[num_textprops].from = 0; 634 textprops[num_textprops].from = 0;
@@ -640,7 +640,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
640 /* Copy a single-byte string to a multibyte string. */ 640 /* Copy a single-byte string to a multibyte string. */
641 else if (STRINGP (this) && STRINGP (val)) 641 else if (STRINGP (this) && STRINGP (val))
642 { 642 {
643 if (string_get_intervals (this)) 643 if (string_intervals (this))
644 { 644 {
645 textprops[num_textprops].argnum = argnum; 645 textprops[num_textprops].argnum = argnum;
646 textprops[num_textprops].from = 0; 646 textprops[num_textprops].from = 0;
@@ -1060,7 +1060,7 @@ If you're not sure, whether to use `string-as-multibyte' or
1060 str_as_multibyte (SDATA (new_string), nbytes, 1060 str_as_multibyte (SDATA (new_string), nbytes,
1061 SBYTES (string), NULL); 1061 SBYTES (string), NULL);
1062 string = new_string; 1062 string = new_string;
1063 string_set_intervals (string, NULL); 1063 set_string_intervals (string, NULL);
1064 } 1064 }
1065 return string; 1065 return string;
1066} 1066}
@@ -2150,8 +2150,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2150 int i; 2150 int i;
2151 2151
2152 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) 2152 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
2153 XCHAR_TABLE (array)->contents[i] = item; 2153 set_char_table_contents (array, i, item);
2154 XCHAR_TABLE (array)->defalt = item; 2154 set_char_table_defalt (array, item);
2155 } 2155 }
2156 else if (STRINGP (array)) 2156 else if (STRINGP (array))
2157 { 2157 {
diff --git a/src/font.c b/src/font.c
index c3040b8aa3f..5b9e4f1cfcf 100644
--- a/src/font.c
+++ b/src/font.c
@@ -23,9 +23,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <config.h> 23#include <config.h>
24#include <float.h> 24#include <float.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <ctype.h>
27#include <setjmp.h> 26#include <setjmp.h>
28 27
28#include <c-ctype.h>
29
29#include "lisp.h" 30#include "lisp.h"
30#include "character.h" 31#include "character.h"
31#include "buffer.h" 32#include "buffer.h"
@@ -1079,7 +1080,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
1079 p = f[XLFD_POINT_INDEX]; 1080 p = f[XLFD_POINT_INDEX];
1080 if (*p == '[') 1081 if (*p == '[')
1081 point_size = parse_matrix (p); 1082 point_size = parse_matrix (p);
1082 else if (isdigit (*p)) 1083 else if (c_isdigit (*p))
1083 point_size = atoi (p), point_size /= 10; 1084 point_size = atoi (p), point_size /= 10;
1084 if (point_size >= 0) 1085 if (point_size >= 0)
1085 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); 1086 ASET (font, FONT_SIZE_INDEX, make_float (point_size));
@@ -1346,7 +1347,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
1346 { 1347 {
1347 int decimal = 0, size_found = 1; 1348 int decimal = 0, size_found = 1;
1348 for (q = p + 1; *q && *q != ':'; q++) 1349 for (q = p + 1; *q && *q != ':'; q++)
1349 if (! isdigit (*q)) 1350 if (! c_isdigit (*q))
1350 { 1351 {
1351 if (*q != '.' || decimal) 1352 if (*q != '.' || decimal)
1352 { 1353 {
@@ -1474,7 +1475,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
1474 1475
1475 /* Scan backwards from the end, looking for a size. */ 1476 /* Scan backwards from the end, looking for a size. */
1476 for (p = name + len - 1; p >= name; p--) 1477 for (p = name + len - 1; p >= name; p--)
1477 if (!isdigit (*p)) 1478 if (!c_isdigit (*p))
1478 break; 1479 break;
1479 1480
1480 if ((p < name + len - 1) && ((p + 1 == name) || *p == ' ')) 1481 if ((p < name + len - 1) && ((p + 1 == name) || *p == ' '))
diff --git a/src/font.h b/src/font.h
index 3e9af6df235..6e9387f7632 100644
--- a/src/font.h
+++ b/src/font.h
@@ -284,8 +284,11 @@ struct font
284 284
285 /* Beyond here, there should be no more Lisp_Object components. */ 285 /* Beyond here, there should be no more Lisp_Object components. */
286 286
287 /* Maximum bound width over all existing characters of the font. On 287 /* Minimum and maximum glyph widths, in pixels. Some font backends,
288 X window, this is same as (font->max_bounds.width). */ 288 such as xft, lack the information to easily compute minimum and
289 maximum widths over all characters; in that case, these values
290 are approximate. */
291 int min_width;
289 int max_width; 292 int max_width;
290 293
291 /* By which pixel size the font is opened. */ 294 /* By which pixel size the font is opened. */
@@ -301,13 +304,10 @@ struct font
301 304
302 /* Average width of glyphs in the font. If the font itself doesn't 305 /* Average width of glyphs in the font. If the font itself doesn't
303 have that information but has glyphs of ASCII characters, the 306 have that information but has glyphs of ASCII characters, the
304 value is the average with of those glyphs. Otherwise, the value 307 value is the average width of those glyphs. Otherwise, the value
305 is 0. */ 308 is 0. */
306 int average_width; 309 int average_width;
307 310
308 /* Minimum glyph width (in pixels). */
309 int min_width;
310
311 /* Ascent and descent of the font (in pixels). */ 311 /* Ascent and descent of the font (in pixels). */
312 int ascent, descent; 312 int ascent, descent;
313 313
diff --git a/src/fontset.c b/src/fontset.c
index 3c7e931d121..c39d68a8ecf 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1916,7 +1916,7 @@ format is the same as above. */)
1916 if (!EQ (fontset, Vdefault_fontset)) 1916 if (!EQ (fontset, Vdefault_fontset))
1917 { 1917 {
1918 tables[1] = Fmake_char_table (Qnil, Qnil); 1918 tables[1] = Fmake_char_table (Qnil, Qnil);
1919 XCHAR_TABLE (tables[0])->extras[0] = tables[1]; 1919 set_char_table_extras (tables[0], 0, tables[1]);
1920 fontsets[1] = Vdefault_fontset; 1920 fontsets[1] = Vdefault_fontset;
1921 } 1921 }
1922 1922
@@ -1979,7 +1979,7 @@ format is the same as above. */)
1979 if (c <= MAX_5_BYTE_CHAR) 1979 if (c <= MAX_5_BYTE_CHAR)
1980 char_table_set_range (tables[k], c, to, alist); 1980 char_table_set_range (tables[k], c, to, alist);
1981 else 1981 else
1982 XCHAR_TABLE (tables[k])->defalt = alist; 1982 set_char_table_defalt (tables[k], alist);
1983 1983
1984 /* At last, change each elements to font names. */ 1984 /* At last, change each elements to font names. */
1985 for (; CONSP (alist); alist = XCDR (alist)) 1985 for (; CONSP (alist); alist = XCDR (alist))
diff --git a/src/frame.c b/src/frame.c
index ea682835a87..a00f44a1e5a 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -19,11 +19,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include <config.h>
21 21
22#define FRAME_INLINE EXTERN_INLINE
23
22#include <stdio.h> 24#include <stdio.h>
23#include <ctype.h>
24#include <errno.h> 25#include <errno.h>
25#include <limits.h> 26#include <limits.h>
26#include <setjmp.h> 27#include <setjmp.h>
28
29#include <c-ctype.h>
30
27#include "lisp.h" 31#include "lisp.h"
28#include "character.h" 32#include "character.h"
29#ifdef HAVE_X_WINDOWS 33#ifdef HAVE_X_WINDOWS
@@ -125,6 +129,18 @@ static Lisp_Object Qdelete_frame_functions;
125static void x_report_frame_params (struct frame *, Lisp_Object *); 129static void x_report_frame_params (struct frame *, Lisp_Object *);
126#endif 130#endif
127 131
132/* These setters are used only in this file, so they can be private. */
133static inline void
134fset_buffer_predicate (struct frame *f, Lisp_Object val)
135{
136 f->buffer_predicate = val;
137}
138static inline void
139fset_minibuffer_window (struct frame *f, Lisp_Object val)
140{
141 f->minibuffer_window = val;
142}
143
128 144
129static void 145static void
130set_menu_bar_lines_1 (Lisp_Object window, int n) 146set_menu_bar_lines_1 (Lisp_Object window, int n)
@@ -132,8 +148,8 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
132 struct window *w = XWINDOW (window); 148 struct window *w = XWINDOW (window);
133 149
134 w->last_modified = 0; 150 w->last_modified = 0;
135 WSET (w, top_line, make_number (XFASTINT (w->top_line) + n)); 151 wset_top_line (w, make_number (XFASTINT (w->top_line) + n));
136 WSET (w, total_lines, make_number (XFASTINT (w->total_lines) - n)); 152 wset_total_lines (w, make_number (XFASTINT (w->total_lines) - n));
137 153
138 /* Handle just the top child in a vertical split. */ 154 /* Handle just the top child in a vertical split. */
139 if (!NILP (w->vchild)) 155 if (!NILP (w->vchild))
@@ -269,7 +285,7 @@ make_frame (int mini_p)
269 285
270 /* Initialize Lisp data. Note that allocate_frame initializes all 286 /* Initialize Lisp data. Note that allocate_frame initializes all
271 Lisp data to nil, so do it only for slots which should not be nil. */ 287 Lisp data to nil, so do it only for slots which should not be nil. */
272 FSET (f, tool_bar_position, Qtop); 288 fset_tool_bar_position (f, Qtop);
273 289
274 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all 290 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all
275 non-Lisp data, so do it only for slots which should not be zero. 291 non-Lisp data, so do it only for slots which should not be zero.
@@ -289,20 +305,20 @@ make_frame (int mini_p)
289 if (mini_p) 305 if (mini_p)
290 { 306 {
291 mini_window = make_window (); 307 mini_window = make_window ();
292 WSET (XWINDOW (root_window), next, mini_window); 308 wset_next (XWINDOW (root_window), mini_window);
293 WSET (XWINDOW (mini_window), prev, root_window); 309 wset_prev (XWINDOW (mini_window), root_window);
294 XWINDOW (mini_window)->mini = 1; 310 XWINDOW (mini_window)->mini = 1;
295 WSET (XWINDOW (mini_window), frame, frame); 311 wset_frame (XWINDOW (mini_window), frame);
296 FSET (f, minibuffer_window, mini_window); 312 fset_minibuffer_window (f, mini_window);
297 } 313 }
298 else 314 else
299 { 315 {
300 mini_window = Qnil; 316 mini_window = Qnil;
301 WSET (XWINDOW (root_window), next, Qnil); 317 wset_next (XWINDOW (root_window), Qnil);
302 FSET (f, minibuffer_window, Qnil); 318 fset_minibuffer_window (f, Qnil);
303 } 319 }
304 320
305 WSET (XWINDOW (root_window), frame, frame); 321 wset_frame (XWINDOW (root_window), frame);
306 322
307 /* 10 is arbitrary, 323 /* 10 is arbitrary,
308 just so that there is "something there." 324 just so that there is "something there."
@@ -311,21 +327,21 @@ make_frame (int mini_p)
311 SET_FRAME_COLS (f, 10); 327 SET_FRAME_COLS (f, 10);
312 FRAME_LINES (f) = 10; 328 FRAME_LINES (f) = 10;
313 329
314 WSET (XWINDOW (root_window), total_cols, make_number (10)); 330 wset_total_cols (XWINDOW (root_window), make_number (10));
315 WSET (XWINDOW (root_window), total_lines, make_number (mini_p ? 9 : 10)); 331 wset_total_lines (XWINDOW (root_window), make_number (mini_p ? 9 : 10));
316 332
317 if (mini_p) 333 if (mini_p)
318 { 334 {
319 WSET (XWINDOW (mini_window), total_cols, make_number (10)); 335 wset_total_cols (XWINDOW (mini_window), make_number (10));
320 WSET (XWINDOW (mini_window), top_line, make_number (9)); 336 wset_top_line (XWINDOW (mini_window), make_number (9));
321 WSET (XWINDOW (mini_window), total_lines, make_number (1)); 337 wset_total_lines (XWINDOW (mini_window), make_number (1));
322 } 338 }
323 339
324 /* Choose a buffer for the frame's root window. */ 340 /* Choose a buffer for the frame's root window. */
325 { 341 {
326 Lisp_Object buf; 342 Lisp_Object buf;
327 343
328 WSET (XWINDOW (root_window), buffer, Qt); 344 wset_buffer (XWINDOW (root_window), Qt);
329 buf = Fcurrent_buffer (); 345 buf = Fcurrent_buffer ();
330 /* If buf is a 'hidden' buffer (i.e. one whose name starts with 346 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
331 a space), try to find another one. */ 347 a space), try to find another one. */
@@ -339,12 +355,12 @@ make_frame (int mini_p)
339 etc. Running Lisp functions at this point surely ends in a 355 etc. Running Lisp functions at this point surely ends in a
340 SEGV. */ 356 SEGV. */
341 set_window_buffer (root_window, buf, 0, 0); 357 set_window_buffer (root_window, buf, 0, 0);
342 FSET (f, buffer_list, Fcons (buf, Qnil)); 358 fset_buffer_list (f, Fcons (buf, Qnil));
343 } 359 }
344 360
345 if (mini_p) 361 if (mini_p)
346 { 362 {
347 WSET (XWINDOW (mini_window), buffer, Qt); 363 wset_buffer (XWINDOW (mini_window), Qt);
348 set_window_buffer (mini_window, 364 set_window_buffer (mini_window,
349 (NILP (Vminibuffer_list) 365 (NILP (Vminibuffer_list)
350 ? get_minibuffer (0) 366 ? get_minibuffer (0)
@@ -352,8 +368,8 @@ make_frame (int mini_p)
352 0, 0); 368 0, 0);
353 } 369 }
354 370
355 FSET (f, root_window, root_window); 371 fset_root_window (f, root_window);
356 FSET (f, selected_window, root_window); 372 fset_selected_window (f, root_window);
357 /* Make sure this window seems more recently used than 373 /* Make sure this window seems more recently used than
358 a newly-created, never-selected window. */ 374 a newly-created, never-selected window. */
359 XWINDOW (f->selected_window)->use_time = ++window_select_count; 375 XWINDOW (f->selected_window)->use_time = ++window_select_count;
@@ -393,8 +409,8 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
393 XSETFRAME (frame_dummy, f); 409 XSETFRAME (frame_dummy, f);
394 GCPRO1 (frame_dummy); 410 GCPRO1 (frame_dummy);
395 /* If there's no minibuffer frame to use, create one. */ 411 /* If there's no minibuffer frame to use, create one. */
396 KSET (kb, Vdefault_minibuffer_frame, 412 kset_default_minibuffer_frame
397 call1 (intern ("make-initial-minibuffer-frame"), display)); 413 (kb, call1 (intern ("make-initial-minibuffer-frame"), display));
398 UNGCPRO; 414 UNGCPRO;
399 } 415 }
400 416
@@ -402,7 +418,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
402 = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window; 418 = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window;
403 } 419 }
404 420
405 FSET (f, minibuffer_window, mini_window); 421 fset_minibuffer_window (f, mini_window);
406 422
407 /* Make the chosen minibuffer window display the proper minibuffer, 423 /* Make the chosen minibuffer window display the proper minibuffer,
408 unless it is already showing a minibuffer. */ 424 unless it is already showing a minibuffer. */
@@ -439,11 +455,12 @@ make_minibuffer_frame (void)
439 Avoid infinite looping on the window chain by marking next pointer 455 Avoid infinite looping on the window chain by marking next pointer
440 as nil. */ 456 as nil. */
441 457
442 mini_window = FSET (f, minibuffer_window, f->root_window); 458 mini_window = f->root_window;
459 fset_minibuffer_window (f, mini_window);
443 XWINDOW (mini_window)->mini = 1; 460 XWINDOW (mini_window)->mini = 1;
444 WSET (XWINDOW (mini_window), next, Qnil); 461 wset_next (XWINDOW (mini_window), Qnil);
445 WSET (XWINDOW (mini_window), prev, Qnil); 462 wset_prev (XWINDOW (mini_window), Qnil);
446 WSET (XWINDOW (mini_window), frame, frame); 463 wset_frame (XWINDOW (mini_window), frame);
447 464
448 /* Put the proper buffer in that window. */ 465 /* Put the proper buffer in that window. */
449 466
@@ -482,7 +499,7 @@ make_initial_frame (void)
482 Vframe_list = Fcons (frame, Vframe_list); 499 Vframe_list = Fcons (frame, Vframe_list);
483 500
484 tty_frame_count = 1; 501 tty_frame_count = 1;
485 FSET (f, name, build_pure_c_string ("F1")); 502 fset_name (f, build_pure_c_string ("F1"));
486 503
487 f->visible = 1; 504 f->visible = 1;
488 f->async_visible = 1; 505 f->async_visible = 1;
@@ -523,7 +540,7 @@ make_terminal_frame (struct terminal *terminal)
523 XSETFRAME (frame, f); 540 XSETFRAME (frame, f);
524 Vframe_list = Fcons (frame, Vframe_list); 541 Vframe_list = Fcons (frame, Vframe_list);
525 542
526 FSET (f, name, make_formatted_string (name, "F%"pMd, ++tty_frame_count)); 543 fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count));
527 544
528 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ 545 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
529 f->async_visible = 1; /* Don't let visible be cleared later. */ 546 f->async_visible = 1; /* Don't let visible be cleared later. */
@@ -693,7 +710,7 @@ affects all frames on the same terminal device. */)
693 710
694 /* Make the frame face alist be frame-specific, so that each 711 /* Make the frame face alist be frame-specific, so that each
695 frame could change its face definitions independently. */ 712 frame could change its face definitions independently. */
696 FSET (f, face_alist, Fcopy_alist (sf->face_alist)); 713 fset_face_alist (f, Fcopy_alist (sf->face_alist));
697 /* Simple Fcopy_alist isn't enough, because we need the contents of 714 /* Simple Fcopy_alist isn't enough, because we need the contents of
698 the vectors which are the CDRs of associations in face_alist to 715 the vectors which are the CDRs of associations in face_alist to
699 be copied as well. */ 716 be copied as well. */
@@ -847,7 +864,7 @@ to that frame. */)
847 (Lisp_Object event) 864 (Lisp_Object event)
848{ 865{
849 /* Preserve prefix arg that the command loop just cleared. */ 866 /* Preserve prefix arg that the command loop just cleared. */
850 KSET (current_kboard, Vprefix_arg, Vcurrent_prefix_arg); 867 kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
851 Frun_hooks (1, &Qmouse_leave_buffer_hook); 868 Frun_hooks (1, &Qmouse_leave_buffer_hook);
852 return do_switch_frame (event, 0, 0, Qnil); 869 return do_switch_frame (event, 0, 0, Qnil);
853} 870}
@@ -1280,7 +1297,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1280 /* Mark all the windows that used to be on FRAME as deleted, and then 1297 /* Mark all the windows that used to be on FRAME as deleted, and then
1281 remove the reference to them. */ 1298 remove the reference to them. */
1282 delete_all_child_windows (f->root_window); 1299 delete_all_child_windows (f->root_window);
1283 FSET (f, root_window, Qnil); 1300 fset_root_window (f, Qnil);
1284 1301
1285 Vframe_list = Fdelq (frame, Vframe_list); 1302 Vframe_list = Fdelq (frame, Vframe_list);
1286 FRAME_SET_VISIBLE (f, 0); 1303 FRAME_SET_VISIBLE (f, 0);
@@ -1289,7 +1306,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1289 garbage collection. The frame object itself may not be garbage 1306 garbage collection. The frame object itself may not be garbage
1290 collected until much later, because recent_keys and other data 1307 collected until much later, because recent_keys and other data
1291 structures can still refer to it. */ 1308 structures can still refer to it. */
1292 FSET (f, menu_bar_vector, Qnil); 1309 fset_menu_bar_vector (f, Qnil);
1293 1310
1294 free_font_driver_list (f); 1311 free_font_driver_list (f);
1295 xfree (f->namebuf); 1312 xfree (f->namebuf);
@@ -1441,11 +1458,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1441 if (NILP (frame_with_minibuf)) 1458 if (NILP (frame_with_minibuf))
1442 abort (); 1459 abort ();
1443 1460
1444 KSET (kb, Vdefault_minibuffer_frame, frame_with_minibuf); 1461 kset_default_minibuffer_frame (kb, frame_with_minibuf);
1445 } 1462 }
1446 else 1463 else
1447 /* No frames left on this kboard--say no minibuffer either. */ 1464 /* No frames left on this kboard--say no minibuffer either. */
1448 KSET (kb, Vdefault_minibuffer_frame, Qnil); 1465 kset_default_minibuffer_frame (kb, Qnil);
1449 } 1466 }
1450 1467
1451 /* Cause frame titles to update--necessary if we now have just one frame. */ 1468 /* Cause frame titles to update--necessary if we now have just one frame. */
@@ -1683,7 +1700,7 @@ make_frame_visible_1 (Lisp_Object window)
1683 w = XWINDOW (window); 1700 w = XWINDOW (window);
1684 1701
1685 if (!NILP (w->buffer)) 1702 if (!NILP (w->buffer))
1686 BSET (XBUFFER (w->buffer), display_time, Fcurrent_time ()); 1703 bset_display_time (XBUFFER (w->buffer), Fcurrent_time ());
1687 1704
1688 if (!NILP (w->vchild)) 1705 if (!NILP (w->vchild))
1689 make_frame_visible_1 (w->vchild); 1706 make_frame_visible_1 (w->vchild);
@@ -1917,7 +1934,7 @@ The redirection lasts until `redirect-frame-focus' is called to change it. */)
1917 1934
1918 f = XFRAME (frame); 1935 f = XFRAME (frame);
1919 1936
1920 FSET (f, focus_frame, focus_frame); 1937 fset_focus_frame (f, focus_frame);
1921 1938
1922 if (FRAME_TERMINAL (f)->frame_rehighlight_hook) 1939 if (FRAME_TERMINAL (f)->frame_rehighlight_hook)
1923 (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f); 1940 (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f);
@@ -1982,10 +1999,10 @@ frames_discard_buffer (Lisp_Object buffer)
1982 1999
1983 FOR_EACH_FRAME (tail, frame) 2000 FOR_EACH_FRAME (tail, frame)
1984 { 2001 {
1985 FSET (XFRAME (frame), buffer_list, 2002 fset_buffer_list
1986 Fdelq (buffer, XFRAME (frame)->buffer_list)); 2003 (XFRAME (frame), Fdelq (buffer, XFRAME (frame)->buffer_list));
1987 FSET (XFRAME (frame), buried_buffer_list, 2004 fset_buried_buffer_list
1988 Fdelq (buffer, XFRAME (frame)->buried_buffer_list)); 2005 (XFRAME (frame), Fdelq (buffer, XFRAME (frame)->buried_buffer_list));
1989 } 2006 }
1990} 2007}
1991 2008
@@ -2052,7 +2069,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
2052 error ("Frame names of the form F<num> are usurped by Emacs"); 2069 error ("Frame names of the form F<num> are usurped by Emacs");
2053 } 2070 }
2054 2071
2055 FSET (f, name, name); 2072 fset_name (f, name);
2056 update_mode_lines = 1; 2073 update_mode_lines = 1;
2057} 2074}
2058 2075
@@ -2069,7 +2086,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2069 for (; CONSP (val); val = XCDR (val)) 2086 for (; CONSP (val); val = XCDR (val))
2070 if (!NILP (Fbuffer_live_p (XCAR (val)))) 2087 if (!NILP (Fbuffer_live_p (XCAR (val))))
2071 list = Fcons (XCAR (val), list); 2088 list = Fcons (XCAR (val), list);
2072 FSET (f, buffer_list, Fnreverse (list)); 2089 fset_buffer_list (f, Fnreverse (list));
2073 return; 2090 return;
2074 } 2091 }
2075 if (EQ (prop, Qburied_buffer_list)) 2092 if (EQ (prop, Qburied_buffer_list))
@@ -2078,7 +2095,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2078 for (; CONSP (val); val = XCDR (val)) 2095 for (; CONSP (val); val = XCDR (val))
2079 if (!NILP (Fbuffer_live_p (XCAR (val)))) 2096 if (!NILP (Fbuffer_live_p (XCAR (val))))
2080 list = Fcons (XCAR (val), list); 2097 list = Fcons (XCAR (val), list);
2081 FSET (f, buried_buffer_list, Fnreverse (list)); 2098 fset_buried_buffer_list (f, Fnreverse (list));
2082 return; 2099 return;
2083 } 2100 }
2084 2101
@@ -2096,7 +2113,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2096 case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break; 2113 case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break;
2097 case SYMBOL_LOCALIZED: 2114 case SYMBOL_LOCALIZED:
2098 { struct Lisp_Buffer_Local_Value *blv = sym->val.blv; 2115 { struct Lisp_Buffer_Local_Value *blv = sym->val.blv;
2099 if (blv->frame_local && BLV_FOUND (blv) && XFRAME (blv->where) == f) 2116 if (blv->frame_local && blv_found (blv) && XFRAME (blv->where) == f)
2100 swap_in_global_binding (sym); 2117 swap_in_global_binding (sym);
2101 break; 2118 break;
2102 } 2119 }
@@ -2115,7 +2132,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2115 /* Update the frame parameter alist. */ 2132 /* Update the frame parameter alist. */
2116 old_alist_elt = Fassq (prop, f->param_alist); 2133 old_alist_elt = Fassq (prop, f->param_alist);
2117 if (EQ (old_alist_elt, Qnil)) 2134 if (EQ (old_alist_elt, Qnil))
2118 FSET (f, param_alist, Fcons (Fcons (prop, val), f->param_alist)); 2135 fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist));
2119 else 2136 else
2120 Fsetcdr (old_alist_elt, val); 2137 Fsetcdr (old_alist_elt, val);
2121 2138
@@ -2123,7 +2140,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2123 in addition to the alist. */ 2140 in addition to the alist. */
2124 2141
2125 if (EQ (prop, Qbuffer_predicate)) 2142 if (EQ (prop, Qbuffer_predicate))
2126 FSET (f, buffer_predicate, val); 2143 fset_buffer_predicate (f, val);
2127 2144
2128 if (! FRAME_WINDOW_P (f)) 2145 if (! FRAME_WINDOW_P (f))
2129 { 2146 {
@@ -2143,7 +2160,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2143 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer"); 2160 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2144 2161
2145 /* Install the chosen minibuffer window, with proper buffer. */ 2162 /* Install the chosen minibuffer window, with proper buffer. */
2146 FSET (f, minibuffer_window, val); 2163 fset_minibuffer_window (f, val);
2147 } 2164 }
2148} 2165}
2149 2166
@@ -3271,7 +3288,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3271 new_value = Qnil; 3288 new_value = Qnil;
3272 while (*p0) 3289 while (*p0)
3273 { 3290 {
3274 while (*p1 && ! isspace (*p1) && *p1 != ',') p1++; 3291 while (*p1 && ! c_isspace (*p1) && *p1 != ',') p1++;
3275 if (p0 < p1) 3292 if (p0 < p1)
3276 new_value = Fcons (Fintern (make_string (p0, p1 - p0), Qnil), 3293 new_value = Fcons (Fintern (make_string (p0, p1 - p0), Qnil),
3277 new_value); 3294 new_value);
@@ -3279,7 +3296,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3279 { 3296 {
3280 int c; 3297 int c;
3281 3298
3282 while ((c = *++p1) && isspace (c)); 3299 while ((c = *++p1) && c_isspace (c));
3283 } 3300 }
3284 p0 = p1; 3301 p0 = p1;
3285 } 3302 }
diff --git a/src/frame.h b/src/frame.h
index e07974fb4d2..92fbda42c70 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -25,6 +25,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25 25
26#include "dispextern.h" 26#include "dispextern.h"
27 27
28INLINE_HEADER_BEGIN
29#ifndef FRAME_INLINE
30# define FRAME_INLINE INLINE
31#endif
32
28 33
29/* Miscellanea. */ 34/* Miscellanea. */
30 35
@@ -80,10 +85,6 @@ struct terminal;
80 85
81struct font_driver_list; 86struct font_driver_list;
82 87
83/* Most code should use this macro to set Lisp field in struct frame. */
84
85#define FSET(f, field, value) ((f)->field = (value))
86
87struct frame 88struct frame
88{ 89{
89 struct vectorlike_header header; 90 struct vectorlike_header header;
@@ -499,6 +500,109 @@ struct frame
499 unsigned long foreground_pixel; 500 unsigned long foreground_pixel;
500}; 501};
501 502
503/* Most code should use these functions to set Lisp fields in struct frame. */
504
505FRAME_INLINE void
506fset_buffer_list (struct frame *f, Lisp_Object val)
507{
508 f->buffer_list = val;
509}
510FRAME_INLINE void
511fset_buried_buffer_list (struct frame *f, Lisp_Object val)
512{
513 f->buried_buffer_list = val;
514}
515FRAME_INLINE void
516fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
517{
518 f->condemned_scroll_bars = val;
519}
520FRAME_INLINE void
521fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
522{
523 f->current_tool_bar_string = val;
524}
525FRAME_INLINE void
526fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
527{
528 f->desired_tool_bar_string = val;
529}
530FRAME_INLINE void
531fset_face_alist (struct frame *f, Lisp_Object val)
532{
533 f->face_alist = val;
534}
535FRAME_INLINE void
536fset_focus_frame (struct frame *f, Lisp_Object val)
537{
538 f->focus_frame = val;
539}
540FRAME_INLINE void
541fset_icon_name (struct frame *f, Lisp_Object val)
542{
543 f->icon_name = val;
544}
545FRAME_INLINE void
546fset_menu_bar_items (struct frame *f, Lisp_Object val)
547{
548 f->menu_bar_items = val;
549}
550FRAME_INLINE void
551fset_menu_bar_vector (struct frame *f, Lisp_Object val)
552{
553 f->menu_bar_vector = val;
554}
555FRAME_INLINE void
556fset_menu_bar_window (struct frame *f, Lisp_Object val)
557{
558 f->menu_bar_window = val;
559}
560FRAME_INLINE void
561fset_name (struct frame *f, Lisp_Object val)
562{
563 f->name = val;
564}
565FRAME_INLINE void
566fset_param_alist (struct frame *f, Lisp_Object val)
567{
568 f->param_alist = val;
569}
570FRAME_INLINE void
571fset_root_window (struct frame *f, Lisp_Object val)
572{
573 f->root_window = val;
574}
575FRAME_INLINE void
576fset_scroll_bars (struct frame *f, Lisp_Object val)
577{
578 f->scroll_bars = val;
579}
580FRAME_INLINE void
581fset_selected_window (struct frame *f, Lisp_Object val)
582{
583 f->selected_window = val;
584}
585FRAME_INLINE void
586fset_title (struct frame *f, Lisp_Object val)
587{
588 f->title = val;
589}
590FRAME_INLINE void
591fset_tool_bar_items (struct frame *f, Lisp_Object val)
592{
593 f->tool_bar_items = val;
594}
595FRAME_INLINE void
596fset_tool_bar_position (struct frame *f, Lisp_Object val)
597{
598 f->tool_bar_position = val;
599}
600FRAME_INLINE void
601fset_tool_bar_window (struct frame *f, Lisp_Object val)
602{
603 f->tool_bar_window = val;
604}
605
502#define FRAME_KBOARD(f) ((f)->terminal->kboard) 606#define FRAME_KBOARD(f) ((f)->terminal->kboard)
503 607
504/* Return a pointer to the image cache of frame F. */ 608/* Return a pointer to the image cache of frame F. */
@@ -1146,4 +1250,6 @@ extern void set_frame_menubar (FRAME_PTR, int, int);
1146 1250
1147#endif /* HAVE_WINDOW_SYSTEM */ 1251#endif /* HAVE_WINDOW_SYSTEM */
1148 1252
1253INLINE_HEADER_END
1254
1149#endif /* not EMACS_FRAME_H */ 1255#endif /* not EMACS_FRAME_H */
diff --git a/src/gnutls.c b/src/gnutls.c
index 5189f2098cf..a2573f6bd99 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -830,7 +830,7 @@ one trustfile (usually a CA bundle). */)
830 XPROCESS (proc)->gnutls_state = NULL; 830 XPROCESS (proc)->gnutls_state = NULL;
831 XPROCESS (proc)->gnutls_x509_cred = NULL; 831 XPROCESS (proc)->gnutls_x509_cred = NULL;
832 XPROCESS (proc)->gnutls_anon_cred = NULL; 832 XPROCESS (proc)->gnutls_anon_cred = NULL;
833 PSET (XPROCESS (proc), gnutls_cred_type, type); 833 pset_gnutls_cred_type (XPROCESS (proc), type);
834 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_EMPTY; 834 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_EMPTY;
835 835
836 GNUTLS_LOG (1, max_log_level, "allocating credentials"); 836 GNUTLS_LOG (1, max_log_level, "allocating credentials");
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 6638f375a2c..2941605d448 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -24,7 +24,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#include <signal.h> 24#include <signal.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <setjmp.h> 26#include <setjmp.h>
27#include <ctype.h> 27
28#include <c-ctype.h>
29
28#include "lisp.h" 30#include "lisp.h"
29#include "xterm.h" 31#include "xterm.h"
30#include "blockinput.h" 32#include "blockinput.h"
@@ -2016,7 +2018,7 @@ xg_get_file_name (FRAME_PTR f,
2016 2018
2017#if USE_NEW_GTK_FONT_CHOOSER 2019#if USE_NEW_GTK_FONT_CHOOSER
2018 2020
2019extern Lisp_Object Qnormal; 2021extern Lisp_Object Qxft, Qnormal;
2020extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold; 2022extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold;
2021extern Lisp_Object Qbold, Qextra_bold, Qultra_bold; 2023extern Lisp_Object Qbold, Qextra_bold, Qultra_bold;
2022extern Lisp_Object Qoblique, Qitalic; 2024extern Lisp_Object Qoblique, Qitalic;
@@ -2072,7 +2074,7 @@ xg_get_font (FRAME_PTR f, const char *default_name)
2072 if (p) 2074 if (p)
2073 { 2075 {
2074 char *ep = p+1; 2076 char *ep = p+1;
2075 while (isdigit (*ep)) 2077 while (c_isdigit (*ep))
2076 ++ep; 2078 ++ep;
2077 if (*ep == '\0') *p = ' '; 2079 if (*ep == '\0') *p = ' ';
2078 } 2080 }
@@ -2099,7 +2101,7 @@ xg_get_font (FRAME_PTR f, const char *default_name)
2099 2101
2100 if (desc) 2102 if (desc)
2101 { 2103 {
2102 Lisp_Object args[8]; 2104 Lisp_Object args[10];
2103 const char *name = pango_font_description_get_family (desc); 2105 const char *name = pango_font_description_get_family (desc);
2104 gint size = pango_font_description_get_size (desc); 2106 gint size = pango_font_description_get_size (desc);
2105 PangoWeight weight = pango_font_description_get_weight (desc); 2107 PangoWeight weight = pango_font_description_get_weight (desc);
@@ -2117,6 +2119,9 @@ xg_get_font (FRAME_PTR f, const char *default_name)
2117 args[6] = QCslant; 2119 args[6] = QCslant;
2118 args[7] = XG_STYLE_TO_SYMBOL (style); 2120 args[7] = XG_STYLE_TO_SYMBOL (style);
2119 2121
2122 args[8] = QCtype;
2123 args[9] = Qxft;
2124
2120 font = Ffont_spec (8, args); 2125 font = Ffont_spec (8, args);
2121 2126
2122 pango_font_description_free (desc); 2127 pango_font_description_free (desc);
diff --git a/src/image.c b/src/image.c
index 8a318c2f6ec..f2778165ece 100644
--- a/src/image.c
+++ b/src/image.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#include <config.h> 20#include <config.h>
21#include <stdio.h> 21#include <stdio.h>
22#include <math.h> 22#include <math.h>
23#include <ctype.h>
24#include <unistd.h> 23#include <unistd.h>
25 24
26#ifdef HAVE_PNG 25#ifdef HAVE_PNG
@@ -33,6 +32,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
33 32
34#include <setjmp.h> 33#include <setjmp.h>
35 34
35#include <c-ctype.h>
36
36/* This makes the fields of a Display accessible, in Xlib header files. */ 37/* This makes the fields of a Display accessible, in Xlib header files. */
37 38
38#define XLIB_ILLEGAL_ACCESS 39#define XLIB_ILLEGAL_ACCESS
@@ -2405,12 +2406,12 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2405 loop: 2406 loop:
2406 2407
2407 /* Skip white space. */ 2408 /* Skip white space. */
2408 while (*s < end && (c = *(*s)++, isspace (c))) 2409 while (*s < end && (c = *(*s)++, c_isspace (c)))
2409 ; 2410 ;
2410 2411
2411 if (*s >= end) 2412 if (*s >= end)
2412 c = 0; 2413 c = 0;
2413 else if (isdigit (c)) 2414 else if (c_isdigit (c))
2414 { 2415 {
2415 int value = 0, digit; 2416 int value = 0, digit;
2416 2417
@@ -2422,7 +2423,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2422 while (*s < end) 2423 while (*s < end)
2423 { 2424 {
2424 c = *(*s)++; 2425 c = *(*s)++;
2425 if (isdigit (c)) 2426 if (c_isdigit (c))
2426 digit = c - '0'; 2427 digit = c - '0';
2427 else if (c >= 'a' && c <= 'f') 2428 else if (c >= 'a' && c <= 'f')
2428 digit = c - 'a' + 10; 2429 digit = c - 'a' + 10;
@@ -2433,11 +2434,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2433 value = 16 * value + digit; 2434 value = 16 * value + digit;
2434 } 2435 }
2435 } 2436 }
2436 else if (isdigit (c)) 2437 else if (c_isdigit (c))
2437 { 2438 {
2438 value = c - '0'; 2439 value = c - '0';
2439 while (*s < end 2440 while (*s < end
2440 && (c = *(*s)++, isdigit (c))) 2441 && (c = *(*s)++, c_isdigit (c)))
2441 value = 8 * value + c - '0'; 2442 value = 8 * value + c - '0';
2442 } 2443 }
2443 } 2444 }
@@ -2445,7 +2446,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2445 { 2446 {
2446 value = c - '0'; 2447 value = c - '0';
2447 while (*s < end 2448 while (*s < end
2448 && (c = *(*s)++, isdigit (c))) 2449 && (c = *(*s)++, c_isdigit (c)))
2449 value = 10 * value + c - '0'; 2450 value = 10 * value + c - '0';
2450 } 2451 }
2451 2452
@@ -2454,11 +2455,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2454 *ival = value; 2455 *ival = value;
2455 c = XBM_TK_NUMBER; 2456 c = XBM_TK_NUMBER;
2456 } 2457 }
2457 else if (isalpha (c) || c == '_') 2458 else if (c_isalpha (c) || c == '_')
2458 { 2459 {
2459 *sval++ = c; 2460 *sval++ = c;
2460 while (*s < end 2461 while (*s < end
2461 && (c = *(*s)++, (isalnum (c) || c == '_'))) 2462 && (c = *(*s)++, (c_isalnum (c) || c == '_')))
2462 *sval++ = c; 2463 *sval++ = c;
2463 *sval = 0; 2464 *sval = 0;
2464 if (*s < end) 2465 if (*s < end)
@@ -3661,16 +3662,17 @@ xpm_scan (const unsigned char **s,
3661 while (*s < end) 3662 while (*s < end)
3662 { 3663 {
3663 /* Skip white-space. */ 3664 /* Skip white-space. */
3664 while (*s < end && (c = *(*s)++, isspace (c))) 3665 while (*s < end && (c = *(*s)++, c_isspace (c)))
3665 ; 3666 ;
3666 3667
3667 /* gnus-pointer.xpm uses '-' in its identifier. 3668 /* gnus-pointer.xpm uses '-' in its identifier.
3668 sb-dir-plus.xpm uses '+' in its identifier. */ 3669 sb-dir-plus.xpm uses '+' in its identifier. */
3669 if (isalpha (c) || c == '_' || c == '-' || c == '+') 3670 if (c_isalpha (c) || c == '_' || c == '-' || c == '+')
3670 { 3671 {
3671 *beg = *s - 1; 3672 *beg = *s - 1;
3672 while (*s < end 3673 while (*s < end
3673 && (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+')) 3674 && (c = **s, c_isalnum (c)
3675 || c == '_' || c == '-' || c == '+'))
3674 ++*s; 3676 ++*s;
3675 *len = *s - *beg; 3677 *len = *s - *beg;
3676 return XPM_TK_IDENT; 3678 return XPM_TK_IDENT;
@@ -5014,7 +5016,7 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
5014 while (*s < end) 5016 while (*s < end)
5015 { 5017 {
5016 /* Skip white-space. */ 5018 /* Skip white-space. */
5017 while (*s < end && (c = *(*s)++, isspace (c))) 5019 while (*s < end && (c = *(*s)++, c_isspace (c)))
5018 ; 5020 ;
5019 5021
5020 if (c == '#') 5022 if (c == '#')
@@ -5023,11 +5025,11 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
5023 while (*s < end && (c = *(*s)++, c != '\n')) 5025 while (*s < end && (c = *(*s)++, c != '\n'))
5024 ; 5026 ;
5025 } 5027 }
5026 else if (isdigit (c)) 5028 else if (c_isdigit (c))
5027 { 5029 {
5028 /* Read decimal number. */ 5030 /* Read decimal number. */
5029 val = c - '0'; 5031 val = c - '0';
5030 while (*s < end && (c = *(*s)++, isdigit (c))) 5032 while (*s < end && (c = *(*s)++, c_isdigit (c)))
5031 val = 10 * val + c - '0'; 5033 val = 10 * val + c - '0';
5032 break; 5034 break;
5033 } 5035 }
@@ -8554,7 +8556,7 @@ gs_load (struct frame *f, struct image *img)
8554 don't either. Let the Lisp loader use `unwind-protect' instead. */ 8556 don't either. Let the Lisp loader use `unwind-protect' instead. */
8555 printnum1 = FRAME_X_WINDOW (f); 8557 printnum1 = FRAME_X_WINDOW (f);
8556 printnum2 = img->pixmap; 8558 printnum2 = img->pixmap;
8557 window_and_pixmap_id 8559 window_and_pixmap_id
8558 = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2); 8560 = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
8559 8561
8560 printnum1 = FRAME_FOREGROUND_PIXEL (f); 8562 printnum1 = FRAME_FOREGROUND_PIXEL (f);
diff --git a/src/indent.c b/src/indent.c
index 881e5d7ddaf..160b8c7479e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -141,7 +141,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
141 struct Lisp_Vector *widthtab; 141 struct Lisp_Vector *widthtab;
142 142
143 if (!VECTORP (BVAR (buf, width_table))) 143 if (!VECTORP (BVAR (buf, width_table)))
144 BSET (buf, width_table, Fmake_vector (make_number (256), make_number (0))); 144 bset_width_table (buf, Fmake_vector (make_number (256), make_number (0)));
145 widthtab = XVECTOR (BVAR (buf, width_table)); 145 widthtab = XVECTOR (BVAR (buf, width_table));
146 if (widthtab->header.size != 256) 146 if (widthtab->header.size != 256)
147 abort (); 147 abort ();
@@ -166,7 +166,7 @@ width_run_cache_on_off (void)
166 { 166 {
167 free_region_cache (current_buffer->width_run_cache); 167 free_region_cache (current_buffer->width_run_cache);
168 current_buffer->width_run_cache = 0; 168 current_buffer->width_run_cache = 0;
169 BSET (current_buffer, width_table, Qnil); 169 bset_width_table (current_buffer, Qnil);
170 } 170 }
171 } 171 }
172 else 172 else
@@ -336,7 +336,7 @@ current_column (void)
336 336
337 /* If the buffer has overlays, text properties, 337 /* If the buffer has overlays, text properties,
338 or multibyte characters, use a more general algorithm. */ 338 or multibyte characters, use a more general algorithm. */
339 if (buffer_get_intervals (current_buffer) 339 if (buffer_intervals (current_buffer)
340 || buffer_has_overlays () 340 || buffer_has_overlays ()
341 || Z != Z_BYTE) 341 || Z != Z_BYTE)
342 return current_column_1 (); 342 return current_column_1 ();
@@ -2003,7 +2003,7 @@ whether or not it is currently displayed in some window. */)
2003 old_buffer = w->buffer; 2003 old_buffer = w->buffer;
2004 old_charpos = XMARKER (w->pointm)->charpos; 2004 old_charpos = XMARKER (w->pointm)->charpos;
2005 old_bytepos = XMARKER (w->pointm)->bytepos; 2005 old_bytepos = XMARKER (w->pointm)->bytepos;
2006 WSET (w, buffer, Fcurrent_buffer ()); 2006 wset_buffer (w, Fcurrent_buffer ());
2007 set_marker_both (w->pointm, w->buffer, 2007 set_marker_both (w->pointm, w->buffer,
2008 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); 2008 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
2009 } 2009 }
@@ -2146,7 +2146,7 @@ whether or not it is currently displayed in some window. */)
2146 2146
2147 if (BUFFERP (old_buffer)) 2147 if (BUFFERP (old_buffer))
2148 { 2148 {
2149 WSET (w, buffer, old_buffer); 2149 wset_buffer (w, old_buffer);
2150 set_marker_both (w->pointm, w->buffer, 2150 set_marker_both (w->pointm, w->buffer,
2151 old_charpos, old_bytepos); 2151 old_charpos, old_bytepos);
2152 } 2152 }
diff --git a/src/insdel.c b/src/insdel.c
index 14d2dab084d..1dceb67bffa 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -844,10 +844,10 @@ insert_1_both (const char *string,
844 PT + nchars, PT_BYTE + nbytes, 844 PT + nchars, PT_BYTE + nbytes,
845 before_markers); 845 before_markers);
846 846
847 if (buffer_get_intervals (current_buffer)) 847 if (buffer_intervals (current_buffer))
848 offset_intervals (current_buffer, PT, nchars); 848 offset_intervals (current_buffer, PT, nchars);
849 849
850 if (!inherit && buffer_get_intervals (current_buffer)) 850 if (!inherit && buffer_intervals (current_buffer))
851 set_text_properties (make_number (PT), make_number (PT + nchars), 851 set_text_properties (make_number (PT), make_number (PT + nchars),
852 Qnil, Qnil, Qnil); 852 Qnil, Qnil, Qnil);
853 853
@@ -976,7 +976,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
976 976
977 offset_intervals (current_buffer, PT, nchars); 977 offset_intervals (current_buffer, PT, nchars);
978 978
979 intervals = string_get_intervals (string); 979 intervals = string_intervals (string);
980 /* Get the intervals for the part of the string we are inserting. */ 980 /* Get the intervals for the part of the string we are inserting. */
981 if (nbytes < SBYTES (string)) 981 if (nbytes < SBYTES (string))
982 intervals = copy_intervals (intervals, pos, nchars); 982 intervals = copy_intervals (intervals, pos, nchars);
@@ -1017,7 +1017,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes)
1017 adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, 1017 adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes,
1018 GPT, GPT_BYTE, 0); 1018 GPT, GPT_BYTE, 0);
1019 1019
1020 if (buffer_get_intervals (current_buffer)) 1020 if (buffer_intervals (current_buffer))
1021 { 1021 {
1022 offset_intervals (current_buffer, GPT - nchars, nchars); 1022 offset_intervals (current_buffer, GPT - nchars, nchars);
1023 graft_intervals_into_buffer (NULL, GPT - nchars, nchars, 1023 graft_intervals_into_buffer (NULL, GPT - nchars, nchars,
@@ -1157,11 +1157,11 @@ insert_from_buffer_1 (struct buffer *buf,
1157 PT_BYTE + outgoing_nbytes, 1157 PT_BYTE + outgoing_nbytes,
1158 0); 1158 0);
1159 1159
1160 if (buffer_get_intervals (current_buffer)) 1160 if (buffer_intervals (current_buffer))
1161 offset_intervals (current_buffer, PT, nchars); 1161 offset_intervals (current_buffer, PT, nchars);
1162 1162
1163 /* Get the intervals for the part of the string we are inserting. */ 1163 /* Get the intervals for the part of the string we are inserting. */
1164 intervals = buffer_get_intervals (buf); 1164 intervals = buffer_intervals (buf);
1165 if (nchars < BUF_Z (buf) - BUF_BEG (buf)) 1165 if (nchars < BUF_Z (buf) - BUF_BEG (buf))
1166 { 1166 {
1167 if (buf == current_buffer && PT <= from) 1167 if (buf == current_buffer && PT <= from)
@@ -1226,7 +1226,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
1226 else if (len < nchars_del) 1226 else if (len < nchars_del)
1227 adjust_overlays_for_delete (from, nchars_del - len); 1227 adjust_overlays_for_delete (from, nchars_del - len);
1228 1228
1229 if (buffer_get_intervals (current_buffer)) 1229 if (buffer_intervals (current_buffer))
1230 offset_intervals (current_buffer, from, len - nchars_del); 1230 offset_intervals (current_buffer, from, len - nchars_del);
1231 1231
1232 if (from < PT) 1232 if (from < PT)
@@ -1412,7 +1412,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1412 1412
1413 /* Get the intervals for the part of the string we are inserting-- 1413 /* Get the intervals for the part of the string we are inserting--
1414 not including the combined-before bytes. */ 1414 not including the combined-before bytes. */
1415 intervals = string_get_intervals (new); 1415 intervals = string_intervals (new);
1416 /* Insert those intervals. */ 1416 /* Insert those intervals. */
1417 graft_intervals_into_buffer (intervals, from, inschars, 1417 graft_intervals_into_buffer (intervals, from, inschars,
1418 current_buffer, inherit); 1418 current_buffer, inherit);
@@ -1792,7 +1792,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
1792 if (! preserve_chars_modiff) 1792 if (! preserve_chars_modiff)
1793 CHARS_MODIFF = MODIFF; 1793 CHARS_MODIFF = MODIFF;
1794 1794
1795 BSET (buffer, point_before_scroll, Qnil); 1795 bset_point_before_scroll (buffer, Qnil);
1796 1796
1797 if (buffer != old_buffer) 1797 if (buffer != old_buffer)
1798 set_buffer_internal (old_buffer); 1798 set_buffer_internal (old_buffer);
@@ -1822,7 +1822,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1822 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1822 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
1823 ++windows_or_buffers_changed; 1823 ++windows_or_buffers_changed;
1824 1824
1825 if (buffer_get_intervals (current_buffer)) 1825 if (buffer_intervals (current_buffer))
1826 { 1826 {
1827 if (preserve_ptr) 1827 if (preserve_ptr)
1828 { 1828 {
diff --git a/src/intervals.c b/src/intervals.c
index 09949bbbd45..0a85e20e5d9 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -59,10 +59,41 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
59static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object); 59static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object);
60static INTERVAL merge_interval_right (INTERVAL); 60static INTERVAL merge_interval_right (INTERVAL);
61static INTERVAL reproduce_tree (INTERVAL, INTERVAL); 61static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
62static INTERVAL reproduce_tree_obj (INTERVAL, Lisp_Object);
63 62
64/* Utility functions for intervals. */ 63/* Utility functions for intervals. */
65 64
65/* Use these functions to set Lisp_Object
66 or pointer slots of struct interval. */
67
68static inline void
69set_interval_object (INTERVAL i, Lisp_Object obj)
70{
71 eassert (BUFFERP (obj) || STRINGP (obj));
72 i->up_obj = 1;
73 i->up.obj = obj;
74}
75
76static inline void
77set_interval_left (INTERVAL i, INTERVAL left)
78{
79 i->left = left;
80}
81
82static inline void
83set_interval_right (INTERVAL i, INTERVAL right)
84{
85 i->right = right;
86}
87
88/* Make the parent of D be whatever the parent of S is, regardless
89 of the type. This is used when balancing an interval tree. */
90
91static inline void
92copy_interval_parent (INTERVAL d, INTERVAL s)
93{
94 d->up = s->up;
95 d->up_obj = s->up_obj;
96}
66 97
67/* Create the root interval of some object, a buffer or string. */ 98/* Create the root interval of some object, a buffer or string. */
68 99
@@ -80,18 +111,18 @@ create_root_interval (Lisp_Object parent)
80 new->total_length = (BUF_Z (XBUFFER (parent)) 111 new->total_length = (BUF_Z (XBUFFER (parent))
81 - BUF_BEG (XBUFFER (parent))); 112 - BUF_BEG (XBUFFER (parent)));
82 eassert (0 <= TOTAL_LENGTH (new)); 113 eassert (0 <= TOTAL_LENGTH (new));
83 buffer_set_intervals (XBUFFER (parent), new); 114 set_buffer_intervals (XBUFFER (parent), new);
84 new->position = BEG; 115 new->position = BEG;
85 } 116 }
86 else if (STRINGP (parent)) 117 else if (STRINGP (parent))
87 { 118 {
88 new->total_length = SCHARS (parent); 119 new->total_length = SCHARS (parent);
89 eassert (0 <= TOTAL_LENGTH (new)); 120 eassert (0 <= TOTAL_LENGTH (new));
90 string_set_intervals (parent, new); 121 set_string_intervals (parent, new);
91 new->position = 0; 122 new->position = 0;
92 } 123 }
93 124
94 interval_set_object (new, parent); 125 set_interval_object (new, parent);
95 126
96 return new; 127 return new;
97} 128}
@@ -105,7 +136,7 @@ copy_properties (register INTERVAL source, register INTERVAL target)
105 return; 136 return;
106 137
107 COPY_INTERVAL_CACHE (source, target); 138 COPY_INTERVAL_CACHE (source, target);
108 interval_set_plist (target, Fcopy_sequence (source->plist)); 139 set_interval_plist (target, Fcopy_sequence (source->plist));
109} 140}
110 141
111/* Merge the properties of interval SOURCE into the properties 142/* Merge the properties of interval SOURCE into the properties
@@ -141,7 +172,7 @@ merge_properties (register INTERVAL source, register INTERVAL target)
141 if (NILP (val)) 172 if (NILP (val))
142 { 173 {
143 val = XCAR (o); 174 val = XCAR (o);
144 interval_set_plist (target, Fcons (sym, Fcons (val, target->plist))); 175 set_interval_plist (target, Fcons (sym, Fcons (val, target->plist)));
145 } 176 }
146 o = XCDR (o); 177 o = XCDR (o);
147 } 178 }
@@ -323,21 +354,21 @@ rotate_right (INTERVAL interval)
323 if (! ROOT_INTERVAL_P (interval)) 354 if (! ROOT_INTERVAL_P (interval))
324 { 355 {
325 if (AM_LEFT_CHILD (interval)) 356 if (AM_LEFT_CHILD (interval))
326 interval_set_left (INTERVAL_PARENT (interval), B); 357 set_interval_left (INTERVAL_PARENT (interval), B);
327 else 358 else
328 interval_set_right (INTERVAL_PARENT (interval), B); 359 set_interval_right (INTERVAL_PARENT (interval), B);
329 } 360 }
330 interval_copy_parent (B, interval); 361 copy_interval_parent (B, interval);
331 362
332 /* Make B the parent of A */ 363 /* Make B the parent of A */
333 i = B->right; 364 i = B->right;
334 interval_set_right (B, interval); 365 set_interval_right (B, interval);
335 interval_set_parent (interval, B); 366 set_interval_parent (interval, B);
336 367
337 /* Make A point to c */ 368 /* Make A point to c */
338 interval_set_left (interval, i); 369 set_interval_left (interval, i);
339 if (i) 370 if (i)
340 interval_set_parent (i, interval); 371 set_interval_parent (i, interval);
341 372
342 /* A's total length is decreased by the length of B and its left child. */ 373 /* A's total length is decreased by the length of B and its left child. */
343 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); 374 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval);
@@ -370,21 +401,21 @@ rotate_left (INTERVAL interval)
370 if (! ROOT_INTERVAL_P (interval)) 401 if (! ROOT_INTERVAL_P (interval))
371 { 402 {
372 if (AM_LEFT_CHILD (interval)) 403 if (AM_LEFT_CHILD (interval))
373 interval_set_left (INTERVAL_PARENT (interval), B); 404 set_interval_left (INTERVAL_PARENT (interval), B);
374 else 405 else
375 interval_set_right (INTERVAL_PARENT (interval), B); 406 set_interval_right (INTERVAL_PARENT (interval), B);
376 } 407 }
377 interval_copy_parent (B, interval); 408 copy_interval_parent (B, interval);
378 409
379 /* Make B the parent of A */ 410 /* Make B the parent of A */
380 i = B->left; 411 i = B->left;
381 interval_set_left (B, interval); 412 set_interval_left (B, interval);
382 interval_set_parent (interval, B); 413 set_interval_parent (interval, B);
383 414
384 /* Make A point to c */ 415 /* Make A point to c */
385 interval_set_right (interval, i); 416 set_interval_right (interval, i);
386 if (i) 417 if (i)
387 interval_set_parent (i, interval); 418 set_interval_parent (i, interval);
388 419
389 /* A's total length is decreased by the length of B and its right child. */ 420 /* A's total length is decreased by the length of B and its right child. */
390 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); 421 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval);
@@ -456,9 +487,9 @@ balance_possible_root_interval (register INTERVAL interval)
456 if (have_parent) 487 if (have_parent)
457 { 488 {
458 if (BUFFERP (parent)) 489 if (BUFFERP (parent))
459 buffer_set_intervals (XBUFFER (parent), interval); 490 set_buffer_intervals (XBUFFER (parent), interval);
460 else if (STRINGP (parent)) 491 else if (STRINGP (parent))
461 string_set_intervals (parent, interval); 492 set_string_intervals (parent, interval);
462 } 493 }
463 494
464 return interval; 495 return interval;
@@ -494,9 +525,9 @@ buffer_balance_intervals (struct buffer *b)
494 INTERVAL i; 525 INTERVAL i;
495 526
496 eassert (b != NULL); 527 eassert (b != NULL);
497 i = buffer_get_intervals (b); 528 i = buffer_intervals (b);
498 if (i) 529 if (i)
499 buffer_set_intervals (b, balance_an_interval (i)); 530 set_buffer_intervals (b, balance_an_interval (i));
500} 531}
501 532
502/* Split INTERVAL into two pieces, starting the second piece at 533/* Split INTERVAL into two pieces, starting the second piece at
@@ -520,20 +551,20 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset)
520 ptrdiff_t new_length = LENGTH (interval) - offset; 551 ptrdiff_t new_length = LENGTH (interval) - offset;
521 552
522 new->position = position + offset; 553 new->position = position + offset;
523 interval_set_parent (new, interval); 554 set_interval_parent (new, interval);
524 555
525 if (NULL_RIGHT_CHILD (interval)) 556 if (NULL_RIGHT_CHILD (interval))
526 { 557 {
527 interval_set_right (interval, new); 558 set_interval_right (interval, new);
528 new->total_length = new_length; 559 new->total_length = new_length;
529 eassert (0 <= TOTAL_LENGTH (new)); 560 eassert (0 <= TOTAL_LENGTH (new));
530 } 561 }
531 else 562 else
532 { 563 {
533 /* Insert the new node between INTERVAL and its right child. */ 564 /* Insert the new node between INTERVAL and its right child. */
534 interval_set_right (new, interval->right); 565 set_interval_right (new, interval->right);
535 interval_set_parent (interval->right, new); 566 set_interval_parent (interval->right, new);
536 interval_set_right (interval, new); 567 set_interval_right (interval, new);
537 new->total_length = new_length + new->right->total_length; 568 new->total_length = new_length + new->right->total_length;
538 eassert (0 <= TOTAL_LENGTH (new)); 569 eassert (0 <= TOTAL_LENGTH (new));
539 balance_an_interval (new); 570 balance_an_interval (new);
@@ -565,20 +596,20 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset)
565 596
566 new->position = interval->position; 597 new->position = interval->position;
567 interval->position = interval->position + offset; 598 interval->position = interval->position + offset;
568 interval_set_parent (new, interval); 599 set_interval_parent (new, interval);
569 600
570 if (NULL_LEFT_CHILD (interval)) 601 if (NULL_LEFT_CHILD (interval))
571 { 602 {
572 interval_set_left (interval, new); 603 set_interval_left (interval, new);
573 new->total_length = new_length; 604 new->total_length = new_length;
574 eassert (0 <= TOTAL_LENGTH (new)); 605 eassert (0 <= TOTAL_LENGTH (new));
575 } 606 }
576 else 607 else
577 { 608 {
578 /* Insert the new node between INTERVAL and its left child. */ 609 /* Insert the new node between INTERVAL and its left child. */
579 interval_set_left (new, interval->left); 610 set_interval_left (new, interval->left);
580 interval_set_parent (new->left, new); 611 set_interval_parent (new->left, new);
581 interval_set_left (interval, new); 612 set_interval_left (interval, new);
582 new->total_length = new_length + new->left->total_length; 613 new->total_length = new_length + new->left->total_length;
583 eassert (0 <= TOTAL_LENGTH (new)); 614 eassert (0 <= TOTAL_LENGTH (new));
584 balance_an_interval (new); 615 balance_an_interval (new);
@@ -953,20 +984,20 @@ adjust_intervals_for_insertion (INTERVAL tree,
953 RESET_INTERVAL (&newi); 984 RESET_INTERVAL (&newi);
954 pleft = prev ? prev->plist : Qnil; 985 pleft = prev ? prev->plist : Qnil;
955 pright = i ? i->plist : Qnil; 986 pright = i ? i->plist : Qnil;
956 interval_set_plist (&newi, merge_properties_sticky (pleft, pright)); 987 set_interval_plist (&newi, merge_properties_sticky (pleft, pright));
957 988
958 if (! prev) /* i.e. position == BEG */ 989 if (! prev) /* i.e. position == BEG */
959 { 990 {
960 if (! intervals_equal (i, &newi)) 991 if (! intervals_equal (i, &newi))
961 { 992 {
962 i = split_interval_left (i, length); 993 i = split_interval_left (i, length);
963 interval_set_plist (i, newi.plist); 994 set_interval_plist (i, newi.plist);
964 } 995 }
965 } 996 }
966 else if (! intervals_equal (prev, &newi)) 997 else if (! intervals_equal (prev, &newi))
967 { 998 {
968 prev = split_interval_right (prev, position - prev->position); 999 prev = split_interval_right (prev, position - prev->position);
969 interval_set_plist (prev, newi.plist); 1000 set_interval_plist (prev, newi.plist);
970 if (i && intervals_equal (prev, i)) 1001 if (i && intervals_equal (prev, i))
971 merge_interval_right (prev); 1002 merge_interval_right (prev);
972 } 1003 }
@@ -1191,8 +1222,8 @@ delete_node (register INTERVAL i)
1191 this->total_length += migrate_amt; 1222 this->total_length += migrate_amt;
1192 } 1223 }
1193 eassert (0 <= TOTAL_LENGTH (this)); 1224 eassert (0 <= TOTAL_LENGTH (this));
1194 interval_set_left (this, migrate); 1225 set_interval_left (this, migrate);
1195 interval_set_parent (migrate, this); 1226 set_interval_parent (migrate, this);
1196 1227
1197 return i->right; 1228 return i->right;
1198} 1229}
@@ -1217,12 +1248,12 @@ delete_interval (register INTERVAL i)
1217 GET_INTERVAL_OBJECT (owner, i); 1248 GET_INTERVAL_OBJECT (owner, i);
1218 parent = delete_node (i); 1249 parent = delete_node (i);
1219 if (parent) 1250 if (parent)
1220 interval_set_object (parent, owner); 1251 set_interval_object (parent, owner);
1221 1252
1222 if (BUFFERP (owner)) 1253 if (BUFFERP (owner))
1223 buffer_set_intervals (XBUFFER (owner), parent); 1254 set_buffer_intervals (XBUFFER (owner), parent);
1224 else if (STRINGP (owner)) 1255 else if (STRINGP (owner))
1225 string_set_intervals (owner, parent); 1256 set_string_intervals (owner, parent);
1226 else 1257 else
1227 abort (); 1258 abort ();
1228 1259
@@ -1232,15 +1263,15 @@ delete_interval (register INTERVAL i)
1232 parent = INTERVAL_PARENT (i); 1263 parent = INTERVAL_PARENT (i);
1233 if (AM_LEFT_CHILD (i)) 1264 if (AM_LEFT_CHILD (i))
1234 { 1265 {
1235 interval_set_left (parent, delete_node (i)); 1266 set_interval_left (parent, delete_node (i));
1236 if (parent->left) 1267 if (parent->left)
1237 interval_set_parent (parent->left, parent); 1268 set_interval_parent (parent->left, parent);
1238 } 1269 }
1239 else 1270 else
1240 { 1271 {
1241 interval_set_right (parent, delete_node (i)); 1272 set_interval_right (parent, delete_node (i));
1242 if (parent->right) 1273 if (parent->right)
1243 interval_set_parent (parent->right, parent); 1274 set_interval_parent (parent->right, parent);
1244 } 1275 }
1245} 1276}
1246 1277
@@ -1321,8 +1352,8 @@ static void
1321adjust_intervals_for_deletion (struct buffer *buffer, 1352adjust_intervals_for_deletion (struct buffer *buffer,
1322 ptrdiff_t start, ptrdiff_t length) 1353 ptrdiff_t start, ptrdiff_t length)
1323{ 1354{
1324 register ptrdiff_t left_to_delete = length; 1355 ptrdiff_t left_to_delete = length;
1325 register INTERVAL tree = buffer_get_intervals (buffer); 1356 INTERVAL tree = buffer_intervals (buffer);
1326 Lisp_Object parent; 1357 Lisp_Object parent;
1327 ptrdiff_t offset; 1358 ptrdiff_t offset;
1328 1359
@@ -1337,7 +1368,7 @@ adjust_intervals_for_deletion (struct buffer *buffer,
1337 1368
1338 if (length == TOTAL_LENGTH (tree)) 1369 if (length == TOTAL_LENGTH (tree))
1339 { 1370 {
1340 buffer_set_intervals (buffer, NULL); 1371 set_buffer_intervals (buffer, NULL);
1341 return; 1372 return;
1342 } 1373 }
1343 1374
@@ -1354,10 +1385,10 @@ adjust_intervals_for_deletion (struct buffer *buffer,
1354 { 1385 {
1355 left_to_delete -= interval_deletion_adjustment (tree, start - offset, 1386 left_to_delete -= interval_deletion_adjustment (tree, start - offset,
1356 left_to_delete); 1387 left_to_delete);
1357 tree = buffer_get_intervals (buffer); 1388 tree = buffer_intervals (buffer);
1358 if (left_to_delete == tree->total_length) 1389 if (left_to_delete == tree->total_length)
1359 { 1390 {
1360 buffer_set_intervals (buffer, NULL); 1391 set_buffer_intervals (buffer, NULL);
1361 return; 1392 return;
1362 } 1393 }
1363 } 1394 }
@@ -1371,11 +1402,11 @@ adjust_intervals_for_deletion (struct buffer *buffer,
1371void 1402void
1372offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) 1403offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length)
1373{ 1404{
1374 if (!buffer_get_intervals (buffer) || length == 0) 1405 if (!buffer_intervals (buffer) || length == 0)
1375 return; 1406 return;
1376 1407
1377 if (length > 0) 1408 if (length > 0)
1378 adjust_intervals_for_insertion (buffer_get_intervals (buffer), 1409 adjust_intervals_for_insertion (buffer_intervals (buffer),
1379 start, length); 1410 start, length);
1380 else 1411 else
1381 { 1412 {
@@ -1498,6 +1529,26 @@ merge_interval_left (register INTERVAL i)
1498 abort (); 1529 abort ();
1499} 1530}
1500 1531
1532/* Create a copy of SOURCE but with the default value of UP. */
1533
1534static INTERVAL
1535reproduce_interval (INTERVAL source)
1536{
1537 register INTERVAL target = make_interval ();
1538
1539 target->total_length = source->total_length;
1540 target->position = source->position;
1541
1542 copy_properties (source, target);
1543
1544 if (! NULL_LEFT_CHILD (source))
1545 set_interval_left (target, reproduce_tree (source->left, target));
1546 if (! NULL_RIGHT_CHILD (source))
1547 set_interval_right (target, reproduce_tree (source->right, target));
1548
1549 return target;
1550}
1551
1501/* Make an exact copy of interval tree SOURCE which descends from 1552/* Make an exact copy of interval tree SOURCE which descends from
1502 PARENT. This is done by recursing through SOURCE, copying 1553 PARENT. This is done by recursing through SOURCE, copying
1503 the current interval and its properties, and then adjusting 1554 the current interval and its properties, and then adjusting
@@ -1506,33 +1557,17 @@ merge_interval_left (register INTERVAL i)
1506static INTERVAL 1557static INTERVAL
1507reproduce_tree (INTERVAL source, INTERVAL parent) 1558reproduce_tree (INTERVAL source, INTERVAL parent)
1508{ 1559{
1509 register INTERVAL t = make_interval (); 1560 INTERVAL target = reproduce_interval (source);
1510 1561 set_interval_parent (target, parent);
1511 memcpy (t, source, sizeof *t); 1562 return target;
1512 copy_properties (source, t);
1513 interval_set_parent (t, parent);
1514 if (! NULL_LEFT_CHILD (source))
1515 interval_set_left (t, reproduce_tree (source->left, t));
1516 if (! NULL_RIGHT_CHILD (source))
1517 interval_set_right (t, reproduce_tree (source->right, t));
1518
1519 return t;
1520} 1563}
1521 1564
1522static INTERVAL 1565static INTERVAL
1523reproduce_tree_obj (INTERVAL source, Lisp_Object parent) 1566reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
1524{ 1567{
1525 register INTERVAL t = make_interval (); 1568 INTERVAL target = reproduce_interval (source);
1526 1569 set_interval_object (target, parent);
1527 memcpy (t, source, sizeof *t); 1570 return target;
1528 copy_properties (source, t);
1529 interval_set_object (t, parent);
1530 if (! NULL_LEFT_CHILD (source))
1531 interval_set_left (t, reproduce_tree (source->left, t));
1532 if (! NULL_RIGHT_CHILD (source))
1533 interval_set_right (t, reproduce_tree (source->right, t));
1534
1535 return t;
1536} 1571}
1537 1572
1538/* Insert the intervals of SOURCE into BUFFER at POSITION. 1573/* Insert the intervals of SOURCE into BUFFER at POSITION.
@@ -1577,12 +1612,10 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position,
1577 ptrdiff_t length, struct buffer *buffer, 1612 ptrdiff_t length, struct buffer *buffer,
1578 int inherit) 1613 int inherit)
1579{ 1614{
1580 register INTERVAL under, over, this; 1615 INTERVAL tree = buffer_intervals (buffer);
1581 register INTERVAL tree; 1616 INTERVAL under, over, this;
1582 ptrdiff_t over_used; 1617 ptrdiff_t over_used;
1583 1618
1584 tree = buffer_get_intervals (buffer);
1585
1586 /* If the new text has no properties, then with inheritance it 1619 /* If the new text has no properties, then with inheritance it
1587 becomes part of whatever interval it was inserted into. 1620 becomes part of whatever interval it was inserted into.
1588 To prevent inheritance, we must clear out the properties 1621 To prevent inheritance, we must clear out the properties
@@ -1611,9 +1644,9 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position,
1611 Lisp_Object buf; 1644 Lisp_Object buf;
1612 1645
1613 XSETBUFFER (buf, buffer); 1646 XSETBUFFER (buf, buffer);
1614 buffer_set_intervals (buffer, reproduce_tree_obj (source, buf)); 1647 set_buffer_intervals (buffer, reproduce_tree_obj (source, buf));
1615 buffer_get_intervals (buffer)->position = BUF_BEG (buffer); 1648 buffer_intervals (buffer)->position = BUF_BEG (buffer);
1616 eassert (buffer_get_intervals (buffer)->up_obj == 1); 1649 eassert (buffer_intervals (buffer)->up_obj == 1);
1617 return; 1650 return;
1618 } 1651 }
1619 else if (!tree) 1652 else if (!tree)
@@ -1854,7 +1887,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1854 int have_overlays; 1887 int have_overlays;
1855 ptrdiff_t original_position; 1888 ptrdiff_t original_position;
1856 1889
1857 BSET (current_buffer, point_before_scroll, Qnil); 1890 bset_point_before_scroll (current_buffer, Qnil);
1858 1891
1859 if (charpos == PT) 1892 if (charpos == PT)
1860 return; 1893 return;
@@ -1871,7 +1904,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1871 1904
1872 /* If we have no text properties and overlays, 1905 /* If we have no text properties and overlays,
1873 then we can do it quickly. */ 1906 then we can do it quickly. */
1874 if (!buffer_get_intervals (current_buffer) && ! have_overlays) 1907 if (!buffer_intervals (current_buffer) && ! have_overlays)
1875 { 1908 {
1876 temp_set_point_both (current_buffer, charpos, bytepos); 1909 temp_set_point_both (current_buffer, charpos, bytepos);
1877 return; 1910 return;
@@ -1880,7 +1913,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1880 /* Set TO to the interval containing the char after CHARPOS, 1913 /* Set TO to the interval containing the char after CHARPOS,
1881 and TOPREV to the interval containing the char before CHARPOS. 1914 and TOPREV to the interval containing the char before CHARPOS.
1882 Either one may be null. They may be equal. */ 1915 Either one may be null. They may be equal. */
1883 to = find_interval (buffer_get_intervals (current_buffer), charpos); 1916 to = find_interval (buffer_intervals (current_buffer), charpos);
1884 if (charpos == BEGV) 1917 if (charpos == BEGV)
1885 toprev = 0; 1918 toprev = 0;
1886 else if (to && to->position == charpos) 1919 else if (to && to->position == charpos)
@@ -1894,7 +1927,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1894 and FROMPREV to the interval containing the char before PT. 1927 and FROMPREV to the interval containing the char before PT.
1895 Either one may be null. They may be equal. */ 1928 Either one may be null. They may be equal. */
1896 /* We could cache this and save time. */ 1929 /* We could cache this and save time. */
1897 from = find_interval (buffer_get_intervals (current_buffer), buffer_point); 1930 from = find_interval (buffer_intervals (current_buffer), buffer_point);
1898 if (buffer_point == BEGV) 1931 if (buffer_point == BEGV)
1899 fromprev = 0; 1932 fromprev = 0;
1900 else if (from && from->position == PT) 1933 else if (from && from->position == PT)
@@ -2000,7 +2033,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
2000 /* Set TO to the interval containing the char after CHARPOS, 2033 /* Set TO to the interval containing the char after CHARPOS,
2001 and TOPREV to the interval containing the char before CHARPOS. 2034 and TOPREV to the interval containing the char before CHARPOS.
2002 Either one may be null. They may be equal. */ 2035 Either one may be null. They may be equal. */
2003 to = find_interval (buffer_get_intervals (current_buffer), charpos); 2036 to = find_interval (buffer_intervals (current_buffer), charpos);
2004 if (charpos == BEGV) 2037 if (charpos == BEGV)
2005 toprev = 0; 2038 toprev = 0;
2006 else if (to && to->position == charpos) 2039 else if (to && to->position == charpos)
@@ -2133,11 +2166,11 @@ get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val,
2133 INTERVAL i, prev, next; 2166 INTERVAL i, prev, next;
2134 2167
2135 if (NILP (object)) 2168 if (NILP (object))
2136 i = find_interval (buffer_get_intervals (current_buffer), pos); 2169 i = find_interval (buffer_intervals (current_buffer), pos);
2137 else if (BUFFERP (object)) 2170 else if (BUFFERP (object))
2138 i = find_interval (buffer_get_intervals (XBUFFER (object)), pos); 2171 i = find_interval (buffer_intervals (XBUFFER (object)), pos);
2139 else if (STRINGP (object)) 2172 else if (STRINGP (object))
2140 i = find_interval (string_get_intervals (object), pos); 2173 i = find_interval (string_intervals (object), pos);
2141 else 2174 else
2142 abort (); 2175 abort ();
2143 2176
@@ -2264,13 +2297,13 @@ void
2264copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, 2297copy_intervals_to_string (Lisp_Object string, struct buffer *buffer,
2265 ptrdiff_t position, ptrdiff_t length) 2298 ptrdiff_t position, ptrdiff_t length)
2266{ 2299{
2267 INTERVAL interval_copy = copy_intervals (buffer_get_intervals (buffer), 2300 INTERVAL interval_copy = copy_intervals (buffer_intervals (buffer),
2268 position, length); 2301 position, length);
2269 if (!interval_copy) 2302 if (!interval_copy)
2270 return; 2303 return;
2271 2304
2272 interval_set_object (interval_copy, string); 2305 set_interval_object (interval_copy, string);
2273 string_set_intervals (string, interval_copy); 2306 set_string_intervals (string, interval_copy);
2274} 2307}
2275 2308
2276/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. 2309/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise.
@@ -2283,8 +2316,8 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
2283 ptrdiff_t pos = 0; 2316 ptrdiff_t pos = 0;
2284 ptrdiff_t end = SCHARS (s1); 2317 ptrdiff_t end = SCHARS (s1);
2285 2318
2286 i1 = find_interval (string_get_intervals (s1), 0); 2319 i1 = find_interval (string_intervals (s1), 0);
2287 i2 = find_interval (string_get_intervals (s2), 0); 2320 i2 = find_interval (string_intervals (s2), 0);
2288 2321
2289 while (pos < end) 2322 while (pos < end)
2290 { 2323 {
@@ -2409,13 +2442,13 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
2409 { 2442 {
2410 if ((i)->left) 2443 if ((i)->left)
2411 { 2444 {
2412 interval_set_plist (i, i->left->plist); 2445 set_interval_plist (i, i->left->plist);
2413 (i)->left->total_length = 0; 2446 (i)->left->total_length = 0;
2414 delete_interval ((i)->left); 2447 delete_interval ((i)->left);
2415 } 2448 }
2416 else 2449 else
2417 { 2450 {
2418 interval_set_plist (i, i->right->plist); 2451 set_interval_plist (i, i->right->plist);
2419 (i)->right->total_length = 0; 2452 (i)->right->total_length = 0;
2420 delete_interval ((i)->right); 2453 delete_interval ((i)->right);
2421 } 2454 }
@@ -2429,7 +2462,7 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
2429void 2462void
2430set_intervals_multibyte (int multi_flag) 2463set_intervals_multibyte (int multi_flag)
2431{ 2464{
2432 INTERVAL i = buffer_get_intervals (current_buffer); 2465 INTERVAL i = buffer_intervals (current_buffer);
2433 2466
2434 if (i) 2467 if (i)
2435 set_intervals_multibyte_1 (i, multi_flag, BEG, BEG_BYTE, Z, Z_BYTE); 2468 set_intervals_multibyte_1 (i, multi_flag, BEG, BEG_BYTE, Z, Z_BYTE);
diff --git a/src/intervals.h b/src/intervals.h
index a5166c6376f..01e72d7c9db 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -137,47 +137,16 @@ struct interval
137 or pointer slots of struct interval. */ 137 or pointer slots of struct interval. */
138 138
139INTERVALS_INLINE void 139INTERVALS_INLINE void
140interval_set_parent (INTERVAL i, INTERVAL parent) 140set_interval_parent (INTERVAL i, INTERVAL parent)
141{ 141{
142 i->up_obj = 0; 142 i->up_obj = 0;
143 i->up.interval = parent; 143 i->up.interval = parent;
144} 144}
145 145
146INTERVALS_INLINE void 146INTERVALS_INLINE void
147interval_set_object (INTERVAL i, Lisp_Object obj) 147set_interval_plist (INTERVAL i, Lisp_Object plist)
148{
149 eassert (BUFFERP (obj) || STRINGP (obj));
150 i->up_obj = 1;
151 i->up.obj = obj;
152}
153
154INTERVALS_INLINE void
155interval_set_left (INTERVAL i, INTERVAL left)
156{
157 i->left = left;
158}
159
160INTERVALS_INLINE void
161interval_set_right (INTERVAL i, INTERVAL right)
162{
163 i->right = right;
164}
165
166INTERVALS_INLINE Lisp_Object
167interval_set_plist (INTERVAL i, Lisp_Object plist)
168{ 148{
169 i->plist = plist; 149 i->plist = plist;
170 return plist;
171}
172
173/* Make the parent of D be whatever the parent of S is, regardless
174 of the type. This is used when balancing an interval tree. */
175
176INTERVALS_INLINE void
177interval_copy_parent (INTERVAL d, INTERVAL s)
178{
179 d->up = s->up;
180 d->up_obj = s->up_obj;
181} 150}
182 151
183/* Get the parent interval, if any, otherwise a null pointer. Useful 152/* Get the parent interval, if any, otherwise a null pointer. Useful
@@ -191,11 +160,11 @@ interval_copy_parent (INTERVAL d, INTERVAL s)
191{ \ 160{ \
192 (i)->total_length = (i)->position = 0; \ 161 (i)->total_length = (i)->position = 0; \
193 (i)->left = (i)->right = NULL; \ 162 (i)->left = (i)->right = NULL; \
194 interval_set_parent (i, NULL); \ 163 set_interval_parent (i, NULL); \
195 (i)->write_protect = 0; \ 164 (i)->write_protect = 0; \
196 (i)->visible = 0; \ 165 (i)->visible = 0; \
197 (i)->front_sticky = (i)->rear_sticky = 0; \ 166 (i)->front_sticky = (i)->rear_sticky = 0; \
198 interval_set_plist (i, Qnil); \ 167 set_interval_plist (i, Qnil); \
199} 168}
200 169
201/* Copy the cached property values of interval FROM to interval TO. */ 170/* Copy the cached property values of interval FROM to interval TO. */
diff --git a/src/keyboard.c b/src/keyboard.c
index 0b3c48ab713..7b9be358caa 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -18,6 +18,9 @@ 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#include <config.h> 20#include <config.h>
21
22#define KEYBOARD_INLINE EXTERN_INLINE
23
21#include <signal.h> 24#include <signal.h>
22#include <stdio.h> 25#include <stdio.h>
23#include <setjmp.h> 26#include <setjmp.h>
@@ -472,6 +475,53 @@ static void handle_user_signal (int);
472static char *find_user_signal_name (int); 475static char *find_user_signal_name (int);
473static int store_user_signal_events (void); 476static int store_user_signal_events (void);
474 477
478/* These setters are used only in this file, so they can be private. */
479static inline void
480kset_echo_string (struct kboard *kb, Lisp_Object val)
481{
482 kb->INTERNAL_FIELD (echo_string) = val;
483}
484static inline void
485kset_kbd_queue (struct kboard *kb, Lisp_Object val)
486{
487 kb->INTERNAL_FIELD (kbd_queue) = val;
488}
489static inline void
490kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val)
491{
492 kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val;
493}
494static inline void
495kset_last_prefix_arg (struct kboard *kb, Lisp_Object val)
496{
497 kb->INTERNAL_FIELD (Vlast_prefix_arg) = val;
498}
499static inline void
500kset_last_repeatable_command (struct kboard *kb, Lisp_Object val)
501{
502 kb->INTERNAL_FIELD (Vlast_repeatable_command) = val;
503}
504static inline void
505kset_local_function_key_map (struct kboard *kb, Lisp_Object val)
506{
507 kb->INTERNAL_FIELD (Vlocal_function_key_map) = val;
508}
509static inline void
510kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val)
511{
512 kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val;
513}
514static inline void
515kset_real_last_command (struct kboard *kb, Lisp_Object val)
516{
517 kb->INTERNAL_FIELD (Vreal_last_command) = val;
518}
519static inline void
520kset_system_key_syms (struct kboard *kb, Lisp_Object val)
521{
522 kb->INTERNAL_FIELD (system_key_syms) = val;
523}
524
475 525
476/* Add C to the echo string, if echoing is going on. 526/* Add C to the echo string, if echoing is going on.
477 C can be a character, which is printed prettily ("M-C-x" and all that 527 C can be a character, which is printed prettily ("M-C-x" and all that
@@ -554,8 +604,9 @@ echo_char (Lisp_Object c)
554 else if (STRINGP (echo_string)) 604 else if (STRINGP (echo_string))
555 echo_string = concat2 (echo_string, build_string (" ")); 605 echo_string = concat2 (echo_string, build_string (" "));
556 606
557 KSET (current_kboard, echo_string, 607 kset_echo_string
558 concat2 (echo_string, make_string (buffer, ptr - buffer))); 608 (current_kboard,
609 concat2 (echo_string, make_string (buffer, ptr - buffer)));
559 610
560 echo_now (); 611 echo_now ();
561 } 612 }
@@ -600,8 +651,9 @@ echo_dash (void)
600 651
601 /* Put a dash at the end of the buffer temporarily, 652 /* Put a dash at the end of the buffer temporarily,
602 but make it go away when the next character is added. */ 653 but make it go away when the next character is added. */
603 KSET (current_kboard, echo_string, 654 kset_echo_string
604 concat2 (KVAR (current_kboard, echo_string), build_string ("-"))); 655 (current_kboard,
656 concat2 (KVAR (current_kboard, echo_string), build_string ("-")));
605 echo_now (); 657 echo_now ();
606} 658}
607 659
@@ -663,7 +715,7 @@ cancel_echoing (void)
663{ 715{
664 current_kboard->immediate_echo = 0; 716 current_kboard->immediate_echo = 0;
665 current_kboard->echo_after_prompt = -1; 717 current_kboard->echo_after_prompt = -1;
666 KSET (current_kboard, echo_string, Qnil); 718 kset_echo_string (current_kboard, Qnil);
667 ok_to_echo_at_next_pause = NULL; 719 ok_to_echo_at_next_pause = NULL;
668 echo_kboard = NULL; 720 echo_kboard = NULL;
669 echo_message_buffer = Qnil; 721 echo_message_buffer = Qnil;
@@ -687,9 +739,9 @@ static void
687echo_truncate (ptrdiff_t nchars) 739echo_truncate (ptrdiff_t nchars)
688{ 740{
689 if (STRINGP (KVAR (current_kboard, echo_string))) 741 if (STRINGP (KVAR (current_kboard, echo_string)))
690 KSET (current_kboard, echo_string, 742 kset_echo_string (current_kboard,
691 Fsubstring (KVAR (current_kboard, echo_string), 743 Fsubstring (KVAR (current_kboard, echo_string),
692 make_number (0), make_number (nchars))); 744 make_number (0), make_number (nchars)));
693 truncate_echo_area (nchars); 745 truncate_echo_area (nchars);
694} 746}
695 747
@@ -1019,8 +1071,8 @@ cmd_error (Lisp_Object data)
1019 Vstandard_input = Qt; 1071 Vstandard_input = Qt;
1020 Vexecuting_kbd_macro = Qnil; 1072 Vexecuting_kbd_macro = Qnil;
1021 executing_kbd_macro = Qnil; 1073 executing_kbd_macro = Qnil;
1022 KSET (current_kboard, Vprefix_arg, Qnil); 1074 kset_prefix_arg (current_kboard, Qnil);
1023 KSET (current_kboard, Vlast_prefix_arg, Qnil); 1075 kset_last_prefix_arg (current_kboard, Qnil);
1024 cancel_echoing (); 1076 cancel_echoing ();
1025 1077
1026 /* Avoid unquittable loop if data contains a circular list. */ 1078 /* Avoid unquittable loop if data contains a circular list. */
@@ -1341,8 +1393,8 @@ command_loop_1 (void)
1341#endif 1393#endif
1342 int already_adjusted = 0; 1394 int already_adjusted = 0;
1343 1395
1344 KSET (current_kboard, Vprefix_arg, Qnil); 1396 kset_prefix_arg (current_kboard, Qnil);
1345 KSET (current_kboard, Vlast_prefix_arg, Qnil); 1397 kset_last_prefix_arg (current_kboard, Qnil);
1346 Vdeactivate_mark = Qnil; 1398 Vdeactivate_mark = Qnil;
1347 waiting_for_input = 0; 1399 waiting_for_input = 0;
1348 cancel_echoing (); 1400 cancel_echoing ();
@@ -1374,10 +1426,10 @@ command_loop_1 (void)
1374 } 1426 }
1375 1427
1376 /* Do this after running Vpost_command_hook, for consistency. */ 1428 /* Do this after running Vpost_command_hook, for consistency. */
1377 KSET (current_kboard, Vlast_command, Vthis_command); 1429 kset_last_command (current_kboard, Vthis_command);
1378 KSET (current_kboard, Vreal_last_command, Vreal_this_command); 1430 kset_real_last_command (current_kboard, Vreal_this_command);
1379 if (!CONSP (last_command_event)) 1431 if (!CONSP (last_command_event))
1380 KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); 1432 kset_last_repeatable_command (current_kboard, Vreal_this_command);
1381 1433
1382 while (1) 1434 while (1)
1383 { 1435 {
@@ -1549,7 +1601,7 @@ command_loop_1 (void)
1549 keys = Fkey_description (keys, Qnil); 1601 keys = Fkey_description (keys, Qnil);
1550 bitch_at_user (); 1602 bitch_at_user ();
1551 message_with_string ("%s is undefined", keys, 0); 1603 message_with_string ("%s is undefined", keys, 0);
1552 KSET (current_kboard, defining_kbd_macro, Qnil); 1604 kset_defining_kbd_macro (current_kboard, Qnil);
1553 update_mode_lines = 1; 1605 update_mode_lines = 1;
1554 /* If this is a down-mouse event, don't reset prefix-arg; 1606 /* If this is a down-mouse event, don't reset prefix-arg;
1555 pass it to the command run by the up event. */ 1607 pass it to the command run by the up event. */
@@ -1559,10 +1611,10 @@ command_loop_1 (void)
1559 = parse_modifiers (EVENT_HEAD (last_command_event)); 1611 = parse_modifiers (EVENT_HEAD (last_command_event));
1560 int modifiers = XINT (XCAR (XCDR (breakdown))); 1612 int modifiers = XINT (XCAR (XCDR (breakdown)));
1561 if (!(modifiers & down_modifier)) 1613 if (!(modifiers & down_modifier))
1562 KSET (current_kboard, Vprefix_arg, Qnil); 1614 kset_prefix_arg (current_kboard, Qnil);
1563 } 1615 }
1564 else 1616 else
1565 KSET (current_kboard, Vprefix_arg, Qnil); 1617 kset_prefix_arg (current_kboard, Qnil);
1566 } 1618 }
1567 else 1619 else
1568 { 1620 {
@@ -1599,7 +1651,7 @@ command_loop_1 (void)
1599 unbind_to (scount, Qnil); 1651 unbind_to (scount, Qnil);
1600#endif 1652#endif
1601 } 1653 }
1602 KSET (current_kboard, Vlast_prefix_arg, Vcurrent_prefix_arg); 1654 kset_last_prefix_arg (current_kboard, Vcurrent_prefix_arg);
1603 1655
1604 safe_run_hooks (Qpost_command_hook); 1656 safe_run_hooks (Qpost_command_hook);
1605 1657
@@ -1630,10 +1682,10 @@ command_loop_1 (void)
1630 if (NILP (KVAR (current_kboard, Vprefix_arg)) 1682 if (NILP (KVAR (current_kboard, Vprefix_arg))
1631 || CONSP (last_command_event)) 1683 || CONSP (last_command_event))
1632 { 1684 {
1633 KSET (current_kboard, Vlast_command, Vthis_command); 1685 kset_last_command (current_kboard, Vthis_command);
1634 KSET (current_kboard, Vreal_last_command, Vreal_this_command); 1686 kset_real_last_command (current_kboard, Vreal_this_command);
1635 if (!CONSP (last_command_event)) 1687 if (!CONSP (last_command_event))
1636 KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); 1688 kset_last_repeatable_command (current_kboard, Vreal_this_command);
1637 cancel_echoing (); 1689 cancel_echoing ();
1638 this_command_key_count = 0; 1690 this_command_key_count = 0;
1639 this_command_key_count_reset = 0; 1691 this_command_key_count_reset = 0;
@@ -2576,7 +2628,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2576 abort (); 2628 abort ();
2577 } 2629 }
2578 if (!CONSP (last)) 2630 if (!CONSP (last))
2579 KSET (kb, kbd_queue, Fcons (c, Qnil)); 2631 kset_kbd_queue (kb, Fcons (c, Qnil));
2580 else 2632 else
2581 XSETCDR (last, Fcons (c, Qnil)); 2633 XSETCDR (last, Fcons (c, Qnil));
2582 kb->kbd_queue_has_data = 1; 2634 kb->kbd_queue_has_data = 1;
@@ -2748,8 +2800,8 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2748 if (!CONSP (KVAR (current_kboard, kbd_queue))) 2800 if (!CONSP (KVAR (current_kboard, kbd_queue)))
2749 abort (); 2801 abort ();
2750 c = XCAR (KVAR (current_kboard, kbd_queue)); 2802 c = XCAR (KVAR (current_kboard, kbd_queue));
2751 KSET (current_kboard, kbd_queue, 2803 kset_kbd_queue (current_kboard,
2752 XCDR (KVAR (current_kboard, kbd_queue))); 2804 XCDR (KVAR (current_kboard, kbd_queue)));
2753 if (NILP (KVAR (current_kboard, kbd_queue))) 2805 if (NILP (KVAR (current_kboard, kbd_queue)))
2754 current_kboard->kbd_queue_has_data = 0; 2806 current_kboard->kbd_queue_has_data = 0;
2755 input_pending = readable_events (0); 2807 input_pending = readable_events (0);
@@ -2816,7 +2868,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2816 abort (); 2868 abort ();
2817 } 2869 }
2818 if (!CONSP (last)) 2870 if (!CONSP (last))
2819 KSET (kb, kbd_queue, Fcons (c, Qnil)); 2871 kset_kbd_queue (kb, Fcons (c, Qnil));
2820 else 2872 else
2821 XSETCDR (last, Fcons (c, Qnil)); 2873 XSETCDR (last, Fcons (c, Qnil));
2822 kb->kbd_queue_has_data = 1; 2874 kb->kbd_queue_has_data = 1;
@@ -3074,7 +3126,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
3074 3126
3075 cancel_echoing (); 3127 cancel_echoing ();
3076 ok_to_echo_at_next_pause = saved_ok_to_echo; 3128 ok_to_echo_at_next_pause = saved_ok_to_echo;
3077 KSET (current_kboard, echo_string, saved_echo_string); 3129 kset_echo_string (current_kboard, saved_echo_string);
3078 current_kboard->echo_after_prompt = saved_echo_after_prompt; 3130 current_kboard->echo_after_prompt = saved_echo_after_prompt;
3079 if (saved_immediate_echo) 3131 if (saved_immediate_echo)
3080 echo_now (); 3132 echo_now ();
@@ -3545,9 +3597,9 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3545 3597
3546 if (single_kboard && kb != current_kboard) 3598 if (single_kboard && kb != current_kboard)
3547 { 3599 {
3548 KSET (kb, kbd_queue, 3600 kset_kbd_queue
3549 Fcons (make_lispy_switch_frame (event->frame_or_window), 3601 (kb, Fcons (make_lispy_switch_frame (event->frame_or_window),
3550 Fcons (make_number (c), Qnil))); 3602 Fcons (make_number (c), Qnil)));
3551 kb->kbd_queue_has_data = 1; 3603 kb->kbd_queue_has_data = 1;
3552 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++) 3604 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
3553 { 3605 {
@@ -5426,7 +5478,7 @@ make_lispy_event (struct input_event *event)
5426 /* We need to use an alist rather than a vector as the cache 5478 /* We need to use an alist rather than a vector as the cache
5427 since we can't make a vector long enough. */ 5479 since we can't make a vector long enough. */
5428 if (NILP (KVAR (current_kboard, system_key_syms))) 5480 if (NILP (KVAR (current_kboard, system_key_syms)))
5429 KSET (current_kboard, system_key_syms, Fcons (Qnil, Qnil)); 5481 kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
5430 return modify_event_symbol (event->code, 5482 return modify_event_symbol (event->code,
5431 event->modifiers, 5483 event->modifiers,
5432 Qfunction_key, 5484 Qfunction_key,
@@ -8755,11 +8807,11 @@ read_char_minibuf_menu_prompt (int commandflag,
8755 is not used on replay. 8807 is not used on replay.
8756 */ 8808 */
8757 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); 8809 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro);
8758 KSET (current_kboard, defining_kbd_macro, Qnil); 8810 kset_defining_kbd_macro (current_kboard, Qnil);
8759 do 8811 do
8760 obj = read_char (commandflag, 0, 0, Qt, 0, NULL); 8812 obj = read_char (commandflag, 0, 0, Qt, 0, NULL);
8761 while (BUFFERP (obj)); 8813 while (BUFFERP (obj));
8762 KSET (current_kboard, defining_kbd_macro, orig_defn_macro); 8814 kset_defining_kbd_macro (current_kboard, orig_defn_macro);
8763 8815
8764 if (!INTEGERP (obj)) 8816 if (!INTEGERP (obj))
8765 return obj; 8817 return obj;
@@ -9115,7 +9167,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9115 /* Install the string STR as the beginning of the string of 9167 /* Install the string STR as the beginning of the string of
9116 echoing, so that it serves as a prompt for the next 9168 echoing, so that it serves as a prompt for the next
9117 character. */ 9169 character. */
9118 KSET (current_kboard, echo_string, prompt); 9170 kset_echo_string (current_kboard, prompt);
9119 current_kboard->echo_after_prompt = SCHARS (prompt); 9171 current_kboard->echo_after_prompt = SCHARS (prompt);
9120 echo_now (); 9172 echo_now ();
9121 } 9173 }
@@ -9361,15 +9413,17 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9361 9413
9362 if (!NILP (delayed_switch_frame)) 9414 if (!NILP (delayed_switch_frame))
9363 { 9415 {
9364 KSET (interrupted_kboard, kbd_queue, 9416 kset_kbd_queue
9365 Fcons (delayed_switch_frame, 9417 (interrupted_kboard,
9366 KVAR (interrupted_kboard, kbd_queue))); 9418 Fcons (delayed_switch_frame,
9419 KVAR (interrupted_kboard, kbd_queue)));
9367 delayed_switch_frame = Qnil; 9420 delayed_switch_frame = Qnil;
9368 } 9421 }
9369 9422
9370 while (t > 0) 9423 while (t > 0)
9371 KSET (interrupted_kboard, kbd_queue, 9424 kset_kbd_queue
9372 Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue))); 9425 (interrupted_kboard,
9426 Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue)));
9373 9427
9374 /* If the side queue is non-empty, ensure it begins with a 9428 /* If the side queue is non-empty, ensure it begins with a
9375 switch-frame, so we'll replay it in the right context. */ 9429 switch-frame, so we'll replay it in the right context. */
@@ -9381,9 +9435,10 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9381 { 9435 {
9382 Lisp_Object frame; 9436 Lisp_Object frame;
9383 XSETFRAME (frame, interrupted_frame); 9437 XSETFRAME (frame, interrupted_frame);
9384 KSET (interrupted_kboard, kbd_queue, 9438 kset_kbd_queue
9385 Fcons (make_lispy_switch_frame (frame), 9439 (interrupted_kboard,
9386 KVAR (interrupted_kboard, kbd_queue))); 9440 Fcons (make_lispy_switch_frame (frame),
9441 KVAR (interrupted_kboard, kbd_queue)));
9387 } 9442 }
9388 mock_input = 0; 9443 mock_input = 0;
9389 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); 9444 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -10277,7 +10332,7 @@ a special event, so ignore the prefix argument and don't clear it. */)
10277 { 10332 {
10278 prefixarg = KVAR (current_kboard, Vprefix_arg); 10333 prefixarg = KVAR (current_kboard, Vprefix_arg);
10279 Vcurrent_prefix_arg = prefixarg; 10334 Vcurrent_prefix_arg = prefixarg;
10280 KSET (current_kboard, Vprefix_arg, Qnil); 10335 kset_prefix_arg (current_kboard, Qnil);
10281 } 10336 }
10282 else 10337 else
10283 prefixarg = Qnil; 10338 prefixarg = Qnil;
@@ -11216,11 +11271,8 @@ The `posn-' functions access elements of such lists. */)
11216 11271
11217 if (WINDOWP (frame_or_window)) 11272 if (WINDOWP (frame_or_window))
11218 { 11273 {
11219 struct window *w; 11274 struct window *w = decode_valid_window (frame_or_window);
11220
11221 CHECK_LIVE_WINDOW (frame_or_window);
11222 11275
11223 w = XWINDOW (frame_or_window);
11224 XSETINT (x, (XINT (x) 11276 XSETINT (x, (XINT (x)
11225 + WINDOW_LEFT_EDGE_X (w) 11277 + WINDOW_LEFT_EDGE_X (w)
11226 + (NILP (whole) 11278 + (NILP (whole)
@@ -11275,30 +11327,30 @@ The `posn-' functions access elements of such lists. */)
11275void 11327void
11276init_kboard (KBOARD *kb) 11328init_kboard (KBOARD *kb)
11277{ 11329{
11278 KSET (kb, Voverriding_terminal_local_map, Qnil); 11330 kset_overriding_terminal_local_map (kb, Qnil);
11279 KSET (kb, Vlast_command, Qnil); 11331 kset_last_command (kb, Qnil);
11280 KSET (kb, Vreal_last_command, Qnil); 11332 kset_real_last_command (kb, Qnil);
11281 KSET (kb, Vkeyboard_translate_table, Qnil); 11333 kset_keyboard_translate_table (kb, Qnil);
11282 KSET (kb, Vlast_repeatable_command, Qnil); 11334 kset_last_repeatable_command (kb, Qnil);
11283 KSET (kb, Vprefix_arg, Qnil); 11335 kset_prefix_arg (kb, Qnil);
11284 KSET (kb, Vlast_prefix_arg, Qnil); 11336 kset_last_prefix_arg (kb, Qnil);
11285 KSET (kb, kbd_queue, Qnil); 11337 kset_kbd_queue (kb, Qnil);
11286 kb->kbd_queue_has_data = 0; 11338 kb->kbd_queue_has_data = 0;
11287 kb->immediate_echo = 0; 11339 kb->immediate_echo = 0;
11288 KSET (kb, echo_string, Qnil); 11340 kset_echo_string (kb, Qnil);
11289 kb->echo_after_prompt = -1; 11341 kb->echo_after_prompt = -1;
11290 kb->kbd_macro_buffer = 0; 11342 kb->kbd_macro_buffer = 0;
11291 kb->kbd_macro_bufsize = 0; 11343 kb->kbd_macro_bufsize = 0;
11292 KSET (kb, defining_kbd_macro, Qnil); 11344 kset_defining_kbd_macro (kb, Qnil);
11293 KSET (kb, Vlast_kbd_macro, Qnil); 11345 kset_last_kbd_macro (kb, Qnil);
11294 kb->reference_count = 0; 11346 kb->reference_count = 0;
11295 KSET (kb, Vsystem_key_alist, Qnil); 11347 kset_system_key_alist (kb, Qnil);
11296 KSET (kb, system_key_syms, Qnil); 11348 kset_system_key_syms (kb, Qnil);
11297 KSET (kb, Vwindow_system, Qt); /* Unset. */ 11349 kset_window_system (kb, Qt); /* Unset. */
11298 KSET (kb, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); 11350 kset_input_decode_map (kb, Fmake_sparse_keymap (Qnil));
11299 KSET (kb, Vlocal_function_key_map, Fmake_sparse_keymap (Qnil)); 11351 kset_local_function_key_map (kb, Fmake_sparse_keymap (Qnil));
11300 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map); 11352 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
11301 KSET (kb, Vdefault_minibuffer_frame, Qnil); 11353 kset_default_minibuffer_frame (kb, Qnil);
11302} 11354}
11303 11355
11304/* 11356/*
@@ -11374,7 +11426,7 @@ init_keyboard (void)
11374 init_kboard (current_kboard); 11426 init_kboard (current_kboard);
11375 /* A value of nil for Vwindow_system normally means a tty, but we also use 11427 /* A value of nil for Vwindow_system normally means a tty, but we also use
11376 it for the initial terminal since there is no window system there. */ 11428 it for the initial terminal since there is no window system there. */
11377 KSET (current_kboard, Vwindow_system, Qnil); 11429 kset_window_system (current_kboard, Qnil);
11378 11430
11379 if (!noninteractive) 11431 if (!noninteractive)
11380 { 11432 {
diff --git a/src/keyboard.h b/src/keyboard.h
index f83643d6f6e..91484b3649b 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -19,10 +19,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#include "systime.h" /* for EMACS_TIME, Time */ 19#include "systime.h" /* for EMACS_TIME, 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
22INLINE_HEADER_BEGIN
23#ifndef KEYBOARD_INLINE
24# define KEYBOARD_INLINE INLINE
25#endif
26
22/* Most code should use this macro to access Lisp fields in struct kboard. */ 27/* Most code should use this macro to access Lisp fields in struct kboard. */
23 28
24#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field)) 29#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field))
25#define KSET(kboard, field, value) ((kboard)->INTERNAL_FIELD (field) = (value))
26 30
27/* Each KBOARD represents one logical input stream from which Emacs 31/* Each KBOARD represents one logical input stream from which Emacs
28 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
@@ -173,6 +177,47 @@ struct kboard
173 char echo_after_prompt; 177 char echo_after_prompt;
174 }; 178 };
175 179
180KEYBOARD_INLINE void
181kset_default_minibuffer_frame (struct kboard *kb, Lisp_Object val)
182{
183 kb->INTERNAL_FIELD (Vdefault_minibuffer_frame) = val;
184}
185KEYBOARD_INLINE void
186kset_defining_kbd_macro (struct kboard *kb, Lisp_Object val)
187{
188 kb->INTERNAL_FIELD (defining_kbd_macro) = val;
189}
190KEYBOARD_INLINE void
191kset_input_decode_map (struct kboard *kb, Lisp_Object val)
192{
193 kb->INTERNAL_FIELD (Vinput_decode_map) = val;
194}
195KEYBOARD_INLINE void
196kset_last_command (struct kboard *kb, Lisp_Object val)
197{
198 kb->INTERNAL_FIELD (Vlast_command) = val;
199}
200KEYBOARD_INLINE void
201kset_last_kbd_macro (struct kboard *kb, Lisp_Object val)
202{
203 kb->INTERNAL_FIELD (Vlast_kbd_macro) = val;
204}
205KEYBOARD_INLINE void
206kset_prefix_arg (struct kboard *kb, Lisp_Object val)
207{
208 kb->INTERNAL_FIELD (Vprefix_arg) = val;
209}
210KEYBOARD_INLINE void
211kset_system_key_alist (struct kboard *kb, Lisp_Object val)
212{
213 kb->INTERNAL_FIELD (Vsystem_key_alist) = val;
214}
215KEYBOARD_INLINE void
216kset_window_system (struct kboard *kb, Lisp_Object val)
217{
218 kb->INTERNAL_FIELD (Vwindow_system) = val;
219}
220
176/* Temporarily used before a frame has been opened. */ 221/* Temporarily used before a frame has been opened. */
177extern KBOARD *initial_kboard; 222extern KBOARD *initial_kboard;
178 223
@@ -510,3 +555,5 @@ extern void mark_kboards (void);
510#ifdef WINDOWSNT 555#ifdef WINDOWSNT
511extern const char *const lispy_function_keys[]; 556extern const char *const lispy_function_keys[];
512#endif 557#endif
558
559INLINE_HEADER_END
diff --git a/src/keymap.c b/src/keymap.c
index c550b37c1d6..21f7dcb5d37 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1854,7 +1854,7 @@ If KEYMAP is nil, that means no local keymap. */)
1854 if (!NILP (keymap)) 1854 if (!NILP (keymap))
1855 keymap = get_keymap (keymap, 1, 1); 1855 keymap = get_keymap (keymap, 1, 1);
1856 1856
1857 BSET (current_buffer, keymap, keymap); 1857 bset_keymap (current_buffer, keymap);
1858 1858
1859 return Qnil; 1859 return Qnil;
1860} 1860}
diff --git a/src/lisp.h b/src/lisp.h
index 90705f51ddb..fea5ac0c768 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -928,7 +928,7 @@ enum
928 8-bit European characters. Do not check validity of CT. */ 928 8-bit European characters. Do not check validity of CT. */
929#define CHAR_TABLE_SET(CT, IDX, VAL) \ 929#define CHAR_TABLE_SET(CT, IDX, VAL) \
930 (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \ 930 (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \
931 ? XSUB_CHAR_TABLE (XCHAR_TABLE (CT)->ascii)->contents[IDX] = VAL \ 931 ? set_sub_char_table_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \
932 : char_table_set (CT, IDX, VAL)) 932 : char_table_set (CT, IDX, VAL))
933 933
934enum CHARTAB_SIZE_BITS 934enum CHARTAB_SIZE_BITS
@@ -941,8 +941,6 @@ enum CHARTAB_SIZE_BITS
941 941
942extern const int chartab_size[4]; 942extern const int chartab_size[4];
943 943
944struct Lisp_Sub_Char_Table;
945
946struct Lisp_Char_Table 944struct Lisp_Char_Table
947 { 945 {
948 /* HEADER.SIZE is the vector's size field, which also holds the 946 /* HEADER.SIZE is the vector's size field, which also holds the
@@ -991,6 +989,7 @@ struct Lisp_Sub_Char_Table
991 /* Minimum character covered by the sub char-table. */ 989 /* Minimum character covered by the sub char-table. */
992 Lisp_Object min_char; 990 Lisp_Object min_char;
993 991
992 /* Use set_sub_char_table_contents to set this. */
994 Lisp_Object contents[1]; 993 Lisp_Object contents[1];
995 }; 994 };
996 995
@@ -1472,14 +1471,6 @@ struct Lisp_Buffer_Local_Value
1472 Lisp_Object valcell; 1471 Lisp_Object valcell;
1473 }; 1472 };
1474 1473
1475#define BLV_FOUND(blv) \
1476 (eassert ((blv)->found == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found)
1477#define SET_BLV_FOUND(blv, v) \
1478 (eassert ((v) == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found = (v))
1479
1480#define BLV_VALUE(blv) (XCDR ((blv)->valcell))
1481#define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v))
1482
1483/* Like Lisp_Objfwd except that value lives in a slot in the 1474/* Like Lisp_Objfwd except that value lives in a slot in the
1484 current kboard. */ 1475 current kboard. */
1485struct Lisp_Kboard_Objfwd 1476struct Lisp_Kboard_Objfwd
@@ -1758,15 +1749,18 @@ typedef struct {
1758#define CHECK_WINDOW_CONFIGURATION(x) \ 1749#define CHECK_WINDOW_CONFIGURATION(x) \
1759 CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x) 1750 CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
1760 1751
1761/* This macro rejects windows on the interior of the window tree as 1752/* A window of any sort, leaf or interior, is "valid" if one of its
1762 "dead", which is what we want; this is an argument-checking macro, and 1753 buffer, vchild, or hchild members is non-nil. */
1763 the user should never get access to interior windows. 1754#define CHECK_VALID_WINDOW(x) \
1764 1755 CHECK_TYPE (WINDOWP (x) \
1765 A window of any sort, leaf or interior, is dead if the buffer, 1756 && (!NILP (XWINDOW (x)->buffer) \
1766 vchild, and hchild members are all nil. */ 1757 || !NILP (XWINDOW (x)->vchild) \
1767 1758 || !NILP (XWINDOW (x)->hchild)), \
1768#define CHECK_LIVE_WINDOW(x) \ 1759 Qwindow_valid_p, x)
1769 CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \ 1760
1761/* A window is "live" if and only if it shows a buffer. */
1762#define CHECK_LIVE_WINDOW(x) \
1763 CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \
1770 Qwindow_live_p, x) 1764 Qwindow_live_p, x)
1771 1765
1772#define CHECK_PROCESS(x) \ 1766#define CHECK_PROCESS(x) \
@@ -2412,6 +2406,52 @@ set_symbol_next (Lisp_Object sym, struct Lisp_Symbol *next)
2412 XSYMBOL (sym)->next = next; 2406 XSYMBOL (sym)->next = next;
2413} 2407}
2414 2408
2409/* Buffer-local (also frame-local) variable access functions. */
2410
2411LISP_INLINE int
2412blv_found (struct Lisp_Buffer_Local_Value *blv)
2413{
2414 eassert (blv->found == !EQ (blv->defcell, blv->valcell));
2415 return blv->found;
2416}
2417
2418LISP_INLINE void
2419set_blv_found (struct Lisp_Buffer_Local_Value *blv, int found)
2420{
2421 eassert (found == !EQ (blv->defcell, blv->valcell));
2422 blv->found = found;
2423}
2424
2425LISP_INLINE Lisp_Object
2426blv_value (struct Lisp_Buffer_Local_Value *blv)
2427{
2428 return XCDR (blv->valcell);
2429}
2430
2431LISP_INLINE void
2432set_blv_value (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2433{
2434 XSETCDR (blv->valcell, val);
2435}
2436
2437LISP_INLINE void
2438set_blv_where (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2439{
2440 blv->where = val;
2441}
2442
2443LISP_INLINE void
2444set_blv_defcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2445{
2446 blv->defcell = val;
2447}
2448
2449LISP_INLINE void
2450set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2451{
2452 blv->valcell = val;
2453}
2454
2415/* Set overlay's property list. */ 2455/* Set overlay's property list. */
2416 2456
2417LISP_INLINE void 2457LISP_INLINE void
@@ -2423,7 +2463,7 @@ set_overlay_plist (Lisp_Object overlay, Lisp_Object plist)
2423/* Get text properties of S. */ 2463/* Get text properties of S. */
2424 2464
2425LISP_INLINE INTERVAL 2465LISP_INLINE INTERVAL
2426string_get_intervals (Lisp_Object s) 2466string_intervals (Lisp_Object s)
2427{ 2467{
2428 return XSTRING (s)->intervals; 2468 return XSTRING (s)->intervals;
2429} 2469}
@@ -2431,11 +2471,57 @@ string_get_intervals (Lisp_Object s)
2431/* Set text properties of S to I. */ 2471/* Set text properties of S to I. */
2432 2472
2433LISP_INLINE void 2473LISP_INLINE void
2434string_set_intervals (Lisp_Object s, INTERVAL i) 2474set_string_intervals (Lisp_Object s, INTERVAL i)
2435{ 2475{
2436 XSTRING (s)->intervals = i; 2476 XSTRING (s)->intervals = i;
2437} 2477}
2438 2478
2479/* Set a Lisp slot in TABLE to VAL. Most code should use this instead
2480 of setting slots directly. */
2481
2482LISP_INLINE void
2483set_char_table_ascii (Lisp_Object table, Lisp_Object val)
2484{
2485 XCHAR_TABLE (table)->ascii = val;
2486}
2487LISP_INLINE void
2488set_char_table_defalt (Lisp_Object table, Lisp_Object val)
2489{
2490 XCHAR_TABLE (table)->defalt = val;
2491}
2492LISP_INLINE void
2493set_char_table_parent (Lisp_Object table, Lisp_Object val)
2494{
2495 XCHAR_TABLE (table)->parent = val;
2496}
2497LISP_INLINE void
2498set_char_table_purpose (Lisp_Object table, Lisp_Object val)
2499{
2500 XCHAR_TABLE (table)->purpose = val;
2501}
2502
2503/* Set different slots in (sub)character tables. */
2504
2505LISP_INLINE void
2506set_char_table_extras (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
2507{
2508 eassert (0 <= idx && idx < CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (table)));
2509 XCHAR_TABLE (table)->extras[idx] = val;
2510}
2511
2512LISP_INLINE void
2513set_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
2514{
2515 eassert (0 <= idx && idx < (1 << CHARTAB_SIZE_BITS_0));
2516 XCHAR_TABLE (table)->contents[idx] = val;
2517}
2518
2519LISP_INLINE void
2520set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
2521{
2522 XSUB_CHAR_TABLE (table)->contents[idx] = val;
2523}
2524
2439/* Defined in data.c. */ 2525/* Defined in data.c. */
2440extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; 2526extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
2441extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; 2527extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
@@ -2657,7 +2743,6 @@ _Noreturn void __executable_start (void);
2657#endif 2743#endif
2658extern Lisp_Object selected_frame; 2744extern Lisp_Object selected_frame;
2659extern Lisp_Object Vwindow_system; 2745extern Lisp_Object Vwindow_system;
2660void duration_to_sec_usec (double, int *, int *);
2661extern Lisp_Object sit_for (Lisp_Object, int, int); 2746extern Lisp_Object sit_for (Lisp_Object, int, int);
2662extern void init_display (void); 2747extern void init_display (void);
2663extern void syms_of_display (void); 2748extern void syms_of_display (void);
@@ -2835,9 +2920,8 @@ extern Lisp_Object copy_char_table (Lisp_Object);
2835extern Lisp_Object char_table_ref (Lisp_Object, int); 2920extern Lisp_Object char_table_ref (Lisp_Object, int);
2836extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, 2921extern Lisp_Object char_table_ref_and_range (Lisp_Object, int,
2837 int *, int *); 2922 int *, int *);
2838extern Lisp_Object char_table_set (Lisp_Object, int, Lisp_Object); 2923extern void char_table_set (Lisp_Object, int, Lisp_Object);
2839extern Lisp_Object char_table_set_range (Lisp_Object, int, int, 2924extern void char_table_set_range (Lisp_Object, int, int, Lisp_Object);
2840 Lisp_Object);
2841extern int char_table_translate (Lisp_Object, int); 2925extern int char_table_translate (Lisp_Object, int);
2842extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, 2926extern void map_char_table (void (*) (Lisp_Object, Lisp_Object,
2843 Lisp_Object), 2927 Lisp_Object),
diff --git a/src/lread.c b/src/lread.c
index 72991e92bae..e2ad03b349f 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -80,7 +80,7 @@ static Lisp_Object Qascii_character, Qload, Qload_file_name;
80Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; 80Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
81static Lisp_Object Qinhibit_file_name_operation; 81static Lisp_Object Qinhibit_file_name_operation;
82static Lisp_Object Qeval_buffer_list; 82static Lisp_Object Qeval_buffer_list;
83static Lisp_Object Qlexical_binding; 83Lisp_Object Qlexical_binding;
84static Lisp_Object Qfile_truename, Qdo_after_load_evaluation; /* ACM 2006/5/16 */ 84static Lisp_Object Qfile_truename, Qdo_after_load_evaluation; /* ACM 2006/5/16 */
85 85
86/* Used instead of Qget_file_char while loading *.elc files compiled 86/* Used instead of Qget_file_char while loading *.elc files compiled
@@ -3189,8 +3189,8 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
3189 /* Check for text properties in each interval. 3189 /* Check for text properties in each interval.
3190 substitute_in_interval contains part of the logic. */ 3190 substitute_in_interval contains part of the logic. */
3191 3191
3192 INTERVAL root_interval = string_get_intervals (subtree); 3192 INTERVAL root_interval = string_intervals (subtree);
3193 Lisp_Object arg = Fcons (object, placeholder); 3193 Lisp_Object arg = Fcons (object, placeholder);
3194 3194
3195 traverse_intervals_noorder (root_interval, 3195 traverse_intervals_noorder (root_interval,
3196 &substitute_in_interval, arg); 3196 &substitute_in_interval, arg);
@@ -3211,7 +3211,7 @@ substitute_in_interval (INTERVAL interval, Lisp_Object arg)
3211 Lisp_Object object = Fcar (arg); 3211 Lisp_Object object = Fcar (arg);
3212 Lisp_Object placeholder = Fcdr (arg); 3212 Lisp_Object placeholder = Fcdr (arg);
3213 3213
3214 SUBSTITUTE (interval->plist, interval_set_plist (interval, true_value)); 3214 SUBSTITUTE (interval->plist, set_interval_plist (interval, true_value));
3215} 3215}
3216 3216
3217 3217
diff --git a/src/macros.c b/src/macros.c
index d74d12e6158..e81068181b9 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -127,7 +127,7 @@ macro before appending to it. */)
127 127
128 message ("Appending to kbd macro..."); 128 message ("Appending to kbd macro...");
129 } 129 }
130 KSET (current_kboard, defining_kbd_macro, Qt); 130 kset_defining_kbd_macro (current_kboard, Qt);
131 131
132 return Qnil; 132 return Qnil;
133} 133}
@@ -137,12 +137,13 @@ macro before appending to it. */)
137void 137void
138end_kbd_macro (void) 138end_kbd_macro (void)
139{ 139{
140 KSET (current_kboard, defining_kbd_macro, Qnil); 140 kset_defining_kbd_macro (current_kboard, Qnil);
141 update_mode_lines++; 141 update_mode_lines++;
142 KSET (current_kboard, Vlast_kbd_macro, 142 kset_last_kbd_macro
143 make_event_array ((current_kboard->kbd_macro_end 143 (current_kboard,
144 - current_kboard->kbd_macro_buffer), 144 make_event_array ((current_kboard->kbd_macro_end
145 current_kboard->kbd_macro_buffer)); 145 - current_kboard->kbd_macro_buffer),
146 current_kboard->kbd_macro_buffer));
146} 147}
147 148
148DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p", 149DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p",
@@ -330,7 +331,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
330 executing_kbd_macro = final; 331 executing_kbd_macro = final;
331 executing_kbd_macro_index = 0; 332 executing_kbd_macro_index = 0;
332 333
333 KSET (current_kboard, Vprefix_arg, Qnil); 334 kset_prefix_arg (current_kboard, Qnil);
334 335
335 if (!NILP (loopfunc)) 336 if (!NILP (loopfunc))
336 { 337 {
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 31dc94f7964..9c13f561a04 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -395,6 +395,8 @@ BLOCKINPUT_H = $(SRC)/blockinput.h \
395 $(ATIMER_H) 395 $(ATIMER_H)
396BUFFER_H = $(SRC)/buffer.h \ 396BUFFER_H = $(SRC)/buffer.h \
397 $(SYSTIME_H) 397 $(SYSTIME_H)
398C_CTYPE_H = $(GNU_LIB)/c-ctype.h \
399 $(NT_INC)/stdbool.h
398CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \ 400CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \
399 $(NT_INC)/unistd.h 401 $(NT_INC)/unistd.h
400CHARACTER_H = $(SRC)/character.h \ 402CHARACTER_H = $(SRC)/character.h \
@@ -441,7 +443,8 @@ LISP_H = $(SRC)/lisp.h \
441 $(SRC)/globals.h \ 443 $(SRC)/globals.h \
442 $(GNU_LIB)/intprops.h \ 444 $(GNU_LIB)/intprops.h \
443 $(INTTYPES_H) \ 445 $(INTTYPES_H) \
444 $(NT_INC)/stdalign.h 446 $(NT_INC)/stdalign.h \
447 $(NT_INC)/stdbool.h
445MD5_H = $(GNU_LIB)/md5.h \ 448MD5_H = $(GNU_LIB)/md5.h \
446 $(NT_INC)/stdint.h 449 $(NT_INC)/stdint.h
447MENU_H = $(SRC)/menu.h \ 450MENU_H = $(SRC)/menu.h \
@@ -626,6 +629,7 @@ $(BLD)/charset.$(O) : \
626 $(CHARSET_H) \ 629 $(CHARSET_H) \
627 $(CODING_H) \ 630 $(CODING_H) \
628 $(CONFIG_H) \ 631 $(CONFIG_H) \
632 $(C_CTYPE_H) \
629 $(LISP_H) 633 $(LISP_H)
630 634
631$(BLD)/chartab.$(O) : \ 635$(BLD)/chartab.$(O) : \
@@ -747,6 +751,7 @@ $(BLD)/doc.$(O) : \
747 $(BUFFER_H) \ 751 $(BUFFER_H) \
748 $(CHARACTER_H) \ 752 $(CHARACTER_H) \
749 $(CONFIG_H) \ 753 $(CONFIG_H) \
754 $(C_CTYPE_H) \
750 $(KEYBOARD_H) \ 755 $(KEYBOARD_H) \
751 $(LISP_H) 756 $(LISP_H)
752 757
@@ -820,6 +825,7 @@ $(BLD)/fileio.$(O) : \
820 $(CHARACTER_H) \ 825 $(CHARACTER_H) \
821 $(CODING_H) \ 826 $(CODING_H) \
822 $(CONFIG_H) \ 827 $(CONFIG_H) \
828 $(C_CTYPE_H) \
823 $(DISPEXTERN_H) \ 829 $(DISPEXTERN_H) \
824 $(FRAME_H) \ 830 $(FRAME_H) \
825 $(INTERVALS_H) \ 831 $(INTERVALS_H) \
@@ -881,6 +887,7 @@ $(BLD)/font.$(O) : \
881 $(CHARACTER_H) \ 887 $(CHARACTER_H) \
882 $(CHARSET_H) \ 888 $(CHARSET_H) \
883 $(CONFIG_H) \ 889 $(CONFIG_H) \
890 $(C_CTYPE_H) \
884 $(DISPEXTERN_H) \ 891 $(DISPEXTERN_H) \
885 $(FONT_H) \ 892 $(FONT_H) \
886 $(FRAME_H) \ 893 $(FRAME_H) \
@@ -916,6 +923,7 @@ $(BLD)/frame.$(O) : \
916 $(BUFFER_H) \ 923 $(BUFFER_H) \
917 $(CHARACTER_H) \ 924 $(CHARACTER_H) \
918 $(CONFIG_H) \ 925 $(CONFIG_H) \
926 $(C_CTYPE_H) \
919 $(DISPEXTERN_H) \ 927 $(DISPEXTERN_H) \
920 $(FONT_H) \ 928 $(FONT_H) \
921 $(FRAME_H) \ 929 $(FRAME_H) \
@@ -967,6 +975,7 @@ $(BLD)/image.$(O) : \
967 $(CHARACTER_H) \ 975 $(CHARACTER_H) \
968 $(CODING_H) \ 976 $(CODING_H) \
969 $(CONFIG_H) \ 977 $(CONFIG_H) \
978 $(C_CTYPE_H) \
970 $(DISPEXTERN_H) \ 979 $(DISPEXTERN_H) \
971 $(FONT_H) \ 980 $(FONT_H) \
972 $(FRAME_H) \ 981 $(FRAME_H) \
@@ -1354,6 +1363,7 @@ $(BLD)/sysdep.$(O) : \
1354 $(BLOCKINPUT_H) \ 1363 $(BLOCKINPUT_H) \
1355 $(CAREADLINKAT_H) \ 1364 $(CAREADLINKAT_H) \
1356 $(CONFIG_H) \ 1365 $(CONFIG_H) \
1366 $(C_CTYPE_H) \
1357 $(DISPEXTERN_H) \ 1367 $(DISPEXTERN_H) \
1358 $(FRAME_H) \ 1368 $(FRAME_H) \
1359 $(GRP_H) \ 1369 $(GRP_H) \
@@ -1499,6 +1509,7 @@ $(BLD)/xfaces.$(O) : \
1499 $(CHARACTER_H) \ 1509 $(CHARACTER_H) \
1500 $(CHARSET_H) \ 1510 $(CHARSET_H) \
1501 $(CONFIG_H) \ 1511 $(CONFIG_H) \
1512 $(C_CTYPE_H) \
1502 $(DISPEXTERN_H) \ 1513 $(DISPEXTERN_H) \
1503 $(FONT_H) \ 1514 $(FONT_H) \
1504 $(FRAME_H) \ 1515 $(FRAME_H) \
diff --git a/src/minibuf.c b/src/minibuf.c
index 06ea415db62..2154d1654df 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -565,11 +565,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
565 565
566 /* Defeat (setq-default truncate-lines t), since truncated lines do 566 /* Defeat (setq-default truncate-lines t), since truncated lines do
567 not work correctly in minibuffers. (Bug#5715, etc) */ 567 not work correctly in minibuffers. (Bug#5715, etc) */
568 BSET (current_buffer, truncate_lines, Qnil); 568 bset_truncate_lines (current_buffer, Qnil);
569 569
570 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ 570 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
571 if (inherit_input_method) 571 if (inherit_input_method)
572 BSET (current_buffer, enable_multibyte_characters, enable_multibyte); 572 bset_enable_multibyte_characters (current_buffer, enable_multibyte);
573 573
574 /* The current buffer's default directory is usually the right thing 574 /* The current buffer's default directory is usually the right thing
575 for our minibuffer here. However, if you're typing a command at 575 for our minibuffer here. However, if you're typing a command at
@@ -580,7 +580,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
580 you think of something better to do? Find another buffer with a 580 you think of something better to do? Find another buffer with a
581 better directory, and use that one instead. */ 581 better directory, and use that one instead. */
582 if (STRINGP (ambient_dir)) 582 if (STRINGP (ambient_dir))
583 BSET (current_buffer, directory, ambient_dir); 583 bset_directory (current_buffer, ambient_dir);
584 else 584 else
585 { 585 {
586 Lisp_Object buf_list; 586 Lisp_Object buf_list;
@@ -594,8 +594,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
594 other_buf = XCDR (XCAR (buf_list)); 594 other_buf = XCDR (XCAR (buf_list));
595 if (STRINGP (BVAR (XBUFFER (other_buf), directory))) 595 if (STRINGP (BVAR (XBUFFER (other_buf), directory)))
596 { 596 {
597 BSET (current_buffer, directory, 597 bset_directory (current_buffer,
598 BVAR (XBUFFER (other_buf), directory)); 598 BVAR (XBUFFER (other_buf), directory));
599 break; 599 break;
600 } 600 }
601 } 601 }
@@ -672,7 +672,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
672 } 672 }
673 673
674 clear_message (1, 1); 674 clear_message (1, 1);
675 BSET (current_buffer, keymap, map); 675 bset_keymap (current_buffer, map);
676 676
677 /* Turn on an input method stored in INPUT_METHOD if any. */ 677 /* Turn on an input method stored in INPUT_METHOD if any. */
678 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) 678 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
@@ -681,7 +681,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
681 Frun_hooks (1, &Qminibuffer_setup_hook); 681 Frun_hooks (1, &Qminibuffer_setup_hook);
682 682
683 /* Don't allow the user to undo past this point. */ 683 /* Don't allow the user to undo past this point. */
684 BSET (current_buffer, undo_list, Qnil); 684 bset_undo_list (current_buffer, Qnil);
685 685
686 recursive_edit_1 (); 686 recursive_edit_1 ();
687 687
diff --git a/src/msdos.c b/src/msdos.c
index bcb7fbe75e0..30435820d9e 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -520,8 +520,8 @@ dos_set_window_size (int *rows, int *cols)
520 520
521 /* If the user specified a special video mode for these dimensions, 521 /* If the user specified a special video mode for these dimensions,
522 use that mode. */ 522 use that mode. */
523 video_mode 523 video_mode
524 = Fsymbol_value (Fintern_soft (make_formatted_string 524 = Fsymbol_value (Fintern_soft (make_formatted_string
525 (video_name, "screen-dimensions-%dx%d", 525 (video_name, "screen-dimensions-%dx%d",
526 *rows, *cols), Qnil)); 526 *rows, *cols), Qnil));
527 527
@@ -1801,7 +1801,7 @@ internal_terminal_init (void)
1801 } 1801 }
1802 1802
1803 tty = FRAME_TTY (sf); 1803 tty = FRAME_TTY (sf);
1804 KSET (current_kboard, Vwindow_system, Qpc); 1804 kset_window_system (current_kboard, Qpc);
1805 sf->output_method = output_msdos_raw; 1805 sf->output_method = output_msdos_raw;
1806 if (init_needed) 1806 if (init_needed)
1807 { 1807 {
diff --git a/src/nsfns.m b/src/nsfns.m
index 1b39f0257a5..e8b5d22077a 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -447,7 +447,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
447 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) 447 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
448 return; 448 return;
449 449
450 FSET (f, icon_name, arg); 450 fset_icon_name (f, arg);
451 451
452 if (NILP (arg)) 452 if (NILP (arg))
453 { 453 {
@@ -539,7 +539,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit)
539 if (! NILP (Fstring_equal (name, f->name))) 539 if (! NILP (Fstring_equal (name, f->name)))
540 return; 540 return;
541 541
542 FSET (f, name, name); 542 fset_name (f, name);
543 543
544 /* title overrides explicit name */ 544 /* title overrides explicit name */
545 if (! NILP (f->title)) 545 if (! NILP (f->title))
@@ -590,7 +590,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
590 590
591 update_mode_lines = 1; 591 update_mode_lines = 1;
592 592
593 FSET (f, title, name); 593 fset_title (f, name);
594 594
595 if (NILP (name)) 595 if (NILP (name))
596 name = f->name; 596 name = f->name;
@@ -676,7 +676,7 @@ ns_set_name_as_filename (struct frame *f)
676 676
677 [[view window] setRepresentedFilename: fstr]; 677 [[view window] setRepresentedFilename: fstr];
678 [[view window] setTitle: str]; 678 [[view window] setTitle: str];
679 FSET (f, name, name); 679 fset_name (f, name);
680 } 680 }
681 681
682 [pool release]; 682 [pool release];
@@ -1204,11 +1204,11 @@ This function is an internal primitive--use `make-frame' instead. */)
1204 1204
1205 FRAME_FONTSET (f) = -1; 1205 FRAME_FONTSET (f) = -1;
1206 1206
1207 FSET (f, icon_name, x_get_arg (dpyinfo, parms, Qicon_name, 1207 fset_icon_name (f, x_get_arg (dpyinfo, parms, Qicon_name,
1208 "iconName", "Title", 1208 "iconName", "Title",
1209 RES_TYPE_STRING)); 1209 RES_TYPE_STRING));
1210 if (! STRINGP (f->icon_name)) 1210 if (! STRINGP (f->icon_name))
1211 FSET (f, icon_name, Qnil); 1211 fset_icon_name (f, Qnil);
1212 1212
1213 FRAME_NS_DISPLAY_INFO (f) = dpyinfo; 1213 FRAME_NS_DISPLAY_INFO (f) = dpyinfo;
1214 1214
@@ -1231,12 +1231,12 @@ This function is an internal primitive--use `make-frame' instead. */)
1231 be set. */ 1231 be set. */
1232 if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name)) 1232 if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name))
1233 { 1233 {
1234 FSET (f, name, build_string ([ns_app_name UTF8String])); 1234 fset_name (f, build_string ([ns_app_name UTF8String]));
1235 f->explicit_name = 0; 1235 f->explicit_name = 0;
1236 } 1236 }
1237 else 1237 else
1238 { 1238 {
1239 FSET (f, name, name); 1239 fset_name (f, name);
1240 f->explicit_name = 1; 1240 f->explicit_name = 1;
1241 specbind (Qx_resource_name, name); 1241 specbind (Qx_resource_name, name);
1242 } 1242 }
@@ -1391,13 +1391,13 @@ This function is an internal primitive--use `make-frame' instead. */)
1391 if (FRAME_HAS_MINIBUF_P (f) 1391 if (FRAME_HAS_MINIBUF_P (f)
1392 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 1392 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
1393 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 1393 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
1394 KSET (kb, Vdefault_minibuffer_frame, frame); 1394 kset_default_minibuffer_frame (kb, frame);
1395 1395
1396 /* All remaining specified parameters, which have not been "used" 1396 /* All remaining specified parameters, which have not been "used"
1397 by x_get_arg and friends, now go in the misc. alist of the frame. */ 1397 by x_get_arg and friends, now go in the misc. alist of the frame. */
1398 for (tem = parms; CONSP (tem); tem = XCDR (tem)) 1398 for (tem = parms; CONSP (tem); tem = XCDR (tem))
1399 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 1399 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
1400 FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); 1400 fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
1401 1401
1402 UNGCPRO; 1402 UNGCPRO;
1403 1403
diff --git a/src/nsfont.m b/src/nsfont.m
index 6f9294e082a..1f8d28cd238 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -236,27 +236,62 @@ ns_fallback_entity (void)
236} 236}
237 237
238 238
239/* Utility: get width of a char c in screen font sfont */ 239/* Utility: get width of a char c in screen font SFONT */
240static float 240static float
241ns_char_width (NSFont *sfont, int c) 241ns_char_width (NSFont *sfont, int c)
242{ 242{
243 float w; 243 float w = -1.0;
244 NSString *cstr = [NSString stringWithFormat: @"%c", c]; 244 NSString *cstr = [NSString stringWithFormat: @"%c", c];
245
245#ifdef NS_IMPL_COCOA 246#ifdef NS_IMPL_COCOA
246 NSGlyph glyph = [sfont glyphWithName: cstr]; 247 NSGlyph glyph = [sfont glyphWithName: cstr];
247 if (glyph) 248 if (glyph)
248 { 249 w = [sfont advancementForGlyph: glyph].width;
249 float w = [sfont advancementForGlyph: glyph].width;
250 if (w >= 1.5)
251 return w;
252 }
253#endif 250#endif
251
252 if (w < 0.0)
254 { 253 {
255 NSDictionary *attrsDictionary = 254 NSDictionary *attrsDictionary =
256 [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName]; 255 [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName];
257 w = [cstr sizeWithAttributes: attrsDictionary].width; 256 w = [cstr sizeWithAttributes: attrsDictionary].width;
258 } 257 }
259 return max (w, 2.0); 258
259 return max (w, 1.0);
260}
261
262/* Return average width over ASCII printable characters for SFONT. */
263
264static NSString *ascii_printable;
265
266static int
267ns_ascii_average_width (NSFont *sfont)
268{
269 float w = -1.0;
270
271 if (!ascii_printable)
272 {
273 char chars[95];
274 int ch;
275 for (ch = 0; ch < 95; ch++)
276 chars[ch] = ' ' + ch;
277
278 ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars];
279 }
280
281#ifdef NS_IMPL_COCOA
282 NSGlyph glyph = [sfont glyphWithName: ascii_printable];
283 if (glyph)
284 w = [sfont advancementForGlyph: glyph].width;
285#endif
286
287 if (w < 0.0)
288 {
289 NSDictionary *attrsDictionary =
290 [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName];
291 w = [ascii_printable sizeWithAttributes: attrsDictionary].width;
292 }
293
294 return lrint (w / 95.0);
260} 295}
261 296
262 297
@@ -885,10 +920,11 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
885 /* set up metrics portion of font struct */ 920 /* set up metrics portion of font struct */
886 font->ascent = lrint([sfont ascender]); 921 font->ascent = lrint([sfont ascender]);
887 font->descent = -lrint(floor(adjusted_descender)); 922 font->descent = -lrint(floor(adjusted_descender));
888 font->min_width = ns_char_width(sfont, '|');
889 font->space_width = lrint (ns_char_width (sfont, ' ')); 923 font->space_width = lrint (ns_char_width (sfont, ' '));
890 font->average_width = lrint (font_info->width);
891 font->max_width = lrint (font_info->max_bounds.width); 924 font->max_width = lrint (font_info->max_bounds.width);
925 font->min_width = font->space_width; /* Approximate. */
926 font->average_width = ns_ascii_average_width (sfont);
927
892 font->height = lrint (font_info->height); 928 font->height = lrint (font_info->height);
893 font->underline_position = lrint (font_info->underpos); 929 font->underline_position = lrint (font_info->underpos);
894 font->underline_thickness = lrint (font_info->underwidth); 930 font->underline_thickness = lrint (font_info->underwidth);
@@ -1492,4 +1528,6 @@ syms_of_nsfont (void)
1492 DEFSYM (Qmedium, "medium"); 1528 DEFSYM (Qmedium, "medium");
1493 DEFVAR_LISP ("ns-reg-to-script", Vns_reg_to_script, 1529 DEFVAR_LISP ("ns-reg-to-script", Vns_reg_to_script,
1494 doc: /* Internal use: maps font registry to Unicode script. */); 1530 doc: /* Internal use: maps font registry to Unicode script. */);
1531
1532 ascii_printable = NULL;
1495} 1533}
diff --git a/src/nsimage.m b/src/nsimage.m
index 1479294948b..8a8a3ddaae4 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -302,7 +302,7 @@ static EmacsImage *ImageList = nil;
302 [bmRep release]; 302 [bmRep release];
303 return nil; 303 return nil;
304 } 304 }
305#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) 305#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10)
306 s1 = *s++; 306 s1 = *s++;
307 s2 = *s++; 307 s2 = *s++;
308 c = hexchar (s1) * 0x10 + hexchar (s2); 308 c = hexchar (s1) * 0x10 + hexchar (s2);
@@ -501,4 +501,3 @@ static EmacsImage *ImageList = nil;
501} 501}
502 502
503@end 503@end
504
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 657b9306942..e8a0b43a01b 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -214,7 +214,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
214 if (! NILP (Vlucid_menu_bar_dirty_flag)) 214 if (! NILP (Vlucid_menu_bar_dirty_flag))
215 call0 (Qrecompute_lucid_menubar); 215 call0 (Qrecompute_lucid_menubar);
216 safe_run_hooks (Qmenu_bar_update_hook); 216 safe_run_hooks (Qmenu_bar_update_hook);
217 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 217 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
218 218
219 /* Now ready to go */ 219 /* Now ready to go */
220 items = FRAME_MENU_BAR_ITEMS (f); 220 items = FRAME_MENU_BAR_ITEMS (f);
@@ -340,7 +340,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
340 } 340 }
341 /* The menu items are different, so store them in the frame */ 341 /* The menu items are different, so store them in the frame */
342 /* FIXME: this is not correct for single-submenu case */ 342 /* FIXME: this is not correct for single-submenu case */
343 FSET (f, menu_bar_vector, menu_items); 343 fset_menu_bar_vector (f, menu_items);
344 f->menu_bar_items_used = menu_items_used; 344 f->menu_bar_items_used = menu_items_used;
345 345
346 /* Calls restore_menu_items, etc., as they were outside */ 346 /* Calls restore_menu_items, etc., as they were outside */
diff --git a/src/nsterm.h b/src/nsterm.h
index 94984b3d35e..54f4a4ec89e 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -450,7 +450,10 @@ struct nsfont_info
450 struct font font; 450 struct font font;
451 451
452 char *name; /* PostScript name, uniquely identifies on NS systems */ 452 char *name; /* PostScript name, uniquely identifies on NS systems */
453 float width; /* this and following metrics stored as float rather than int */ 453
454 /* The following metrics are stored as float rather than int. */
455
456 float width; /* Maximum advance for the font. */
454 float height; 457 float height;
455 float underpos; 458 float underpos;
456 float underwidth; 459 float underwidth;
diff --git a/src/nsterm.m b/src/nsterm.m
index 76e6ee8fb40..3ab9358467a 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -36,6 +36,8 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
36#include <signal.h> 36#include <signal.h>
37#include <unistd.h> 37#include <unistd.h>
38#include <setjmp.h> 38#include <setjmp.h>
39
40#include <c-ctype.h>
39#include <c-strcase.h> 41#include <c-strcase.h>
40#include <ftoastr.h> 42#include <ftoastr.h>
41 43
@@ -1030,7 +1032,7 @@ ns_frame_rehighlight (struct frame *frame)
1030 : dpyinfo->x_focus_frame); 1032 : dpyinfo->x_focus_frame);
1031 if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame)) 1033 if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame))
1032 { 1034 {
1033 FSET (dpyinfo->x_focus_frame, focus_frame, Qnil); 1035 fset_focus_frame (dpyinfo->x_focus_frame, Qnil);
1034 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; 1036 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame;
1035 } 1037 }
1036 } 1038 }
@@ -3696,7 +3698,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3696 { 3698 {
3697 bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); 3699 bar = XNS_SCROLL_BAR (window->vertical_scroll_bar);
3698 [bar removeFromSuperview]; 3700 [bar removeFromSuperview];
3699 WSET (window, vertical_scroll_bar, Qnil); 3701 wset_vertical_scroll_bar (window, Qnil);
3700 } 3702 }
3701 ns_clear_frame_area (f, sb_left, top, width, height); 3703 ns_clear_frame_area (f, sb_left, top, width, height);
3702 UNBLOCK_INPUT; 3704 UNBLOCK_INPUT;
@@ -3707,7 +3709,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3707 { 3709 {
3708 ns_clear_frame_area (f, sb_left, top, width, height); 3710 ns_clear_frame_area (f, sb_left, top, width, height);
3709 bar = [[EmacsScroller alloc] initFrame: r window: win]; 3711 bar = [[EmacsScroller alloc] initFrame: r window: win];
3710 WSET (window, vertical_scroll_bar, make_save_value (bar, 0)); 3712 wset_vertical_scroll_bar (window, make_save_value (bar, 0));
3711 } 3713 }
3712 else 3714 else
3713 { 3715 {
@@ -4091,7 +4093,7 @@ ns_term_init (Lisp_Object display_name)
4091 4093
4092 terminal->kboard = xmalloc (sizeof *terminal->kboard); 4094 terminal->kboard = xmalloc (sizeof *terminal->kboard);
4093 init_kboard (terminal->kboard); 4095 init_kboard (terminal->kboard);
4094 KSET (terminal->kboard, Vwindow_system, Qns); 4096 kset_window_system (terminal->kboard, Qns);
4095 terminal->kboard->next_kboard = all_kboards; 4097 terminal->kboard->next_kboard = all_kboards;
4096 all_kboards = terminal->kboard; 4098 all_kboards = terminal->kboard;
4097 /* Don't let the initial kboard remain current longer than necessary. 4099 /* Don't let the initial kboard remain current longer than necessary.
@@ -6386,7 +6388,7 @@ not_in_argv (NSString *arg)
6386{ 6388{
6387 NSTRACE (EmacsScroller_dealloc); 6389 NSTRACE (EmacsScroller_dealloc);
6388 if (!NILP (win)) 6390 if (!NILP (win))
6389 WSET (XWINDOW (win), vertical_scroll_bar, Qnil); 6391 wset_vertical_scroll_bar (XWINDOW (win), Qnil);
6390 [super dealloc]; 6392 [super dealloc];
6391} 6393}
6392 6394
@@ -6785,20 +6787,20 @@ ns_xlfd_to_fontname (const char *xlfd)
6785 6787
6786 /* undo hack in ns_fontname_to_xlfd, converting '$' to '-', '_' to ' ' 6788 /* undo hack in ns_fontname_to_xlfd, converting '$' to '-', '_' to ' '
6787 also uppercase after '-' or ' ' */ 6789 also uppercase after '-' or ' ' */
6788 name[0] = toupper (name[0]); 6790 name[0] = c_toupper (name[0]);
6789 for (len =strlen (name), i =0; i<len; i++) 6791 for (len =strlen (name), i =0; i<len; i++)
6790 { 6792 {
6791 if (name[i] == '$') 6793 if (name[i] == '$')
6792 { 6794 {
6793 name[i] = '-'; 6795 name[i] = '-';
6794 if (i+1<len) 6796 if (i+1<len)
6795 name[i+1] = toupper (name[i+1]); 6797 name[i+1] = c_toupper (name[i+1]);
6796 } 6798 }
6797 else if (name[i] == '_') 6799 else if (name[i] == '_')
6798 { 6800 {
6799 name[i] = ' '; 6801 name[i] = ' ';
6800 if (i+1<len) 6802 if (i+1<len)
6801 name[i+1] = toupper (name[i+1]); 6803 name[i+1] = c_toupper (name[i+1]);
6802 } 6804 }
6803 } 6805 }
6804/*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */ 6806/*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */
diff --git a/src/print.c b/src/print.c
index 1546ab3e229..e7da5a25643 100644
--- a/src/print.c
+++ b/src/print.c
@@ -496,14 +496,14 @@ temp_output_buffer_setup (const char *bufname)
496 496
497 Fkill_all_local_variables (); 497 Fkill_all_local_variables ();
498 delete_all_overlays (current_buffer); 498 delete_all_overlays (current_buffer);
499 BSET (current_buffer, directory, BVAR (old, directory)); 499 bset_directory (current_buffer, BVAR (old, directory));
500 BSET (current_buffer, read_only, Qnil); 500 bset_read_only (current_buffer, Qnil);
501 BSET (current_buffer, filename, Qnil); 501 bset_filename (current_buffer, Qnil);
502 BSET (current_buffer, undo_list, Qt); 502 bset_undo_list (current_buffer, Qt);
503 eassert (current_buffer->overlays_before == NULL); 503 eassert (current_buffer->overlays_before == NULL);
504 eassert (current_buffer->overlays_after == NULL); 504 eassert (current_buffer->overlays_after == NULL);
505 BSET (current_buffer, enable_multibyte_characters, 505 bset_enable_multibyte_characters
506 BVAR (&buffer_defaults, enable_multibyte_characters)); 506 (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters));
507 specbind (Qinhibit_read_only, Qt); 507 specbind (Qinhibit_read_only, Qt);
508 specbind (Qinhibit_modification_hooks, Qt); 508 specbind (Qinhibit_modification_hooks, Qt);
509 Ferase_buffer (); 509 Ferase_buffer ();
@@ -1196,7 +1196,7 @@ print_preprocess (Lisp_Object obj)
1196 { 1196 {
1197 case Lisp_String: 1197 case Lisp_String:
1198 /* A string may have text properties, which can be circular. */ 1198 /* A string may have text properties, which can be circular. */
1199 traverse_intervals_noorder (string_get_intervals (obj), 1199 traverse_intervals_noorder (string_intervals (obj),
1200 print_preprocess_string, Qnil); 1200 print_preprocess_string, Qnil);
1201 break; 1201 break;
1202 1202
@@ -1299,7 +1299,7 @@ static Lisp_Object
1299print_prune_string_charset (Lisp_Object string) 1299print_prune_string_charset (Lisp_Object string)
1300{ 1300{
1301 print_check_string_result = 0; 1301 print_check_string_result = 0;
1302 traverse_intervals (string_get_intervals (string), 0, 1302 traverse_intervals (string_intervals (string), 0,
1303 print_check_string_charset_prop, string); 1303 print_check_string_charset_prop, string);
1304 if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) 1304 if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND))
1305 { 1305 {
@@ -1410,7 +1410,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1410 if (! EQ (Vprint_charset_text_property, Qt)) 1410 if (! EQ (Vprint_charset_text_property, Qt))
1411 obj = print_prune_string_charset (obj); 1411 obj = print_prune_string_charset (obj);
1412 1412
1413 if (string_get_intervals (obj)) 1413 if (string_intervals (obj))
1414 { 1414 {
1415 PRINTCHAR ('#'); 1415 PRINTCHAR ('#');
1416 PRINTCHAR ('('); 1416 PRINTCHAR ('(');
@@ -1501,9 +1501,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1501 } 1501 }
1502 PRINTCHAR ('\"'); 1502 PRINTCHAR ('\"');
1503 1503
1504 if (string_get_intervals (obj)) 1504 if (string_intervals (obj))
1505 { 1505 {
1506 traverse_intervals (string_get_intervals (obj), 1506 traverse_intervals (string_intervals (obj),
1507 0, print_interval, printcharfun); 1507 0, print_interval, printcharfun);
1508 PRINTCHAR (')'); 1508 PRINTCHAR (')');
1509 } 1509 }
diff --git a/src/process.c b/src/process.c
index a43655e4da8..ea463cd9187 100644
--- a/src/process.c
+++ b/src/process.c
@@ -20,6 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21 21
22#include <config.h> 22#include <config.h>
23
24#define PROCESS_INLINE EXTERN_INLINE
25
23#include <signal.h> 26#include <signal.h>
24#include <stdio.h> 27#include <stdio.h>
25#include <errno.h> 28#include <errno.h>
@@ -334,6 +337,88 @@ static struct sockaddr_and_len {
334/* Maximum number of bytes to send to a pty without an eof. */ 337/* Maximum number of bytes to send to a pty without an eof. */
335static int pty_max_bytes; 338static int pty_max_bytes;
336 339
340/* These setters are used only in this file, so they can be private. */
341static inline void
342pset_buffer (struct Lisp_Process *p, Lisp_Object val)
343{
344 p->buffer = val;
345}
346static inline void
347pset_command (struct Lisp_Process *p, Lisp_Object val)
348{
349 p->command = val;
350}
351static inline void
352pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val)
353{
354 p->decode_coding_system = val;
355}
356static inline void
357pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val)
358{
359 p->decoding_buf = val;
360}
361static inline void
362pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val)
363{
364 p->encode_coding_system = val;
365}
366static inline void
367pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val)
368{
369 p->encoding_buf = val;
370}
371static inline void
372pset_filter (struct Lisp_Process *p, Lisp_Object val)
373{
374 p->filter = val;
375}
376static inline void
377pset_log (struct Lisp_Process *p, Lisp_Object val)
378{
379 p->log = val;
380}
381static inline void
382pset_mark (struct Lisp_Process *p, Lisp_Object val)
383{
384 p->mark = val;
385}
386static inline void
387pset_name (struct Lisp_Process *p, Lisp_Object val)
388{
389 p->name = val;
390}
391static inline void
392pset_plist (struct Lisp_Process *p, Lisp_Object val)
393{
394 p->plist = val;
395}
396static inline void
397pset_sentinel (struct Lisp_Process *p, Lisp_Object val)
398{
399 p->sentinel = val;
400}
401static inline void
402pset_status (struct Lisp_Process *p, Lisp_Object val)
403{
404 p->status = val;
405}
406static inline void
407pset_tty_name (struct Lisp_Process *p, Lisp_Object val)
408{
409 p->tty_name = val;
410}
411static inline void
412pset_type (struct Lisp_Process *p, Lisp_Object val)
413{
414 p->type = val;
415}
416static inline void
417pset_write_queue (struct Lisp_Process *p, Lisp_Object val)
418{
419 p->write_queue = val;
420}
421
337 422
338 423
339static struct fd_callback_data 424static struct fd_callback_data
@@ -428,7 +513,7 @@ static void
428update_status (struct Lisp_Process *p) 513update_status (struct Lisp_Process *p)
429{ 514{
430 eassert (p->raw_status_new); 515 eassert (p->raw_status_new);
431 PSET (p, status, status_convert (p->raw_status)); 516 pset_status (p, status_convert (p->raw_status));
432 p->raw_status_new = 0; 517 p->raw_status_new = 0;
433} 518}
434 519
@@ -626,8 +711,8 @@ make_process (Lisp_Object name)
626 p = allocate_process (); 711 p = allocate_process ();
627 /* Initialize Lisp data. Note that allocate_process initializes all 712 /* Initialize Lisp data. Note that allocate_process initializes all
628 Lisp data to nil, so do it only for slots which should not be nil. */ 713 Lisp data to nil, so do it only for slots which should not be nil. */
629 PSET (p, status, Qrun); 714 pset_status (p, Qrun);
630 PSET (p, mark, Fmake_marker ()); 715 pset_mark (p, Fmake_marker ());
631 716
632 /* Initialize non-Lisp data. Note that allocate_process zeroes out all 717 /* Initialize non-Lisp data. Note that allocate_process zeroes out all
633 non-Lisp data, so do it only for slots which should not be zero. */ 718 non-Lisp data, so do it only for slots which should not be zero. */
@@ -648,7 +733,7 @@ make_process (Lisp_Object name)
648 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); 733 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i));
649 } 734 }
650 name = name1; 735 name = name1;
651 PSET (p, name, name); 736 pset_name (p, name);
652 XSETPROCESS (val, p); 737 XSETPROCESS (val, p);
653 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); 738 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist);
654 return val; 739 return val;
@@ -745,7 +830,7 @@ nil, indicating the current buffer's process. */)
745 p->raw_status_new = 0; 830 p->raw_status_new = 0;
746 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 831 if (NETCONN1_P (p) || SERIALCONN1_P (p))
747 { 832 {
748 PSET (p, status, Fcons (Qexit, Fcons (make_number (0), Qnil))); 833 pset_status (p, Fcons (Qexit, Fcons (make_number (0), Qnil)));
749 p->tick = ++process_tick; 834 p->tick = ++process_tick;
750 status_notify (p); 835 status_notify (p);
751 redisplay_preserve_echo_area (13); 836 redisplay_preserve_echo_area (13);
@@ -774,7 +859,7 @@ nil, indicating the current buffer's process. */)
774 { 859 {
775 Fkill_process (process, Qnil); 860 Fkill_process (process, Qnil);
776 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 861 /* Do this now, since remove_process will make sigchld_handler do nothing. */
777 PSET (p, status, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil))); 862 pset_status (p, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)));
778 p->tick = ++process_tick; 863 p->tick = ++process_tick;
779 status_notify (p); 864 status_notify (p);
780 redisplay_preserve_echo_area (13); 865 redisplay_preserve_echo_area (13);
@@ -901,9 +986,9 @@ Return BUFFER. */)
901 if (!NILP (buffer)) 986 if (!NILP (buffer))
902 CHECK_BUFFER (buffer); 987 CHECK_BUFFER (buffer);
903 p = XPROCESS (process); 988 p = XPROCESS (process);
904 PSET (p, buffer, buffer); 989 pset_buffer (p, buffer);
905 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 990 if (NETCONN1_P (p) || SERIALCONN1_P (p))
906 PSET (p, childp, Fplist_put (p->childp, QCbuffer, buffer)); 991 pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer));
907 setup_process_coding_systems (process); 992 setup_process_coding_systems (process);
908 return buffer; 993 return buffer;
909} 994}
@@ -974,9 +1059,9 @@ The string argument is normally a multibyte string, except:
974 } 1059 }
975 } 1060 }
976 1061
977 PSET (p, filter, filter); 1062 pset_filter (p, filter);
978 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1063 if (NETCONN1_P (p) || SERIALCONN1_P (p))
979 PSET (p, childp, Fplist_put (p->childp, QCfilter, filter)); 1064 pset_childp (p, Fplist_put (p->childp, QCfilter, filter));
980 setup_process_coding_systems (process); 1065 setup_process_coding_systems (process);
981 return filter; 1066 return filter;
982} 1067}
@@ -1003,9 +1088,9 @@ It gets two arguments: the process, and a string describing the change. */)
1003 CHECK_PROCESS (process); 1088 CHECK_PROCESS (process);
1004 p = XPROCESS (process); 1089 p = XPROCESS (process);
1005 1090
1006 PSET (p, sentinel, sentinel); 1091 pset_sentinel (p, sentinel);
1007 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1092 if (NETCONN1_P (p) || SERIALCONN1_P (p))
1008 PSET (p, childp, Fplist_put (p->childp, QCsentinel, sentinel)); 1093 pset_childp (p, Fplist_put (p->childp, QCsentinel, sentinel));
1009 return sentinel; 1094 return sentinel;
1010} 1095}
1011 1096
@@ -1138,7 +1223,7 @@ DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
1138 CHECK_PROCESS (process); 1223 CHECK_PROCESS (process);
1139 CHECK_LIST (plist); 1224 CHECK_LIST (plist);
1140 1225
1141 PSET (XPROCESS (process), plist, plist); 1226 pset_plist (XPROCESS (process), plist);
1142 return plist; 1227 return plist;
1143} 1228}
1144 1229
@@ -1324,18 +1409,18 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1324 itself; it's all taken care of here. */ 1409 itself; it's all taken care of here. */
1325 record_unwind_protect (start_process_unwind, proc); 1410 record_unwind_protect (start_process_unwind, proc);
1326 1411
1327 PSET (XPROCESS (proc), childp, Qt); 1412 pset_childp (XPROCESS (proc), Qt);
1328 PSET (XPROCESS (proc), plist, Qnil); 1413 pset_plist (XPROCESS (proc), Qnil);
1329 PSET (XPROCESS (proc), type, Qreal); 1414 pset_type (XPROCESS (proc), Qreal);
1330 PSET (XPROCESS (proc), buffer, buffer); 1415 pset_buffer (XPROCESS (proc), buffer);
1331 PSET (XPROCESS (proc), sentinel, Qnil); 1416 pset_sentinel (XPROCESS (proc), Qnil);
1332 PSET (XPROCESS (proc), filter, Qnil); 1417 pset_filter (XPROCESS (proc), Qnil);
1333 PSET (XPROCESS (proc), command, Flist (nargs - 2, args + 2)); 1418 pset_command (XPROCESS (proc), Flist (nargs - 2, args + 2));
1334 1419
1335#ifdef HAVE_GNUTLS 1420#ifdef HAVE_GNUTLS
1336 /* AKA GNUTLS_INITSTAGE(proc). */ 1421 /* AKA GNUTLS_INITSTAGE(proc). */
1337 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; 1422 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY;
1338 PSET (XPROCESS (proc), gnutls_cred_type, Qnil); 1423 pset_gnutls_cred_type (XPROCESS (proc), Qnil);
1339#endif 1424#endif
1340 1425
1341#ifdef ADAPTIVE_READ_BUFFERING 1426#ifdef ADAPTIVE_READ_BUFFERING
@@ -1375,7 +1460,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1375 else if (CONSP (Vdefault_process_coding_system)) 1460 else if (CONSP (Vdefault_process_coding_system))
1376 val = XCAR (Vdefault_process_coding_system); 1461 val = XCAR (Vdefault_process_coding_system);
1377 } 1462 }
1378 PSET (XPROCESS (proc), decode_coding_system, val); 1463 pset_decode_coding_system (XPROCESS (proc), val);
1379 1464
1380 val = Vcoding_system_for_write; 1465 val = Vcoding_system_for_write;
1381 if (NILP (val)) 1466 if (NILP (val))
@@ -1395,7 +1480,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1395 else if (CONSP (Vdefault_process_coding_system)) 1480 else if (CONSP (Vdefault_process_coding_system))
1396 val = XCDR (Vdefault_process_coding_system); 1481 val = XCDR (Vdefault_process_coding_system);
1397 } 1482 }
1398 PSET (XPROCESS (proc), encode_coding_system, val); 1483 pset_encode_coding_system (XPROCESS (proc), val);
1399 /* Note: At this moment, the above coding system may leave 1484 /* Note: At this moment, the above coding system may leave
1400 text-conversion or eol-conversion unspecified. They will be 1485 text-conversion or eol-conversion unspecified. They will be
1401 decided after we read output from the process and decode it by 1486 decided after we read output from the process and decode it by
@@ -1404,9 +1489,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1404 } 1489 }
1405 1490
1406 1491
1407 PSET (XPROCESS (proc), decoding_buf, empty_unibyte_string); 1492 pset_decoding_buf (XPROCESS (proc), empty_unibyte_string);
1408 XPROCESS (proc)->decoding_carryover = 0; 1493 XPROCESS (proc)->decoding_carryover = 0;
1409 PSET (XPROCESS (proc), encoding_buf, empty_unibyte_string); 1494 pset_encoding_buf (XPROCESS (proc), empty_unibyte_string);
1410 1495
1411 XPROCESS (proc)->inherit_coding_system_flag 1496 XPROCESS (proc)->inherit_coding_system_flag
1412 = !(NILP (buffer) || !inherit_process_coding_system); 1497 = !(NILP (buffer) || !inherit_process_coding_system);
@@ -1628,7 +1713,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1628 more portable (see USG_SUBTTY_WORKS above). */ 1713 more portable (see USG_SUBTTY_WORKS above). */
1629 1714
1630 XPROCESS (process)->pty_flag = pty_flag; 1715 XPROCESS (process)->pty_flag = pty_flag;
1631 PSET (XPROCESS (process), status, Qrun); 1716 pset_status (XPROCESS (process), Qrun);
1632 1717
1633 /* Delay interrupts until we have a chance to store 1718 /* Delay interrupts until we have a chance to store
1634 the new fork's pid in its process structure */ 1719 the new fork's pid in its process structure */
@@ -1867,10 +1952,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1867 1952
1868#ifdef HAVE_PTYS 1953#ifdef HAVE_PTYS
1869 if (pty_flag) 1954 if (pty_flag)
1870 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 1955 pset_tty_name (XPROCESS (process), build_string (pty_name));
1871 else 1956 else
1872#endif 1957#endif
1873 PSET (XPROCESS (process), tty_name, Qnil); 1958 pset_tty_name (XPROCESS (process), Qnil);
1874 1959
1875#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1960#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
1876 /* Wait for child_setup to complete in case that vfork is 1961 /* Wait for child_setup to complete in case that vfork is
@@ -1965,7 +2050,7 @@ create_pty (Lisp_Object process)
1965 more portable (see USG_SUBTTY_WORKS above). */ 2050 more portable (see USG_SUBTTY_WORKS above). */
1966 2051
1967 XPROCESS (process)->pty_flag = pty_flag; 2052 XPROCESS (process)->pty_flag = pty_flag;
1968 PSET (XPROCESS (process), status, Qrun); 2053 pset_status (XPROCESS (process), Qrun);
1969 setup_process_coding_systems (process); 2054 setup_process_coding_systems (process);
1970 2055
1971 FD_SET (inchannel, &input_wait_mask); 2056 FD_SET (inchannel, &input_wait_mask);
@@ -1976,10 +2061,10 @@ create_pty (Lisp_Object process)
1976 XPROCESS (process)->pid = -2; 2061 XPROCESS (process)->pid = -2;
1977#ifdef HAVE_PTYS 2062#ifdef HAVE_PTYS
1978 if (pty_flag) 2063 if (pty_flag)
1979 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 2064 pset_tty_name (XPROCESS (process), build_string (pty_name));
1980 else 2065 else
1981#endif 2066#endif
1982 PSET (XPROCESS (process), tty_name, Qnil); 2067 pset_tty_name (XPROCESS (process), Qnil);
1983} 2068}
1984 2069
1985 2070
@@ -2368,7 +2453,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2368 2453
2369 if (set_socket_option (s, option, value)) 2454 if (set_socket_option (s, option, value))
2370 { 2455 {
2371 PSET (p, childp, Fplist_put (p->childp, option, value)); 2456 pset_childp (p, Fplist_put (p->childp, option, value));
2372 return Qt; 2457 return Qt;
2373 } 2458 }
2374 2459
@@ -2601,18 +2686,18 @@ usage: (make-serial-process &rest ARGS) */)
2601 if (NILP (buffer)) 2686 if (NILP (buffer))
2602 buffer = name; 2687 buffer = name;
2603 buffer = Fget_buffer_create (buffer); 2688 buffer = Fget_buffer_create (buffer);
2604 PSET (p, buffer, buffer); 2689 pset_buffer (p, buffer);
2605 2690
2606 PSET (p, childp, contact); 2691 pset_childp (p, contact);
2607 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 2692 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
2608 PSET (p, type, Qserial); 2693 pset_type (p, Qserial);
2609 PSET (p, sentinel, Fplist_get (contact, QCsentinel)); 2694 pset_sentinel (p, Fplist_get (contact, QCsentinel));
2610 PSET (p, filter, Fplist_get (contact, QCfilter)); 2695 pset_filter (p, Fplist_get (contact, QCfilter));
2611 PSET (p, log, Qnil); 2696 pset_log (p, Qnil);
2612 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 2697 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
2613 p->kill_without_query = 1; 2698 p->kill_without_query = 1;
2614 if (tem = Fplist_get (contact, QCstop), !NILP (tem)) 2699 if (tem = Fplist_get (contact, QCstop), !NILP (tem))
2615 PSET (p, command, Qt); 2700 pset_command (p, Qt);
2616 p->pty_flag = 0; 2701 p->pty_flag = 0;
2617 2702
2618 if (!EQ (p->command, Qt)) 2703 if (!EQ (p->command, Qt))
@@ -2644,7 +2729,7 @@ usage: (make-serial-process &rest ARGS) */)
2644 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2729 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2645 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2730 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2646 val = Qnil; 2731 val = Qnil;
2647 PSET (p, decode_coding_system, val); 2732 pset_decode_coding_system (p, val);
2648 2733
2649 val = Qnil; 2734 val = Qnil;
2650 if (!NILP (tem)) 2735 if (!NILP (tem))
@@ -2658,12 +2743,12 @@ usage: (make-serial-process &rest ARGS) */)
2658 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2743 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2659 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2744 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2660 val = Qnil; 2745 val = Qnil;
2661 PSET (p, encode_coding_system, val); 2746 pset_encode_coding_system (p, val);
2662 2747
2663 setup_process_coding_systems (proc); 2748 setup_process_coding_systems (proc);
2664 PSET (p, decoding_buf, empty_unibyte_string); 2749 pset_decoding_buf (p, empty_unibyte_string);
2665 p->decoding_carryover = 0; 2750 p->decoding_carryover = 0;
2666 PSET (p, encoding_buf, empty_unibyte_string); 2751 pset_encoding_buf (p, empty_unibyte_string);
2667 p->inherit_coding_system_flag 2752 p->inherit_coding_system_flag
2668 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 2753 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
2669 2754
@@ -3400,23 +3485,23 @@ usage: (make-network-process &rest ARGS) */)
3400 3485
3401 p = XPROCESS (proc); 3486 p = XPROCESS (proc);
3402 3487
3403 PSET (p, childp, contact); 3488 pset_childp (p, contact);
3404 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 3489 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
3405 PSET (p, type, Qnetwork); 3490 pset_type (p, Qnetwork);
3406 3491
3407 PSET (p, buffer, buffer); 3492 pset_buffer (p, buffer);
3408 PSET (p, sentinel, sentinel); 3493 pset_sentinel (p, sentinel);
3409 PSET (p, filter, filter); 3494 pset_filter (p, filter);
3410 PSET (p, log, Fplist_get (contact, QClog)); 3495 pset_log (p, Fplist_get (contact, QClog));
3411 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3496 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3412 p->kill_without_query = 1; 3497 p->kill_without_query = 1;
3413 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3498 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3414 PSET (p, command, Qt); 3499 pset_command (p, Qt);
3415 p->pid = 0; 3500 p->pid = 0;
3416 p->infd = inch; 3501 p->infd = inch;
3417 p->outfd = outch; 3502 p->outfd = outch;
3418 if (is_server && socktype != SOCK_DGRAM) 3503 if (is_server && socktype != SOCK_DGRAM)
3419 PSET (p, status, Qlisten); 3504 pset_status (p, Qlisten);
3420 3505
3421 /* Make the process marker point into the process buffer (if any). */ 3506 /* Make the process marker point into the process buffer (if any). */
3422 if (BUFFERP (buffer)) 3507 if (BUFFERP (buffer))
@@ -3430,7 +3515,7 @@ usage: (make-network-process &rest ARGS) */)
3430 /* We may get here if connect did succeed immediately. However, 3515 /* We may get here if connect did succeed immediately. However,
3431 in that case, we still need to signal this like a non-blocking 3516 in that case, we still need to signal this like a non-blocking
3432 connection. */ 3517 connection. */
3433 PSET (p, status, Qconnect); 3518 pset_status (p, Qconnect);
3434 if (!FD_ISSET (inch, &connect_wait_mask)) 3519 if (!FD_ISSET (inch, &connect_wait_mask))
3435 { 3520 {
3436 FD_SET (inch, &connect_wait_mask); 3521 FD_SET (inch, &connect_wait_mask);
@@ -3497,7 +3582,7 @@ usage: (make-network-process &rest ARGS) */)
3497 else 3582 else
3498 val = Qnil; 3583 val = Qnil;
3499 } 3584 }
3500 PSET (p, decode_coding_system, val); 3585 pset_decode_coding_system (p, val);
3501 3586
3502 if (!NILP (tem)) 3587 if (!NILP (tem))
3503 { 3588 {
@@ -3531,13 +3616,13 @@ usage: (make-network-process &rest ARGS) */)
3531 else 3616 else
3532 val = Qnil; 3617 val = Qnil;
3533 } 3618 }
3534 PSET (p, encode_coding_system, val); 3619 pset_encode_coding_system (p, val);
3535 } 3620 }
3536 setup_process_coding_systems (proc); 3621 setup_process_coding_systems (proc);
3537 3622
3538 PSET (p, decoding_buf, empty_unibyte_string); 3623 pset_decoding_buf (p, empty_unibyte_string);
3539 p->decoding_carryover = 0; 3624 p->decoding_carryover = 0;
3540 PSET (p, encoding_buf, empty_unibyte_string); 3625 pset_encoding_buf (p, empty_unibyte_string);
3541 3626
3542 p->inherit_coding_system_flag 3627 p->inherit_coding_system_flag
3543 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3628 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4150,18 +4235,18 @@ server_accept_connection (Lisp_Object server, int channel)
4150 conv_sockaddr_to_lisp (&saddr.sa, len)); 4235 conv_sockaddr_to_lisp (&saddr.sa, len));
4151#endif 4236#endif
4152 4237
4153 PSET (p, childp, contact); 4238 pset_childp (p, contact);
4154 PSET (p, plist, Fcopy_sequence (ps->plist)); 4239 pset_plist (p, Fcopy_sequence (ps->plist));
4155 PSET (p, type, Qnetwork); 4240 pset_type (p, Qnetwork);
4156 4241
4157 PSET (p, buffer, buffer); 4242 pset_buffer (p, buffer);
4158 PSET (p, sentinel, ps->sentinel); 4243 pset_sentinel (p, ps->sentinel);
4159 PSET (p, filter, ps->filter); 4244 pset_filter (p, ps->filter);
4160 PSET (p, command, Qnil); 4245 pset_command (p, Qnil);
4161 p->pid = 0; 4246 p->pid = 0;
4162 p->infd = s; 4247 p->infd = s;
4163 p->outfd = s; 4248 p->outfd = s;
4164 PSET (p, status, Qrun); 4249 pset_status (p, Qrun);
4165 4250
4166 /* Client processes for accepted connections are not stopped initially. */ 4251 /* Client processes for accepted connections are not stopped initially. */
4167 if (!EQ (p->filter, Qt)) 4252 if (!EQ (p->filter, Qt))
@@ -4178,13 +4263,13 @@ server_accept_connection (Lisp_Object server, int channel)
4178 of the new process should reflect the settings at the time the 4263 of the new process should reflect the settings at the time the
4179 server socket was opened; not the current settings. */ 4264 server socket was opened; not the current settings. */
4180 4265
4181 PSET (p, decode_coding_system, ps->decode_coding_system); 4266 pset_decode_coding_system (p, ps->decode_coding_system);
4182 PSET (p, encode_coding_system, ps->encode_coding_system); 4267 pset_encode_coding_system (p, ps->encode_coding_system);
4183 setup_process_coding_systems (proc); 4268 setup_process_coding_systems (proc);
4184 4269
4185 PSET (p, decoding_buf, empty_unibyte_string); 4270 pset_decoding_buf (p, empty_unibyte_string);
4186 p->decoding_carryover = 0; 4271 p->decoding_carryover = 0;
4187 PSET (p, encoding_buf, empty_unibyte_string); 4272 pset_encoding_buf (p, empty_unibyte_string);
4188 4273
4189 p->inherit_coding_system_flag 4274 p->inherit_coding_system_flag
4190 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4275 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -4889,7 +4974,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4889 waitpid() will not find the process object to 4974 waitpid() will not find the process object to
4890 delete. Do it here. */ 4975 delete. Do it here. */
4891 p->tick = ++process_tick; 4976 p->tick = ++process_tick;
4892 PSET (p, status, Qfailed); 4977 pset_status (p, Qfailed);
4893 } 4978 }
4894 else 4979 else
4895 kill (getpid (), SIGCHLD); 4980 kill (getpid (), SIGCHLD);
@@ -4909,8 +4994,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4909 if (XPROCESS (proc)->raw_status_new) 4994 if (XPROCESS (proc)->raw_status_new)
4910 update_status (XPROCESS (proc)); 4995 update_status (XPROCESS (proc));
4911 if (EQ (XPROCESS (proc)->status, Qrun)) 4996 if (EQ (XPROCESS (proc)->status, Qrun))
4912 PSET (XPROCESS (proc), status, 4997 pset_status (XPROCESS (proc),
4913 Fcons (Qexit, Fcons (make_number (256), Qnil))); 4998 list2 (Qexit, make_number (256)));
4914 } 4999 }
4915 } 5000 }
4916#ifdef NON_BLOCKING_CONNECT 5001#ifdef NON_BLOCKING_CONNECT
@@ -4958,13 +5043,12 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4958 if (xerrno) 5043 if (xerrno)
4959 { 5044 {
4960 p->tick = ++process_tick; 5045 p->tick = ++process_tick;
4961 PSET (p, status, 5046 pset_status (p, list2 (Qfailed, make_number (xerrno)));
4962 Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)));
4963 deactivate_process (proc); 5047 deactivate_process (proc);
4964 } 5048 }
4965 else 5049 else
4966 { 5050 {
4967 PSET (p, status, Qrun); 5051 pset_status (p, Qrun);
4968 /* Execute the sentinel here. If we had relied on 5052 /* Execute the sentinel here. If we had relied on
4969 status_notify to do it later, it will read input 5053 status_notify to do it later, it will read input
4970 from the process before calling the sentinel. */ 5054 from the process before calling the sentinel. */
@@ -5164,7 +5248,7 @@ read_process_output (Lisp_Object proc, register int channel)
5164 /* A new coding system might be found. */ 5248 /* A new coding system might be found. */
5165 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5249 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5166 { 5250 {
5167 PSET (p, decode_coding_system, Vlast_coding_system_used); 5251 pset_decode_coding_system (p, Vlast_coding_system_used);
5168 5252
5169 /* Don't call setup_coding_system for 5253 /* Don't call setup_coding_system for
5170 proc_decode_coding_system[channel] here. It is done in 5254 proc_decode_coding_system[channel] here. It is done in
@@ -5180,8 +5264,8 @@ read_process_output (Lisp_Object proc, register int channel)
5180 if (NILP (p->encode_coding_system) 5264 if (NILP (p->encode_coding_system)
5181 && proc_encode_coding_system[p->outfd]) 5265 && proc_encode_coding_system[p->outfd])
5182 { 5266 {
5183 PSET (p, encode_coding_system, 5267 pset_encode_coding_system
5184 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5268 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5185 setup_coding_system (p->encode_coding_system, 5269 setup_coding_system (p->encode_coding_system,
5186 proc_encode_coding_system[p->outfd]); 5270 proc_encode_coding_system[p->outfd]);
5187 } 5271 }
@@ -5190,7 +5274,7 @@ read_process_output (Lisp_Object proc, register int channel)
5190 if (coding->carryover_bytes > 0) 5274 if (coding->carryover_bytes > 0)
5191 { 5275 {
5192 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5276 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5193 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5277 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5194 memcpy (SDATA (p->decoding_buf), coding->carryover, 5278 memcpy (SDATA (p->decoding_buf), coding->carryover,
5195 coding->carryover_bytes); 5279 coding->carryover_bytes);
5196 p->decoding_carryover = coding->carryover_bytes; 5280 p->decoding_carryover = coding->carryover_bytes;
@@ -5246,7 +5330,7 @@ read_process_output (Lisp_Object proc, register int channel)
5246 old_begv_byte = BEGV_BYTE; 5330 old_begv_byte = BEGV_BYTE;
5247 old_zv_byte = ZV_BYTE; 5331 old_zv_byte = ZV_BYTE;
5248 5332
5249 BSET (current_buffer, read_only, Qnil); 5333 bset_read_only (current_buffer, Qnil);
5250 5334
5251 /* Insert new output into buffer 5335 /* Insert new output into buffer
5252 at the current end-of-output marker, 5336 at the current end-of-output marker,
@@ -5274,12 +5358,12 @@ read_process_output (Lisp_Object proc, register int channel)
5274 similar code in the previous `if' block. */ 5358 similar code in the previous `if' block. */
5275 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5359 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5276 { 5360 {
5277 PSET (p, decode_coding_system, Vlast_coding_system_used); 5361 pset_decode_coding_system (p, Vlast_coding_system_used);
5278 if (NILP (p->encode_coding_system) 5362 if (NILP (p->encode_coding_system)
5279 && proc_encode_coding_system[p->outfd]) 5363 && proc_encode_coding_system[p->outfd])
5280 { 5364 {
5281 PSET (p, encode_coding_system, 5365 pset_encode_coding_system
5282 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5366 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5283 setup_coding_system (p->encode_coding_system, 5367 setup_coding_system (p->encode_coding_system,
5284 proc_encode_coding_system[p->outfd]); 5368 proc_encode_coding_system[p->outfd]);
5285 } 5369 }
@@ -5287,7 +5371,7 @@ read_process_output (Lisp_Object proc, register int channel)
5287 if (coding->carryover_bytes > 0) 5371 if (coding->carryover_bytes > 0)
5288 { 5372 {
5289 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5373 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5290 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5374 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5291 memcpy (SDATA (p->decoding_buf), coding->carryover, 5375 memcpy (SDATA (p->decoding_buf), coding->carryover,
5292 coding->carryover_bytes); 5376 coding->carryover_bytes);
5293 p->decoding_carryover = coding->carryover_bytes; 5377 p->decoding_carryover = coding->carryover_bytes;
@@ -5337,7 +5421,7 @@ read_process_output (Lisp_Object proc, register int channel)
5337 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5421 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5338 5422
5339 5423
5340 BSET (current_buffer, read_only, old_read_only); 5424 bset_read_only (current_buffer, old_read_only);
5341 SET_PT_BOTH (opoint, opoint_byte); 5425 SET_PT_BOTH (opoint, opoint_byte);
5342 } 5426 }
5343 /* Handling the process output should not deactivate the mark. */ 5427 /* Handling the process output should not deactivate the mark. */
@@ -5404,9 +5488,9 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5404 entry = Fcons (obj, Fcons (make_number (offset), make_number (len))); 5488 entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
5405 5489
5406 if (front) 5490 if (front)
5407 PSET (p, write_queue, Fcons (entry, p->write_queue)); 5491 pset_write_queue (p, Fcons (entry, p->write_queue));
5408 else 5492 else
5409 PSET (p, write_queue, nconc2 (p->write_queue, Fcons (entry, Qnil))); 5493 pset_write_queue (p, nconc2 (p->write_queue, Fcons (entry, Qnil)));
5410} 5494}
5411 5495
5412/* Remove the first element in the write_queue of process P, put its 5496/* Remove the first element in the write_queue of process P, put its
@@ -5424,7 +5508,7 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5424 return 0; 5508 return 0;
5425 5509
5426 entry = XCAR (p->write_queue); 5510 entry = XCAR (p->write_queue);
5427 PSET (p, write_queue, XCDR (p->write_queue)); 5511 pset_write_queue (p, XCDR (p->write_queue));
5428 5512
5429 *obj = XCAR (entry); 5513 *obj = XCAR (entry);
5430 offset_length = XCDR (entry); 5514 offset_length = XCDR (entry);
@@ -5471,8 +5555,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5471 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) 5555 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
5472 || EQ (object, Qt)) 5556 || EQ (object, Qt))
5473 { 5557 {
5474 PSET (p, encode_coding_system, 5558 pset_encode_coding_system
5475 complement_process_encoding_system (p->encode_coding_system)); 5559 (p, complement_process_encoding_system (p->encode_coding_system));
5476 if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) 5560 if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
5477 { 5561 {
5478 /* The coding system for encoding was changed to raw-text 5562 /* The coding system for encoding was changed to raw-text
@@ -5693,7 +5777,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5693 proc = process_sent_to; 5777 proc = process_sent_to;
5694 p = XPROCESS (proc); 5778 p = XPROCESS (proc);
5695 p->raw_status_new = 0; 5779 p->raw_status_new = 0;
5696 PSET (p, status, Fcons (Qexit, Fcons (make_number (256), Qnil))); 5780 pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil)));
5697 p->tick = ++process_tick; 5781 p->tick = ++process_tick;
5698 deactivate_process (proc); 5782 deactivate_process (proc);
5699 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); 5783 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
@@ -5922,7 +6006,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5922#ifdef SIGCONT 6006#ifdef SIGCONT
5923 case SIGCONT: 6007 case SIGCONT:
5924 p->raw_status_new = 0; 6008 p->raw_status_new = 0;
5925 PSET (p, status, Qrun); 6009 pset_status (p, Qrun);
5926 p->tick = ++process_tick; 6010 p->tick = ++process_tick;
5927 if (!nomsg) 6011 if (!nomsg)
5928 { 6012 {
@@ -6018,7 +6102,7 @@ traffic. */)
6018 FD_CLR (p->infd, &input_wait_mask); 6102 FD_CLR (p->infd, &input_wait_mask);
6019 FD_CLR (p->infd, &non_keyboard_wait_mask); 6103 FD_CLR (p->infd, &non_keyboard_wait_mask);
6020 } 6104 }
6021 PSET (p, command, Qt); 6105 pset_command (p, Qt);
6022 return process; 6106 return process;
6023 } 6107 }
6024#ifndef SIGTSTP 6108#ifndef SIGTSTP
@@ -6054,7 +6138,7 @@ traffic. */)
6054 tcflush (p->infd, TCIFLUSH); 6138 tcflush (p->infd, TCIFLUSH);
6055#endif /* not WINDOWSNT */ 6139#endif /* not WINDOWSNT */
6056 } 6140 }
6057 PSET (p, command, Qnil); 6141 pset_command (p, Qnil);
6058 return process; 6142 return process;
6059 } 6143 }
6060#ifdef SIGCONT 6144#ifdef SIGCONT
@@ -6470,7 +6554,7 @@ sigchld_handler (int signo)
6470static Lisp_Object 6554static Lisp_Object
6471exec_sentinel_unwind (Lisp_Object data) 6555exec_sentinel_unwind (Lisp_Object data)
6472{ 6556{
6473 PSET (XPROCESS (XCAR (data)), sentinel, XCDR (data)); 6557 pset_sentinel (XPROCESS (XCAR (data)), XCDR (data));
6474 return Qnil; 6558 return Qnil;
6475} 6559}
6476 6560
@@ -6516,7 +6600,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6516 6600
6517 /* Zilch the sentinel while it's running, to avoid recursive invocations; 6601 /* Zilch the sentinel while it's running, to avoid recursive invocations;
6518 assure that it gets restored no matter how the sentinel exits. */ 6602 assure that it gets restored no matter how the sentinel exits. */
6519 PSET (p, sentinel, Qnil); 6603 pset_sentinel (p, Qnil);
6520 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel)); 6604 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel));
6521 /* Inhibit quit so that random quits don't screw up a running filter. */ 6605 /* Inhibit quit so that random quits don't screw up a running filter. */
6522 specbind (Qinhibit_quit, Qt); 6606 specbind (Qinhibit_quit, Qt);
@@ -6671,13 +6755,13 @@ status_notify (struct Lisp_Process *deleting_process)
6671 before_byte = PT_BYTE; 6755 before_byte = PT_BYTE;
6672 6756
6673 tem = BVAR (current_buffer, read_only); 6757 tem = BVAR (current_buffer, read_only);
6674 BSET (current_buffer, read_only, Qnil); 6758 bset_read_only (current_buffer, Qnil);
6675 insert_string ("\nProcess "); 6759 insert_string ("\nProcess ");
6676 { /* FIXME: temporary kludge */ 6760 { /* FIXME: temporary kludge */
6677 Lisp_Object tem2 = p->name; Finsert (1, &tem2); } 6761 Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
6678 insert_string (" "); 6762 insert_string (" ");
6679 Finsert (1, &msg); 6763 Finsert (1, &msg);
6680 BSET (current_buffer, read_only, tem); 6764 bset_read_only (current_buffer, tem);
6681 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6765 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6682 6766
6683 if (opoint >= before) 6767 if (opoint >= before)
@@ -6714,8 +6798,8 @@ encode subprocess input. */)
6714 Fcheck_coding_system (decoding); 6798 Fcheck_coding_system (decoding);
6715 Fcheck_coding_system (encoding); 6799 Fcheck_coding_system (encoding);
6716 encoding = coding_inherit_eol_type (encoding, Qnil); 6800 encoding = coding_inherit_eol_type (encoding, Qnil);
6717 PSET (p, decode_coding_system, decoding); 6801 pset_decode_coding_system (p, decoding);
6718 PSET (p, encode_coding_system, encoding); 6802 pset_encode_coding_system (p, encoding);
6719 setup_process_coding_systems (process); 6803 setup_process_coding_systems (process);
6720 6804
6721 return Qnil; 6805 return Qnil;
@@ -6745,8 +6829,8 @@ suppressed. */)
6745 CHECK_PROCESS (process); 6829 CHECK_PROCESS (process);
6746 p = XPROCESS (process); 6830 p = XPROCESS (process);
6747 if (NILP (flag)) 6831 if (NILP (flag))
6748 PSET (p, decode_coding_system, 6832 pset_decode_coding_system
6749 raw_text_coding_system (p->decode_coding_system)); 6833 (p, raw_text_coding_system (p->decode_coding_system));
6750 setup_process_coding_systems (process); 6834 setup_process_coding_systems (process);
6751 6835
6752 return Qnil; 6836 return Qnil;
diff --git a/src/process.h b/src/process.h
index 43cc7ea33c0..55a572117c6 100644
--- a/src/process.h
+++ b/src/process.h
@@ -26,10 +26,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include "gnutls.h" 26#include "gnutls.h"
27#endif 27#endif
28 28
29/* Most code should use these macros to set 29INLINE_HEADER_BEGIN
30 Lisp fields in struct Lisp_Process. */ 30#ifndef PROCESS_INLINE
31 31# define PROCESS_INLINE INLINE
32#define PSET(p, field, value) ((p)->field = (value)) 32#endif
33 33
34/* This structure records information about a subprocess 34/* This structure records information about a subprocess
35 or network connection. */ 35 or network connection. */
@@ -165,6 +165,23 @@ struct Lisp_Process
165 165
166#define ChannelMask(n) (1 << (n)) 166#define ChannelMask(n) (1 << (n))
167 167
168/* Most code should use these functions to set Lisp fields in struct
169 process. */
170
171PROCESS_INLINE void
172pset_childp (struct Lisp_Process *p, Lisp_Object val)
173{
174 p->childp = val;
175}
176
177#ifdef HAVE_GNUTLS
178PROCESS_INLINE void
179pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val)
180{
181 p->gnutls_cred_type = val;
182}
183#endif
184
168/* True if we are about to fork off a synchronous process or if we 185/* True if we are about to fork off a synchronous process or if we
169 are waiting for it. */ 186 are waiting for it. */
170extern int synch_process_alive; 187extern int synch_process_alive;
@@ -208,3 +225,5 @@ extern void add_read_fd (int fd, fd_callback func, void *data);
208extern void delete_read_fd (int fd); 225extern void delete_read_fd (int fd);
209extern void add_write_fd (int fd, fd_callback func, void *data); 226extern void add_write_fd (int fd, fd_callback func, void *data);
210extern void delete_write_fd (int fd); 227extern void delete_write_fd (int fd);
228
229INLINE_HEADER_END
diff --git a/src/search.c b/src/search.c
index 004e599be9c..0b4f635066c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -278,8 +278,8 @@ looking_at_1 (Lisp_Object string, int posix)
278 save_search_regs (); 278 save_search_regs ();
279 279
280 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 280 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
281 XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2] 281 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
282 = BVAR (current_buffer, case_eqv_table); 282 BVAR (current_buffer, case_eqv_table));
283 283
284 CHECK_STRING (string); 284 CHECK_STRING (string);
285 bufp = compile_pattern (string, 285 bufp = compile_pattern (string,
@@ -393,8 +393,8 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int p
393 } 393 }
394 394
395 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 395 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
396 XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2] 396 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
397 = BVAR (current_buffer, case_eqv_table); 397 BVAR (current_buffer, case_eqv_table));
398 398
399 bufp = compile_pattern (regexp, 399 bufp = compile_pattern (regexp,
400 (NILP (Vinhibit_changing_match_data) 400 (NILP (Vinhibit_changing_match_data)
@@ -990,8 +990,8 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
990 } 990 }
991 991
992 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 992 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
993 XCHAR_TABLE (BVAR (current_buffer, case_canon_table))->extras[2] 993 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
994 = BVAR (current_buffer, case_eqv_table); 994 BVAR (current_buffer, case_eqv_table));
995 995
996 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, 996 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,
997 (!NILP (BVAR (current_buffer, case_fold_search)) 997 (!NILP (BVAR (current_buffer, case_fold_search))
diff --git a/src/syntax.c b/src/syntax.c
index 08a63e033b2..f995b8f2cac 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22 22
23#include <ctype.h>
24#include <sys/types.h> 23#include <sys/types.h>
25#include <setjmp.h> 24#include <setjmp.h>
26#include "lisp.h" 25#include "lisp.h"
@@ -150,6 +149,13 @@ static void scan_sexps_forward (struct lisp_parse_state *,
150 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, 149 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT,
151 int, Lisp_Object, int); 150 int, Lisp_Object, int);
152static int in_classes (int, Lisp_Object); 151static int in_classes (int, Lisp_Object);
152
153/* This setter is used only in this file, so it can be private. */
154static inline void
155bset_syntax_table (struct buffer *b, Lisp_Object val)
156{
157 b->INTERNAL_FIELD (syntax_table) = val;
158}
153 159
154/* Whether the syntax of the character C has the prefix flag set. */ 160/* Whether the syntax of the character C has the prefix flag set. */
155int syntax_prefix_flag_p (int c) 161int syntax_prefix_flag_p (int c)
@@ -819,7 +825,7 @@ It is a copy of the TABLE, which defaults to the standard syntax table. */)
819 825
820 /* Only the standard syntax table should have a default element. 826 /* Only the standard syntax table should have a default element.
821 Other syntax tables should inherit from parents instead. */ 827 Other syntax tables should inherit from parents instead. */
822 XCHAR_TABLE (copy)->defalt = Qnil; 828 set_char_table_defalt (copy, Qnil);
823 829
824 /* Copied syntax tables should all have parents. 830 /* Copied syntax tables should all have parents.
825 If we copied one with no parent, such as the standard syntax table, 831 If we copied one with no parent, such as the standard syntax table,
@@ -836,7 +842,7 @@ One argument, a syntax table. */)
836{ 842{
837 int idx; 843 int idx;
838 check_syntax_table (table); 844 check_syntax_table (table);
839 BSET (current_buffer, syntax_table, table); 845 bset_syntax_table (current_buffer, table);
840 /* Indicate that this buffer now has a specified syntax table. */ 846 /* Indicate that this buffer now has a specified syntax table. */
841 idx = PER_BUFFER_VAR_IDX (syntax_table); 847 idx = PER_BUFFER_VAR_IDX (syntax_table);
842 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 848 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
diff --git a/src/sysdep.c b/src/sysdep.c
index 01ca905a987..183ee005227 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#define SYSTIME_INLINE EXTERN_INLINE 22#define SYSTIME_INLINE EXTERN_INLINE
23 23
24#include <ctype.h>
25#include <signal.h> 24#include <signal.h>
26#include <stdio.h> 25#include <stdio.h>
27#include <setjmp.h> 26#include <setjmp.h>
@@ -33,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
33#include <unistd.h> 32#include <unistd.h>
34 33
35#include <allocator.h> 34#include <allocator.h>
35#include <c-ctype.h>
36#include <careadlinkat.h> 36#include <careadlinkat.h>
37#include <ignore-value.h> 37#include <ignore-value.h>
38#include <utimens.h> 38#include <utimens.h>
@@ -2307,8 +2307,7 @@ serial_configure (struct Lisp_Process *p,
2307 error ("tcsetattr() failed: %s", emacs_strerror (errno)); 2307 error ("tcsetattr() failed: %s", emacs_strerror (errno));
2308 2308
2309 childp2 = Fplist_put (childp2, QCsummary, build_string (summary)); 2309 childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
2310 PSET (p, childp, childp2); 2310 pset_childp (p, childp2);
2311
2312} 2311}
2313#endif /* not DOS_NT */ 2312#endif /* not DOS_NT */
2314 2313
@@ -2733,7 +2732,7 @@ system_process_attributes (Lisp_Object pid)
2733 if (emacs_read (fd, &ch, 1) != 1) 2732 if (emacs_read (fd, &ch, 1) != 1)
2734 break; 2733 break;
2735 c = ch; 2734 c = ch;
2736 if (isspace (c) || c == '\\') 2735 if (c_isspace (c) || c == '\\')
2737 cmdline_size++; /* for later quoting, see below */ 2736 cmdline_size++; /* for later quoting, see below */
2738 } 2737 }
2739 if (cmdline_size) 2738 if (cmdline_size)
@@ -2757,7 +2756,7 @@ system_process_attributes (Lisp_Object pid)
2757 for (p = cmdline; p < cmdline + nread; p++) 2756 for (p = cmdline; p < cmdline + nread; p++)
2758 { 2757 {
2759 /* Escape-quote whitespace and backslashes. */ 2758 /* Escape-quote whitespace and backslashes. */
2760 if (isspace (*p) || *p == '\\') 2759 if (c_isspace (*p) || *p == '\\')
2761 { 2760 {
2762 memmove (p + 1, p, nread - (p - cmdline)); 2761 memmove (p + 1, p, nread - (p - cmdline));
2763 nread++; 2762 nread++;
diff --git a/src/term.c b/src/term.c
index 514c7ad11ec..23e074287c1 100644
--- a/src/term.c
+++ b/src/term.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include <config.h> 22#include <config.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <ctype.h>
25#include <errno.h> 24#include <errno.h>
26#include <sys/file.h> 25#include <sys/file.h>
27#include <sys/time.h> 26#include <sys/time.h>
@@ -1333,7 +1332,7 @@ term_get_fkeys_1 (void)
1333 1332
1334 /* This can happen if CANNOT_DUMP or with strange options. */ 1333 /* This can happen if CANNOT_DUMP or with strange options. */
1335 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) 1334 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
1336 KSET (kboard, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); 1335 kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil));
1337 1336
1338 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) 1337 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
1339 { 1338 {
@@ -3281,7 +3280,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3281 3280
3282 terminal->kboard = xmalloc (sizeof *terminal->kboard); 3281 terminal->kboard = xmalloc (sizeof *terminal->kboard);
3283 init_kboard (terminal->kboard); 3282 init_kboard (terminal->kboard);
3284 KSET (terminal->kboard, Vwindow_system, Qnil); 3283 kset_window_system (terminal->kboard, Qnil);
3285 terminal->kboard->next_kboard = all_kboards; 3284 terminal->kboard->next_kboard = all_kboards;
3286 all_kboards = terminal->kboard; 3285 all_kboards = terminal->kboard;
3287 terminal->kboard->reference_count++; 3286 terminal->kboard->reference_count++;
diff --git a/src/termhooks.h b/src/termhooks.h
index 51815886c78..a1164be85cc 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -22,6 +22,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include "systime.h" /* for Time */ 23#include "systime.h" /* for Time */
24 24
25INLINE_HEADER_BEGIN
26#ifndef TERMHOOKS_INLINE
27# define TERMHOOKS_INLINE INLINE
28#endif
29
25struct glyph; 30struct glyph;
26struct frame; 31struct frame;
27 32
@@ -324,10 +329,6 @@ struct ns_display_info;
324struct x_display_info; 329struct x_display_info;
325struct w32_display_info; 330struct w32_display_info;
326 331
327/* Most code should use this macro to set Lisp field in struct terminal. */
328
329#define TSET(f, field, value) ((f)->field = (value))
330
331/* Terminal-local parameters. */ 332/* Terminal-local parameters. */
332struct terminal 333struct terminal
333{ 334{
@@ -634,6 +635,18 @@ struct terminal
634 void (*delete_terminal_hook) (struct terminal *); 635 void (*delete_terminal_hook) (struct terminal *);
635}; 636};
636 637
638/* Most code should use these functions to set Lisp fields in struct
639 terminal. */
640TERMHOOKS_INLINE void
641tset_charset_list (struct terminal *t, Lisp_Object val)
642{
643 t->charset_list = val;
644}
645TERMHOOKS_INLINE void
646tset_selection_alist (struct terminal *t, Lisp_Object val)
647{
648 t->Vselection_alist = val;
649}
637 650
638/* Chain of all terminal devices currently in use. */ 651/* Chain of all terminal devices currently in use. */
639extern struct terminal *terminal_list; 652extern struct terminal *terminal_list;
@@ -672,3 +685,5 @@ extern unsigned char *encode_terminal_code (struct glyph *, int,
672#ifdef HAVE_GPM 685#ifdef HAVE_GPM
673extern void close_gpm (int gpm_fd); 686extern void close_gpm (int gpm_fd);
674#endif 687#endif
688
689INLINE_HEADER_END
diff --git a/src/terminal.c b/src/terminal.c
index 53610d9736f..d94164a4e40 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include <config.h> 19#include <config.h>
20
21#define TERMHOOKS_INLINE EXTERN_INLINE
22
20#include <stdio.h> 23#include <stdio.h>
21#include <setjmp.h> 24#include <setjmp.h>
22 25
@@ -39,6 +42,13 @@ struct terminal *initial_terminal;
39 42
40static void delete_initial_terminal (struct terminal *); 43static void delete_initial_terminal (struct terminal *);
41 44
45/* This setter is used only in this file, so it can be private. */
46static inline void
47tset_param_alist (struct terminal *t, Lisp_Object val)
48{
49 t->param_alist = val;
50}
51
42 52
43 53
44void 54void
@@ -446,7 +456,7 @@ store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object val
446 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); 456 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist);
447 if (EQ (old_alist_elt, Qnil)) 457 if (EQ (old_alist_elt, Qnil))
448 { 458 {
449 TSET (t, param_alist, Fcons (Fcons (parameter, value), t->param_alist)); 459 tset_param_alist (t, Fcons (Fcons (parameter, value), t->param_alist));
450 return Qnil; 460 return Qnil;
451 } 461 }
452 else 462 else
diff --git a/src/textprop.c b/src/textprop.c
index ac1980fde78..20d98b0e6f3 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -143,7 +143,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en
143 if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end) 143 if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end)
144 && XINT (*end) <= BUF_ZV (b))) 144 && XINT (*end) <= BUF_ZV (b)))
145 args_out_of_range (*begin, *end); 145 args_out_of_range (*begin, *end);
146 i = buffer_get_intervals (b); 146 i = buffer_intervals (b);
147 147
148 /* If there's no text, there are no properties. */ 148 /* If there's no text, there are no properties. */
149 if (BUF_BEGV (b) == BUF_ZV (b)) 149 if (BUF_BEGV (b) == BUF_ZV (b))
@@ -161,7 +161,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en
161 XSETFASTINT (*begin, XFASTINT (*begin)); 161 XSETFASTINT (*begin, XFASTINT (*begin));
162 if (begin != end) 162 if (begin != end)
163 XSETFASTINT (*end, XFASTINT (*end)); 163 XSETFASTINT (*end, XFASTINT (*end));
164 i = string_get_intervals (object); 164 i = string_intervals (object);
165 165
166 if (len == 0) 166 if (len == 0)
167 return NULL; 167 return NULL;
@@ -338,7 +338,7 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object)
338 } 338 }
339 339
340 /* Store new properties. */ 340 /* Store new properties. */
341 interval_set_plist (interval, Fcopy_sequence (properties)); 341 set_interval_plist (interval, Fcopy_sequence (properties));
342} 342}
343 343
344/* Add the properties of PLIST to the interval I, or set 344/* Add the properties of PLIST to the interval I, or set
@@ -411,7 +411,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object)
411 record_property_change (i->position, LENGTH (i), 411 record_property_change (i->position, LENGTH (i),
412 sym1, Qnil, object); 412 sym1, Qnil, object);
413 } 413 }
414 interval_set_plist (i, Fcons (sym1, Fcons (val1, i->plist))); 414 set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist)));
415 changed++; 415 changed++;
416 } 416 }
417 } 417 }
@@ -484,7 +484,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object
484 } 484 }
485 485
486 if (changed) 486 if (changed)
487 interval_set_plist (i, current_plist); 487 set_interval_plist (i, current_plist);
488 return changed; 488 return changed;
489} 489}
490 490
@@ -510,13 +510,13 @@ interval_of (ptrdiff_t position, Lisp_Object object)
510 510
511 beg = BUF_BEGV (b); 511 beg = BUF_BEGV (b);
512 end = BUF_ZV (b); 512 end = BUF_ZV (b);
513 i = buffer_get_intervals (b); 513 i = buffer_intervals (b);
514 } 514 }
515 else 515 else
516 { 516 {
517 beg = 0; 517 beg = 0;
518 end = SCHARS (object); 518 end = SCHARS (object);
519 i = string_get_intervals (object); 519 i = string_intervals (object);
520 } 520 }
521 521
522 if (!(beg <= position && position <= end)) 522 if (!(beg <= position && position <= end))
@@ -1274,10 +1274,10 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties,
1274 && XFASTINT (start) == 0 1274 && XFASTINT (start) == 0
1275 && XFASTINT (end) == SCHARS (object)) 1275 && XFASTINT (end) == SCHARS (object))
1276 { 1276 {
1277 if (!string_get_intervals (object)) 1277 if (!string_intervals (object))
1278 return Qnil; 1278 return Qnil;
1279 1279
1280 string_set_intervals (object, NULL); 1280 set_string_intervals (object, NULL);
1281 return Qt; 1281 return Qt;
1282 } 1282 }
1283 1283
@@ -1339,7 +1339,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie
1339 return; 1339 return;
1340 1340
1341 if (i == NULL) 1341 if (i == NULL)
1342 i = find_interval (buffer_get_intervals (XBUFFER (buffer)), s); 1342 i = find_interval (buffer_intervals (XBUFFER (buffer)), s);
1343 1343
1344 if (i->position != s) 1344 if (i->position != s)
1345 { 1345 {
@@ -1993,10 +1993,10 @@ void
1993verify_interval_modification (struct buffer *buf, 1993verify_interval_modification (struct buffer *buf,
1994 ptrdiff_t start, ptrdiff_t end) 1994 ptrdiff_t start, ptrdiff_t end)
1995{ 1995{
1996 register INTERVAL intervals = buffer_get_intervals (buf); 1996 INTERVAL intervals = buffer_intervals (buf);
1997 register INTERVAL i; 1997 INTERVAL i;
1998 Lisp_Object hooks; 1998 Lisp_Object hooks;
1999 register Lisp_Object prev_mod_hooks; 1999 Lisp_Object prev_mod_hooks;
2000 Lisp_Object mod_hooks; 2000 Lisp_Object mod_hooks;
2001 struct gcpro gcpro1; 2001 struct gcpro gcpro1;
2002 2002
diff --git a/src/undo.c b/src/undo.c
index cfb67ba5bc8..777e3291806 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -104,9 +104,9 @@ record_point (ptrdiff_t pt)
104 if (at_boundary 104 if (at_boundary
105 && current_buffer == last_boundary_buffer 105 && current_buffer == last_boundary_buffer
106 && last_boundary_position != pt) 106 && last_boundary_position != pt)
107 BSET (current_buffer, undo_list, 107 bset_undo_list (current_buffer,
108 Fcons (make_number (last_boundary_position), 108 Fcons (make_number (last_boundary_position),
109 BVAR (current_buffer, undo_list))); 109 BVAR (current_buffer, undo_list)));
110} 110}
111 111
112/* Record an insertion that just happened or is about to happen, 112/* Record an insertion that just happened or is about to happen,
@@ -142,8 +142,8 @@ record_insert (ptrdiff_t beg, ptrdiff_t length)
142 142
143 XSETFASTINT (lbeg, beg); 143 XSETFASTINT (lbeg, beg);
144 XSETINT (lend, beg + length); 144 XSETINT (lend, beg + length);
145 BSET (current_buffer, undo_list, 145 bset_undo_list (current_buffer,
146 Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list))); 146 Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list)));
147} 147}
148 148
149/* Record that a deletion is about to take place, 149/* Record that a deletion is about to take place,
@@ -168,8 +168,9 @@ record_delete (ptrdiff_t beg, Lisp_Object string)
168 record_point (beg); 168 record_point (beg);
169 } 169 }
170 170
171 BSET (current_buffer, undo_list, 171 bset_undo_list
172 Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list))); 172 (current_buffer,
173 Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list)));
173} 174}
174 175
175/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. 176/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -191,9 +192,10 @@ record_marker_adjustment (Lisp_Object marker, ptrdiff_t adjustment)
191 Fundo_boundary (); 192 Fundo_boundary ();
192 last_undo_buffer = current_buffer; 193 last_undo_buffer = current_buffer;
193 194
194 BSET (current_buffer, undo_list, 195 bset_undo_list
195 Fcons (Fcons (marker, make_number (adjustment)), 196 (current_buffer,
196 BVAR (current_buffer, undo_list))); 197 Fcons (Fcons (marker, make_number (adjustment)),
198 BVAR (current_buffer, undo_list)));
197} 199}
198 200
199/* Record that a replacement is about to take place, 201/* Record that a replacement is about to take place,
@@ -226,9 +228,10 @@ record_first_change (void)
226 if (base_buffer->base_buffer) 228 if (base_buffer->base_buffer)
227 base_buffer = base_buffer->base_buffer; 229 base_buffer = base_buffer->base_buffer;
228 230
229 BSET (current_buffer, undo_list, 231 bset_undo_list
230 Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), 232 (current_buffer,
231 BVAR (current_buffer, undo_list))); 233 Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)),
234 BVAR (current_buffer, undo_list)));
232} 235}
233 236
234/* Record a change in property PROP (whose old value was VAL) 237/* Record a change in property PROP (whose old value was VAL)
@@ -266,8 +269,8 @@ record_property_change (ptrdiff_t beg, ptrdiff_t length,
266 XSETINT (lbeg, beg); 269 XSETINT (lbeg, beg);
267 XSETINT (lend, beg + length); 270 XSETINT (lend, beg + length);
268 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); 271 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
269 BSET (current_buffer, undo_list, 272 bset_undo_list (current_buffer,
270 Fcons (entry, BVAR (current_buffer, undo_list))); 273 Fcons (entry, BVAR (current_buffer, undo_list)));
271 274
272 current_buffer = obuf; 275 current_buffer = obuf;
273} 276}
@@ -290,11 +293,12 @@ but another undo command will undo to the previous boundary. */)
290 /* If we have preallocated the cons cell to use here, 293 /* If we have preallocated the cons cell to use here,
291 use that one. */ 294 use that one. */
292 XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); 295 XSETCDR (pending_boundary, BVAR (current_buffer, undo_list));
293 BSET (current_buffer, undo_list, pending_boundary); 296 bset_undo_list (current_buffer, pending_boundary);
294 pending_boundary = Qnil; 297 pending_boundary = Qnil;
295 } 298 }
296 else 299 else
297 BSET (current_buffer, undo_list, Fcons (Qnil, BVAR (current_buffer, undo_list))); 300 bset_undo_list (current_buffer,
301 Fcons (Qnil, BVAR (current_buffer, undo_list)));
298 } 302 }
299 last_boundary_position = PT; 303 last_boundary_position = PT;
300 last_boundary_buffer = current_buffer; 304 last_boundary_buffer = current_buffer;
@@ -435,7 +439,7 @@ truncate_undo_list (struct buffer *b)
435 XSETCDR (last_boundary, Qnil); 439 XSETCDR (last_boundary, Qnil);
436 /* There's nothing we decided to keep, so clear it out. */ 440 /* There's nothing we decided to keep, so clear it out. */
437 else 441 else
438 BSET (b, undo_list, Qnil); 442 bset_undo_list (b, Qnil);
439 443
440 unbind_to (count, Qnil); 444 unbind_to (count, Qnil);
441} 445}
@@ -650,8 +654,9 @@ Return what remains of the list. */)
650 will work right. */ 654 will work right. */
651 if (did_apply 655 if (did_apply
652 && EQ (oldlist, BVAR (current_buffer, undo_list))) 656 && EQ (oldlist, BVAR (current_buffer, undo_list)))
653 BSET (current_buffer, undo_list, 657 bset_undo_list
654 Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list))); 658 (current_buffer,
659 Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)));
655 660
656 UNGCPRO; 661 UNGCPRO;
657 return unbind_to (count, list); 662 return unbind_to (count, list);
diff --git a/src/w32.c b/src/w32.c
index 61de234cf70..b460660cb8c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -7023,7 +7023,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
7023 error ("SetCommState() failed"); 7023 error ("SetCommState() failed");
7024 7024
7025 childp2 = Fplist_put (childp2, QCsummary, build_string (summary)); 7025 childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
7026 PSET (p, childp, childp2); 7026 pset_childp (p, childp2);
7027} 7027}
7028 7028
7029#ifdef HAVE_GNUTLS 7029#ifdef HAVE_GNUTLS
diff --git a/src/w32fns.c b/src/w32fns.c
index 7779f032104..9c5231f9d93 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1490,7 +1490,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1490 else if (!NILP (arg) || NILP (oldval)) 1490 else if (!NILP (arg) || NILP (oldval))
1491 return; 1491 return;
1492 1492
1493 FSET (f, icon_name, arg); 1493 fset_icon_name (f, arg);
1494 1494
1495#if 0 1495#if 0
1496 if (f->output_data.w32->icon_bitmap != 0) 1496 if (f->output_data.w32->icon_bitmap != 0)
@@ -1686,7 +1686,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1686 if (! NILP (Fstring_equal (name, f->name))) 1686 if (! NILP (Fstring_equal (name, f->name)))
1687 return; 1687 return;
1688 1688
1689 FSET (f, name, name); 1689 fset_name (f, name);
1690 1690
1691 /* For setting the frame title, the title parameter should override 1691 /* For setting the frame title, the title parameter should override
1692 the name parameter. */ 1692 the name parameter. */
@@ -1734,7 +1734,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1734 1734
1735 update_mode_lines = 1; 1735 update_mode_lines = 1;
1736 1736
1737 FSET (f, title, name); 1737 fset_title (f, name);
1738 1738
1739 if (NILP (name)) 1739 if (NILP (name))
1740 name = f->name; 1740 name = f->name;
@@ -3925,7 +3925,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
3925 3925
3926 f->explicit_name = 0; 3926 f->explicit_name = 0;
3927 name = f->name; 3927 name = f->name;
3928 FSET (f, name, Qnil); 3928 fset_name (f, Qnil);
3929 x_set_name (f, name, explicit); 3929 x_set_name (f, name, explicit);
3930 } 3930 }
3931 3931
@@ -4174,11 +4174,11 @@ This function is an internal primitive--use `make-frame' instead. */)
4174 f->output_data.w32 = xzalloc (sizeof (struct w32_output)); 4174 f->output_data.w32 = xzalloc (sizeof (struct w32_output));
4175 FRAME_FONTSET (f) = -1; 4175 FRAME_FONTSET (f) = -1;
4176 4176
4177 FSET (f, icon_name, 4177 fset_icon_name
4178 x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title", 4178 (f, x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title",
4179 RES_TYPE_STRING)); 4179 RES_TYPE_STRING));
4180 if (! STRINGP (f->icon_name)) 4180 if (! STRINGP (f->icon_name))
4181 FSET (f, icon_name, Qnil); 4181 fset_icon_name (f, Qnil);
4182 4182
4183/* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ 4183/* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
4184 4184
@@ -4207,12 +4207,12 @@ This function is an internal primitive--use `make-frame' instead. */)
4207 be set. */ 4207 be set. */
4208 if (EQ (name, Qunbound) || NILP (name)) 4208 if (EQ (name, Qunbound) || NILP (name))
4209 { 4209 {
4210 FSET (f, name, build_string (dpyinfo->w32_id_name)); 4210 fset_name (f, build_string (dpyinfo->w32_id_name));
4211 f->explicit_name = 0; 4211 f->explicit_name = 0;
4212 } 4212 }
4213 else 4213 else
4214 { 4214 {
4215 FSET (f, name, name); 4215 fset_name (f, name);
4216 f->explicit_name = 1; 4216 f->explicit_name = 1;
4217 /* use the frame's title when getting resources for this frame. */ 4217 /* use the frame's title when getting resources for this frame. */
4218 specbind (Qx_resource_name, name); 4218 specbind (Qx_resource_name, name);
@@ -4381,13 +4381,13 @@ This function is an internal primitive--use `make-frame' instead. */)
4381 if (FRAME_HAS_MINIBUF_P (f) 4381 if (FRAME_HAS_MINIBUF_P (f)
4382 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 4382 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
4383 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 4383 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
4384 KSET (kb, Vdefault_minibuffer_frame, frame); 4384 kset_default_minibuffer_frame (kb, frame);
4385 4385
4386 /* All remaining specified parameters, which have not been "used" 4386 /* All remaining specified parameters, which have not been "used"
4387 by x_get_arg and friends, now go in the misc. alist of the frame. */ 4387 by x_get_arg and friends, now go in the misc. alist of the frame. */
4388 for (tem = parameters; CONSP (tem); tem = XCDR (tem)) 4388 for (tem = parameters; CONSP (tem); tem = XCDR (tem))
4389 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 4389 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
4390 FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); 4390 fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
4391 4391
4392 UNGCPRO; 4392 UNGCPRO;
4393 4393
@@ -5242,7 +5242,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5242 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); 5242 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0);
5243 old_buffer = current_buffer; 5243 old_buffer = current_buffer;
5244 set_buffer_internal_1 (XBUFFER (buffer)); 5244 set_buffer_internal_1 (XBUFFER (buffer));
5245 BSET (current_buffer, truncate_lines, Qnil); 5245 bset_truncate_lines (current_buffer, Qnil);
5246 specbind (Qinhibit_read_only, Qt); 5246 specbind (Qinhibit_read_only, Qt);
5247 specbind (Qinhibit_modification_hooks, Qt); 5247 specbind (Qinhibit_modification_hooks, Qt);
5248 Ferase_buffer (); 5248 Ferase_buffer ();
@@ -5261,7 +5261,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5261 f->output_data.w32 = xzalloc (sizeof (struct w32_output)); 5261 f->output_data.w32 = xzalloc (sizeof (struct w32_output));
5262 5262
5263 FRAME_FONTSET (f) = -1; 5263 FRAME_FONTSET (f) = -1;
5264 FSET (f, icon_name, Qnil); 5264 fset_icon_name (f, Qnil);
5265 5265
5266#ifdef GLYPH_DEBUG 5266#ifdef GLYPH_DEBUG
5267 image_cache_refcount = 5267 image_cache_refcount =
@@ -5276,12 +5276,12 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5276 be set. */ 5276 be set. */
5277 if (EQ (name, Qunbound) || NILP (name)) 5277 if (EQ (name, Qunbound) || NILP (name))
5278 { 5278 {
5279 FSET (f, name, build_string (dpyinfo->w32_id_name)); 5279 fset_name (f, build_string (dpyinfo->w32_id_name));
5280 f->explicit_name = 0; 5280 f->explicit_name = 0;
5281 } 5281 }
5282 else 5282 else
5283 { 5283 {
5284 FSET (f, name, name); 5284 fset_name (f, name);
5285 f->explicit_name = 1; 5285 f->explicit_name = 1;
5286 /* use the frame's title when getting resources for this frame. */ 5286 /* use the frame's title when getting resources for this frame. */
5287 specbind (Qx_resource_name, name); 5287 specbind (Qx_resource_name, name);
@@ -5647,8 +5647,8 @@ Text larger than the specified size is clipped. */)
5647 5647
5648 /* Set up the frame's root window. */ 5648 /* Set up the frame's root window. */
5649 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5649 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5650 WSET (w, left_col, make_number (0)); 5650 wset_left_col (w, make_number (0));
5651 WSET (w, top_line, make_number (0)); 5651 wset_top_line (w, make_number (0));
5652 5652
5653 if (CONSP (Vx_max_tooltip_size) 5653 if (CONSP (Vx_max_tooltip_size)
5654 && INTEGERP (XCAR (Vx_max_tooltip_size)) 5654 && INTEGERP (XCAR (Vx_max_tooltip_size))
@@ -5656,13 +5656,13 @@ Text larger than the specified size is clipped. */)
5656 && INTEGERP (XCDR (Vx_max_tooltip_size)) 5656 && INTEGERP (XCDR (Vx_max_tooltip_size))
5657 && XINT (XCDR (Vx_max_tooltip_size)) > 0) 5657 && XINT (XCDR (Vx_max_tooltip_size)) > 0)
5658 { 5658 {
5659 WSET (w, total_cols, XCAR (Vx_max_tooltip_size)); 5659 wset_total_cols (w, XCAR (Vx_max_tooltip_size));
5660 WSET (w, total_lines, XCDR (Vx_max_tooltip_size)); 5660 wset_total_lines (w, XCDR (Vx_max_tooltip_size));
5661 } 5661 }
5662 else 5662 else
5663 { 5663 {
5664 WSET (w, total_cols, make_number (80)); 5664 wset_total_cols (w, make_number (80));
5665 WSET (w, total_lines, make_number (40)); 5665 wset_total_lines (w, make_number (40));
5666 } 5666 }
5667 5667
5668 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5668 FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
@@ -5672,7 +5672,7 @@ Text larger than the specified size is clipped. */)
5672 /* Display the tooltip text in a temporary buffer. */ 5672 /* Display the tooltip text in a temporary buffer. */
5673 old_buffer = current_buffer; 5673 old_buffer = current_buffer;
5674 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5674 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5675 BSET (current_buffer, truncate_lines, Qnil); 5675 bset_truncate_lines (current_buffer, Qnil);
5676 clear_glyph_matrix (w->desired_matrix); 5676 clear_glyph_matrix (w->desired_matrix);
5677 clear_glyph_matrix (w->current_matrix); 5677 clear_glyph_matrix (w->current_matrix);
5678 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5678 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -5733,7 +5733,7 @@ Text larger than the specified size is clipped. */)
5733 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5733 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5734 not in pixels. */ 5734 not in pixels. */
5735 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5735 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5736 WSET (w, total_cols, make_number (width)); 5736 wset_total_cols (w, make_number (width));
5737 FRAME_TOTAL_COLS (f) = width; 5737 FRAME_TOTAL_COLS (f) = width;
5738 adjust_glyphs (f); 5738 adjust_glyphs (f);
5739 w->pseudo_window_p = 1; 5739 w->pseudo_window_p = 1;
diff --git a/src/w32menu.c b/src/w32menu.c
index 02302c2d594..3aa4c8bc96d 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -413,7 +413,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
413 /* Run the hooks. */ 413 /* Run the hooks. */
414 safe_run_hooks (Qactivate_menubar_hook); 414 safe_run_hooks (Qactivate_menubar_hook);
415 safe_run_hooks (Qmenu_bar_update_hook); 415 safe_run_hooks (Qmenu_bar_update_hook);
416 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 416 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
417 417
418 items = FRAME_MENU_BAR_ITEMS (f); 418 items = FRAME_MENU_BAR_ITEMS (f);
419 419
@@ -500,7 +500,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
500 return; 500 return;
501 } 501 }
502 502
503 FSET (f, menu_bar_vector, menu_items); 503 fset_menu_bar_vector (f, menu_items);
504 f->menu_bar_items_used = menu_items_used; 504 f->menu_bar_items_used = menu_items_used;
505 505
506 /* This undoes save_menu_items. */ 506 /* This undoes save_menu_items. */
@@ -615,7 +615,7 @@ initialize_frame_menubar (FRAME_PTR f)
615{ 615{
616 /* This function is called before the first chance to redisplay 616 /* This function is called before the first chance to redisplay
617 the frame. It has to be, so the frame will have the right size. */ 617 the frame. It has to be, so the frame will have the right size. */
618 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 618 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
619 set_frame_menubar (f, 1, 1); 619 set_frame_menubar (f, 1, 1);
620} 620}
621 621
diff --git a/src/w32term.c b/src/w32term.c
index 7da9433d3f1..6948a98998e 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2972,7 +2972,7 @@ x_frame_rehighlight (struct w32_display_info *dpyinfo)
2972 : dpyinfo->w32_focus_frame); 2972 : dpyinfo->w32_focus_frame);
2973 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) 2973 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame))
2974 { 2974 {
2975 FSET (dpyinfo->w32_focus_frame, focus_frame, Qnil); 2975 fset_focus_frame (dpyinfo->w32_focus_frame, Qnil);
2976 dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame; 2976 dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame;
2977 } 2977 }
2978 } 2978 }
@@ -3646,7 +3646,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
3646 bar->next = FRAME_SCROLL_BARS (f); 3646 bar->next = FRAME_SCROLL_BARS (f);
3647 bar->prev = Qnil; 3647 bar->prev = Qnil;
3648 XSETVECTOR (barobj, bar); 3648 XSETVECTOR (barobj, bar);
3649 FSET (f, scroll_bars, barobj); 3649 fset_scroll_bars (f, barobj);
3650 if (! NILP (bar->next)) 3650 if (! NILP (bar->next))
3651 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 3651 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
3652 3652
@@ -3670,7 +3670,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
3670 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); 3670 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
3671 3671
3672 /* Dissociate this scroll bar from its window. */ 3672 /* Dissociate this scroll bar from its window. */
3673 WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil); 3673 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
3674 3674
3675 UNBLOCK_INPUT; 3675 UNBLOCK_INPUT;
3676} 3676}
@@ -3808,7 +3808,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3808 3808
3809 w32_set_scroll_bar_thumb (bar, portion, position, whole); 3809 w32_set_scroll_bar_thumb (bar, portion, position, whole);
3810 XSETVECTOR (barobj, bar); 3810 XSETVECTOR (barobj, bar);
3811 WSET (w, vertical_scroll_bar, barobj); 3811 wset_vertical_scroll_bar (w, barobj);
3812} 3812}
3813 3813
3814 3814
@@ -3832,12 +3832,12 @@ w32_condemn_scroll_bars (FRAME_PTR frame)
3832 { 3832 {
3833 Lisp_Object bar; 3833 Lisp_Object bar;
3834 bar = FRAME_SCROLL_BARS (frame); 3834 bar = FRAME_SCROLL_BARS (frame);
3835 FSET (frame, scroll_bars, XSCROLL_BAR (bar)->next); 3835 fset_scroll_bars (frame, XSCROLL_BAR (bar)->next);
3836 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); 3836 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame);
3837 XSCROLL_BAR (bar)->prev = Qnil; 3837 XSCROLL_BAR (bar)->prev = Qnil;
3838 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) 3838 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame)))
3839 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; 3839 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar;
3840 FSET (frame, condemned_scroll_bars, bar); 3840 fset_condemned_scroll_bars (frame, bar);
3841 } 3841 }
3842} 3842}
3843 3843
@@ -3869,7 +3869,7 @@ w32_redeem_scroll_bar (struct window *window)
3869 return; 3869 return;
3870 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), 3870 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
3871 window->vertical_scroll_bar)) 3871 window->vertical_scroll_bar))
3872 FSET (f, condemned_scroll_bars, bar->next); 3872 fset_condemned_scroll_bars (f, bar->next);
3873 else 3873 else
3874 /* If its prev pointer is nil, it must be at the front of 3874 /* If its prev pointer is nil, it must be at the front of
3875 one or the other! */ 3875 one or the other! */
@@ -3884,7 +3884,7 @@ w32_redeem_scroll_bar (struct window *window)
3884 bar->next = FRAME_SCROLL_BARS (f); 3884 bar->next = FRAME_SCROLL_BARS (f);
3885 bar->prev = Qnil; 3885 bar->prev = Qnil;
3886 XSETVECTOR (barobj, bar); 3886 XSETVECTOR (barobj, bar);
3887 FSET (f, scroll_bars, barobj); 3887 fset_scroll_bars (f, barobj);
3888 if (! NILP (bar->next)) 3888 if (! NILP (bar->next))
3889 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 3889 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
3890} 3890}
@@ -3901,7 +3901,7 @@ w32_judge_scroll_bars (FRAME_PTR f)
3901 3901
3902 /* Clear out the condemned list now so we won't try to process any 3902 /* Clear out the condemned list now so we won't try to process any
3903 more events on the hapless scroll bars. */ 3903 more events on the hapless scroll bars. */
3904 FSET (f, condemned_scroll_bars, Qnil); 3904 fset_condemned_scroll_bars (f, Qnil);
3905 3905
3906 for (; ! NILP (bar); bar = next) 3906 for (; ! NILP (bar); bar = next)
3907 { 3907 {
@@ -6232,7 +6232,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6232 terminal like X does. */ 6232 terminal like X does. */
6233 terminal->kboard = xmalloc (sizeof (KBOARD)); 6233 terminal->kboard = xmalloc (sizeof (KBOARD));
6234 init_kboard (terminal->kboard); 6234 init_kboard (terminal->kboard);
6235 KSET (terminal->kboard, Vwindow_system, intern ("w32")); 6235 kset_window_system (terminal->kboard, intern ("w32"));
6236 terminal->kboard->next_kboard = all_kboards; 6236 terminal->kboard->next_kboard = all_kboards;
6237 all_kboards = terminal->kboard; 6237 all_kboards = terminal->kboard;
6238 /* Don't let the initial kboard remain current longer than necessary. 6238 /* Don't let the initial kboard remain current longer than necessary.
diff --git a/src/window.c b/src/window.c
index 31711718a38..d8e09162228 100644
--- a/src/window.c
+++ b/src/window.c
@@ -19,6 +19,9 @@ You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22
23#define WINDOW_INLINE EXTERN_INLINE
24
22#include <stdio.h> 25#include <stdio.h>
23#include <setjmp.h> 26#include <setjmp.h>
24 27
@@ -53,7 +56,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
53#ifdef HAVE_XWIDGETS 56#ifdef HAVE_XWIDGETS
54#include "xwidget.h" 57#include "xwidget.h"
55#endif 58#endif
56Lisp_Object Qwindowp, Qwindow_live_p; 59Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_valid_p;
57static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; 60static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer;
58static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; 61static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
59static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; 62static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
@@ -63,7 +66,6 @@ static Lisp_Object Qsafe, Qabove, Qbelow;
63static Lisp_Object Qauto_buffer_name, Qclone_of; 66static Lisp_Object Qauto_buffer_name, Qclone_of;
64 67
65static int displayed_window_lines (struct window *); 68static int displayed_window_lines (struct window *);
66static struct window *decode_window (Lisp_Object);
67static int count_windows (struct window *); 69static int count_windows (struct window *);
68static int get_leaf_windows (struct window *, struct window **, int); 70static int get_leaf_windows (struct window *, struct window **, int);
69static void window_scroll (Lisp_Object, EMACS_INT, int, int); 71static void window_scroll (Lisp_Object, EMACS_INT, int, int);
@@ -133,8 +135,120 @@ static int window_scroll_pixel_based_preserve_y;
133static EMACS_INT window_scroll_preserve_hpos; 135static EMACS_INT window_scroll_preserve_hpos;
134static EMACS_INT window_scroll_preserve_vpos; 136static EMACS_INT window_scroll_preserve_vpos;
135 137
136static struct window * 138/* These setters are used only in this file, so they can be private. */
137decode_window (register Lisp_Object window) 139static inline void
140wset_combination_limit (struct window *w, Lisp_Object val)
141{
142 w->combination_limit = val;
143}
144static inline void
145wset_dedicated (struct window *w, Lisp_Object val)
146{
147 w->dedicated = val;
148}
149static inline void
150wset_display_table (struct window *w, Lisp_Object val)
151{
152 w->display_table = val;
153}
154static inline void
155wset_hchild (struct window *w, Lisp_Object val)
156{
157 w->hchild = val;
158}
159static inline void
160wset_left_fringe_width (struct window *w, Lisp_Object val)
161{
162 w->left_fringe_width = val;
163}
164static inline void
165wset_left_margin_cols (struct window *w, Lisp_Object val)
166{
167 w->left_margin_cols = val;
168}
169static inline void
170wset_new_normal (struct window *w, Lisp_Object val)
171{
172 w->new_normal = val;
173}
174static inline void
175wset_new_total (struct window *w, Lisp_Object val)
176{
177 w->new_total = val;
178}
179static inline void
180wset_next_buffers (struct window *w, Lisp_Object val)
181{
182 w->next_buffers = val;
183}
184static inline void
185wset_normal_cols (struct window *w, Lisp_Object val)
186{
187 w->normal_cols = val;
188}
189static inline void
190wset_normal_lines (struct window *w, Lisp_Object val)
191{
192 w->normal_lines = val;
193}
194static inline void
195wset_parent (struct window *w, Lisp_Object val)
196{
197 w->parent = val;
198}
199static inline void
200wset_pointm (struct window *w, Lisp_Object val)
201{
202 w->pointm = val;
203}
204static inline void
205wset_prev_buffers (struct window *w, Lisp_Object val)
206{
207 w->prev_buffers = val;
208}
209static inline void
210wset_right_fringe_width (struct window *w, Lisp_Object val)
211{
212 w->right_fringe_width = val;
213}
214static inline void
215wset_right_margin_cols (struct window *w, Lisp_Object val)
216{
217 w->right_margin_cols = val;
218}
219static inline void
220wset_scroll_bar_width (struct window *w, Lisp_Object val)
221{
222 w->scroll_bar_width = val;
223}
224static inline void
225wset_start (struct window *w, Lisp_Object val)
226{
227 w->start = val;
228}
229static inline void
230wset_temslot (struct window *w, Lisp_Object val)
231{
232 w->temslot = val;
233}
234static inline void
235wset_vchild (struct window *w, Lisp_Object val)
236{
237 w->vchild = val;
238}
239static inline void
240wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val)
241{
242 w->vertical_scroll_bar_type = val;
243}
244static inline void
245wset_window_parameters (struct window *w, Lisp_Object val)
246{
247 w->window_parameters = val;
248}
249
250struct window *
251decode_live_window (register Lisp_Object window)
138{ 252{
139 if (NILP (window)) 253 if (NILP (window))
140 return XWINDOW (selected_window); 254 return XWINDOW (selected_window);
@@ -156,6 +270,19 @@ decode_any_window (register Lisp_Object window)
156 return w; 270 return w;
157} 271}
158 272
273struct window *
274decode_valid_window (register Lisp_Object window)
275{
276 struct window *w;
277
278 if (NILP (window))
279 return XWINDOW (selected_window);
280
281 CHECK_VALID_WINDOW (window);
282 w = XWINDOW (window);
283 return w;
284}
285
159DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, 286DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
160 doc: /* Return t if OBJECT is a window and nil otherwise. */) 287 doc: /* Return t if OBJECT is a window and nil otherwise. */)
161 (Lisp_Object object) 288 (Lisp_Object object)
@@ -163,6 +290,15 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
163 return WINDOWP (object) ? Qt : Qnil; 290 return WINDOWP (object) ? Qt : Qnil;
164} 291}
165 292
293DEFUN ("window-valid-p", Fwindow_valid_p, Swindow_valid_p, 1, 1, 0,
294 doc: /* Return t if OBJECT is a valid window and nil otherwise.
295A valid window is either a window that displays a buffer or an internal
296window. Deleted windows are not live. */)
297 (Lisp_Object object)
298{
299 return WINDOW_VALID_P (object) ? Qt : Qnil;
300}
301
166DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, 302DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
167 doc: /* Return t if OBJECT is a live window and nil otherwise. 303 doc: /* Return t if OBJECT is a live window and nil otherwise.
168A live window is a window that displays a buffer. 304A live window is a window that displays a buffer.
@@ -175,10 +311,10 @@ Internal windows and deleted windows are not live. */)
175/* Frames and windows. */ 311/* Frames and windows. */
176DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, 312DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
177 doc: /* Return the frame that window WINDOW is on. 313 doc: /* Return the frame that window WINDOW is on.
178If WINDOW is omitted or nil, it defaults to the selected window. */) 314WINDOW must be a valid window and defaults to the selected one. */)
179 (Lisp_Object window) 315 (Lisp_Object window)
180{ 316{
181 return decode_any_window (window)->frame; 317 return decode_valid_window (window)->frame;
182} 318}
183 319
184DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, 320DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
@@ -192,8 +328,8 @@ With a window argument, return the root window of that window's frame. */)
192 328
193 if (NILP (frame_or_window)) 329 if (NILP (frame_or_window))
194 window = SELECTED_FRAME ()->root_window; 330 window = SELECTED_FRAME ()->root_window;
195 else if (WINDOWP (frame_or_window)) 331 else if (WINDOW_VALID_P (frame_or_window))
196 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; 332 window = XFRAME (XWINDOW (frame_or_window)->frame)->root_window;
197 else 333 else
198 { 334 {
199 CHECK_LIVE_FRAME (frame_or_window); 335 CHECK_LIVE_FRAME (frame_or_window);
@@ -217,18 +353,18 @@ If FRAME is omitted or nil, it defaults to the selected frame. */)
217DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 353DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p,
218 Swindow_minibuffer_p, 0, 1, 0, 354 Swindow_minibuffer_p, 0, 1, 0,
219 doc: /* Return non-nil if WINDOW is a minibuffer window. 355 doc: /* Return non-nil if WINDOW is a minibuffer window.
220If WINDOW is omitted or nil, it defaults to the selected window. */) 356WINDOW must be a valid window and defaults to the selected one. */)
221 (Lisp_Object window) 357 (Lisp_Object window)
222{ 358{
223 return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil; 359 return MINI_WINDOW_P (decode_valid_window (window)) ? Qt : Qnil;
224} 360}
225 361
226/* Don't move this to window.el - this must be a safe routine. */ 362/* Don't move this to window.el - this must be a safe routine. */
227DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, 363DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0,
228 doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW. 364 doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW.
229If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. 365If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
230Else if FRAME-OR-WINDOW denotes any window, return the first window of 366Else if FRAME-OR-WINDOW denotes a valid window, return the first window
231that window's frame. If FRAME-OR-WINDOW denotes a live frame, return 367of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return
232the first window of that frame. */) 368the first window of that frame. */)
233 (Lisp_Object frame_or_window) 369 (Lisp_Object frame_or_window)
234{ 370{
@@ -236,7 +372,7 @@ the first window of that frame. */)
236 372
237 if (NILP (frame_or_window)) 373 if (NILP (frame_or_window))
238 window = SELECTED_FRAME ()->root_window; 374 window = SELECTED_FRAME ()->root_window;
239 else if (WINDOWP (frame_or_window)) 375 else if (WINDOW_VALID_P (frame_or_window))
240 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; 376 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window;
241 else 377 else
242 { 378 {
@@ -261,16 +397,16 @@ DEFUN ("frame-selected-window", Fframe_selected_window,
261 Sframe_selected_window, 0, 1, 0, 397 Sframe_selected_window, 0, 1, 0,
262 doc: /* Return the selected window of FRAME-OR-WINDOW. 398 doc: /* Return the selected window of FRAME-OR-WINDOW.
263If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. 399If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
264Else if FRAME-OR-WINDOW denotes any window, return the selected window 400Else if FRAME-OR-WINDOW denotes a valid window, return the selected
265of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return 401window of that window's frame. If FRAME-OR-WINDOW denotes a live frame,
266the selected window of that frame. */) 402return the selected window of that frame. */)
267 (Lisp_Object frame_or_window) 403 (Lisp_Object frame_or_window)
268{ 404{
269 Lisp_Object window; 405 Lisp_Object window;
270 406
271 if (NILP (frame_or_window)) 407 if (NILP (frame_or_window))
272 window = SELECTED_FRAME ()->selected_window; 408 window = SELECTED_FRAME ()->selected_window;
273 else if (WINDOWP (frame_or_window)) 409 else if (WINDOW_VALID_P (frame_or_window))
274 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; 410 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window;
275 else 411 else
276 { 412 {
@@ -303,7 +439,10 @@ Return WINDOW. */)
303 if (EQ (frame, selected_frame)) 439 if (EQ (frame, selected_frame))
304 return Fselect_window (window, norecord); 440 return Fselect_window (window, norecord);
305 else 441 else
306 return FSET (XFRAME (frame), selected_window, window); 442 {
443 fset_selected_window (XFRAME (frame), window);
444 return window;
445 }
307} 446}
308 447
309DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, 448DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0,
@@ -346,7 +485,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
346 sf = SELECTED_FRAME (); 485 sf = SELECTED_FRAME ();
347 if (XFRAME (WINDOW_FRAME (w)) != sf) 486 if (XFRAME (WINDOW_FRAME (w)) != sf)
348 { 487 {
349 FSET (XFRAME (WINDOW_FRAME (w)), selected_window, window); 488 fset_selected_window (XFRAME (WINDOW_FRAME (w)), window);
350 /* Use this rather than Fhandle_switch_frame 489 /* Use this rather than Fhandle_switch_frame
351 so that FRAME_FOCUS_FRAME is moved appropriately as we 490 so that FRAME_FOCUS_FRAME is moved appropriately as we
352 move around in the state where a minibuffer in a separate 491 move around in the state where a minibuffer in a separate
@@ -357,7 +496,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
357 return window; 496 return window;
358 } 497 }
359 else 498 else
360 FSET (sf, selected_window, window); 499 fset_selected_window (sf, window);
361 500
362 /* Store the current buffer's actual point into the 501 /* Store the current buffer's actual point into the
363 old selected window. It belongs to that window, 502 old selected window. It belongs to that window,
@@ -375,7 +514,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
375 514
376 Fset_buffer (w->buffer); 515 Fset_buffer (w->buffer);
377 516
378 BSET (XBUFFER (w->buffer), last_selected_window, window); 517 bset_last_selected_window (XBUFFER (w->buffer), window);
379 518
380 /* Go to the point recorded in the window. 519 /* Go to the point recorded in the window.
381 This is important when the buffer is in more 520 This is important when the buffer is in more
@@ -423,88 +562,93 @@ Return nil for an internal window or a deleted window. */)
423 562
424DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, 563DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
425 doc: /* Return the parent window of window WINDOW. 564 doc: /* Return the parent window of window WINDOW.
426If WINDOW is omitted or nil, it defaults to the selected window. 565WINDOW must be a valid window and defaults to the selected one.
427Return nil for a window with no parent (e.g. a root window). */) 566Return nil for a window with no parent (e.g. a root window). */)
428 (Lisp_Object window) 567 (Lisp_Object window)
429{ 568{
430 return decode_any_window (window)->parent; 569 return decode_valid_window (window)->parent;
431} 570}
432 571
433DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, 572DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
434 doc: /* Return the topmost child window of window WINDOW. 573 doc: /* Return the topmost child window of window WINDOW.
574WINDOW must be a valid window and defaults to the selected one.
435Return nil if WINDOW is a live window (live windows have no children). 575Return nil if WINDOW is a live window (live windows have no children).
436Return nil if WINDOW is an internal window whose children form a 576Return nil if WINDOW is an internal window whose children form a
437horizontal combination. */) 577horizontal combination. */)
438 (Lisp_Object window) 578 (Lisp_Object window)
439{ 579{
440 CHECK_WINDOW (window); 580 CHECK_WINDOW (window);
441 return decode_any_window (window)->vchild; 581 return decode_valid_window (window)->vchild;
442} 582}
443 583
444DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, 584DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
445 doc: /* Return the leftmost child window of window WINDOW. 585 doc: /* Return the leftmost child window of window WINDOW.
586WINDOW must be a valid window and defaults to the selected one.
446Return nil if WINDOW is a live window (live windows have no children). 587Return nil if WINDOW is a live window (live windows have no children).
447Return nil if WINDOW is an internal window whose children form a 588Return nil if WINDOW is an internal window whose children form a
448vertical combination. */) 589vertical combination. */)
449 (Lisp_Object window) 590 (Lisp_Object window)
450{ 591{
451 CHECK_WINDOW (window); 592 CHECK_WINDOW (window);
452 return decode_any_window (window)->hchild; 593 return decode_valid_window (window)->hchild;
453} 594}
454 595
455DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, 596DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
456 doc: /* Return the next sibling window of window WINDOW. 597 doc: /* Return the next sibling window of window WINDOW.
457If WINDOW is omitted or nil, it defaults to the selected window. 598WINDOW must be a valid window and defaults to the selected one.
458Return nil if WINDOW has no next sibling. */) 599Return nil if WINDOW has no next sibling. */)
459 (Lisp_Object window) 600 (Lisp_Object window)
460{ 601{
461 return decode_any_window (window)->next; 602 return decode_valid_window (window)->next;
462} 603}
463 604
464DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, 605DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
465 doc: /* Return the previous sibling window of window WINDOW. 606 doc: /* Return the previous sibling window of window WINDOW.
466If WINDOW is omitted or nil, it defaults to the selected window. 607WINDOW must be a valid window and defaults to the selected one.
467Return nil if WINDOW has no previous sibling. */) 608Return nil if WINDOW has no previous sibling. */)
468 (Lisp_Object window) 609 (Lisp_Object window)
469{ 610{
470 return decode_any_window (window)->prev; 611 return decode_valid_window (window)->prev;
471} 612}
472 613
473DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, 614DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0,
474 doc: /* Return combination limit of window WINDOW. 615 doc: /* Return combination limit of window WINDOW.
616WINDOW must be a valid window and defaults to the selected one.
475If the return value is nil, child windows of WINDOW can be recombined with 617If the return value is nil, child windows of WINDOW can be recombined with
476WINDOW's siblings. A return value of t means that child windows of 618WINDOW's siblings. A return value of t means that child windows of
477WINDOW are never \(re-)combined with WINDOW's siblings. */) 619WINDOW are never \(re-)combined with WINDOW's siblings. */)
478 (Lisp_Object window) 620 (Lisp_Object window)
479{ 621{
480 return decode_any_window (window)->combination_limit; 622 return decode_valid_window (window)->combination_limit;
481} 623}
482 624
483DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, 625DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
484 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. 626 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT.
627WINDOW must be a valid window and defaults to the selected one.
485If LIMIT is nil, child windows of WINDOW can be recombined with 628If LIMIT is nil, child windows of WINDOW can be recombined with
486WINDOW's siblings. LIMIT t means that child windows of WINDOW are 629WINDOW's siblings. LIMIT t means that child windows of WINDOW are
487never \(re-)combined with WINDOW's siblings. Other values are reserved 630never \(re-)combined with WINDOW's siblings. Other values are reserved
488for future use. */) 631for future use. */)
489 (Lisp_Object window, Lisp_Object limit) 632 (Lisp_Object window, Lisp_Object limit)
490{ 633{
491 return WSET (decode_any_window (window), combination_limit, limit); 634 wset_combination_limit (decode_valid_window (window), limit);
635 return limit;
492} 636}
493 637
494DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 638DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
495 doc: /* Return the use time of window WINDOW. 639 doc: /* Return the use time of window WINDOW.
496If WINDOW is omitted or nil, it defaults to the selected window. 640WINDOW must be a live window and defaults to the selected one.
497The window with the highest use time is the most recently selected 641The window with the highest use time is the most recently selected
498one. The window with the lowest use time is the least recently 642one. The window with the lowest use time is the least recently
499selected one. */) 643selected one. */)
500 (Lisp_Object window) 644 (Lisp_Object window)
501{ 645{
502 return make_number (decode_window (window)->use_time); 646 return make_number (decode_live_window (window)->use_time);
503} 647}
504 648
505DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, 649DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0,
506 doc: /* Return the total height, in lines, of window WINDOW. 650 doc: /* Return the total height, in lines, of window WINDOW.
507If WINDOW is omitted or nil, it defaults to the selected window. 651WINDOW must be a valid window and defaults to the selected one.
508 652
509The return value includes the mode line and header line, if any. 653The return value includes the mode line and header line, if any.
510If WINDOW is an internal window, the total height is the height 654If WINDOW is an internal window, the total height is the height
@@ -514,12 +658,12 @@ On a graphical display, this total height is reported as an
514integer multiple of the default character height. */) 658integer multiple of the default character height. */)
515 (Lisp_Object window) 659 (Lisp_Object window)
516{ 660{
517 return decode_any_window (window)->total_lines; 661 return decode_valid_window (window)->total_lines;
518} 662}
519 663
520DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, 664DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0,
521 doc: /* Return the total width, in columns, of window WINDOW. 665 doc: /* Return the total width, in columns, of window WINDOW.
522If WINDOW is omitted or nil, it defaults to the selected window. 666WINDOW must be a valid window and defaults to the selected one.
523 667
524The return value includes any vertical dividers or scroll bars 668The return value includes any vertical dividers or scroll bars
525belonging to WINDOW. If WINDOW is an internal window, the total width 669belonging to WINDOW. If WINDOW is an internal window, the total width
@@ -529,34 +673,34 @@ On a graphical display, this total width is reported as an
529integer multiple of the default character width. */) 673integer multiple of the default character width. */)
530 (Lisp_Object window) 674 (Lisp_Object window)
531{ 675{
532 return decode_any_window (window)->total_cols; 676 return decode_valid_window (window)->total_cols;
533} 677}
534 678
535DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 679DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
536 doc: /* Return the new total size of window WINDOW. 680 doc: /* Return the new total size of window WINDOW.
537If WINDOW is omitted or nil, it defaults to the selected window. */) 681WINDOW must be a valid window and defaults to the selected one. */)
538 (Lisp_Object window) 682 (Lisp_Object window)
539{ 683{
540 return decode_any_window (window)->new_total; 684 return decode_valid_window (window)->new_total;
541} 685}
542 686
543DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, 687DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
544 doc: /* Return the normal height of window WINDOW. 688 doc: /* Return the normal height of window WINDOW.
545If WINDOW is omitted or nil, it defaults to the selected window. 689WINDOW must be a valid window and defaults to the selected one.
546If HORIZONTAL is non-nil, return the normal width of WINDOW. */) 690If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
547 (Lisp_Object window, Lisp_Object horizontal) 691 (Lisp_Object window, Lisp_Object horizontal)
548{ 692{
549 struct window *w = decode_any_window (window); 693 struct window *w = decode_valid_window (window);
550 694
551 return NILP (horizontal) ? w->normal_lines : w->normal_cols; 695 return NILP (horizontal) ? w->normal_lines : w->normal_cols;
552} 696}
553 697
554DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, 698DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
555 doc: /* Return new normal size of window WINDOW. 699 doc: /* Return new normal size of window WINDOW.
556If WINDOW is omitted or nil, it defaults to the selected window. */) 700WINDOW must be a valid window and defaults to the selected one. */)
557 (Lisp_Object window) 701 (Lisp_Object window)
558{ 702{
559 return decode_any_window (window)->new_normal; 703 return decode_valid_window (window)->new_normal;
560} 704}
561 705
562DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 706DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
@@ -565,10 +709,10 @@ This is the distance, in columns, between the left edge of WINDOW and
565the left edge of the frame's window area. For instance, the return 709the left edge of the frame's window area. For instance, the return
566value is 0 if there is no window to the left of WINDOW. 710value is 0 if there is no window to the left of WINDOW.
567 711
568If WINDOW is omitted or nil, it defaults to the selected window. */) 712WINDOW must be a valid window and defaults to the selected one. */)
569 (Lisp_Object window) 713 (Lisp_Object window)
570{ 714{
571 return decode_any_window (window)->left_col; 715 return decode_valid_window (window)->left_col;
572} 716}
573 717
574DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 718DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
@@ -577,10 +721,10 @@ This is the distance, in lines, between the top of WINDOW and the top
577of the frame's window area. For instance, the return value is 0 if 721of the frame's window area. For instance, the return value is 0 if
578there is no window above WINDOW. 722there is no window above WINDOW.
579 723
580If WINDOW is omitted or nil, it defaults to the selected window. */) 724WINDOW must be a valid window and defaults to the selected one. */)
581 (Lisp_Object window) 725 (Lisp_Object window)
582{ 726{
583 return decode_any_window (window)->top_line; 727 return decode_valid_window (window)->top_line;
584} 728}
585 729
586/* Return the number of lines of W's body. Don't count any mode or 730/* Return the number of lines of W's body. Don't count any mode or
@@ -634,8 +778,7 @@ window_body_cols (struct window *w)
634 778
635DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, 779DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0,
636 doc: /* Return the height, in lines, of WINDOW's text area. 780 doc: /* Return the height, in lines, of WINDOW's text area.
637If WINDOW is omitted or nil, it defaults to the selected window. 781WINDOW must be a live window and defaults to the selected one.
638Signal an error if the window is not live.
639 782
640The returned height does not include the mode line or header line. 783The returned height does not include the mode line or header line.
641On a graphical display, the height is expressed as an integer multiple 784On a graphical display, the height is expressed as an integer multiple
@@ -644,21 +787,20 @@ area is only partially visible, that counts as a whole line; to
644exclude partially-visible lines, use `window-text-height'. */) 787exclude partially-visible lines, use `window-text-height'. */)
645 (Lisp_Object window) 788 (Lisp_Object window)
646{ 789{
647 struct window *w = decode_window (window); 790 struct window *w = decode_live_window (window);
648 return make_number (window_body_lines (w)); 791 return make_number (window_body_lines (w));
649} 792}
650 793
651DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, 794DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0,
652 doc: /* Return the width, in columns, of WINDOW's text area. 795 doc: /* Return the width, in columns, of WINDOW's text area.
653If WINDOW is omitted or nil, it defaults to the selected window. 796WINDOW must be a live window and defaults to the selected one.
654Signal an error if the window is not live.
655 797
656The return value does not include any vertical dividers, fringe or 798The return value does not include any vertical dividers, fringe or
657marginal areas, or scroll bars. On a graphical display, the width is 799marginal areas, or scroll bars. On a graphical display, the width is
658expressed as an integer multiple of the default character width. */) 800expressed as an integer multiple of the default character width. */)
659 (Lisp_Object window) 801 (Lisp_Object window)
660{ 802{
661 struct window *w = decode_window (window); 803 struct window *w = decode_live_window (window);
662 return make_number (window_body_cols (w)); 804 return make_number (window_body_cols (w));
663} 805}
664 806
@@ -667,7 +809,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
667WINDOW must be a live window and defaults to the selected one. */) 809WINDOW must be a live window and defaults to the selected one. */)
668 (Lisp_Object window) 810 (Lisp_Object window)
669{ 811{
670 return make_number (decode_window (window)->hscroll); 812 return make_number (decode_live_window (window)->hscroll);
671} 813}
672 814
673/* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable 815/* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable
@@ -694,7 +836,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll)
694 836
695DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, 837DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
696 doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. 838 doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL.
697If WINDOW is nil, the selected window is used. 839WINDOW must be a live window and defaults to the selected one.
698Clip the number to a reasonable value if out of range. 840Clip the number to a reasonable value if out of range.
699Return the new number. NCOL should be zero or positive. 841Return the new number. NCOL should be zero or positive.
700 842
@@ -702,7 +844,7 @@ Note that if `automatic-hscrolling' is non-nil, you cannot scroll the
702window so that the location of point moves off-window. */) 844window so that the location of point moves off-window. */)
703 (Lisp_Object window, Lisp_Object ncol) 845 (Lisp_Object window, Lisp_Object ncol)
704{ 846{
705 struct window *w = decode_window (window); 847 struct window *w = decode_live_window (window);
706 848
707 CHECK_NUMBER (ncol); 849 CHECK_NUMBER (ncol);
708 return set_window_hscroll (w, XINT (ncol)); 850 return set_window_hscroll (w, XINT (ncol));
@@ -711,41 +853,44 @@ window so that the location of point moves off-window. */)
711DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, 853DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
712 Swindow_redisplay_end_trigger, 0, 1, 0, 854 Swindow_redisplay_end_trigger, 0, 1, 0,
713 doc: /* Return WINDOW's redisplay end trigger value. 855 doc: /* Return WINDOW's redisplay end trigger value.
714WINDOW defaults to the selected window. 856WINDOW must be a live window and defaults to the selected one.
715See `set-window-redisplay-end-trigger' for more information. */) 857See `set-window-redisplay-end-trigger' for more information. */)
716 (Lisp_Object window) 858 (Lisp_Object window)
717{ 859{
718 return decode_window (window)->redisplay_end_trigger; 860 return decode_live_window (window)->redisplay_end_trigger;
719} 861}
720 862
721DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, 863DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger,
722 Sset_window_redisplay_end_trigger, 2, 2, 0, 864 Sset_window_redisplay_end_trigger, 2, 2, 0,
723 doc: /* Set WINDOW's redisplay end trigger value to VALUE. 865 doc: /* Set WINDOW's redisplay end trigger value to VALUE.
724VALUE should be a buffer position (typically a marker) or nil. 866WINDOW must be a live window and defaults to the selected one. VALUE
725If it is a buffer position, then if redisplay in WINDOW reaches a position 867should be a buffer position (typically a marker) or nil. If it is a
726beyond VALUE, the functions in `redisplay-end-trigger-functions' are called 868buffer position, then if redisplay in WINDOW reaches a position beyond
727with two arguments: WINDOW, and the end trigger value. 869VALUE, the functions in `redisplay-end-trigger-functions' are called
728Afterwards the end-trigger value is reset to nil. */) 870with two arguments: WINDOW, and the end trigger value. Afterwards the
871end-trigger value is reset to nil. */)
729 (register Lisp_Object window, Lisp_Object value) 872 (register Lisp_Object window, Lisp_Object value)
730{ 873{
731 return WSET (decode_window (window), redisplay_end_trigger, value); 874 wset_redisplay_end_trigger (decode_live_window (window), value);
875 return value;
732} 876}
733 877
734DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, 878DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0,
735 doc: /* Return a list of the edge coordinates of WINDOW. 879 doc: /* Return a list of the edge coordinates of WINDOW.
736The list has the form (LEFT TOP RIGHT BOTTOM). 880WINDOW must be a valid window and defaults to the selected one.
737TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, 881
738all relative to 0, 0 at top left corner of frame. 882The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM
739 883count by lines, and LEFT and RIGHT count by columns, all relative to 0,
740RIGHT is one more than the rightmost column occupied by WINDOW. 8840 at top left corner of frame.
741BOTTOM is one more than the bottommost row occupied by WINDOW. 885
742The edges include the space used by WINDOW's scroll bar, display 886RIGHT is one more than the rightmost column occupied by WINDOW. BOTTOM
743margins, fringes, header line, and/or mode line. For the edges of 887is one more than the bottommost row occupied by WINDOW. The edges
744just the text area, use `window-inside-edges'. */) 888include the space used by WINDOW's scroll bar, display margins, fringes,
889header line, and/or mode line. For the edges of just the text area, use
890`window-inside-edges'. */)
745 (Lisp_Object window) 891 (Lisp_Object window)
746{ 892{
747 register struct window *w = decode_any_window (window); 893 register struct window *w = decode_valid_window (window);
748 CHECK_LIVE_FRAME (w->frame);
749 894
750 return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), 895 return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)),
751 Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), 896 Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)),
@@ -756,8 +901,10 @@ just the text area, use `window-inside-edges'. */)
756 901
757DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, 902DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0,
758 doc: /* Return a list of the edge pixel coordinates of WINDOW. 903 doc: /* Return a list of the edge pixel coordinates of WINDOW.
759The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at 904WINDOW must be a valid window and defaults to the selected one.
760the top left corner of the frame. 905
906The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
9070, 0 at the top left corner of the frame.
761 908
762RIGHT is one more than the rightmost x position occupied by WINDOW. 909RIGHT is one more than the rightmost x position occupied by WINDOW.
763BOTTOM is one more than the bottommost y position occupied by WINDOW. 910BOTTOM is one more than the bottommost y position occupied by WINDOW.
@@ -766,8 +913,7 @@ margins, fringes, header line, and/or mode line. For the pixel edges
766of just the text area, use `window-inside-pixel-edges'. */) 913of just the text area, use `window-inside-pixel-edges'. */)
767 (Lisp_Object window) 914 (Lisp_Object window)
768{ 915{
769 register struct window *w = decode_any_window (window); 916 register struct window *w = decode_valid_window (window);
770 CHECK_LIVE_FRAME (w->frame);
771 917
772 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), 918 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)),
773 Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), 919 Fcons (make_number (WINDOW_TOP_EDGE_Y (w)),
@@ -801,8 +947,10 @@ calc_absolute_offset (struct window *w, int *add_x, int *add_y)
801DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, 947DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges,
802 Swindow_absolute_pixel_edges, 0, 1, 0, 948 Swindow_absolute_pixel_edges, 0, 1, 0,
803 doc: /* Return a list of the edge pixel coordinates of WINDOW. 949 doc: /* Return a list of the edge pixel coordinates of WINDOW.
804The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at 950WINDOW must be a valid window and defaults to the selected one.
805the top left corner of the display. 951
952The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
9530, 0 at the top left corner of the display.
806 954
807RIGHT is one more than the rightmost x position occupied by WINDOW. 955RIGHT is one more than the rightmost x position occupied by WINDOW.
808BOTTOM is one more than the bottommost y position occupied by WINDOW. 956BOTTOM is one more than the bottommost y position occupied by WINDOW.
@@ -811,10 +959,8 @@ margins, fringes, header line, and/or mode line. For the pixel edges
811of just the text area, use `window-inside-absolute-pixel-edges'. */) 959of just the text area, use `window-inside-absolute-pixel-edges'. */)
812 (Lisp_Object window) 960 (Lisp_Object window)
813{ 961{
814 register struct window *w = decode_any_window (window); 962 register struct window *w = decode_valid_window (window);
815 int add_x, add_y; 963 int add_x, add_y;
816
817 CHECK_LIVE_FRAME (w->frame);
818 calc_absolute_offset (w, &add_x, &add_y); 964 calc_absolute_offset (w, &add_x, &add_y);
819 965
820 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), 966 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x),
@@ -826,17 +972,19 @@ of just the text area, use `window-inside-absolute-pixel-edges'. */)
826 972
827DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, 973DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0,
828 doc: /* Return a list of the edge coordinates of WINDOW. 974 doc: /* Return a list of the edge coordinates of WINDOW.
829The list has the form (LEFT TOP RIGHT BOTTOM). 975WINDOW must be a live window and defaults to the selected one.
830TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, 976
831all relative to 0, 0 at top left corner of frame. 977The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM
978count by lines, and LEFT and RIGHT count by columns, all relative to 0,
9790 at top left corner of frame.
832 980
833RIGHT is one more than the rightmost column of WINDOW's text area. 981RIGHT is one more than the rightmost column of WINDOW's text area.
834BOTTOM is one more than the bottommost row of WINDOW's text area. 982BOTTOM is one more than the bottommost row of WINDOW's text area. The
835The inside edges do not include the space used by the WINDOW's scroll 983inside edges do not include the space used by the WINDOW's scroll bar,
836bar, display margins, fringes, header line, and/or mode line. */) 984display margins, fringes, header line, and/or mode line. */)
837 (Lisp_Object window) 985 (Lisp_Object window)
838{ 986{
839 register struct window *w = decode_window (window); 987 register struct window *w = decode_live_window (window);
840 988
841 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) 989 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w)
842 + WINDOW_LEFT_MARGIN_COLS (w) 990 + WINDOW_LEFT_MARGIN_COLS (w)
@@ -852,8 +1000,10 @@ bar, display margins, fringes, header line, and/or mode line. */)
852 1000
853DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, 1001DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0,
854 doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. 1002 doc: /* Return a list of the edge pixel coordinates of WINDOW's text area.
855The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) 1003WINDOW must be a live window and defaults to the selected one.
856at the top left corner of the frame's window area. 1004
1005The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
1006(0,0) at the top left corner of the frame's window area.
857 1007
858RIGHT is one more than the rightmost x position of WINDOW's text area. 1008RIGHT is one more than the rightmost x position of WINDOW's text area.
859BOTTOM is one more than the bottommost y position of WINDOW's text area. 1009BOTTOM is one more than the bottommost y position of WINDOW's text area.
@@ -861,7 +1011,7 @@ The inside edges do not include the space used by WINDOW's scroll bar,
861display margins, fringes, header line, and/or mode line. */) 1011display margins, fringes, header line, and/or mode line. */)
862 (Lisp_Object window) 1012 (Lisp_Object window)
863{ 1013{
864 register struct window *w = decode_window (window); 1014 register struct window *w = decode_live_window (window);
865 1015
866 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) 1016 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w)
867 + WINDOW_LEFT_MARGIN_WIDTH (w) 1017 + WINDOW_LEFT_MARGIN_WIDTH (w)
@@ -879,8 +1029,10 @@ DEFUN ("window-inside-absolute-pixel-edges",
879 Fwindow_inside_absolute_pixel_edges, 1029 Fwindow_inside_absolute_pixel_edges,
880 Swindow_inside_absolute_pixel_edges, 0, 1, 0, 1030 Swindow_inside_absolute_pixel_edges, 0, 1, 0,
881 doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. 1031 doc: /* Return a list of the edge pixel coordinates of WINDOW's text area.
882The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) 1032WINDOW must be a live window and defaults to the selected one.
883at the top left corner of the frame's window area. 1033
1034The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
1035(0,0) at the top left corner of the frame's window area.
884 1036
885RIGHT is one more than the rightmost x position of WINDOW's text area. 1037RIGHT is one more than the rightmost x position of WINDOW's text area.
886BOTTOM is one more than the bottommost y position of WINDOW's text area. 1038BOTTOM is one more than the bottommost y position of WINDOW's text area.
@@ -888,7 +1040,7 @@ The inside edges do not include the space used by WINDOW's scroll bar,
888display margins, fringes, header line, and/or mode line. */) 1040display margins, fringes, header line, and/or mode line. */)
889 (Lisp_Object window) 1041 (Lisp_Object window)
890{ 1042{
891 register struct window *w = decode_window (window); 1043 register struct window *w = decode_live_window (window);
892 int add_x, add_y; 1044 int add_x, add_y;
893 calc_absolute_offset (w, &add_x, &add_y); 1045 calc_absolute_offset (w, &add_x, &add_y);
894 1046
@@ -1067,7 +1219,7 @@ window_relative_x_coord (struct window *w, enum window_part part, int x)
1067DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, 1219DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
1068 Scoordinates_in_window_p, 2, 2, 0, 1220 Scoordinates_in_window_p, 2, 2, 0,
1069 doc: /* Return non-nil if COORDINATES are in WINDOW. 1221 doc: /* Return non-nil if COORDINATES are in WINDOW.
1070WINDOW must be a live window. 1222WINDOW must be a live window and defaults to the selected one.
1071COORDINATES is a cons of the form (X . Y), X and Y being distances 1223COORDINATES is a cons of the form (X . Y), X and Y being distances
1072measured in characters from the upper-left corner of the frame. 1224measured in characters from the upper-left corner of the frame.
1073\(0 . 0) denotes the character in the upper left corner of the 1225\(0 . 0) denotes the character in the upper left corner of the
@@ -1089,8 +1241,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
1089 int x, y; 1241 int x, y;
1090 Lisp_Object lx, ly; 1242 Lisp_Object lx, ly;
1091 1243
1092 CHECK_LIVE_WINDOW (window); 1244 w = decode_live_window (window);
1093 w = XWINDOW (window);
1094 f = XFRAME (w->frame); 1245 f = XFRAME (w->frame);
1095 CHECK_CONS (coordinates); 1246 CHECK_CONS (coordinates);
1096 lx = Fcar (coordinates); 1247 lx = Fcar (coordinates);
@@ -1268,7 +1419,7 @@ of point, outside of any save-excursion forms.
1268But that is hard to define. */) 1419But that is hard to define. */)
1269 (Lisp_Object window) 1420 (Lisp_Object window)
1270{ 1421{
1271 register struct window *w = decode_window (window); 1422 register struct window *w = decode_live_window (window);
1272 1423
1273 if (w == XWINDOW (selected_window) 1424 if (w == XWINDOW (selected_window)
1274 && current_buffer == XBUFFER (w->buffer)) 1425 && current_buffer == XBUFFER (w->buffer))
@@ -1282,7 +1433,7 @@ WINDOW must be a live window and defaults to the selected one.
1282This is updated by redisplay or by calling `set-window-start'. */) 1433This is updated by redisplay or by calling `set-window-start'. */)
1283 (Lisp_Object window) 1434 (Lisp_Object window)
1284{ 1435{
1285 return Fmarker_position (decode_window (window)->start); 1436 return Fmarker_position (decode_live_window (window)->start);
1286} 1437}
1287 1438
1288/* This is text temporarily removed from the doc string below. 1439/* This is text temporarily removed from the doc string below.
@@ -1309,7 +1460,7 @@ if it isn't already recorded. */)
1309 (Lisp_Object window, Lisp_Object update) 1460 (Lisp_Object window, Lisp_Object update)
1310{ 1461{
1311 Lisp_Object value; 1462 Lisp_Object value;
1312 struct window *w = decode_window (window); 1463 struct window *w = decode_live_window (window);
1313 Lisp_Object buf; 1464 Lisp_Object buf;
1314 struct buffer *b; 1465 struct buffer *b;
1315 1466
@@ -1376,10 +1527,11 @@ if it isn't already recorded. */)
1376 1527
1377DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, 1528DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0,
1378 doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer. 1529 doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer.
1530WINDOW must be a live window and defaults to the selected one.
1379Return POS. */) 1531Return POS. */)
1380 (Lisp_Object window, Lisp_Object pos) 1532 (Lisp_Object window, Lisp_Object pos)
1381{ 1533{
1382 register struct window *w = decode_window (window); 1534 register struct window *w = decode_live_window (window);
1383 1535
1384 CHECK_NUMBER_COERCE_MARKER (pos); 1536 CHECK_NUMBER_COERCE_MARKER (pos);
1385 if (w == XWINDOW (selected_window) 1537 if (w == XWINDOW (selected_window)
@@ -1398,12 +1550,12 @@ Return POS. */)
1398 1550
1399DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, 1551DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0,
1400 doc: /* Make display in WINDOW start at position POS in WINDOW's buffer. 1552 doc: /* Make display in WINDOW start at position POS in WINDOW's buffer.
1401If WINDOW is nil, the selected window is used. Return POS. 1553WINDOW must be a live window and defaults to the selected one. Return
1402Optional third arg NOFORCE non-nil inhibits next redisplay from 1554POS. Optional third arg NOFORCE non-nil inhibits next redisplay from
1403overriding motion of point in order to display at this exact start. */) 1555overriding motion of point in order to display at this exact start. */)
1404 (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce) 1556 (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce)
1405{ 1557{
1406 register struct window *w = decode_window (window); 1558 register struct window *w = decode_live_window (window);
1407 1559
1408 CHECK_NUMBER_COERCE_MARKER (pos); 1560 CHECK_NUMBER_COERCE_MARKER (pos);
1409 set_marker_restricted (w->start, pos, w->buffer); 1561 set_marker_restricted (w->start, pos, w->buffer);
@@ -1423,12 +1575,14 @@ overriding motion of point in order to display at this exact start. */)
1423DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 1575DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p,
1424 Spos_visible_in_window_p, 0, 3, 0, 1576 Spos_visible_in_window_p, 0, 3, 0,
1425 doc: /* Return non-nil if position POS is currently on the frame in WINDOW. 1577 doc: /* Return non-nil if position POS is currently on the frame in WINDOW.
1426Return nil if that position is scrolled vertically out of view. 1578WINDOW must be a live window and defaults to the selected one.
1427If a character is only partially visible, nil is returned, unless the 1579
1428optional argument PARTIALLY is non-nil. 1580Return nil if that position is scrolled vertically out of view. If a
1429If POS is only out of view because of horizontal scrolling, return non-nil. 1581character is only partially visible, nil is returned, unless the
1430If POS is t, it specifies the position of the last visible glyph in WINDOW. 1582optional argument PARTIALLY is non-nil. If POS is only out of view
1431POS defaults to point in WINDOW; WINDOW defaults to the selected window. 1583because of horizontal scrolling, return non-nil. If POS is t, it
1584specifies the position of the last visible glyph in WINDOW. POS
1585defaults to point in WINDOW; WINDOW defaults to the selected window.
1432 1586
1433If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 1587If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
1434return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), 1588return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
@@ -1447,7 +1601,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1447 int rtop, rbot, rowh, vpos, fully_p = 1; 1601 int rtop, rbot, rowh, vpos, fully_p = 1;
1448 int x, y; 1602 int x, y;
1449 1603
1450 w = decode_window (window); 1604 w = decode_live_window (window);
1451 buf = XBUFFER (w->buffer); 1605 buf = XBUFFER (w->buffer);
1452 SET_TEXT_POS_FROM_MARKER (top, w->start); 1606 SET_TEXT_POS_FROM_MARKER (top, w->start);
1453 1607
@@ -1489,7 +1643,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1489DEFUN ("window-line-height", Fwindow_line_height, 1643DEFUN ("window-line-height", Fwindow_line_height,
1490 Swindow_line_height, 0, 2, 0, 1644 Swindow_line_height, 0, 2, 0,
1491 doc: /* Return height in pixels of text line LINE in window WINDOW. 1645 doc: /* Return height in pixels of text line LINE in window WINDOW.
1492WINDOW defaults to the selected window. 1646WINDOW must be a live window and defaults to the selected one.
1493 1647
1494Return height of current line if LINE is omitted or nil. Return height of 1648Return height of current line if LINE is omitted or nil. Return height of
1495header or mode line if LINE is `header-line' or `mode-line'. 1649header or mode line if LINE is `header-line' or `mode-line'.
@@ -1513,7 +1667,7 @@ Return nil if window display is not up-to-date. In that case, use
1513 int max_y, crop, i; 1667 int max_y, crop, i;
1514 EMACS_INT n; 1668 EMACS_INT n;
1515 1669
1516 w = decode_window (window); 1670 w = decode_live_window (window);
1517 1671
1518 if (noninteractive || w->pseudo_window_p) 1672 if (noninteractive || w->pseudo_window_p)
1519 return Qnil; 1673 return Qnil;
@@ -1601,8 +1755,8 @@ DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p,
1601More precisely, return the value assigned by the last call of 1755More precisely, return the value assigned by the last call of
1602`set-window-dedicated-p' for WINDOW. Return nil if that function was 1756`set-window-dedicated-p' for WINDOW. Return nil if that function was
1603never called with WINDOW as its argument, or the value set by that 1757never called with WINDOW as its argument, or the value set by that
1604function was internally reset since its last call. WINDOW defaults to 1758function was internally reset since its last call. WINDOW must be a
1605the selected window. 1759live window and defaults to the selected one.
1606 1760
1607When a window is dedicated to its buffer, `display-buffer' will refrain 1761When a window is dedicated to its buffer, `display-buffer' will refrain
1608from displaying another buffer in it. `get-lru-window' and 1762from displaying another buffer in it. `get-lru-window' and
@@ -1615,7 +1769,7 @@ window, unless that window is "strongly" dedicated to its buffer, that
1615is the value returned by `window-dedicated-p' is t. */) 1769is the value returned by `window-dedicated-p' is t. */)
1616 (Lisp_Object window) 1770 (Lisp_Object window)
1617{ 1771{
1618 return decode_window (window)->dedicated; 1772 return decode_live_window (window)->dedicated;
1619} 1773}
1620 1774
1621DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, 1775DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p,
@@ -1639,7 +1793,8 @@ buffer. If and when `set-window-buffer' displays another buffer in a
1639window, it also makes sure that the window is no more dedicated. */) 1793window, it also makes sure that the window is no more dedicated. */)
1640 (Lisp_Object window, Lisp_Object flag) 1794 (Lisp_Object window, Lisp_Object flag)
1641{ 1795{
1642 return WSET (decode_window (window), dedicated, flag); 1796 wset_dedicated (decode_live_window (window), flag);
1797 return flag;
1643} 1798}
1644 1799
1645DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, 1800DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers,
@@ -1652,7 +1807,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
1652window for that buffer, and POS is a window-specific point value. */) 1807window for that buffer, and POS is a window-specific point value. */)
1653 (Lisp_Object window) 1808 (Lisp_Object window)
1654{ 1809{
1655 return decode_window (window)->prev_buffers; 1810 return decode_live_window (window)->prev_buffers;
1656} 1811}
1657 1812
1658DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, 1813DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers,
@@ -1665,7 +1820,8 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
1665window for that buffer, and POS is a window-specific point value. */) 1820window for that buffer, and POS is a window-specific point value. */)
1666 (Lisp_Object window, Lisp_Object prev_buffers) 1821 (Lisp_Object window, Lisp_Object prev_buffers)
1667{ 1822{
1668 return WSET (decode_window (window), prev_buffers, prev_buffers); 1823 wset_prev_buffers (decode_live_window (window), prev_buffers);
1824 return prev_buffers;
1669} 1825}
1670 1826
1671DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, 1827DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
@@ -1674,7 +1830,7 @@ DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
1674WINDOW must be a live window and defaults to the selected one. */) 1830WINDOW must be a live window and defaults to the selected one. */)
1675 (Lisp_Object window) 1831 (Lisp_Object window)
1676{ 1832{
1677 return decode_window (window)->next_buffers; 1833 return decode_live_window (window)->next_buffers;
1678} 1834}
1679 1835
1680DEFUN ("set-window-next-buffers", Fset_window_next_buffers, 1836DEFUN ("set-window-next-buffers", Fset_window_next_buffers,
@@ -1684,44 +1840,46 @@ WINDOW must be a live window and defaults to the selected one.
1684NEXT-BUFFERS should be a list of buffers. */) 1840NEXT-BUFFERS should be a list of buffers. */)
1685 (Lisp_Object window, Lisp_Object next_buffers) 1841 (Lisp_Object window, Lisp_Object next_buffers)
1686{ 1842{
1687 return WSET (decode_window (window), next_buffers, next_buffers); 1843 wset_next_buffers (decode_live_window (window), next_buffers);
1844 return next_buffers;
1688} 1845}
1689 1846
1690DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, 1847DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
1691 0, 1, 0, 1848 0, 1, 0,
1692 doc: /* Return the parameters of WINDOW and their values. 1849 doc: /* Return the parameters of WINDOW and their values.
1693WINDOW defaults to the selected window. The return value is a list of 1850WINDOW must be a valid window and defaults to the selected one. The
1694elements of the form (PARAMETER . VALUE). */) 1851return value is a list of elements of the form (PARAMETER . VALUE). */)
1695 (Lisp_Object window) 1852 (Lisp_Object window)
1696{ 1853{
1697 return Fcopy_alist (decode_any_window (window)->window_parameters); 1854 return Fcopy_alist (decode_valid_window (window)->window_parameters);
1698} 1855}
1699 1856
1700DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, 1857DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
1701 2, 2, 0, 1858 2, 2, 0,
1702 doc: /* Return WINDOW's value for PARAMETER. 1859 doc: /* Return WINDOW's value for PARAMETER.
1703WINDOW defaults to the selected window. */) 1860WINDOW must be a valid window and defaults to the selected one. */)
1704 (Lisp_Object window, Lisp_Object parameter) 1861 (Lisp_Object window, Lisp_Object parameter)
1705{ 1862{
1706 Lisp_Object result; 1863 Lisp_Object result;
1707 1864
1708 result = Fassq (parameter, decode_any_window (window)->window_parameters); 1865 result = Fassq (parameter, decode_valid_window (window)->window_parameters);
1709 return CDR_SAFE (result); 1866 return CDR_SAFE (result);
1710} 1867}
1711 1868
1712DEFUN ("set-window-parameter", Fset_window_parameter, 1869DEFUN ("set-window-parameter", Fset_window_parameter,
1713 Sset_window_parameter, 3, 3, 0, 1870 Sset_window_parameter, 3, 3, 0,
1714 doc: /* Set WINDOW's value of PARAMETER to VALUE. 1871 doc: /* Set WINDOW's value of PARAMETER to VALUE.
1715WINDOW defaults to the selected window. Return VALUE. */) 1872WINDOW must be a valid window and defaults to the selected one.
1873Return VALUE. */)
1716 (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) 1874 (Lisp_Object window, Lisp_Object parameter, Lisp_Object value)
1717{ 1875{
1718 register struct window *w = decode_any_window (window); 1876 register struct window *w = decode_valid_window (window);
1719 Lisp_Object old_alist_elt; 1877 Lisp_Object old_alist_elt;
1720 1878
1721 old_alist_elt = Fassq (parameter, w->window_parameters); 1879 old_alist_elt = Fassq (parameter, w->window_parameters);
1722 if (NILP (old_alist_elt)) 1880 if (NILP (old_alist_elt))
1723 WSET (w, window_parameters, 1881 wset_window_parameters
1724 Fcons (Fcons (parameter, value), w->window_parameters)); 1882 (w, Fcons (Fcons (parameter, value), w->window_parameters));
1725 else 1883 else
1726 Fsetcdr (old_alist_elt, value); 1884 Fsetcdr (old_alist_elt, value);
1727 return value; 1885 return value;
@@ -1730,10 +1888,10 @@ WINDOW defaults to the selected window. Return VALUE. */)
1730DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, 1888DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
1731 0, 1, 0, 1889 0, 1, 0,
1732 doc: /* Return the display-table that WINDOW is using. 1890 doc: /* Return the display-table that WINDOW is using.
1733WINDOW defaults to the selected window. */) 1891WINDOW must be a live window and defaults to the selected one. */)
1734 (Lisp_Object window) 1892 (Lisp_Object window)
1735{ 1893{
1736 return decode_window (window)->display_table; 1894 return decode_live_window (window)->display_table;
1737} 1895}
1738 1896
1739/* Get the display table for use on window W. This is either W's 1897/* Get the display table for use on window W. This is either W's
@@ -1762,10 +1920,12 @@ window_display_table (struct window *w)
1762} 1920}
1763 1921
1764DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, 1922DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0,
1765 doc: /* Set WINDOW's display-table to TABLE. */) 1923 doc: /* Set WINDOW's display-table to TABLE.
1924WINDOW must be a live window and defaults to the selected one. */)
1766 (register Lisp_Object window, Lisp_Object table) 1925 (register Lisp_Object window, Lisp_Object table)
1767{ 1926{
1768 return WSET (decode_window (window), display_table, table); 1927 wset_display_table (decode_live_window (window), table);
1928 return table;
1769} 1929}
1770 1930
1771/* Record info on buffer window W is displaying 1931/* Record info on buffer window W is displaying
@@ -1814,7 +1974,7 @@ unshow_buffer (register struct window *w)
1814 1974
1815 if (WINDOWP (BVAR (b, last_selected_window)) 1975 if (WINDOWP (BVAR (b, last_selected_window))
1816 && w == XWINDOW (BVAR (b, last_selected_window))) 1976 && w == XWINDOW (BVAR (b, last_selected_window)))
1817 BSET (b, last_selected_window, Qnil); 1977 bset_last_selected_window (b, Qnil);
1818} 1978}
1819 1979
1820/* Put NEW into the window structure in place of OLD. SETFLAG zero 1980/* Put NEW into the window structure in place of OLD. SETFLAG zero
@@ -1829,18 +1989,18 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1829 /* If OLD is its frame's root window, then NEW is the new 1989 /* If OLD is its frame's root window, then NEW is the new
1830 root window for that frame. */ 1990 root window for that frame. */
1831 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) 1991 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame))))
1832 FSET (XFRAME (o->frame), root_window, new); 1992 fset_root_window (XFRAME (o->frame), new);
1833 1993
1834 if (setflag) 1994 if (setflag)
1835 { 1995 {
1836 WSET (n, left_col, o->left_col); 1996 wset_left_col (n, o->left_col);
1837 WSET (n, top_line, o->top_line); 1997 wset_top_line (n, o->top_line);
1838 WSET (n, total_cols, o->total_cols); 1998 wset_total_cols (n, o->total_cols);
1839 WSET (n, total_lines, o->total_lines); 1999 wset_total_lines (n, o->total_lines);
1840 WSET (n, normal_cols, o->normal_cols); 2000 wset_normal_cols (n, o->normal_cols);
1841 WSET (o, normal_cols, make_float (1.0)); 2001 wset_normal_cols (o, make_float (1.0));
1842 WSET (n, normal_lines, o->normal_lines); 2002 wset_normal_lines (n, o->normal_lines);
1843 WSET (o, normal_lines, make_float (1.0)); 2003 wset_normal_lines (o, make_float (1.0));
1844 n->desired_matrix = n->current_matrix = 0; 2004 n->desired_matrix = n->current_matrix = 0;
1845 n->vscroll = 0; 2005 n->vscroll = 0;
1846 memset (&n->cursor, 0, sizeof (n->cursor)); 2006 memset (&n->cursor, 0, sizeof (n->cursor));
@@ -1850,30 +2010,30 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1850 n->phys_cursor_width = -1; 2010 n->phys_cursor_width = -1;
1851 n->must_be_updated_p = 0; 2011 n->must_be_updated_p = 0;
1852 n->pseudo_window_p = 0; 2012 n->pseudo_window_p = 0;
1853 WSET (n, window_end_vpos, make_number (0)); 2013 wset_window_end_vpos (n, make_number (0));
1854 WSET (n, window_end_pos, make_number (0)); 2014 wset_window_end_pos (n, make_number (0));
1855 WSET (n, window_end_valid, Qnil); 2015 wset_window_end_valid (n, Qnil);
1856 n->frozen_window_start_p = 0; 2016 n->frozen_window_start_p = 0;
1857 } 2017 }
1858 2018
1859 tem = o->next; 2019 tem = o->next;
1860 WSET (n, next, tem); 2020 wset_next (n, tem);
1861 if (!NILP (tem)) 2021 if (!NILP (tem))
1862 WSET (XWINDOW (tem), prev, new); 2022 wset_prev (XWINDOW (tem), new);
1863 2023
1864 tem = o->prev; 2024 tem = o->prev;
1865 WSET (n, prev, tem); 2025 wset_prev (n, tem);
1866 if (!NILP (tem)) 2026 if (!NILP (tem))
1867 WSET (XWINDOW (tem), next, new); 2027 wset_next (XWINDOW (tem), new);
1868 2028
1869 tem = o->parent; 2029 tem = o->parent;
1870 WSET (n, parent, tem); 2030 wset_parent (n, tem);
1871 if (!NILP (tem)) 2031 if (!NILP (tem))
1872 { 2032 {
1873 if (EQ (XWINDOW (tem)->vchild, old)) 2033 if (EQ (XWINDOW (tem)->vchild, old))
1874 WSET (XWINDOW (tem), vchild, new); 2034 wset_vchild (XWINDOW (tem), new);
1875 if (EQ (XWINDOW (tem)->hchild, old)) 2035 if (EQ (XWINDOW (tem)->hchild, old))
1876 WSET (XWINDOW (tem), hchild, new); 2036 wset_hchild (XWINDOW (tem), new);
1877 } 2037 }
1878} 2038}
1879 2039
@@ -1906,34 +2066,34 @@ recombine_windows (Lisp_Object window)
1906 assign new normal sizes. */ 2066 assign new normal sizes. */
1907 if (NILP (w->prev)) 2067 if (NILP (w->prev))
1908 if (horflag) 2068 if (horflag)
1909 WSET (p, hchild, child); 2069 wset_hchild (p, child);
1910 else 2070 else
1911 WSET (p, vchild, child); 2071 wset_vchild (p, child);
1912 else 2072 else
1913 { 2073 {
1914 WSET (c, prev, w->prev); 2074 wset_prev (c, w->prev);
1915 WSET (XWINDOW (w->prev), next, child); 2075 wset_next (XWINDOW (w->prev), child);
1916 } 2076 }
1917 2077
1918 while (c) 2078 while (c)
1919 { 2079 {
1920 WSET (c, parent, parent); 2080 wset_parent (c, parent);
1921 2081
1922 if (horflag) 2082 if (horflag)
1923 WSET (c, normal_cols, 2083 wset_normal_cols (c,
1924 make_float (XFLOATINT (c->total_cols) 2084 make_float (XFLOATINT (c->total_cols)
1925 / XFLOATINT (p->total_cols))); 2085 / XFLOATINT (p->total_cols)));
1926 else 2086 else
1927 WSET (c, normal_lines, 2087 wset_normal_lines (c,
1928 make_float (XFLOATINT (c->total_lines) 2088 make_float (XFLOATINT (c->total_lines)
1929 / XFLOATINT (p->total_lines))); 2089 / XFLOATINT (p->total_lines)));
1930 2090
1931 if (NILP (c->next)) 2091 if (NILP (c->next))
1932 { 2092 {
1933 if (!NILP (w->next)) 2093 if (!NILP (w->next))
1934 { 2094 {
1935 WSET (c, next, w->next); 2095 wset_next (c, w->next);
1936 WSET (XWINDOW (c->next), prev, child); 2096 wset_prev (XWINDOW (c->next), child);
1937 } 2097 }
1938 2098
1939 c = 0; 2099 c = 0;
@@ -1946,8 +2106,8 @@ recombine_windows (Lisp_Object window)
1946 } 2106 }
1947 2107
1948 /* WINDOW can be deleted now. */ 2108 /* WINDOW can be deleted now. */
1949 WSET (w, vchild, Qnil); 2109 wset_vchild (w, Qnil);
1950 WSET (w, hchild, Qnil); 2110 wset_hchild (w, Qnil);
1951 } 2111 }
1952 } 2112 }
1953} 2113}
@@ -2112,7 +2272,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
2112 2272
2113 /* ALL_FRAMES nil doesn't specify which frames to include. */ 2273 /* ALL_FRAMES nil doesn't specify which frames to include. */
2114 if (NILP (*all_frames)) 2274 if (NILP (*all_frames))
2115 *all_frames 2275 *all_frames
2116 = (!EQ (*minibuf, Qlambda) 2276 = (!EQ (*minibuf, Qlambda)
2117 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) 2277 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame))
2118 : Qnil); 2278 : Qnil);
@@ -2468,7 +2628,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2468 if (EQ (w->buffer, obj)) 2628 if (EQ (w->buffer, obj))
2469 { 2629 {
2470 /* Undedicate WINDOW. */ 2630 /* Undedicate WINDOW. */
2471 WSET (w, dedicated, Qnil); 2631 wset_dedicated (w, Qnil);
2472 /* Make WINDOW show the buffer returned by 2632 /* Make WINDOW show the buffer returned by
2473 other_buffer_safely, don't run any hooks. */ 2633 other_buffer_safely, don't run any hooks. */
2474 set_window_buffer 2634 set_window_buffer
@@ -2561,8 +2721,8 @@ resize_root_window (Lisp_Object window, Lisp_Object delta, Lisp_Object horizonta
2561DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal, 2721DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal,
2562 Sdelete_other_windows_internal, 0, 2, "", 2722 Sdelete_other_windows_internal, 0, 2, "",
2563 doc: /* Make WINDOW fill its frame. 2723 doc: /* Make WINDOW fill its frame.
2564Only the frame WINDOW is on is affected. WINDOW may be any window and 2724Only the frame WINDOW is on is affected. WINDOW must be a valid window
2565defaults to the selected one. 2725and defaults to the selected one.
2566 2726
2567Optional argument ROOT, if non-nil, must specify an internal window such 2727Optional argument ROOT, if non-nil, must specify an internal window such
2568that WINDOW is in its window subtree. If this is the case, replace ROOT 2728that WINDOW is in its window subtree. If this is the case, replace ROOT
@@ -2581,8 +2741,7 @@ window-start value is reasonable when this function is called. */)
2581 ptrdiff_t startpos IF_LINT (= 0); 2741 ptrdiff_t startpos IF_LINT (= 0);
2582 int top IF_LINT (= 0), new_top, resize_failed; 2742 int top IF_LINT (= 0), new_top, resize_failed;
2583 2743
2584 w = decode_any_window (window); 2744 w = decode_valid_window (window);
2585 CHECK_LIVE_FRAME (w->frame);
2586 XSETWINDOW (window, w); 2745 XSETWINDOW (window, w);
2587 f = XFRAME (w->frame); 2746 f = XFRAME (w->frame);
2588 2747
@@ -2595,8 +2754,7 @@ window-start value is reasonable when this function is called. */)
2595 else 2754 else
2596 /* ROOT must be an ancestor of WINDOW. */ 2755 /* ROOT must be an ancestor of WINDOW. */
2597 { 2756 {
2598 r = decode_any_window (root); 2757 r = decode_valid_window (root);
2599 CHECK_LIVE_FRAME (r->frame);
2600 pwindow = XWINDOW (window)->parent; 2758 pwindow = XWINDOW (window)->parent;
2601 while (!NILP (pwindow)) 2759 while (!NILP (pwindow))
2602 if (EQ (pwindow, root)) 2760 if (EQ (pwindow, root))
@@ -2627,7 +2785,7 @@ window-start value is reasonable when this function is called. */)
2627 if (EQ (selected_frame, w->frame)) 2785 if (EQ (selected_frame, w->frame))
2628 Fselect_window (window, Qnil); 2786 Fselect_window (window, Qnil);
2629 else 2787 else
2630 FSET (f, selected_window, window); 2788 fset_selected_window (f, window);
2631 } 2789 }
2632 } 2790 }
2633 else 2791 else
@@ -2657,7 +2815,7 @@ window-start value is reasonable when this function is called. */)
2657 if (EQ (selected_frame, w->frame)) 2815 if (EQ (selected_frame, w->frame))
2658 Fselect_window (swindow, Qnil); 2816 Fselect_window (swindow, Qnil);
2659 else 2817 else
2660 FSET (f, selected_window, swindow); 2818 fset_selected_window (f, swindow);
2661 } 2819 }
2662 } 2820 }
2663 2821
@@ -2692,7 +2850,7 @@ window-start value is reasonable when this function is called. */)
2692 /* Resize child windows vertically. */ 2850 /* Resize child windows vertically. */
2693 XSETINT (delta, XINT (r->total_lines) 2851 XSETINT (delta, XINT (r->total_lines)
2694 - XINT (w->total_lines)); 2852 - XINT (w->total_lines));
2695 WSET (w, top_line, r->top_line); 2853 wset_top_line (w, r->top_line);
2696 resize_root_window (window, delta, Qnil, Qnil); 2854 resize_root_window (window, delta, Qnil, Qnil);
2697 if (window_resize_check (w, 0)) 2855 if (window_resize_check (w, 0))
2698 window_resize_apply (w, 0); 2856 window_resize_apply (w, 0);
@@ -2708,10 +2866,10 @@ window-start value is reasonable when this function is called. */)
2708 /* Resize child windows horizontally. */ 2866 /* Resize child windows horizontally. */
2709 if (!resize_failed) 2867 if (!resize_failed)
2710 { 2868 {
2711 WSET (w, left_col, r->left_col); 2869 wset_left_col (w, r->left_col);
2712 XSETINT (delta, XINT (r->total_cols) 2870 XSETINT (delta,
2713 - XINT (w->total_cols)); 2871 XINT (r->total_cols) - XINT (w->total_cols));
2714 WSET (w, left_col, r->left_col); 2872 wset_left_col (w, r->left_col);
2715 resize_root_window (window, delta, Qt, Qnil); 2873 resize_root_window (window, delta, Qt, Qnil);
2716 if (window_resize_check (w, 1)) 2874 if (window_resize_check (w, 1))
2717 window_resize_apply (w, 1); 2875 window_resize_apply (w, 1);
@@ -2739,32 +2897,32 @@ window-start value is reasonable when this function is called. */)
2739 { 2897 {
2740 sibling = w->prev; 2898 sibling = w->prev;
2741 s = XWINDOW (sibling); 2899 s = XWINDOW (sibling);
2742 WSET (s, next, w->next); 2900 wset_next (s, w->next);
2743 if (!NILP (s->next)) 2901 if (!NILP (s->next))
2744 WSET (XWINDOW (s->next), prev, sibling); 2902 wset_prev (XWINDOW (s->next), sibling);
2745 } 2903 }
2746 else 2904 else
2747 /* Get SIBLING below (on the right of) WINDOW. */ 2905 /* Get SIBLING below (on the right of) WINDOW. */
2748 { 2906 {
2749 sibling = w->next; 2907 sibling = w->next;
2750 s = XWINDOW (sibling); 2908 s = XWINDOW (sibling);
2751 WSET (s, prev, Qnil); 2909 wset_prev (s, Qnil);
2752 if (!NILP (XWINDOW (w->parent)->vchild)) 2910 if (!NILP (XWINDOW (w->parent)->vchild))
2753 WSET (XWINDOW (w->parent), vchild, sibling); 2911 wset_vchild (XWINDOW (w->parent), sibling);
2754 else 2912 else
2755 WSET (XWINDOW (w->parent), hchild, sibling); 2913 wset_hchild (XWINDOW (w->parent), sibling);
2756 } 2914 }
2757 2915
2758 /* Delete ROOT and all child windows of ROOT. */ 2916 /* Delete ROOT and all child windows of ROOT. */
2759 if (!NILP (r->vchild)) 2917 if (!NILP (r->vchild))
2760 { 2918 {
2761 delete_all_child_windows (r->vchild); 2919 delete_all_child_windows (r->vchild);
2762 WSET (r, vchild, Qnil); 2920 wset_vchild (r, Qnil);
2763 } 2921 }
2764 else if (!NILP (r->hchild)) 2922 else if (!NILP (r->hchild))
2765 { 2923 {
2766 delete_all_child_windows (r->hchild); 2924 delete_all_child_windows (r->hchild);
2767 WSET (r, hchild, Qnil); 2925 wset_hchild (r, Qnil);
2768 } 2926 }
2769 2927
2770 replace_window (root, window, 1); 2928 replace_window (root, window, 1);
@@ -2791,7 +2949,7 @@ window-start value is reasonable when this function is called. */)
2791 pos = *vmotion (startpos, -top, w); 2949 pos = *vmotion (startpos, -top, w);
2792 2950
2793 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); 2951 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos);
2794 WSET (w, window_end_valid, Qnil); 2952 wset_window_end_valid (w, Qnil);
2795 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE 2953 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE
2796 || FETCH_BYTE (pos.bytepos - 1) == '\n'); 2954 || FETCH_BYTE (pos.bytepos - 1) == '\n');
2797 /* We need to do this, so that the window-scroll-functions 2955 /* We need to do this, so that the window-scroll-functions
@@ -2882,14 +3040,14 @@ adjust_window_margins (struct window *w)
2882 { 3040 {
2883 if (WINDOW_LEFT_MARGIN_COLS (w) > 0) 3041 if (WINDOW_LEFT_MARGIN_COLS (w) > 0)
2884 { 3042 {
2885 WSET (w, left_margin_cols, make_number (margin_cols / 2)); 3043 wset_left_margin_cols (w, make_number (margin_cols / 2));
2886 WSET (w, right_margin_cols, make_number (margin_cols / 2)); 3044 wset_right_margin_cols (w, make_number (margin_cols / 2));
2887 } 3045 }
2888 else 3046 else
2889 WSET (w, right_margin_cols, make_number (margin_cols)); 3047 wset_right_margin_cols (w, make_number (margin_cols));
2890 } 3048 }
2891 else 3049 else
2892 WSET (w, left_margin_cols, make_number (margin_cols)); 3050 wset_left_margin_cols (w, make_number (margin_cols));
2893 return 1; 3051 return 1;
2894} 3052}
2895 3053
@@ -2989,23 +3147,23 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
2989 ptrdiff_t count = SPECPDL_INDEX (); 3147 ptrdiff_t count = SPECPDL_INDEX ();
2990 int samebuf = EQ (buffer, w->buffer); 3148 int samebuf = EQ (buffer, w->buffer);
2991 3149
2992 WSET (w, buffer, buffer); 3150 wset_buffer (w, buffer);
2993 3151
2994 if (EQ (window, selected_window)) 3152 if (EQ (window, selected_window))
2995 BSET (b, last_selected_window, window); 3153 bset_last_selected_window (b, window);
2996 3154
2997 /* Let redisplay errors through. */ 3155 /* Let redisplay errors through. */
2998 b->display_error_modiff = 0; 3156 b->display_error_modiff = 0;
2999 3157
3000 /* Update time stamps of buffer display. */ 3158 /* Update time stamps of buffer display. */
3001 if (INTEGERP (BVAR (b, display_count))) 3159 if (INTEGERP (BVAR (b, display_count)))
3002 BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1)); 3160 bset_display_count (b, make_number (XINT (BVAR (b, display_count)) + 1));
3003 BSET (b, display_time, Fcurrent_time ()); 3161 bset_display_time (b, Fcurrent_time ());
3004 3162
3005 WSET (w, window_end_pos, make_number (0)); 3163 wset_window_end_pos (w, make_number (0));
3006 WSET (w, window_end_vpos, make_number (0)); 3164 wset_window_end_vpos (w, make_number (0));
3007 memset (&w->last_cursor, 0, sizeof w->last_cursor); 3165 memset (&w->last_cursor, 0, sizeof w->last_cursor);
3008 WSET (w, window_end_valid, Qnil); 3166 wset_window_end_valid (w, Qnil);
3009 if (!(keep_margins_p && samebuf)) 3167 if (!(keep_margins_p && samebuf))
3010 { /* If we're not actually changing the buffer, don't reset hscroll and 3168 { /* If we're not actually changing the buffer, don't reset hscroll and
3011 vscroll. This case happens for example when called from 3169 vscroll. This case happens for example when called from
@@ -3050,8 +3208,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3050 Lisp_Object save_left = w->left_margin_cols; 3208 Lisp_Object save_left = w->left_margin_cols;
3051 Lisp_Object save_right = w->right_margin_cols; 3209 Lisp_Object save_right = w->right_margin_cols;
3052 3210
3053 WSET (w, left_margin_cols, Qnil); 3211 wset_left_margin_cols (w, Qnil);
3054 WSET (w, right_margin_cols, Qnil); 3212 wset_right_margin_cols (w, Qnil);
3055 3213
3056 Fset_window_fringes (window, 3214 Fset_window_fringes (window,
3057 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), 3215 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
@@ -3061,8 +3219,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3061 BVAR (b, scroll_bar_width), 3219 BVAR (b, scroll_bar_width),
3062 BVAR (b, vertical_scroll_bar_type), Qnil); 3220 BVAR (b, vertical_scroll_bar_type), Qnil);
3063 3221
3064 WSET (w, left_margin_cols, save_left); 3222 wset_left_margin_cols (w, save_left);
3065 WSET (w, right_margin_cols, save_right); 3223 wset_right_margin_cols (w, save_right);
3066 3224
3067 Fset_window_margins (window, 3225 Fset_window_margins (window,
3068 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); 3226 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
@@ -3081,7 +3239,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3081 3239
3082DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, 3240DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0,
3083 doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. 3241 doc: /* Make WINDOW display BUFFER-OR-NAME as its contents.
3084WINDOW has to be a live window and defaults to the selected one. 3242WINDOW must be a live window and defaults to the selected one.
3085BUFFER-OR-NAME must be a buffer or the name of an existing buffer. 3243BUFFER-OR-NAME must be a buffer or the name of an existing buffer.
3086 3244
3087Optional third argument KEEP-MARGINS non-nil means that WINDOW's current 3245Optional third argument KEEP-MARGINS non-nil means that WINDOW's current
@@ -3098,7 +3256,7 @@ This function runs `window-scroll-functions' before running
3098 (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins) 3256 (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins)
3099{ 3257{
3100 register Lisp_Object tem, buffer; 3258 register Lisp_Object tem, buffer;
3101 register struct window *w = decode_window (window); 3259 register struct window *w = decode_live_window (window);
3102 3260
3103 XSETWINDOW (window, w); 3261 XSETWINDOW (window, w);
3104 buffer = Fget_buffer (buffer_or_name); 3262 buffer = Fget_buffer (buffer_or_name);
@@ -3121,7 +3279,7 @@ This function runs `window-scroll-functions' before running
3121 else 3279 else
3122 /* WINDOW is weakly dedicated to its buffer, reset 3280 /* WINDOW is weakly dedicated to its buffer, reset
3123 dedication. */ 3281 dedication. */
3124 WSET (w, dedicated, Qnil); 3282 wset_dedicated (w, Qnil);
3125 3283
3126 call1 (Qrecord_window_buffer, window); 3284 call1 (Qrecord_window_buffer, window);
3127 } 3285 }
@@ -3191,7 +3349,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3191 register Lisp_Object window; 3349 register Lisp_Object window;
3192 register struct window *w; 3350 register struct window *w;
3193 3351
3194 BSET (XBUFFER (buf), directory, BVAR (current_buffer, directory)); 3352 bset_directory (XBUFFER (buf), BVAR (current_buffer, directory));
3195 3353
3196 Fset_buffer (buf); 3354 Fset_buffer (buf);
3197 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; 3355 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
@@ -3267,17 +3425,17 @@ make_parent_window (Lisp_Object window, int horflag)
3267 3425
3268 replace_window (window, parent, 1); 3426 replace_window (window, parent, 1);
3269 3427
3270 WSET (o, next, Qnil); 3428 wset_next (o, Qnil);
3271 WSET (o, prev, Qnil); 3429 wset_prev (o, Qnil);
3272 WSET (o, parent, parent); 3430 wset_parent (o, parent);
3273 3431
3274 WSET (p, hchild, horflag ? window : Qnil); 3432 wset_hchild (p, horflag ? window : Qnil);
3275 WSET (p, vchild, horflag ? Qnil : window); 3433 wset_vchild (p, horflag ? Qnil : window);
3276 WSET (p, start, Qnil); 3434 wset_start (p, Qnil);
3277 WSET (p, pointm, Qnil); 3435 wset_pointm (p, Qnil);
3278 WSET (p, buffer, Qnil); 3436 wset_buffer (p, Qnil);
3279 WSET (p, combination_limit, Qnil); 3437 wset_combination_limit (p, Qnil);
3280 WSET (p, window_parameters, Qnil); 3438 wset_window_parameters (p, Qnil);
3281} 3439}
3282 3440
3283/* Make new window from scratch. */ 3441/* Make new window from scratch. */
@@ -3290,19 +3448,19 @@ make_window (void)
3290 w = allocate_window (); 3448 w = allocate_window ();
3291 /* Initialize Lisp data. Note that allocate_window initializes all 3449 /* Initialize Lisp data. Note that allocate_window initializes all
3292 Lisp data to nil, so do it only for slots which should not be nil. */ 3450 Lisp data to nil, so do it only for slots which should not be nil. */
3293 WSET (w, left_col, make_number (0)); 3451 wset_left_col (w, make_number (0));
3294 WSET (w, top_line, make_number (0)); 3452 wset_top_line (w, make_number (0));
3295 WSET (w, total_lines, make_number (0)); 3453 wset_total_lines (w, make_number (0));
3296 WSET (w, total_cols, make_number (0)); 3454 wset_total_cols (w, make_number (0));
3297 WSET (w, normal_lines, make_float (1.0)); 3455 wset_normal_lines (w, make_float (1.0));
3298 WSET (w, normal_cols, make_float (1.0)); 3456 wset_normal_cols (w, make_float (1.0));
3299 WSET (w, new_total, make_number (0)); 3457 wset_new_total (w, make_number (0));
3300 WSET (w, new_normal, make_number (0)); 3458 wset_new_normal (w, make_number (0));
3301 WSET (w, start, Fmake_marker ()); 3459 wset_start (w, Fmake_marker ());
3302 WSET (w, pointm, Fmake_marker ()); 3460 wset_pointm (w, Fmake_marker ());
3303 WSET (w, vertical_scroll_bar_type, Qt); 3461 wset_vertical_scroll_bar_type (w, Qt);
3304 WSET (w, window_end_pos, make_number (0)); 3462 wset_window_end_pos (w, make_number (0));
3305 WSET (w, window_end_vpos, make_number (0)); 3463 wset_window_end_vpos (w, make_number (0));
3306 3464
3307 /* Initialize non-Lisp data. Note that allocate_window zeroes out all 3465 /* Initialize non-Lisp data. Note that allocate_window zeroes out all
3308 non-Lisp data, so do it only for slots which should not be zero. */ 3466 non-Lisp data, so do it only for slots which should not be zero. */
@@ -3320,6 +3478,7 @@ make_window (void)
3320 3478
3321DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, 3479DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0,
3322 doc: /* Set new total size of WINDOW to SIZE. 3480 doc: /* Set new total size of WINDOW to SIZE.
3481WINDOW must be a valid window and defaults to the selected one.
3323Return SIZE. 3482Return SIZE.
3324 3483
3325Optional argument ADD non-nil means add SIZE to the new total size of 3484Optional argument ADD non-nil means add SIZE to the new total size of
@@ -3328,25 +3487,27 @@ WINDOW and return the sum.
3328Note: This function does not operate on any child windows of WINDOW. */) 3487Note: This function does not operate on any child windows of WINDOW. */)
3329 (Lisp_Object window, Lisp_Object size, Lisp_Object add) 3488 (Lisp_Object window, Lisp_Object size, Lisp_Object add)
3330{ 3489{
3331 struct window *w = decode_any_window (window); 3490 struct window *w = decode_valid_window (window);
3332 3491
3333 CHECK_NUMBER (size); 3492 CHECK_NUMBER (size);
3334 if (NILP (add)) 3493 if (NILP (add))
3335 WSET (w, new_total, size); 3494 wset_new_total (w, size);
3336 else 3495 else
3337 WSET (w, new_total, make_number (XINT (w->new_total) + XINT (size))); 3496 wset_new_total (w, make_number (XINT (w->new_total) + XINT (size)));
3338 3497
3339 return w->new_total; 3498 return w->new_total;
3340} 3499}
3341 3500
3342DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, 3501DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0,
3343 doc: /* Set new normal size of WINDOW to SIZE. 3502 doc: /* Set new normal size of WINDOW to SIZE.
3503WINDOW must be a valid window and defaults to the selected one.
3344Return SIZE. 3504Return SIZE.
3345 3505
3346Note: This function does not operate on any child windows of WINDOW. */) 3506Note: This function does not operate on any child windows of WINDOW. */)
3347 (Lisp_Object window, Lisp_Object size) 3507 (Lisp_Object window, Lisp_Object size)
3348{ 3508{
3349 return WSET (decode_any_window (window), new_normal, size); 3509 wset_new_normal (decode_valid_window (window), size);
3510 return size;
3350} 3511}
3351 3512
3352/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is 3513/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is
@@ -3447,17 +3608,17 @@ window_resize_apply (struct window *w, int horflag)
3447 parent window has been set *before*. */ 3608 parent window has been set *before*. */
3448 if (horflag) 3609 if (horflag)
3449 { 3610 {
3450 WSET (w, total_cols, w->new_total); 3611 wset_total_cols (w, w->new_total);
3451 if (NUMBERP (w->new_normal)) 3612 if (NUMBERP (w->new_normal))
3452 WSET (w, normal_cols, w->new_normal); 3613 wset_normal_cols (w, w->new_normal);
3453 3614
3454 pos = XINT (w->left_col); 3615 pos = XINT (w->left_col);
3455 } 3616 }
3456 else 3617 else
3457 { 3618 {
3458 WSET (w, total_lines, w->new_total); 3619 wset_total_lines (w, w->new_total);
3459 if (NUMBERP (w->new_normal)) 3620 if (NUMBERP (w->new_normal))
3460 WSET (w, normal_lines, w->new_normal); 3621 wset_normal_lines (w, w->new_normal);
3461 3622
3462 pos = XINT (w->top_line); 3623 pos = XINT (w->top_line);
3463 } 3624 }
@@ -3469,9 +3630,9 @@ window_resize_apply (struct window *w, int horflag)
3469 while (c) 3630 while (c)
3470 { 3631 {
3471 if (horflag) 3632 if (horflag)
3472 WSET (c, left_col, make_number (pos)); 3633 wset_left_col (c, make_number (pos));
3473 else 3634 else
3474 WSET (c, top_line, make_number (pos)); 3635 wset_top_line (c, make_number (pos));
3475 window_resize_apply (c, horflag); 3636 window_resize_apply (c, horflag);
3476 if (!horflag) 3637 if (!horflag)
3477 pos = pos + XINT (c->total_lines); 3638 pos = pos + XINT (c->total_lines);
@@ -3485,9 +3646,9 @@ window_resize_apply (struct window *w, int horflag)
3485 while (c) 3646 while (c)
3486 { 3647 {
3487 if (horflag) 3648 if (horflag)
3488 WSET (c, left_col, make_number (pos)); 3649 wset_left_col (c, make_number (pos));
3489 else 3650 else
3490 WSET (c, top_line, make_number (pos)); 3651 wset_top_line (c, make_number (pos));
3491 window_resize_apply (c, horflag); 3652 window_resize_apply (c, horflag);
3492 if (horflag) 3653 if (horflag)
3493 pos = pos + XINT (c->total_cols); 3654 pos = pos + XINT (c->total_cols);
@@ -3568,17 +3729,17 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3568 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 3729 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
3569 ? 1 : 0))); 3730 ? 1 : 0)));
3570 3731
3571 WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f))); 3732 wset_top_line (r, make_number (FRAME_TOP_MARGIN (f)));
3572 if (NILP (r->vchild) && NILP (r->hchild)) 3733 if (NILP (r->vchild) && NILP (r->hchild))
3573 /* For a leaf root window just set the size. */ 3734 /* For a leaf root window just set the size. */
3574 if (horflag) 3735 if (horflag)
3575 WSET (r, total_cols, make_number (new_size)); 3736 wset_total_cols (r, make_number (new_size));
3576 else 3737 else
3577 WSET (r, total_lines, make_number (new_size)); 3738 wset_total_lines (r, make_number (new_size));
3578 else 3739 else
3579 { 3740 {
3580 /* old_size is the old size of the frame's root window. */ 3741 /* old_size is the old size of the frame's root window. */
3581 int old_size = XFASTINT (horflag ? r->total_cols 3742 int old_size = XFASTINT (horflag ? r->total_cols
3582 : r->total_lines); 3743 : r->total_lines);
3583 Lisp_Object delta; 3744 Lisp_Object delta;
3584 3745
@@ -3609,9 +3770,9 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3609 root = f->selected_window; 3770 root = f->selected_window;
3610 Fdelete_other_windows_internal (root, Qnil); 3771 Fdelete_other_windows_internal (root, Qnil);
3611 if (horflag) 3772 if (horflag)
3612 WSET (XWINDOW (root), total_cols, make_number (new_size)); 3773 wset_total_cols (XWINDOW (root), make_number (new_size));
3613 else 3774 else
3614 WSET (XWINDOW (root), total_lines, make_number (new_size)); 3775 wset_total_lines (XWINDOW (root), make_number (new_size));
3615 } 3776 }
3616 } 3777 }
3617 } 3778 }
@@ -3621,13 +3782,13 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3621 { 3782 {
3622 m = XWINDOW (mini); 3783 m = XWINDOW (mini);
3623 if (horflag) 3784 if (horflag)
3624 WSET (m, total_cols, make_number (size)); 3785 wset_total_cols (m, make_number (size));
3625 else 3786 else
3626 { 3787 {
3627 /* Are we sure we always want 1 line here? */ 3788 /* Are we sure we always want 1 line here? */
3628 WSET (m, total_lines, make_number (1)); 3789 wset_total_lines (m, make_number (1));
3629 WSET (m, top_line, 3790 wset_top_line
3630 make_number (XINT (r->top_line) + XINT (r->total_lines))); 3791 (m, make_number (XINT (r->top_line) + XINT (r->total_lines)));
3631 } 3792 }
3632 } 3793 }
3633} 3794}
@@ -3708,15 +3869,14 @@ set correctly. See the code of `split-window' for how this is done. */)
3708 { 3869 {
3709 p = XWINDOW (o->parent); 3870 p = XWINDOW (o->parent);
3710 /* Temporarily pretend we split the parent window. */ 3871 /* Temporarily pretend we split the parent window. */
3711 WSET (p, new_total, 3872 wset_new_total
3712 make_number (XINT (horflag ? p->total_cols : p->total_lines) 3873 (p, make_number (XINT (horflag ? p->total_cols : p->total_lines)
3713 - XINT (total_size))); 3874 - XINT (total_size)));
3714 if (!window_resize_check (p, horflag)) 3875 if (!window_resize_check (p, horflag))
3715 error ("Window sizes don't fit"); 3876 error ("Window sizes don't fit");
3716 else 3877 else
3717 /* Undo the temporary pretension. */ 3878 /* Undo the temporary pretension. */
3718 WSET (p, new_total, 3879 wset_new_total (p, horflag ? p->total_cols : p->total_lines);
3719 horflag ? p->total_cols : p->total_lines);
3720 } 3880 }
3721 else 3881 else
3722 { 3882 {
@@ -3740,10 +3900,10 @@ set correctly. See the code of `split-window' for how this is done. */)
3740 p = XWINDOW (o->parent); 3900 p = XWINDOW (o->parent);
3741 /* Store value of `window-combination-limit' in new parent's 3901 /* Store value of `window-combination-limit' in new parent's
3742 combination_limit slot. */ 3902 combination_limit slot. */
3743 WSET (p, combination_limit, Vwindow_combination_limit); 3903 wset_combination_limit (p, Vwindow_combination_limit);
3744 /* These get applied below. */ 3904 /* These get applied below. */
3745 WSET (p, new_total, horflag ? o->total_cols : o->total_lines); 3905 wset_new_total (p, horflag ? o->total_cols : o->total_lines);
3746 WSET (p, new_normal, new_normal); 3906 wset_new_normal (p, new_normal);
3747 } 3907 }
3748 else 3908 else
3749 p = XWINDOW (o->parent); 3909 p = XWINDOW (o->parent);
@@ -3752,62 +3912,62 @@ set correctly. See the code of `split-window' for how this is done. */)
3752 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3912 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3753 new = make_window (); 3913 new = make_window ();
3754 n = XWINDOW (new); 3914 n = XWINDOW (new);
3755 WSET (n, frame, frame); 3915 wset_frame (n, frame);
3756 WSET (n, parent, o->parent); 3916 wset_parent (n, o->parent);
3757 WSET (n, vchild, Qnil); 3917 wset_vchild (n, Qnil);
3758 WSET (n, hchild, Qnil); 3918 wset_hchild (n, Qnil);
3759 3919
3760 if (EQ (side, Qabove) || EQ (side, Qleft)) 3920 if (EQ (side, Qabove) || EQ (side, Qleft))
3761 { 3921 {
3762 WSET (n, prev, o->prev); 3922 wset_prev (n, o->prev);
3763 if (NILP (n->prev)) 3923 if (NILP (n->prev))
3764 if (horflag) 3924 if (horflag)
3765 WSET (p, hchild, new); 3925 wset_hchild (p, new);
3766 else 3926 else
3767 WSET (p, vchild, new); 3927 wset_vchild (p, new);
3768 else 3928 else
3769 WSET (XWINDOW (n->prev), next, new); 3929 wset_next (XWINDOW (n->prev), new);
3770 WSET (n, next, old); 3930 wset_next (n, old);
3771 WSET (o, prev, new); 3931 wset_prev (o, new);
3772 } 3932 }
3773 else 3933 else
3774 { 3934 {
3775 WSET (n, next, o->next); 3935 wset_next (n, o->next);
3776 if (!NILP (n->next)) 3936 if (!NILP (n->next))
3777 WSET (XWINDOW (n->next), prev, new); 3937 wset_prev (XWINDOW (n->next), new);
3778 WSET (n, prev, old); 3938 wset_prev (n, old);
3779 WSET (o, next, new); 3939 wset_next (o, new);
3780 } 3940 }
3781 3941
3782 WSET (n, buffer, Qt); 3942 wset_buffer (n, Qt);
3783 WSET (n, window_end_valid, Qnil); 3943 wset_window_end_valid (n, Qnil);
3784 memset (&n->last_cursor, 0, sizeof n->last_cursor); 3944 memset (&n->last_cursor, 0, sizeof n->last_cursor);
3785 3945
3786 /* Get special geometry settings from reference window. */ 3946 /* Get special geometry settings from reference window. */
3787 WSET (n, left_margin_cols, r->left_margin_cols); 3947 wset_left_margin_cols (n, r->left_margin_cols);
3788 WSET (n, right_margin_cols, r->right_margin_cols); 3948 wset_right_margin_cols (n, r->right_margin_cols);
3789 WSET (n, left_fringe_width, r->left_fringe_width); 3949 wset_left_fringe_width (n, r->left_fringe_width);
3790 WSET (n, right_fringe_width, r->right_fringe_width); 3950 wset_right_fringe_width (n, r->right_fringe_width);
3791 n->fringes_outside_margins = r->fringes_outside_margins; 3951 n->fringes_outside_margins = r->fringes_outside_margins;
3792 WSET (n, scroll_bar_width, r->scroll_bar_width); 3952 wset_scroll_bar_width (n, r->scroll_bar_width);
3793 WSET (n, vertical_scroll_bar_type, r->vertical_scroll_bar_type); 3953 wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type);
3794 3954
3795 /* Directly assign orthogonal coordinates and sizes. */ 3955 /* Directly assign orthogonal coordinates and sizes. */
3796 if (horflag) 3956 if (horflag)
3797 { 3957 {
3798 WSET (n, top_line, o->top_line); 3958 wset_top_line (n, o->top_line);
3799 WSET (n, total_lines, o->total_lines); 3959 wset_total_lines (n, o->total_lines);
3800 } 3960 }
3801 else 3961 else
3802 { 3962 {
3803 WSET (n, left_col, o->left_col); 3963 wset_left_col (n, o->left_col);
3804 WSET (n, total_cols, o->total_cols); 3964 wset_total_cols (n, o->total_cols);
3805 } 3965 }
3806 3966
3807 /* Iso-coordinates and sizes are assigned by window_resize_apply, 3967 /* Iso-coordinates and sizes are assigned by window_resize_apply,
3808 get them ready here. */ 3968 get them ready here. */
3809 WSET (n, new_total, total_size); 3969 wset_new_total (n, total_size);
3810 WSET (n, new_normal, normal_size); 3970 wset_new_normal (n, normal_size);
3811 3971
3812 BLOCK_INPUT; 3972 BLOCK_INPUT;
3813 window_resize_apply (p, horflag); 3973 window_resize_apply (p, horflag);
@@ -3840,8 +4000,6 @@ Signal an error when WINDOW is the only window on its frame. */)
3840 int before_sibling = 0; 4000 int before_sibling = 0;
3841 4001
3842 w = decode_any_window (window); 4002 w = decode_any_window (window);
3843 CHECK_LIVE_FRAME (w->frame);
3844
3845 XSETWINDOW (window, w); 4003 XSETWINDOW (window, w);
3846 if (NILP (w->buffer) 4004 if (NILP (w->buffer)
3847 && NILP (w->hchild) && NILP (w->vchild)) 4005 && NILP (w->hchild) && NILP (w->vchild))
@@ -3875,20 +4033,20 @@ Signal an error when WINDOW is the only window on its frame. */)
3875 before_sibling = 1; 4033 before_sibling = 1;
3876 sibling = w->next; 4034 sibling = w->next;
3877 s = XWINDOW (sibling); 4035 s = XWINDOW (sibling);
3878 WSET (s, prev, Qnil); 4036 wset_prev (s, Qnil);
3879 if (horflag) 4037 if (horflag)
3880 WSET (p, hchild, sibling); 4038 wset_hchild (p, sibling);
3881 else 4039 else
3882 WSET (p, vchild, sibling); 4040 wset_vchild (p, sibling);
3883 } 4041 }
3884 else 4042 else
3885 /* Get SIBLING above (on the left of) WINDOW. */ 4043 /* Get SIBLING above (on the left of) WINDOW. */
3886 { 4044 {
3887 sibling = w->prev; 4045 sibling = w->prev;
3888 s = XWINDOW (sibling); 4046 s = XWINDOW (sibling);
3889 WSET (s, next, w->next); 4047 wset_next (s, w->next);
3890 if (!NILP (s->next)) 4048 if (!NILP (s->next))
3891 WSET (XWINDOW (s->next), prev, sibling); 4049 wset_prev (XWINDOW (s->next), sibling);
3892 } 4050 }
3893 4051
3894 if (window_resize_check (r, horflag) 4052 if (window_resize_check (r, horflag)
@@ -3918,25 +4076,25 @@ Signal an error when WINDOW is the only window on its frame. */)
3918 Vwindow_list = Qnil; 4076 Vwindow_list = Qnil;
3919 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4077 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3920 4078
3921 WSET (w, next, Qnil); /* Don't delete w->next too. */ 4079 wset_next (w, Qnil); /* Don't delete w->next too. */
3922 free_window_matrices (w); 4080 free_window_matrices (w);
3923 4081
3924 if (!NILP (w->vchild)) 4082 if (!NILP (w->vchild))
3925 { 4083 {
3926 delete_all_child_windows (w->vchild); 4084 delete_all_child_windows (w->vchild);
3927 WSET (w, vchild, Qnil); 4085 wset_vchild (w, Qnil);
3928 } 4086 }
3929 else if (!NILP (w->hchild)) 4087 else if (!NILP (w->hchild))
3930 { 4088 {
3931 delete_all_child_windows (w->hchild); 4089 delete_all_child_windows (w->hchild);
3932 WSET (w, hchild, Qnil); 4090 wset_hchild (w, Qnil);
3933 } 4091 }
3934 else if (!NILP (w->buffer)) 4092 else if (!NILP (w->buffer))
3935 { 4093 {
3936 unshow_buffer (w); 4094 unshow_buffer (w);
3937 unchain_marker (XMARKER (w->pointm)); 4095 unchain_marker (XMARKER (w->pointm));
3938 unchain_marker (XMARKER (w->start)); 4096 unchain_marker (XMARKER (w->start));
3939 WSET (w, buffer, Qnil); 4097 wset_buffer (w, Qnil);
3940 } 4098 }
3941 4099
3942 if (NILP (s->prev) && NILP (s->next)) 4100 if (NILP (s->prev) && NILP (s->next))
@@ -3947,11 +4105,11 @@ Signal an error when WINDOW is the only window on its frame. */)
3947 replace_window (parent, sibling, 0); 4105 replace_window (parent, sibling, 0);
3948 /* Have SIBLING inherit the following three slot values from 4106 /* Have SIBLING inherit the following three slot values from
3949 PARENT (the combination_limit slot is not inherited). */ 4107 PARENT (the combination_limit slot is not inherited). */
3950 WSET (s, normal_cols, p->normal_cols); 4108 wset_normal_cols (s, p->normal_cols);
3951 WSET (s, normal_lines, p->normal_lines); 4109 wset_normal_lines (s, p->normal_lines);
3952 /* Mark PARENT as deleted. */ 4110 /* Mark PARENT as deleted. */
3953 WSET (p, vchild, Qnil); 4111 wset_vchild (p, Qnil);
3954 WSET (p, hchild, Qnil); 4112 wset_hchild (p, Qnil);
3955 /* Try to merge SIBLING into its new parent. */ 4113 /* Try to merge SIBLING into its new parent. */
3956 recombine_windows (sibling); 4114 recombine_windows (sibling);
3957 } 4115 }
@@ -3971,7 +4129,7 @@ Signal an error when WINDOW is the only window on its frame. */)
3971 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) 4129 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
3972 Fselect_window (new_selected_window, Qt); 4130 Fselect_window (new_selected_window, Qt);
3973 else 4131 else
3974 FSET (f, selected_window, new_selected_window); 4132 fset_selected_window (f, new_selected_window);
3975 4133
3976 UNBLOCK_INPUT; 4134 UNBLOCK_INPUT;
3977 4135
@@ -3985,7 +4143,7 @@ Signal an error when WINDOW is the only window on its frame. */)
3985 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) 4143 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
3986 Fselect_window (new_selected_window, Qnil); 4144 Fselect_window (new_selected_window, Qnil);
3987 else 4145 else
3988 FSET (f, selected_window, new_selected_window); 4146 fset_selected_window (f, new_selected_window);
3989 } 4147 }
3990 else 4148 else
3991 UNBLOCK_INPUT; 4149 UNBLOCK_INPUT;
@@ -3998,17 +4156,17 @@ Signal an error when WINDOW is the only window on its frame. */)
3998 { 4156 {
3999 if (before_sibling) 4157 if (before_sibling)
4000 { 4158 {
4001 WSET (s, prev, window); 4159 wset_prev (s, window);
4002 if (horflag) 4160 if (horflag)
4003 WSET (p, hchild, window); 4161 wset_hchild (p, window);
4004 else 4162 else
4005 WSET (p, vchild, window); 4163 wset_vchild (p, window);
4006 } 4164 }
4007 else 4165 else
4008 { 4166 {
4009 WSET (s, next, window); 4167 wset_next (s, window);
4010 if (!NILP (w->next)) 4168 if (!NILP (w->next))
4011 WSET (XWINDOW (w->next), prev, window); 4169 wset_prev (XWINDOW (w->next), window);
4012 } 4170 }
4013 error ("Deletion failed"); 4171 error ("Deletion failed");
4014 } 4172 }
@@ -4042,10 +4200,10 @@ grow_mini_window (struct window *w, int delta)
4042 window_resize_apply (r, 0); 4200 window_resize_apply (r, 0);
4043 4201
4044 /* Grow the mini-window. */ 4202 /* Grow the mini-window. */
4045 WSET (w, top_line, 4203 wset_top_line
4046 make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); 4204 (w, make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines)));
4047 WSET (w, total_lines, 4205 wset_total_lines
4048 make_number (XFASTINT (w->total_lines) - XINT (value))); 4206 (w, make_number (XFASTINT (w->total_lines) - XINT (value)));
4049 w->last_modified = 0; 4207 w->last_modified = 0;
4050 w->last_overlay_modified = 0; 4208 w->last_overlay_modified = 0;
4051 4209
@@ -4079,9 +4237,9 @@ shrink_mini_window (struct window *w)
4079 window_resize_apply (r, 0); 4237 window_resize_apply (r, 0);
4080 4238
4081 /* Shrink the mini-window. */ 4239 /* Shrink the mini-window. */
4082 WSET (w, top_line, 4240 wset_top_line (w, make_number (XFASTINT (r->top_line)
4083 make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); 4241 + XFASTINT (r->total_lines)));
4084 WSET (w, total_lines, make_number (1)); 4242 wset_total_lines (w, make_number (1));
4085 4243
4086 w->last_modified = 0; 4244 w->last_modified = 0;
4087 w->last_overlay_modified = 0; 4245 w->last_overlay_modified = 0;
@@ -4122,9 +4280,9 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4122 BLOCK_INPUT; 4280 BLOCK_INPUT;
4123 window_resize_apply (r, 0); 4281 window_resize_apply (r, 0);
4124 4282
4125 WSET (w, total_lines, w->new_total); 4283 wset_total_lines (w, w->new_total);
4126 WSET (w, top_line, 4284 wset_top_line (w, make_number (XINT (r->top_line)
4127 make_number (XINT (r->top_line) + XINT (r->total_lines))); 4285 + XINT (r->total_lines)));
4128 4286
4129 windows_or_buffers_changed++; 4287 windows_or_buffers_changed++;
4130 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4288 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -5192,7 +5350,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5192 5350
5193 /* Set the new window start. */ 5351 /* Set the new window start. */
5194 set_marker_both (w->start, w->buffer, charpos, bytepos); 5352 set_marker_both (w->start, w->buffer, charpos, bytepos);
5195 WSET (w, window_end_valid, Qnil); 5353 wset_window_end_valid (w, Qnil);
5196 5354
5197 w->optional_new_start = 1; 5355 w->optional_new_start = 1;
5198 5356
@@ -5206,13 +5364,13 @@ and redisplay normally--don't erase and redraw the frame. */)
5206DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, 5364DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
5207 0, 1, 0, 5365 0, 1, 0,
5208 doc: /* Return the height in lines of the text display area of WINDOW. 5366 doc: /* Return the height in lines of the text display area of WINDOW.
5209If WINDOW is omitted or nil, it defaults to the selected window. 5367WINDOW must be a live window and defaults to the selected one.
5210 5368
5211The returned height does not include the mode line, any header line, 5369The returned height does not include the mode line, any header line,
5212nor any partial-height lines at the bottom of the text area. */) 5370nor any partial-height lines at the bottom of the text area. */)
5213 (Lisp_Object window) 5371 (Lisp_Object window)
5214{ 5372{
5215 struct window *w = decode_window (window); 5373 struct window *w = decode_live_window (window);
5216 int pixel_height = window_box_height (w); 5374 int pixel_height = window_box_height (w);
5217 int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); 5375 int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame));
5218 return make_number (line_height); 5376 return make_number (line_height);
@@ -5510,34 +5668,34 @@ the return value is nil. Otherwise the value is t. */)
5510 p = SAVED_WINDOW_N (saved_windows, k); 5668 p = SAVED_WINDOW_N (saved_windows, k);
5511 window = p->window; 5669 window = p->window;
5512 w = XWINDOW (window); 5670 w = XWINDOW (window);
5513 WSET (w, next, Qnil); 5671 wset_next (w, Qnil);
5514 5672
5515 if (!NILP (p->parent)) 5673 if (!NILP (p->parent))
5516 WSET (w, parent, SAVED_WINDOW_N 5674 wset_parent
5517 (saved_windows, XFASTINT (p->parent))->window); 5675 (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window);
5518 else 5676 else
5519 WSET (w, parent, Qnil); 5677 wset_parent (w, Qnil);
5520 5678
5521 if (!NILP (p->prev)) 5679 if (!NILP (p->prev))
5522 { 5680 {
5523 WSET (w, prev, SAVED_WINDOW_N 5681 wset_prev
5524 (saved_windows, XFASTINT (p->prev))->window); 5682 (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window);
5525 WSET (XWINDOW (w->prev), next, p->window); 5683 wset_next (XWINDOW (w->prev), p->window);
5526 } 5684 }
5527 else 5685 else
5528 { 5686 {
5529 WSET (w, prev, Qnil); 5687 wset_prev (w, Qnil);
5530 if (!NILP (w->parent)) 5688 if (!NILP (w->parent))
5531 { 5689 {
5532 if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) 5690 if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols))
5533 { 5691 {
5534 WSET (XWINDOW (w->parent), vchild, p->window); 5692 wset_vchild (XWINDOW (w->parent), p->window);
5535 WSET (XWINDOW (w->parent), hchild, Qnil); 5693 wset_hchild (XWINDOW (w->parent), Qnil);
5536 } 5694 }
5537 else 5695 else
5538 { 5696 {
5539 WSET (XWINDOW (w->parent), hchild, p->window); 5697 wset_hchild (XWINDOW (w->parent), p->window);
5540 WSET (XWINDOW (w->parent), vchild, Qnil); 5698 wset_vchild (XWINDOW (w->parent), Qnil);
5541 } 5699 }
5542 } 5700 }
5543 } 5701 }
@@ -5545,25 +5703,25 @@ the return value is nil. Otherwise the value is t. */)
5545 /* If we squirreled away the buffer in the window's height, 5703 /* If we squirreled away the buffer in the window's height,
5546 restore it now. */ 5704 restore it now. */
5547 if (BUFFERP (w->total_lines)) 5705 if (BUFFERP (w->total_lines))
5548 WSET (w, buffer, w->total_lines); 5706 wset_buffer (w, w->total_lines);
5549 WSET (w, left_col, p->left_col); 5707 wset_left_col (w, p->left_col);
5550 WSET (w, top_line, p->top_line); 5708 wset_top_line (w, p->top_line);
5551 WSET (w, total_cols, p->total_cols); 5709 wset_total_cols (w, p->total_cols);
5552 WSET (w, total_lines, p->total_lines); 5710 wset_total_lines (w, p->total_lines);
5553 WSET (w, normal_cols, p->normal_cols); 5711 wset_normal_cols (w, p->normal_cols);
5554 WSET (w, normal_lines, p->normal_lines); 5712 wset_normal_lines (w, p->normal_lines);
5555 w->hscroll = XFASTINT (p->hscroll); 5713 w->hscroll = XFASTINT (p->hscroll);
5556 w->min_hscroll = XFASTINT (p->min_hscroll); 5714 w->min_hscroll = XFASTINT (p->min_hscroll);
5557 WSET (w, display_table, p->display_table); 5715 wset_display_table (w, p->display_table);
5558 WSET (w, left_margin_cols, p->left_margin_cols); 5716 wset_left_margin_cols (w, p->left_margin_cols);
5559 WSET (w, right_margin_cols, p->right_margin_cols); 5717 wset_right_margin_cols (w, p->right_margin_cols);
5560 WSET (w, left_fringe_width, p->left_fringe_width); 5718 wset_left_fringe_width (w, p->left_fringe_width);
5561 WSET (w, right_fringe_width, p->right_fringe_width); 5719 wset_right_fringe_width (w, p->right_fringe_width);
5562 w->fringes_outside_margins = !NILP (p->fringes_outside_margins); 5720 w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
5563 WSET (w, scroll_bar_width, p->scroll_bar_width); 5721 wset_scroll_bar_width (w, p->scroll_bar_width);
5564 WSET (w, vertical_scroll_bar_type, p->vertical_scroll_bar_type); 5722 wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
5565 WSET (w, dedicated, p->dedicated); 5723 wset_dedicated (w, p->dedicated);
5566 WSET (w, combination_limit, p->combination_limit); 5724 wset_combination_limit (w, p->combination_limit);
5567 /* Restore any window parameters that have been saved. 5725 /* Restore any window parameters that have been saved.
5568 Parameters that have not been saved are left alone. */ 5726 Parameters that have not been saved are left alone. */
5569 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) 5727 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem))
@@ -5592,24 +5750,24 @@ the return value is nil. Otherwise the value is t. */)
5592 /* Reinstall the saved buffer and pointers into it. */ 5750 /* Reinstall the saved buffer and pointers into it. */
5593 if (NILP (p->buffer)) 5751 if (NILP (p->buffer))
5594 /* An internal window. */ 5752 /* An internal window. */
5595 WSET (w, buffer, p->buffer); 5753 wset_buffer (w, p->buffer);
5596 else if (!NILP (BVAR (XBUFFER (p->buffer), name))) 5754 else if (!NILP (BVAR (XBUFFER (p->buffer), name)))
5597 /* If saved buffer is alive, install it. */ 5755 /* If saved buffer is alive, install it. */
5598 { 5756 {
5599 WSET (w, buffer, p->buffer); 5757 wset_buffer (w, p->buffer);
5600 w->start_at_line_beg = !NILP (p->start_at_line_beg); 5758 w->start_at_line_beg = !NILP (p->start_at_line_beg);
5601 set_marker_restricted (w->start, p->start, w->buffer); 5759 set_marker_restricted (w->start, p->start, w->buffer);
5602 set_marker_restricted (w->pointm, p->pointm, 5760 set_marker_restricted (w->pointm, p->pointm,
5603 w->buffer); 5761 w->buffer);
5604 Fset_marker (BVAR (XBUFFER (w->buffer), mark), 5762 Fset_marker (BVAR (XBUFFER (w->buffer), mark),
5605 p->mark, w->buffer); 5763 p->mark, w->buffer);
5606 5764
5607 /* As documented in Fcurrent_window_configuration, don't 5765 /* As documented in Fcurrent_window_configuration, don't
5608 restore the location of point in the buffer which was 5766 restore the location of point in the buffer which was
5609 current when the window configuration was recorded. */ 5767 current when the window configuration was recorded. */
5610 if (!EQ (p->buffer, new_current_buffer) 5768 if (!EQ (p->buffer, new_current_buffer)
5611 && XBUFFER (p->buffer) == current_buffer) 5769 && XBUFFER (p->buffer) == current_buffer)
5612 Fgoto_char (w->pointm); 5770 Fgoto_char (w->pointm);
5613 } 5771 }
5614 else if (!NILP (w->buffer) 5772 else if (!NILP (w->buffer)
5615 && !NILP (BVAR (XBUFFER (w->buffer), name))) 5773 && !NILP (BVAR (XBUFFER (w->buffer), name)))
@@ -5621,7 +5779,7 @@ the return value is nil. Otherwise the value is t. */)
5621 set_marker_restricted (w->start, make_number (0), 5779 set_marker_restricted (w->start, make_number (0),
5622 w->buffer); 5780 w->buffer);
5623 if (XMARKER (w->pointm)->buffer == 0) 5781 if (XMARKER (w->pointm)->buffer == 0)
5624 set_marker_restricted_both 5782 set_marker_restricted_both
5625 (w->pointm, w->buffer, 5783 (w->pointm, w->buffer,
5626 BUF_PT (XBUFFER (w->buffer)), 5784 BUF_PT (XBUFFER (w->buffer)),
5627 BUF_PT_BYTE (XBUFFER (w->buffer))); 5785 BUF_PT_BYTE (XBUFFER (w->buffer)));
@@ -5630,7 +5788,8 @@ the return value is nil. Otherwise the value is t. */)
5630 else if (STRINGP (auto_buffer_name = 5788 else if (STRINGP (auto_buffer_name =
5631 Fwindow_parameter (window, Qauto_buffer_name)) 5789 Fwindow_parameter (window, Qauto_buffer_name))
5632 && SCHARS (auto_buffer_name) != 0 5790 && SCHARS (auto_buffer_name) != 0
5633 && !NILP (WSET (w, buffer, Fget_buffer_create (auto_buffer_name)))) 5791 && (wset_buffer (w, Fget_buffer_create (auto_buffer_name)),
5792 !NILP (w->buffer)))
5634 { 5793 {
5635 set_marker_restricted (w->start, 5794 set_marker_restricted (w->start,
5636 make_number (0), w->buffer); 5795 make_number (0), w->buffer);
@@ -5645,7 +5804,7 @@ the return value is nil. Otherwise the value is t. */)
5645 avoid showing an unimportant buffer and, if necessary, to 5804 avoid showing an unimportant buffer and, if necessary, to
5646 recreate *scratch* in the course (part of Juanma's bs-show 5805 recreate *scratch* in the course (part of Juanma's bs-show
5647 scenario from March 2011). */ 5806 scenario from March 2011). */
5648 WSET (w, buffer, other_buffer_safely (Fcurrent_buffer ())); 5807 wset_buffer (w, other_buffer_safely (Fcurrent_buffer ()));
5649 /* This will set the markers to beginning of visible 5808 /* This will set the markers to beginning of visible
5650 range. */ 5809 range. */
5651 set_marker_restricted (w->start, 5810 set_marker_restricted (w->start,
@@ -5657,11 +5816,11 @@ the return value is nil. Otherwise the value is t. */)
5657 /* Record this window as dead. */ 5816 /* Record this window as dead. */
5658 dead_windows = Fcons (window, dead_windows); 5817 dead_windows = Fcons (window, dead_windows);
5659 /* Make sure window is no more dedicated. */ 5818 /* Make sure window is no more dedicated. */
5660 WSET (w, dedicated, Qnil); 5819 wset_dedicated (w, Qnil);
5661 } 5820 }
5662 } 5821 }
5663 5822
5664 FSET (f, root_window, data->root_window); 5823 fset_root_window (f, data->root_window);
5665 /* Arrange *not* to restore point in the buffer that was 5824 /* Arrange *not* to restore point in the buffer that was
5666 current when the window configuration was saved. */ 5825 current when the window configuration was saved. */
5667 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) 5826 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer))
@@ -5757,24 +5916,25 @@ delete_all_child_windows (Lisp_Object window)
5757 /* Delete WINDOW's siblings (we traverse postorderly). */ 5916 /* Delete WINDOW's siblings (we traverse postorderly). */
5758 delete_all_child_windows (w->next); 5917 delete_all_child_windows (w->next);
5759 5918
5760 WSET (w, total_lines, w->buffer); /* See Fset_window_configuration for excuse. */ 5919 /* See Fset_window_configuration for excuse. */
5920 wset_total_lines (w, w->buffer);
5761 5921
5762 if (!NILP (w->vchild)) 5922 if (!NILP (w->vchild))
5763 { 5923 {
5764 delete_all_child_windows (w->vchild); 5924 delete_all_child_windows (w->vchild);
5765 WSET (w, vchild, Qnil); 5925 wset_vchild (w, Qnil);
5766 } 5926 }
5767 else if (!NILP (w->hchild)) 5927 else if (!NILP (w->hchild))
5768 { 5928 {
5769 delete_all_child_windows (w->hchild); 5929 delete_all_child_windows (w->hchild);
5770 WSET (w, hchild, Qnil); 5930 wset_hchild (w, Qnil);
5771 } 5931 }
5772 else if (!NILP (w->buffer)) 5932 else if (!NILP (w->buffer))
5773 { 5933 {
5774 unshow_buffer (w); 5934 unshow_buffer (w);
5775 unchain_marker (XMARKER (w->pointm)); 5935 unchain_marker (XMARKER (w->pointm));
5776 unchain_marker (XMARKER (w->start)); 5936 unchain_marker (XMARKER (w->start));
5777 WSET (w, buffer, Qnil); 5937 wset_buffer (w, Qnil);
5778 } 5938 }
5779 5939
5780 Vwindow_list = Qnil; 5940 Vwindow_list = Qnil;
@@ -5866,7 +6026,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5866 p = SAVED_WINDOW_N (vector, i); 6026 p = SAVED_WINDOW_N (vector, i);
5867 w = XWINDOW (window); 6027 w = XWINDOW (window);
5868 6028
5869 WSET (w, temslot, make_number (i)); i++; 6029 wset_temslot (w, make_number (i)); i++;
5870 p->window = window; 6030 p->window = window;
5871 p->buffer = w->buffer; 6031 p->buffer = w->buffer;
5872 p->left_col = w->left_col; 6032 p->left_col = w->left_col;
@@ -6039,14 +6199,15 @@ saved by this function. */)
6039DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, 6199DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins,
6040 2, 3, 0, 6200 2, 3, 0,
6041 doc: /* Set width of marginal areas of window WINDOW. 6201 doc: /* Set width of marginal areas of window WINDOW.
6042If WINDOW is nil, set margins of the currently selected window. 6202WINDOW must be a live window and defaults to the selected one.
6203
6043Second arg LEFT-WIDTH specifies the number of character cells to 6204Second arg LEFT-WIDTH specifies the number of character cells to
6044reserve for the left marginal area. Optional third arg RIGHT-WIDTH 6205reserve for the left marginal area. Optional third arg RIGHT-WIDTH
6045does the same for the right marginal area. A nil width parameter 6206does the same for the right marginal area. A nil width parameter
6046means no margin. */) 6207means no margin. */)
6047 (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) 6208 (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width)
6048{ 6209{
6049 struct window *w = decode_window (window); 6210 struct window *w = decode_live_window (window);
6050 6211
6051 /* Translate negative or zero widths to nil. 6212 /* Translate negative or zero widths to nil.
6052 Margins that are too wide have to be checked elsewhere. */ 6213 Margins that are too wide have to be checked elsewhere. */
@@ -6068,8 +6229,8 @@ means no margin. */)
6068 if (!EQ (w->left_margin_cols, left_width) 6229 if (!EQ (w->left_margin_cols, left_width)
6069 || !EQ (w->right_margin_cols, right_width)) 6230 || !EQ (w->right_margin_cols, right_width))
6070 { 6231 {
6071 WSET (w, left_margin_cols, left_width); 6232 wset_left_margin_cols (w, left_width);
6072 WSET (w, right_margin_cols, right_width); 6233 wset_right_margin_cols (w, right_width);
6073 6234
6074 adjust_window_margins (w); 6235 adjust_window_margins (w);
6075 6236
@@ -6084,13 +6245,14 @@ means no margin. */)
6084DEFUN ("window-margins", Fwindow_margins, Swindow_margins, 6245DEFUN ("window-margins", Fwindow_margins, Swindow_margins,
6085 0, 1, 0, 6246 0, 1, 0,
6086 doc: /* Get width of marginal areas of window WINDOW. 6247 doc: /* Get width of marginal areas of window WINDOW.
6087If WINDOW is omitted or nil, it defaults to the selected window. 6248WINDOW must be a live window and defaults to the selected one.
6249
6088Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). 6250Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).
6089If a marginal area does not exist, its width will be returned 6251If a marginal area does not exist, its width will be returned
6090as nil. */) 6252as nil. */)
6091 (Lisp_Object window) 6253 (Lisp_Object window)
6092{ 6254{
6093 struct window *w = decode_window (window); 6255 struct window *w = decode_live_window (window);
6094 return Fcons (w->left_margin_cols, w->right_margin_cols); 6256 return Fcons (w->left_margin_cols, w->right_margin_cols);
6095} 6257}
6096 6258
@@ -6103,8 +6265,8 @@ as nil. */)
6103DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, 6265DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes,
6104 2, 4, 0, 6266 2, 4, 0,
6105 doc: /* Set the fringe widths of window WINDOW. 6267 doc: /* Set the fringe widths of window WINDOW.
6106If WINDOW is nil, set the fringe widths of the currently selected 6268WINDOW must be a live window and defaults to the selected one.
6107window. 6269
6108Second arg LEFT-WIDTH specifies the number of pixels to reserve for 6270Second arg LEFT-WIDTH specifies the number of pixels to reserve for
6109the left fringe. Optional third arg RIGHT-WIDTH specifies the right 6271the left fringe. Optional third arg RIGHT-WIDTH specifies the right
6110fringe width. If a fringe width arg is nil, that means to use the 6272fringe width. If a fringe width arg is nil, that means to use the
@@ -6115,7 +6277,7 @@ outside of the display margins. By default, fringes are drawn between
6115display marginal areas and the text area. */) 6277display marginal areas and the text area. */)
6116 (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) 6278 (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins)
6117{ 6279{
6118 struct window *w = decode_window (window); 6280 struct window *w = decode_live_window (window);
6119 int outside = !NILP (outside_margins); 6281 int outside = !NILP (outside_margins);
6120 6282
6121 if (!NILP (left_width)) 6283 if (!NILP (left_width))
@@ -6129,14 +6291,14 @@ display marginal areas and the text area. */)
6129 || !EQ (w->right_fringe_width, right_width) 6291 || !EQ (w->right_fringe_width, right_width)
6130 || w->fringes_outside_margins != outside)) 6292 || w->fringes_outside_margins != outside))
6131 { 6293 {
6132 WSET (w, left_fringe_width, left_width); 6294 wset_left_fringe_width (w, left_width);
6133 WSET (w, right_fringe_width, right_width); 6295 wset_right_fringe_width (w, right_width);
6134 w->fringes_outside_margins = outside; 6296 w->fringes_outside_margins = outside;
6135 6297
6136 adjust_window_margins (w); 6298 adjust_window_margins (w);
6137 6299
6138 clear_glyph_matrix (w->current_matrix); 6300 clear_glyph_matrix (w->current_matrix);
6139 WSET (w, window_end_valid, Qnil); 6301 wset_window_end_valid (w, Qnil);
6140 6302
6141 ++windows_or_buffers_changed; 6303 ++windows_or_buffers_changed;
6142 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6304 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6149,11 +6311,12 @@ display marginal areas and the text area. */)
6149DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, 6311DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes,
6150 0, 1, 0, 6312 0, 1, 0,
6151 doc: /* Get width of fringes of window WINDOW. 6313 doc: /* Get width of fringes of window WINDOW.
6152If WINDOW is omitted or nil, it defaults to the selected window. 6314WINDOW must be a live window and defaults to the selected one.
6315
6153Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) 6316Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
6154 (Lisp_Object window) 6317 (Lisp_Object window)
6155{ 6318{
6156 struct window *w = decode_window (window); 6319 struct window *w = decode_live_window (window);
6157 6320
6158 return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), 6321 return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
6159 Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), 6322 Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
@@ -6170,7 +6333,8 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
6170DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars, 6333DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars,
6171 Sset_window_scroll_bars, 2, 4, 0, 6334 Sset_window_scroll_bars, 2, 4, 0,
6172 doc: /* Set width and type of scroll bars of window WINDOW. 6335 doc: /* Set width and type of scroll bars of window WINDOW.
6173If window is nil, set scroll bars of the currently selected window. 6336WINDOW must be a live window and defaults to the selected one.
6337
6174Second parameter WIDTH specifies the pixel width for the scroll bar; 6338Second parameter WIDTH specifies the pixel width for the scroll bar;
6175this is automatically adjusted to a multiple of the frame column width. 6339this is automatically adjusted to a multiple of the frame column width.
6176Third parameter VERTICAL-TYPE specifies the type of the vertical scroll 6340Third parameter VERTICAL-TYPE specifies the type of the vertical scroll
@@ -6180,7 +6344,7 @@ If VERTICAL-TYPE is t, use the frame's scroll-bar type.
6180Fourth parameter HORIZONTAL-TYPE is currently unused. */) 6344Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6181 (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) 6345 (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type)
6182{ 6346{
6183 struct window *w = decode_window (window); 6347 struct window *w = decode_live_window (window);
6184 6348
6185 if (!NILP (width)) 6349 if (!NILP (width))
6186 { 6350 {
@@ -6199,13 +6363,13 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6199 if (!EQ (w->scroll_bar_width, width) 6363 if (!EQ (w->scroll_bar_width, width)
6200 || !EQ (w->vertical_scroll_bar_type, vertical_type)) 6364 || !EQ (w->vertical_scroll_bar_type, vertical_type))
6201 { 6365 {
6202 WSET (w, scroll_bar_width, width); 6366 wset_scroll_bar_width (w, width);
6203 WSET (w, vertical_scroll_bar_type, vertical_type); 6367 wset_vertical_scroll_bar_type (w, vertical_type);
6204 6368
6205 adjust_window_margins (w); 6369 adjust_window_margins (w);
6206 6370
6207 clear_glyph_matrix (w->current_matrix); 6371 clear_glyph_matrix (w->current_matrix);
6208 WSET (w, window_end_valid, Qnil); 6372 wset_window_end_valid (w, Qnil);
6209 6373
6210 ++windows_or_buffers_changed; 6374 ++windows_or_buffers_changed;
6211 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6375 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6218,13 +6382,14 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6218DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, 6382DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars,
6219 0, 1, 0, 6383 0, 1, 0,
6220 doc: /* Get width and type of scroll bars of window WINDOW. 6384 doc: /* Get width and type of scroll bars of window WINDOW.
6221If WINDOW is omitted or nil, it defaults to the selected window. 6385WINDOW must be a live window and defaults to the selected one.
6386
6222Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). 6387Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE).
6223If WIDTH is nil or TYPE is t, the window is using the frame's corresponding 6388If WIDTH is nil or TYPE is t, the window is using the frame's corresponding
6224value. */) 6389value. */)
6225 (Lisp_Object window) 6390 (Lisp_Object window)
6226{ 6391{
6227 struct window *w = decode_window (window); 6392 struct window *w = decode_live_window (window);
6228 return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6393 return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6229 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6394 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6230 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), 6395 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
@@ -6518,6 +6683,7 @@ syms_of_window (void)
6518 DEFSYM (Qwindowp, "windowp"); 6683 DEFSYM (Qwindowp, "windowp");
6519 DEFSYM (Qwindow_configuration_p, "window-configuration-p"); 6684 DEFSYM (Qwindow_configuration_p, "window-configuration-p");
6520 DEFSYM (Qwindow_live_p, "window-live-p"); 6685 DEFSYM (Qwindow_live_p, "window-live-p");
6686 DEFSYM (Qwindow_valid_p, "window-valid-p");
6521 DEFSYM (Qwindow_deletable_p, "window-deletable-p"); 6687 DEFSYM (Qwindow_deletable_p, "window-deletable-p");
6522 DEFSYM (Qdelete_window, "delete-window"); 6688 DEFSYM (Qdelete_window, "delete-window");
6523 DEFSYM (Qwindow_resize_root_window, "window--resize-root-window"); 6689 DEFSYM (Qwindow_resize_root_window, "window--resize-root-window");
@@ -6670,6 +6836,7 @@ respectively are not installed by `window-state-put'. */);
6670 defsubr (&Sminibuffer_window); 6836 defsubr (&Sminibuffer_window);
6671 defsubr (&Swindow_minibuffer_p); 6837 defsubr (&Swindow_minibuffer_p);
6672 defsubr (&Swindowp); 6838 defsubr (&Swindowp);
6839 defsubr (&Swindow_valid_p);
6673 defsubr (&Swindow_live_p); 6840 defsubr (&Swindow_live_p);
6674 defsubr (&Swindow_frame); 6841 defsubr (&Swindow_frame);
6675 defsubr (&Sframe_root_window); 6842 defsubr (&Sframe_root_window);
diff --git a/src/window.h b/src/window.h
index 3e6f4f82b0a..28b9678b667 100644
--- a/src/window.h
+++ b/src/window.h
@@ -22,6 +22,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include "dispextern.h" 23#include "dispextern.h"
24 24
25INLINE_HEADER_BEGIN
26#ifndef WINDOW_INLINE
27# define WINDOW_INLINE INLINE
28#endif
29
25extern Lisp_Object Qleft, Qright; 30extern Lisp_Object Qleft, Qright;
26 31
27/* Windows are allocated as if they were vectors, but then the 32/* Windows are allocated as if they were vectors, but then the
@@ -86,10 +91,6 @@ struct cursor_pos
86 int hpos, vpos; 91 int hpos, vpos;
87}; 92};
88 93
89/* Most code should use this macro to set Lisp fields in struct window. */
90
91#define WSET(w, field, value) ((w)->field = (value))
92
93struct window 94struct window
94 { 95 {
95 /* This is for Lisp; the terminal code does not refer to it. */ 96 /* This is for Lisp; the terminal code does not refer to it. */
@@ -348,6 +349,75 @@ struct window
348 ptrdiff_t window_end_bytepos; 349 ptrdiff_t window_end_bytepos;
349}; 350};
350 351
352/* Most code should use these functions to set Lisp fields in struct
353 window. */
354WINDOW_INLINE void
355wset_buffer (struct window *w, Lisp_Object val)
356{
357 w->buffer = val;
358}
359WINDOW_INLINE void
360wset_frame (struct window *w, Lisp_Object val)
361{
362 w->frame = val;
363}
364WINDOW_INLINE void
365wset_left_col (struct window *w, Lisp_Object val)
366{
367 w->left_col = val;
368}
369WINDOW_INLINE void
370wset_next (struct window *w, Lisp_Object val)
371{
372 w->next = val;
373}
374WINDOW_INLINE void
375wset_prev (struct window *w, Lisp_Object val)
376{
377 w->prev = val;
378}
379WINDOW_INLINE void
380wset_redisplay_end_trigger (struct window *w, Lisp_Object val)
381{
382 w->redisplay_end_trigger = val;
383}
384WINDOW_INLINE void
385wset_top_line (struct window *w, Lisp_Object val)
386{
387 w->top_line = val;
388}
389WINDOW_INLINE void
390wset_total_cols (struct window *w, Lisp_Object val)
391{
392 w->total_cols = val;
393}
394WINDOW_INLINE void
395wset_total_lines (struct window *w, Lisp_Object val)
396{
397 w->total_lines = val;
398}
399WINDOW_INLINE void
400wset_vertical_scroll_bar (struct window *w, Lisp_Object val)
401{
402 w->vertical_scroll_bar = val;
403}
404WINDOW_INLINE void
405wset_window_end_pos (struct window *w, Lisp_Object val)
406{
407 w->window_end_pos = val;
408}
409WINDOW_INLINE void
410wset_window_end_valid (struct window *w, Lisp_Object val)
411{
412 w->window_end_valid = val;
413}
414WINDOW_INLINE void
415wset_window_end_vpos (struct window *w, Lisp_Object val)
416{
417 w->window_end_vpos = val;
418}
419
420
351/* 1 if W is a minibuffer window. */ 421/* 1 if W is a minibuffer window. */
352 422
353#define MINI_WINDOW_P(W) ((W)->mini) 423#define MINI_WINDOW_P(W) ((W)->mini)
@@ -885,8 +955,15 @@ extern void check_frame_size (struct frame *frame, int *rows, int *cols);
885 955
886struct glyph *get_phys_cursor_glyph (struct window *w); 956struct glyph *get_phys_cursor_glyph (struct window *w);
887 957
888/* Value is non-zero if WINDOW is a live window. */ 958/* Value is non-zero if WINDOW is a valid window. */
959#define WINDOW_VALID_P(WINDOW) \
960 (WINDOWP (WINDOW) \
961 && (!NILP (XWINDOW (WINDOW)->buffer) \
962 || !NILP (XWINDOW (WINDOW)->vchild) \
963 || !NILP (XWINDOW (WINDOW)->hchild)))
964
889 965
966/* Value is non-zero if WINDOW is a live window. */
890#define WINDOW_LIVE_P(WINDOW) \ 967#define WINDOW_LIVE_P(WINDOW) \
891 (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) 968 (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer))
892 969
@@ -895,6 +972,8 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
895extern Lisp_Object Qwindowp, Qwindow_live_p; 972extern Lisp_Object Qwindowp, Qwindow_live_p;
896extern Lisp_Object Vwindow_list; 973extern Lisp_Object Vwindow_list;
897 974
975extern struct window *decode_valid_window (Lisp_Object);
976extern struct window *decode_live_window (Lisp_Object);
898extern int compare_window_configurations (Lisp_Object, Lisp_Object, int); 977extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
899extern void mark_window_cursors_off (struct window *); 978extern void mark_window_cursors_off (struct window *);
900extern int window_internal_height (struct window *); 979extern int window_internal_height (struct window *);
@@ -907,4 +986,6 @@ extern void init_window (void);
907extern void syms_of_window (void); 986extern void syms_of_window (void);
908extern void keys_of_window (void); 987extern void keys_of_window (void);
909 988
989INLINE_HEADER_END
990
910#endif /* not WINDOW_H_INCLUDED */ 991#endif /* not WINDOW_H_INCLUDED */
diff --git a/src/xdisp.c b/src/xdisp.c
index 9bb3d92ac39..8260080ccf2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -367,6 +367,28 @@ Lisp_Object Qcenter;
367static Lisp_Object Qmargin, Qpointer; 367static Lisp_Object Qmargin, Qpointer;
368static Lisp_Object Qline_height; 368static Lisp_Object Qline_height;
369 369
370/* These setters are used only in this file, so they can be private. */
371static inline void
372wset_base_line_number (struct window *w, Lisp_Object val)
373{
374 w->base_line_number = val;
375}
376static inline void
377wset_base_line_pos (struct window *w, Lisp_Object val)
378{
379 w->base_line_pos = val;
380}
381static inline void
382wset_column_number_displayed (struct window *w, Lisp_Object val)
383{
384 w->column_number_displayed = val;
385}
386static inline void
387wset_region_showing (struct window *w, Lisp_Object val)
388{
389 w->region_showing = val;
390}
391
370#ifdef HAVE_WINDOW_SYSTEM 392#ifdef HAVE_WINDOW_SYSTEM
371 393
372/* Test if overflow newline into fringe. Called with iterator IT 394/* Test if overflow newline into fringe. Called with iterator IT
@@ -4052,38 +4074,56 @@ static enum prop_handled
4052handle_invisible_prop (struct it *it) 4074handle_invisible_prop (struct it *it)
4053{ 4075{
4054 enum prop_handled handled = HANDLED_NORMALLY; 4076 enum prop_handled handled = HANDLED_NORMALLY;
4077 int invis_p;
4078 Lisp_Object prop;
4055 4079
4056 if (STRINGP (it->string)) 4080 if (STRINGP (it->string))
4057 { 4081 {
4058 Lisp_Object prop, end_charpos, limit, charpos; 4082 Lisp_Object end_charpos, limit, charpos;
4059 4083
4060 /* Get the value of the invisible text property at the 4084 /* Get the value of the invisible text property at the
4061 current position. Value will be nil if there is no such 4085 current position. Value will be nil if there is no such
4062 property. */ 4086 property. */
4063 charpos = make_number (IT_STRING_CHARPOS (*it)); 4087 charpos = make_number (IT_STRING_CHARPOS (*it));
4064 prop = Fget_text_property (charpos, Qinvisible, it->string); 4088 prop = Fget_text_property (charpos, Qinvisible, it->string);
4089 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
4065 4090
4066 if (!NILP (prop) 4091 if (invis_p && IT_STRING_CHARPOS (*it) < it->end_charpos)
4067 && IT_STRING_CHARPOS (*it) < it->end_charpos)
4068 { 4092 {
4093 /* Record whether we have to display an ellipsis for the
4094 invisible text. */
4095 int display_ellipsis_p = (invis_p == 2);
4069 ptrdiff_t endpos; 4096 ptrdiff_t endpos;
4070 4097
4071 handled = HANDLED_RECOMPUTE_PROPS; 4098 handled = HANDLED_RECOMPUTE_PROPS;
4072 4099
4073 /* Get the position at which the next change of the 4100 /* Get the position at which the next visible text can be
4074 invisible text property can be found in IT->string. 4101 found in IT->string, if any. */
4075 Value will be nil if the property value is the same for
4076 all the rest of IT->string. */
4077 XSETINT (limit, SCHARS (it->string)); 4102 XSETINT (limit, SCHARS (it->string));
4078 end_charpos = Fnext_single_property_change (charpos, Qinvisible, 4103 do
4079 it->string, limit); 4104 {
4105 end_charpos = Fnext_single_property_change (charpos, Qinvisible,
4106 it->string, limit);
4107 if (!NILP (end_charpos))
4108 {
4109 prop = Fget_text_property (end_charpos, Qinvisible, it->string);
4110 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
4111 if (invis_p == 2)
4112 display_ellipsis_p = 1;
4113 }
4114 }
4115 while (!NILP (end_charpos) && invis_p);
4116
4117 if (display_ellipsis_p)
4118 {
4119 it->ellipsis_p = 1;
4120 handled = HANDLED_RETURN;
4121 }
4080 4122
4081 /* Text at current position is invisible. The next
4082 change in the property is at position end_charpos.
4083 Move IT's current position to that position. */
4084 if (INTEGERP (end_charpos) 4123 if (INTEGERP (end_charpos)
4085 && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) 4124 && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit))
4086 { 4125 {
4126 /* Text at END_CHARPOS is visible. Move IT there. */
4087 struct text_pos old; 4127 struct text_pos old;
4088 ptrdiff_t oldpos; 4128 ptrdiff_t oldpos;
4089 4129
@@ -4136,9 +4176,8 @@ handle_invisible_prop (struct it *it)
4136 } 4176 }
4137 else 4177 else
4138 { 4178 {
4139 int invis_p;
4140 ptrdiff_t newpos, next_stop, start_charpos, tem; 4179 ptrdiff_t newpos, next_stop, start_charpos, tem;
4141 Lisp_Object pos, prop, overlay; 4180 Lisp_Object pos, overlay;
4142 4181
4143 /* First of all, is there invisible text at this position? */ 4182 /* First of all, is there invisible text at this position? */
4144 tem = start_charpos = IT_CHARPOS (*it); 4183 tem = start_charpos = IT_CHARPOS (*it);
@@ -6045,7 +6084,7 @@ back_to_previous_visible_line_start (struct it *it)
6045 { 6084 {
6046 Lisp_Object prop; 6085 Lisp_Object prop;
6047 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), 6086 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
6048 Qinvisible, it->window); 6087 Qinvisible, it->window);
6049 if (TEXT_PROP_MEANS_INVISIBLE (prop)) 6088 if (TEXT_PROP_MEANS_INVISIBLE (prop))
6050 continue; 6089 continue;
6051 } 6090 }
@@ -8035,7 +8074,7 @@ run_redisplay_end_trigger_hook (struct it *it)
8035 8074
8036 /* Since we are *trying* to run these functions, don't try to run 8075 /* Since we are *trying* to run these functions, don't try to run
8037 them again, even if they get an error. */ 8076 them again, even if they get an error. */
8038 WSET (it->w, redisplay_end_trigger, Qnil); 8077 wset_redisplay_end_trigger (it->w, Qnil);
8039 Frun_hook_with_args (3, args); 8078 Frun_hook_with_args (3, args);
8040 8079
8041 /* Notice if it changed the face of the character we are on. */ 8080 /* Notice if it changed the face of the character we are on. */
@@ -9372,7 +9411,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9372 old_deactivate_mark = Vdeactivate_mark; 9411 old_deactivate_mark = Vdeactivate_mark;
9373 oldbuf = current_buffer; 9412 oldbuf = current_buffer;
9374 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); 9413 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
9375 BSET (current_buffer, undo_list, Qt); 9414 bset_undo_list (current_buffer, Qt);
9376 9415
9377 oldpoint = message_dolog_marker1; 9416 oldpoint = message_dolog_marker1;
9378 set_marker_restricted (oldpoint, make_number (PT), Qnil); 9417 set_marker_restricted (oldpoint, make_number (PT), Qnil);
@@ -9934,7 +9973,7 @@ ensure_echo_area_buffers (void)
9934 old_buffer = echo_buffer[i]; 9973 old_buffer = echo_buffer[i];
9935 echo_buffer[i] = Fget_buffer_create 9974 echo_buffer[i] = Fget_buffer_create
9936 (make_formatted_string (name, " *Echo Area %d*", i)); 9975 (make_formatted_string (name, " *Echo Area %d*", i));
9937 BSET (XBUFFER (echo_buffer[i]), truncate_lines, Qnil); 9976 bset_truncate_lines (XBUFFER (echo_buffer[i]), Qnil);
9938 /* to force word wrap in echo area - 9977 /* to force word wrap in echo area -
9939 it was decided to postpone this*/ 9978 it was decided to postpone this*/
9940 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ 9979 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */
@@ -10023,12 +10062,12 @@ with_echo_area_buffer (struct window *w, int which,
10023 set_buffer_internal_1 (XBUFFER (buffer)); 10062 set_buffer_internal_1 (XBUFFER (buffer));
10024 if (w) 10063 if (w)
10025 { 10064 {
10026 WSET (w, buffer, buffer); 10065 wset_buffer (w, buffer);
10027 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); 10066 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
10028 } 10067 }
10029 10068
10030 BSET (current_buffer, undo_list, Qt); 10069 bset_undo_list (current_buffer, Qt);
10031 BSET (current_buffer, read_only, Qnil); 10070 bset_read_only (current_buffer, Qnil);
10032 specbind (Qinhibit_read_only, Qt); 10071 specbind (Qinhibit_read_only, Qt);
10033 specbind (Qinhibit_modification_hooks, Qt); 10072 specbind (Qinhibit_modification_hooks, Qt);
10034 10073
@@ -10108,7 +10147,7 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
10108 charpos = AREF (vector, 5); 10147 charpos = AREF (vector, 5);
10109 bytepos = AREF (vector, 6); 10148 bytepos = AREF (vector, 6);
10110 10149
10111 WSET (w, buffer, buffer); 10150 wset_buffer (w, buffer);
10112 set_marker_both (w->pointm, buffer, 10151 set_marker_both (w->pointm, buffer,
10113 XFASTINT (charpos), XFASTINT (bytepos)); 10152 XFASTINT (charpos), XFASTINT (bytepos));
10114 } 10153 }
@@ -10141,7 +10180,7 @@ setup_echo_area_for_printing (int multibyte_p)
10141 10180
10142 /* Switch to that buffer and clear it. */ 10181 /* Switch to that buffer and clear it. */
10143 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 10182 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
10144 BSET (current_buffer, truncate_lines, Qnil); 10183 bset_truncate_lines (current_buffer, Qnil);
10145 10184
10146 if (Z > BEG) 10185 if (Z > BEG)
10147 { 10186 {
@@ -10184,7 +10223,7 @@ setup_echo_area_for_printing (int multibyte_p)
10184 { 10223 {
10185 /* Someone switched buffers between print requests. */ 10224 /* Someone switched buffers between print requests. */
10186 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 10225 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
10187 BSET (current_buffer, truncate_lines, Qnil); 10226 bset_truncate_lines (current_buffer, Qnil);
10188 } 10227 }
10189 } 10228 }
10190} 10229}
@@ -10636,9 +10675,9 @@ set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multiby
10636 != !NILP (BVAR (current_buffer, enable_multibyte_characters))) 10675 != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
10637 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); 10676 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
10638 10677
10639 BSET (current_buffer, truncate_lines, message_truncate_lines ? Qt : Qnil); 10678 bset_truncate_lines (current_buffer, message_truncate_lines ? Qt : Qnil);
10640 if (!NILP (BVAR (current_buffer, bidi_display_reordering))) 10679 if (!NILP (BVAR (current_buffer, bidi_display_reordering)))
10641 BSET (current_buffer, bidi_paragraph_direction, Qleft_to_right); 10680 bset_bidi_paragraph_direction (current_buffer, Qleft_to_right);
10642 10681
10643 /* Insert new message at BEG. */ 10682 /* Insert new message at BEG. */
10644 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 10683 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -11328,7 +11367,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11328 } 11367 }
11329 11368
11330 XSETFRAME (Vmenu_updating_frame, f); 11369 XSETFRAME (Vmenu_updating_frame, f);
11331 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 11370 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
11332 11371
11333 /* Redisplay the menu bar in case we changed it. */ 11372 /* Redisplay the menu bar in case we changed it. */
11334#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ 11373#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
@@ -11541,7 +11580,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11541 may access f->tool_bar_items. Make sure we update both 11580 may access f->tool_bar_items. Make sure we update both
11542 variables within BLOCK_INPUT so no such event interrupts. */ 11581 variables within BLOCK_INPUT so no such event interrupts. */
11543 BLOCK_INPUT; 11582 BLOCK_INPUT;
11544 FSET (f, tool_bar_items, new_tool_bar); 11583 fset_tool_bar_items (f, new_tool_bar);
11545 f->n_tool_bar_items = new_n_tool_bar; 11584 f->n_tool_bar_items = new_n_tool_bar;
11546 w->update_mode_line = 1; 11585 w->update_mode_line = 1;
11547 UNBLOCK_INPUT; 11586 UNBLOCK_INPUT;
@@ -11583,8 +11622,8 @@ build_desired_tool_bar_string (struct frame *f)
11583 11622
11584 /* Reuse f->desired_tool_bar_string, if possible. */ 11623 /* Reuse f->desired_tool_bar_string, if possible. */
11585 if (size < size_needed || NILP (f->desired_tool_bar_string)) 11624 if (size < size_needed || NILP (f->desired_tool_bar_string))
11586 FSET (f, desired_tool_bar_string, 11625 fset_desired_tool_bar_string
11587 Fmake_string (make_number (size_needed), make_number (' '))); 11626 (f, Fmake_string (make_number (size_needed), make_number (' ')));
11588 else 11627 else
11589 { 11628 {
11590 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); 11629 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
@@ -13320,12 +13359,12 @@ redisplay_internal (void)
13320 if ((it.glyph_row - 1)->displays_text_p) 13359 if ((it.glyph_row - 1)->displays_text_p)
13321 { 13360 {
13322 if (XFASTINT (w->window_end_vpos) < this_line_vpos) 13361 if (XFASTINT (w->window_end_vpos) < this_line_vpos)
13323 WSET (w, window_end_vpos, make_number (this_line_vpos)); 13362 wset_window_end_vpos (w, make_number (this_line_vpos));
13324 } 13363 }
13325 else if (XFASTINT (w->window_end_vpos) == this_line_vpos 13364 else if (XFASTINT (w->window_end_vpos) == this_line_vpos
13326 && this_line_vpos > 0) 13365 && this_line_vpos > 0)
13327 WSET (w, window_end_vpos, make_number (this_line_vpos - 1)); 13366 wset_window_end_vpos (w, make_number (this_line_vpos - 1));
13328 WSET (w, window_end_valid, Qnil); 13367 wset_window_end_valid (w, Qnil);
13329 13368
13330 /* Update hint: No need to try to scroll in update_window. */ 13369 /* Update hint: No need to try to scroll in update_window. */
13331 w->desired_matrix->no_scrolling_p = 1; 13370 w->desired_matrix->no_scrolling_p = 1;
@@ -13798,7 +13837,7 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13798 13837
13799 if (accurate_p) 13838 if (accurate_p)
13800 { 13839 {
13801 WSET (w, window_end_valid, w->buffer); 13840 wset_window_end_valid (w, w->buffer);
13802 w->update_mode_line = 0; 13841 w->update_mode_line = 0;
13803 } 13842 }
13804} 13843}
@@ -14906,7 +14945,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14906 if (!just_this_one_p 14945 if (!just_this_one_p
14907 || current_buffer->clip_changed 14946 || current_buffer->clip_changed
14908 || BEG_UNCHANGED < CHARPOS (startp)) 14947 || BEG_UNCHANGED < CHARPOS (startp))
14909 WSET (w, base_line_number, Qnil); 14948 wset_base_line_number (w, Qnil);
14910 14949
14911 /* If cursor ends up on a partially visible line, 14950 /* If cursor ends up on a partially visible line,
14912 treat that as being off the bottom of the screen. */ 14951 treat that as being off the bottom of the screen. */
@@ -15531,7 +15570,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15531 if (XMARKER (w->start)->buffer == current_buffer) 15570 if (XMARKER (w->start)->buffer == current_buffer)
15532 compute_window_start_on_continuation_line (w); 15571 compute_window_start_on_continuation_line (w);
15533 15572
15534 WSET (w, window_end_valid, Qnil); 15573 wset_window_end_valid (w, Qnil);
15535 } 15574 }
15536 15575
15537 /* Some sanity checks. */ 15576 /* Some sanity checks. */
@@ -15642,11 +15681,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15642 15681
15643 w->force_start = 0; 15682 w->force_start = 0;
15644 w->vscroll = 0; 15683 w->vscroll = 0;
15645 WSET (w, window_end_valid, Qnil); 15684 wset_window_end_valid (w, Qnil);
15646 15685
15647 /* Forget any recorded base line for line number display. */ 15686 /* Forget any recorded base line for line number display. */
15648 if (!buffer_unchanged_p) 15687 if (!buffer_unchanged_p)
15649 WSET (w, base_line_number, Qnil); 15688 wset_base_line_number (w, Qnil);
15650 15689
15651 /* Redisplay the mode line. Select the buffer properly for that. 15690 /* Redisplay the mode line. Select the buffer properly for that.
15652 Also, run the hook window-scroll-functions 15691 Also, run the hook window-scroll-functions
@@ -15860,7 +15899,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15860 || current_buffer->clip_changed 15899 || current_buffer->clip_changed
15861 || BEG_UNCHANGED < CHARPOS (startp)) 15900 || BEG_UNCHANGED < CHARPOS (startp))
15862 /* Forget any recorded base line for line number display. */ 15901 /* Forget any recorded base line for line number display. */
15863 WSET (w, base_line_number, Qnil); 15902 wset_base_line_number (w, Qnil);
15864 15903
15865 if (!cursor_row_fully_visible_p (w, 1, 0)) 15904 if (!cursor_row_fully_visible_p (w, 1, 0))
15866 { 15905 {
@@ -15931,7 +15970,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15931 15970
15932 /* Forget any previously recorded base line for line number display. */ 15971 /* Forget any previously recorded base line for line number display. */
15933 if (!buffer_unchanged_p) 15972 if (!buffer_unchanged_p)
15934 WSET (w, base_line_number, Qnil); 15973 wset_base_line_number (w, Qnil);
15935 15974
15936 /* Determine the window start relative to point. */ 15975 /* Determine the window start relative to point. */
15937 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); 15976 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
@@ -16189,8 +16228,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16189 if (!line_number_displayed 16228 if (!line_number_displayed
16190 && !BUFFERP (w->base_line_pos)) 16229 && !BUFFERP (w->base_line_pos))
16191 { 16230 {
16192 WSET (w, base_line_pos, Qnil); 16231 wset_base_line_pos (w, Qnil);
16193 WSET (w, base_line_number, Qnil); 16232 wset_base_line_number (w, Qnil);
16194 } 16233 }
16195 16234
16196 finish_menu_bars: 16235 finish_menu_bars:
@@ -16374,10 +16413,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16374 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); 16413 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row));
16375 w->window_end_bytepos 16414 w->window_end_bytepos
16376 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16415 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16377 WSET (w, window_end_pos, 16416 wset_window_end_pos
16378 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 16417 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
16379 WSET (w, window_end_vpos, 16418 wset_window_end_vpos
16380 make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); 16419 (w, make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)));
16381 eassert 16420 eassert
16382 (MATRIX_ROW (w->desired_matrix, 16421 (MATRIX_ROW (w->desired_matrix,
16383 XFASTINT (w->window_end_vpos))->displays_text_p); 16422 XFASTINT (w->window_end_vpos))->displays_text_p);
@@ -16385,12 +16424,12 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16385 else 16424 else
16386 { 16425 {
16387 w->window_end_bytepos = Z_BYTE - ZV_BYTE; 16426 w->window_end_bytepos = Z_BYTE - ZV_BYTE;
16388 WSET (w, window_end_pos, make_number (Z - ZV)); 16427 wset_window_end_pos (w, make_number (Z - ZV));
16389 WSET (w, window_end_vpos, make_number (0)); 16428 wset_window_end_vpos (w, make_number (0));
16390 } 16429 }
16391 16430
16392 /* But that is not valid info until redisplay finishes. */ 16431 /* But that is not valid info until redisplay finishes. */
16393 WSET (w, window_end_valid, Qnil); 16432 wset_window_end_valid (w, Qnil);
16394 return 1; 16433 return 1;
16395} 16434}
16396 16435
@@ -16621,28 +16660,31 @@ try_window_reusing_current_matrix (struct window *w)
16621 { 16660 {
16622 w->window_end_bytepos 16661 w->window_end_bytepos
16623 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); 16662 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row);
16624 WSET (w, window_end_pos, 16663 wset_window_end_pos
16625 make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row))); 16664 (w, make_number (Z
16626 WSET (w, window_end_vpos, 16665 - MATRIX_ROW_END_CHARPOS (last_reused_text_row)));
16627 make_number (MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix))); 16666 wset_window_end_vpos
16667 (w, make_number (MATRIX_ROW_VPOS (last_reused_text_row,
16668 w->current_matrix)));
16628 } 16669 }
16629 else if (last_text_row) 16670 else if (last_text_row)
16630 { 16671 {
16631 w->window_end_bytepos 16672 w->window_end_bytepos
16632 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16673 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16633 WSET (w, window_end_pos, 16674 wset_window_end_pos
16634 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 16675 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
16635 WSET (w, window_end_vpos, 16676 wset_window_end_vpos
16636 make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); 16677 (w, make_number (MATRIX_ROW_VPOS (last_text_row,
16678 w->desired_matrix)));
16637 } 16679 }
16638 else 16680 else
16639 { 16681 {
16640 /* This window must be completely empty. */ 16682 /* This window must be completely empty. */
16641 w->window_end_bytepos = Z_BYTE - ZV_BYTE; 16683 w->window_end_bytepos = Z_BYTE - ZV_BYTE;
16642 WSET (w, window_end_pos, make_number (Z - ZV)); 16684 wset_window_end_pos (w, make_number (Z - ZV));
16643 WSET (w, window_end_vpos, make_number (0)); 16685 wset_window_end_vpos (w, make_number (0));
16644 } 16686 }
16645 WSET (w, window_end_valid, Qnil); 16687 wset_window_end_valid (w, Qnil);
16646 16688
16647 /* Update hint: don't try scrolling again in update_window. */ 16689 /* Update hint: don't try scrolling again in update_window. */
16648 w->desired_matrix->no_scrolling_p = 1; 16690 w->desired_matrix->no_scrolling_p = 1;
@@ -16823,18 +16865,19 @@ try_window_reusing_current_matrix (struct window *w)
16823 { 16865 {
16824 w->window_end_bytepos 16866 w->window_end_bytepos
16825 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16867 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16826 WSET (w, window_end_pos, 16868 wset_window_end_pos
16827 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 16869 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
16828 WSET (w, window_end_vpos, 16870 wset_window_end_vpos
16829 make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); 16871 (w, make_number (MATRIX_ROW_VPOS (last_text_row,
16872 w->desired_matrix)));
16830 } 16873 }
16831 else 16874 else
16832 { 16875 {
16833 WSET (w, window_end_vpos, 16876 wset_window_end_vpos
16834 make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled)); 16877 (w, make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled));
16835 } 16878 }
16836 16879
16837 WSET (w, window_end_valid, Qnil); 16880 wset_window_end_valid (w, Qnil);
16838 w->desired_matrix->no_scrolling_p = 1; 16881 w->desired_matrix->no_scrolling_p = 1;
16839 16882
16840#ifdef GLYPH_DEBUG 16883#ifdef GLYPH_DEBUG
@@ -17413,8 +17456,8 @@ try_window_id (struct window *w)
17413 { 17456 {
17414 /* We have to compute the window end anew since text 17457 /* We have to compute the window end anew since text
17415 could have been added/removed after it. */ 17458 could have been added/removed after it. */
17416 WSET (w, window_end_pos, 17459 wset_window_end_pos
17417 make_number (Z - MATRIX_ROW_END_CHARPOS (row))); 17460 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
17418 w->window_end_bytepos 17461 w->window_end_bytepos
17419 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17462 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17420 17463
@@ -17848,21 +17891,22 @@ try_window_id (struct window *w)
17848 first_unchanged_at_end_row); 17891 first_unchanged_at_end_row);
17849 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); 17892 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
17850 17893
17851 WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); 17894 wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
17852 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17895 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17853 WSET (w, window_end_vpos, 17896 wset_window_end_vpos
17854 make_number (MATRIX_ROW_VPOS (row, w->current_matrix))); 17897 (w, make_number (MATRIX_ROW_VPOS (row, w->current_matrix)));
17855 eassert (w->window_end_bytepos >= 0); 17898 eassert (w->window_end_bytepos >= 0);
17856 IF_DEBUG (debug_method_add (w, "A")); 17899 IF_DEBUG (debug_method_add (w, "A"));
17857 } 17900 }
17858 else if (last_text_row_at_end) 17901 else if (last_text_row_at_end)
17859 { 17902 {
17860 WSET (w, window_end_pos, 17903 wset_window_end_pos
17861 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end))); 17904 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end)));
17862 w->window_end_bytepos 17905 w->window_end_bytepos
17863 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); 17906 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end);
17864 WSET (w, window_end_vpos, 17907 wset_window_end_vpos
17865 make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix))); 17908 (w, make_number (MATRIX_ROW_VPOS (last_text_row_at_end,
17909 desired_matrix)));
17866 eassert (w->window_end_bytepos >= 0); 17910 eassert (w->window_end_bytepos >= 0);
17867 IF_DEBUG (debug_method_add (w, "B")); 17911 IF_DEBUG (debug_method_add (w, "B"));
17868 } 17912 }
@@ -17871,12 +17915,12 @@ try_window_id (struct window *w)
17871 /* We have displayed either to the end of the window or at the 17915 /* We have displayed either to the end of the window or at the
17872 end of the window, i.e. the last row with text is to be found 17916 end of the window, i.e. the last row with text is to be found
17873 in the desired matrix. */ 17917 in the desired matrix. */
17874 WSET (w, window_end_pos, 17918 wset_window_end_pos
17875 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 17919 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
17876 w->window_end_bytepos 17920 w->window_end_bytepos
17877 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 17921 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
17878 WSET (w, window_end_vpos, 17922 wset_window_end_vpos
17879 make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix))); 17923 (w, make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix)));
17880 eassert (w->window_end_bytepos >= 0); 17924 eassert (w->window_end_bytepos >= 0);
17881 } 17925 }
17882 else if (first_unchanged_at_end_row == NULL 17926 else if (first_unchanged_at_end_row == NULL
@@ -17904,8 +17948,8 @@ try_window_id (struct window *w)
17904 } 17948 }
17905 17949
17906 eassert (row != NULL); 17950 eassert (row != NULL);
17907 WSET (w, window_end_vpos, make_number (vpos + 1)); 17951 wset_window_end_vpos (w, make_number (vpos + 1));
17908 WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); 17952 wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
17909 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17953 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17910 eassert (w->window_end_bytepos >= 0); 17954 eassert (w->window_end_bytepos >= 0);
17911 IF_DEBUG (debug_method_add (w, "C")); 17955 IF_DEBUG (debug_method_add (w, "C"));
@@ -17917,7 +17961,7 @@ try_window_id (struct window *w)
17917 debug_end_vpos = XFASTINT (w->window_end_vpos)); 17961 debug_end_vpos = XFASTINT (w->window_end_vpos));
17918 17962
17919 /* Record that display has not been completed. */ 17963 /* Record that display has not been completed. */
17920 WSET (w, window_end_valid, Qnil); 17964 wset_window_end_valid (w, Qnil);
17921 w->desired_matrix->no_scrolling_p = 1; 17965 w->desired_matrix->no_scrolling_p = 1;
17922 return 3; 17966 return 3;
17923 17967
@@ -19353,7 +19397,7 @@ display_line (struct it *it)
19353 } 19397 }
19354 19398
19355 /* Is IT->w showing the region? */ 19399 /* Is IT->w showing the region? */
19356 WSET (it->w, region_showing, it->region_beg_charpos > 0 ? Qt : Qnil); 19400 wset_region_showing (it->w, it->region_beg_charpos > 0 ? Qt : Qnil);
19357 19401
19358 /* Clear the result glyph row and enable it. */ 19402 /* Clear the result glyph row and enable it. */
19359 prepare_desired_row (row); 19403 prepare_desired_row (row);
@@ -20357,7 +20401,7 @@ display_mode_lines (struct window *w)
20357 20401
20358 /* These will be set while the mode line specs are processed. */ 20402 /* These will be set while the mode line specs are processed. */
20359 line_number_displayed = 0; 20403 line_number_displayed = 0;
20360 WSET (w, column_number_displayed, Qnil); 20404 wset_column_number_displayed (w, Qnil);
20361 20405
20362 if (WINDOW_WANTS_MODELINE_P (w)) 20406 if (WINDOW_WANTS_MODELINE_P (w))
20363 { 20407 {
@@ -21493,7 +21537,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21493 else 21537 else
21494 { 21538 {
21495 ptrdiff_t col = current_column (); 21539 ptrdiff_t col = current_column ();
21496 WSET (w, column_number_displayed, make_number (col)); 21540 wset_column_number_displayed (w, make_number (col));
21497 pint2str (decode_mode_spec_buf, field_width, col); 21541 pint2str (decode_mode_spec_buf, field_width, col);
21498 return decode_mode_spec_buf; 21542 return decode_mode_spec_buf;
21499 } 21543 }
@@ -21556,14 +21600,14 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21556 goto no_value; 21600 goto no_value;
21557 /* But do forget it, if the window shows a different buffer now. */ 21601 /* But do forget it, if the window shows a different buffer now. */
21558 else if (BUFFERP (w->base_line_pos)) 21602 else if (BUFFERP (w->base_line_pos))
21559 WSET (w, base_line_pos, Qnil); 21603 wset_base_line_pos (w, Qnil);
21560 21604
21561 /* If the buffer is very big, don't waste time. */ 21605 /* If the buffer is very big, don't waste time. */
21562 if (INTEGERP (Vline_number_display_limit) 21606 if (INTEGERP (Vline_number_display_limit)
21563 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit)) 21607 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit))
21564 { 21608 {
21565 WSET (w, base_line_pos, Qnil); 21609 wset_base_line_pos (w, Qnil);
21566 WSET (w, base_line_number, Qnil); 21610 wset_base_line_number (w, Qnil);
21567 goto no_value; 21611 goto no_value;
21568 } 21612 }
21569 21613
@@ -21595,8 +21639,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21595 go back past it. */ 21639 go back past it. */
21596 if (startpos == BUF_BEGV (b)) 21640 if (startpos == BUF_BEGV (b))
21597 { 21641 {
21598 WSET (w, base_line_number, make_number (topline)); 21642 wset_base_line_number (w, make_number (topline));
21599 WSET (w, base_line_pos, make_number (BUF_BEGV (b))); 21643 wset_base_line_pos (w, make_number (BUF_BEGV (b)));
21600 } 21644 }
21601 else if (nlines < height + 25 || nlines > height * 3 + 50 21645 else if (nlines < height + 25 || nlines > height * 3 + 50
21602 || linepos == BUF_BEGV (b)) 21646 || linepos == BUF_BEGV (b))
@@ -21622,13 +21666,13 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21622 give up on line numbers for this window. */ 21666 give up on line numbers for this window. */
21623 if (position == limit_byte && limit == startpos - distance) 21667 if (position == limit_byte && limit == startpos - distance)
21624 { 21668 {
21625 WSET (w, base_line_pos, w->buffer); 21669 wset_base_line_pos (w, w->buffer);
21626 WSET (w, base_line_number, Qnil); 21670 wset_base_line_number (w, Qnil);
21627 goto no_value; 21671 goto no_value;
21628 } 21672 }
21629 21673
21630 WSET (w, base_line_number, make_number (topline - nlines)); 21674 wset_base_line_number (w, make_number (topline - nlines));
21631 WSET (w, base_line_pos, make_number (BYTE_TO_CHAR (position))); 21675 wset_base_line_pos (w, make_number (BYTE_TO_CHAR (position)));
21632 } 21676 }
21633 21677
21634 /* Now count lines from the start pos to point. */ 21678 /* Now count lines from the start pos to point. */
@@ -29540,12 +29584,13 @@ init_xdisp (void)
29540 29584
29541 echo_area_window = minibuf_window; 29585 echo_area_window = minibuf_window;
29542 29586
29543 WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f))); 29587 wset_top_line (r, make_number (FRAME_TOP_MARGIN (f)));
29544 WSET (r, total_lines, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f))); 29588 wset_total_lines
29545 WSET (r, total_cols, make_number (FRAME_COLS (f))); 29589 (r, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f)));
29546 WSET (m, top_line, make_number (FRAME_LINES (f) - 1)); 29590 wset_total_cols (r, make_number (FRAME_COLS (f)));
29547 WSET (m, total_lines, make_number (1)); 29591 wset_top_line (m, make_number (FRAME_LINES (f) - 1));
29548 WSET (m, total_cols, make_number (FRAME_COLS (f))); 29592 wset_total_lines (m, make_number (1));
29593 wset_total_cols (m, make_number (FRAME_COLS (f)));
29549 29594
29550 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; 29595 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
29551 scratch_glyph_row.glyphs[TEXT_AREA + 1] 29596 scratch_glyph_row.glyphs[TEXT_AREA + 1]
diff --git a/src/xfaces.c b/src/xfaces.c
index ed372c6b419..46121d66606 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -279,7 +279,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
279 279
280#endif /* HAVE_X_WINDOWS */ 280#endif /* HAVE_X_WINDOWS */
281 281
282#include <ctype.h> 282#include <c-ctype.h>
283 283
284/* Number of pt per inch (from the TeXbook). */ 284/* Number of pt per inch (from the TeXbook). */
285 285
@@ -2281,6 +2281,7 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to,
2281 struct named_merge_point *named_merge_points) 2281 struct named_merge_point *named_merge_points)
2282{ 2282{
2283 int i; 2283 int i;
2284 Lisp_Object font = Qnil;
2284 2285
2285 /* If FROM inherits from some other faces, merge their attributes into 2286 /* If FROM inherits from some other faces, merge their attributes into
2286 TO before merging FROM's direct attributes. Note that an :inherit 2287 TO before merging FROM's direct attributes. Note that an :inherit
@@ -2291,24 +2292,13 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to,
2291 && !NILP (from[LFACE_INHERIT_INDEX])) 2292 && !NILP (from[LFACE_INHERIT_INDEX]))
2292 merge_face_ref (f, from[LFACE_INHERIT_INDEX], to, 0, named_merge_points); 2293 merge_face_ref (f, from[LFACE_INHERIT_INDEX], to, 0, named_merge_points);
2293 2294
2294 i = LFACE_FONT_INDEX; 2295 if (FONT_SPEC_P (from[LFACE_FONT_INDEX]))
2295 if (!UNSPECIFIEDP (from[i]))
2296 { 2296 {
2297 if (!UNSPECIFIEDP (to[i])) 2297 if (!UNSPECIFIEDP (to[LFACE_FONT_INDEX]))
2298 to[i] = merge_font_spec (from[i], to[i]); 2298 font = merge_font_spec (from[LFACE_FONT_INDEX], to[LFACE_FONT_INDEX]);
2299 else 2299 else
2300 to[i] = copy_font_spec (from[i]); 2300 font = copy_font_spec (from[LFACE_FONT_INDEX]);
2301 if (! NILP (AREF (to[i], FONT_FOUNDRY_INDEX))) 2301 to[LFACE_FONT_INDEX] = font;
2302 to[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (to[i], FONT_FOUNDRY_INDEX));
2303 if (! NILP (AREF (to[i], FONT_FAMILY_INDEX)))
2304 to[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (to[i], FONT_FAMILY_INDEX));
2305 if (! NILP (AREF (to[i], FONT_WEIGHT_INDEX)))
2306 to[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (to[i]);
2307 if (! NILP (AREF (to[i], FONT_SLANT_INDEX)))
2308 to[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (to[i]);
2309 if (! NILP (AREF (to[i], FONT_WIDTH_INDEX)))
2310 to[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (to[i]);
2311 ASET (to[i], FONT_SIZE_INDEX, Qnil);
2312 } 2302 }
2313 2303
2314 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 2304 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
@@ -2319,8 +2309,7 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to,
2319 to[i] = merge_face_heights (from[i], to[i], to[i]); 2309 to[i] = merge_face_heights (from[i], to[i], to[i]);
2320 font_clear_prop (to, FONT_SIZE_INDEX); 2310 font_clear_prop (to, FONT_SIZE_INDEX);
2321 } 2311 }
2322 else if (i != LFACE_FONT_INDEX 2312 else if (i != LFACE_FONT_INDEX && ! EQ (to[i], from[i]))
2323 && ! EQ (to[i], from[i]))
2324 { 2313 {
2325 to[i] = from[i]; 2314 to[i] = from[i];
2326 if (i >= LFACE_FAMILY_INDEX && i <=LFACE_SLANT_INDEX) 2315 if (i >= LFACE_FAMILY_INDEX && i <=LFACE_SLANT_INDEX)
@@ -2334,6 +2323,25 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to,
2334 } 2323 }
2335 } 2324 }
2336 2325
2326 /* If FROM specifies a font spec, make its contents take precedence
2327 over :family and other attributes. This is needed for face
2328 remapping using :font to work. */
2329
2330 if (!NILP (font))
2331 {
2332 if (! NILP (AREF (font, FONT_FOUNDRY_INDEX)))
2333 to[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (font, FONT_FOUNDRY_INDEX));
2334 if (! NILP (AREF (font, FONT_FAMILY_INDEX)))
2335 to[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (font, FONT_FAMILY_INDEX));
2336 if (! NILP (AREF (font, FONT_WEIGHT_INDEX)))
2337 to[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (font);
2338 if (! NILP (AREF (font, FONT_SLANT_INDEX)))
2339 to[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (font);
2340 if (! NILP (AREF (font, FONT_WIDTH_INDEX)))
2341 to[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (font);
2342 ASET (font, FONT_SIZE_INDEX, Qnil);
2343 }
2344
2337 /* TO is always an absolute face, which should inherit from nothing. 2345 /* TO is always an absolute face, which should inherit from nothing.
2338 We blindly copy the :inherit attribute above and fix it up here. */ 2346 We blindly copy the :inherit attribute above and fix it up here. */
2339 to[LFACE_INHERIT_INDEX] = Qnil; 2347 to[LFACE_INHERIT_INDEX] = Qnil;
@@ -2575,6 +2583,13 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to,
2575 else 2583 else
2576 err = 1; 2584 err = 1;
2577 } 2585 }
2586 else if (EQ (keyword, QCfont))
2587 {
2588 if (FONTP (value))
2589 to[LFACE_FONT_INDEX] = value;
2590 else
2591 err = 1;
2592 }
2578 else if (EQ (keyword, QCinherit)) 2593 else if (EQ (keyword, QCinherit))
2579 { 2594 {
2580 /* This is not really very useful; it's just like a 2595 /* This is not really very useful; it's just like a
@@ -2680,7 +2695,7 @@ Value is a vector of face attributes. */)
2680 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), 2695 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
2681 Qunspecified); 2696 Qunspecified);
2682 ASET (lface, 0, Qface); 2697 ASET (lface, 0, Qface);
2683 FSET (f, face_alist, Fcons (Fcons (face, lface), f->face_alist)); 2698 fset_face_alist (f, Fcons (Fcons (face, lface), f->face_alist));
2684 } 2699 }
2685 else 2700 else
2686 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 2701 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
@@ -4059,7 +4074,7 @@ hash_string_case_insensitive (Lisp_Object string)
4059 unsigned hash = 0; 4074 unsigned hash = 0;
4060 eassert (STRINGP (string)); 4075 eassert (STRINGP (string));
4061 for (s = SDATA (string); *s; ++s) 4076 for (s = SDATA (string); *s; ++s)
4062 hash = (hash << 1) ^ tolower (*s); 4077 hash = (hash << 1) ^ c_tolower (*s);
4063 return hash; 4078 return hash;
4064} 4079}
4065 4080
diff --git a/src/xfns.c b/src/xfns.c
index 2e7334b7d71..90b54d12345 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -49,7 +49,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
49 49
50#ifdef HAVE_X_WINDOWS 50#ifdef HAVE_X_WINDOWS
51 51
52#include <ctype.h>
53#include <sys/types.h> 52#include <sys/types.h>
54#include <sys/stat.h> 53#include <sys/stat.h>
55 54
@@ -659,7 +658,7 @@ x_set_tool_bar_position (struct frame *f,
659 658
660#ifdef USE_GTK 659#ifdef USE_GTK
661 if (xg_change_toolbar_position (f, new_value)) 660 if (xg_change_toolbar_position (f, new_value))
662 FSET (f, tool_bar_position, new_value); 661 fset_tool_bar_position (f, new_value);
663#endif 662#endif
664} 663}
665 664
@@ -1146,7 +1145,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1146 else if (!NILP (arg) || NILP (oldval)) 1145 else if (!NILP (arg) || NILP (oldval))
1147 return; 1146 return;
1148 1147
1149 FSET (f, icon_name, arg); 1148 fset_icon_name (f, arg);
1150 1149
1151 if (f->output_data.x->icon_bitmap != 0) 1150 if (f->output_data.x->icon_bitmap != 0)
1152 return; 1151 return;
@@ -1637,7 +1636,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1637 if (! NILP (Fstring_equal (name, f->name))) 1636 if (! NILP (Fstring_equal (name, f->name)))
1638 return; 1637 return;
1639 1638
1640 FSET (f, name, name); 1639 fset_name (f, name);
1641 1640
1642 /* For setting the frame title, the title parameter should override 1641 /* For setting the frame title, the title parameter should override
1643 the name parameter. */ 1642 the name parameter. */
@@ -1677,7 +1676,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1677 1676
1678 update_mode_lines = 1; 1677 update_mode_lines = 1;
1679 1678
1680 FSET (f, title, name); 1679 fset_title (f, name);
1681 1680
1682 if (NILP (name)) 1681 if (NILP (name))
1683 name = f->name; 1682 name = f->name;
@@ -2566,7 +2565,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2566 2565
2567 f->explicit_name = 0; 2566 f->explicit_name = 0;
2568 name = f->name; 2567 name = f->name;
2569 FSET (f, name, Qnil); 2568 fset_name (f, Qnil);
2570 x_set_name (f, name, explicit); 2569 x_set_name (f, name, explicit);
2571 } 2570 }
2572 2571
@@ -2709,7 +2708,7 @@ x_window (struct frame *f)
2709 2708
2710 f->explicit_name = 0; 2709 f->explicit_name = 0;
2711 name = f->name; 2710 name = f->name;
2712 FSET (f, name, Qnil); 2711 fset_name (f, Qnil);
2713 x_set_name (f, name, explicit); 2712 x_set_name (f, name, explicit);
2714 } 2713 }
2715 2714
@@ -3129,11 +3128,11 @@ This function is an internal primitive--use `make-frame' instead. */)
3129 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 3128 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
3130#endif /* USE_TOOLKIT_SCROLL_BARS */ 3129#endif /* USE_TOOLKIT_SCROLL_BARS */
3131 3130
3132 FSET (f, icon_name, 3131 fset_icon_name (f,
3133 x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", 3132 x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
3134 RES_TYPE_STRING)); 3133 RES_TYPE_STRING));
3135 if (! STRINGP (f->icon_name)) 3134 if (! STRINGP (f->icon_name))
3136 FSET (f, icon_name, Qnil); 3135 fset_icon_name (f, Qnil);
3137 3136
3138 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 3137 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
3139 3138
@@ -3190,12 +3189,12 @@ This function is an internal primitive--use `make-frame' instead. */)
3190 be set. */ 3189 be set. */
3191 if (EQ (name, Qunbound) || NILP (name)) 3190 if (EQ (name, Qunbound) || NILP (name))
3192 { 3191 {
3193 FSET (f, name, build_string (dpyinfo->x_id_name)); 3192 fset_name (f, build_string (dpyinfo->x_id_name));
3194 f->explicit_name = 0; 3193 f->explicit_name = 0;
3195 } 3194 }
3196 else 3195 else
3197 { 3196 {
3198 FSET (f, name, name); 3197 fset_name (f, name);
3199 f->explicit_name = 1; 3198 f->explicit_name = 1;
3200 /* use the frame's title when getting resources for this frame. */ 3199 /* use the frame's title when getting resources for this frame. */
3201 specbind (Qx_resource_name, name); 3200 specbind (Qx_resource_name, name);
@@ -3456,13 +3455,13 @@ This function is an internal primitive--use `make-frame' instead. */)
3456 if (FRAME_HAS_MINIBUF_P (f) 3455 if (FRAME_HAS_MINIBUF_P (f)
3457 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 3456 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
3458 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 3457 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
3459 KSET (kb, Vdefault_minibuffer_frame, frame); 3458 kset_default_minibuffer_frame (kb, frame);
3460 3459
3461 /* All remaining specified parameters, which have not been "used" 3460 /* All remaining specified parameters, which have not been "used"
3462 by x_get_arg and friends, now go in the misc. alist of the frame. */ 3461 by x_get_arg and friends, now go in the misc. alist of the frame. */
3463 for (tem = parms; CONSP (tem); tem = XCDR (tem)) 3462 for (tem = parms; CONSP (tem); tem = XCDR (tem))
3464 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 3463 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
3465 FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); 3464 fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
3466 3465
3467 UNGCPRO; 3466 UNGCPRO;
3468 3467
@@ -4591,7 +4590,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4591 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); 4590 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0);
4592 old_buffer = current_buffer; 4591 old_buffer = current_buffer;
4593 set_buffer_internal_1 (XBUFFER (buffer)); 4592 set_buffer_internal_1 (XBUFFER (buffer));
4594 BSET (current_buffer, truncate_lines, Qnil); 4593 bset_truncate_lines (current_buffer, Qnil);
4595 specbind (Qinhibit_read_only, Qt); 4594 specbind (Qinhibit_read_only, Qt);
4596 specbind (Qinhibit_modification_hooks, Qt); 4595 specbind (Qinhibit_modification_hooks, Qt);
4597 Ferase_buffer (); 4596 Ferase_buffer ();
@@ -4617,7 +4616,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4617 f->output_data.x->scroll_bar_top_shadow_pixel = -1; 4616 f->output_data.x->scroll_bar_top_shadow_pixel = -1;
4618 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 4617 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
4619#endif /* USE_TOOLKIT_SCROLL_BARS */ 4618#endif /* USE_TOOLKIT_SCROLL_BARS */
4620 FSET (f, icon_name, Qnil); 4619 fset_icon_name (f, Qnil);
4621 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 4620 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
4622 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; 4621 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
4623 f->output_data.x->explicit_parent = 0; 4622 f->output_data.x->explicit_parent = 0;
@@ -4659,12 +4658,12 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4659 be set. */ 4658 be set. */
4660 if (EQ (name, Qunbound) || NILP (name)) 4659 if (EQ (name, Qunbound) || NILP (name))
4661 { 4660 {
4662 FSET (f, name, build_string (dpyinfo->x_id_name)); 4661 fset_name (f, build_string (dpyinfo->x_id_name));
4663 f->explicit_name = 0; 4662 f->explicit_name = 0;
4664 } 4663 }
4665 else 4664 else
4666 { 4665 {
4667 FSET (f, name, name); 4666 fset_name (f, name);
4668 f->explicit_name = 1; 4667 f->explicit_name = 1;
4669 /* use the frame's title when getting resources for this frame. */ 4668 /* use the frame's title when getting resources for this frame. */
4670 specbind (Qx_resource_name, name); 4669 specbind (Qx_resource_name, name);
@@ -5065,20 +5064,20 @@ Text larger than the specified size is clipped. */)
5065 5064
5066 /* Set up the frame's root window. */ 5065 /* Set up the frame's root window. */
5067 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5066 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5068 WSET (w, left_col, make_number (0)); 5067 wset_left_col (w, make_number (0));
5069 WSET (w, top_line, make_number (0)); 5068 wset_top_line (w, make_number (0));
5070 5069
5071 if (CONSP (Vx_max_tooltip_size) 5070 if (CONSP (Vx_max_tooltip_size)
5072 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) 5071 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
5073 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) 5072 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
5074 { 5073 {
5075 WSET (w, total_cols, XCAR (Vx_max_tooltip_size)); 5074 wset_total_cols (w, XCAR (Vx_max_tooltip_size));
5076 WSET (w, total_lines, XCDR (Vx_max_tooltip_size)); 5075 wset_total_lines (w, XCDR (Vx_max_tooltip_size));
5077 } 5076 }
5078 else 5077 else
5079 { 5078 {
5080 WSET (w, total_cols, make_number (80)); 5079 wset_total_cols (w, make_number (80));
5081 WSET (w, total_lines, make_number (40)); 5080 wset_total_lines (w, make_number (40));
5082 } 5081 }
5083 5082
5084 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5083 FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
@@ -5088,7 +5087,7 @@ Text larger than the specified size is clipped. */)
5088 /* Display the tooltip text in a temporary buffer. */ 5087 /* Display the tooltip text in a temporary buffer. */
5089 old_buffer = current_buffer; 5088 old_buffer = current_buffer;
5090 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5089 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5091 BSET (current_buffer, truncate_lines, Qnil); 5090 bset_truncate_lines (current_buffer, Qnil);
5092 clear_glyph_matrix (w->desired_matrix); 5091 clear_glyph_matrix (w->desired_matrix);
5093 clear_glyph_matrix (w->current_matrix); 5092 clear_glyph_matrix (w->current_matrix);
5094 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5093 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -5148,7 +5147,7 @@ Text larger than the specified size is clipped. */)
5148 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5147 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5149 not in pixels. */ 5148 not in pixels. */
5150 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5149 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5151 WSET (w, total_cols, make_number (width)); 5150 wset_total_cols (w, make_number (width));
5152 FRAME_TOTAL_COLS (f) = width; 5151 FRAME_TOTAL_COLS (f) = width;
5153 adjust_glyphs (f); 5152 adjust_glyphs (f);
5154 clear_glyph_matrix (w->desired_matrix); 5153 clear_glyph_matrix (w->desired_matrix);
diff --git a/src/xfont.c b/src/xfont.c
index 9e929eed678..072bce7bb0a 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -823,6 +823,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
823 font->descent = xfont->descent; 823 font->descent = xfont->descent;
824 font->height = font->ascent + font->descent; 824 font->height = font->ascent + font->descent;
825 font->min_width = xfont->min_bounds.width; 825 font->min_width = xfont->min_bounds.width;
826 font->max_width = xfont->max_bounds.width;
826 if (xfont->min_bounds.width == xfont->max_bounds.width) 827 if (xfont->min_bounds.width == xfont->max_bounds.width)
827 { 828 {
828 /* Fixed width font. */ 829 /* Fixed width font. */
diff --git a/src/xftfont.c b/src/xftfont.c
index 2f8125393bc..5e60ab0c4d3 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -39,7 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
39 39
40/* Xft font driver. */ 40/* Xft font driver. */
41 41
42static Lisp_Object Qxft; 42Lisp_Object Qxft;
43static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden, 43static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden,
44 QClcdfilter; 44 QClcdfilter;
45 45
@@ -414,20 +414,25 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
414 ascii_printable[ch] = ' ' + ch; 414 ascii_printable[ch] = ' ' + ch;
415 } 415 }
416 BLOCK_INPUT; 416 BLOCK_INPUT;
417
418 /* Unfortunately Xft doesn't provide a way to get minimum char
419 width. So, we set min_width to space_width. */
420
417 if (spacing != FC_PROPORTIONAL 421 if (spacing != FC_PROPORTIONAL
418#ifdef FC_DUAL 422#ifdef FC_DUAL
419 && spacing != FC_DUAL 423 && spacing != FC_DUAL
420#endif /* FC_DUAL */ 424#endif /* FC_DUAL */
421 ) 425 )
422 { 426 {
423 font->min_width = font->average_width = font->space_width 427 font->min_width = font->max_width = font->average_width
424 = xftfont->max_advance_width; 428 = font->space_width = xftfont->max_advance_width;
425 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); 429 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents);
426 } 430 }
427 else 431 else
428 { 432 {
429 XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents); 433 XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents);
430 font->space_width = extents.xOff; 434 font->min_width = font->max_width = font->space_width
435 = extents.xOff;
431 if (font->space_width <= 0) 436 if (font->space_width <= 0)
432 /* dirty workaround */ 437 /* dirty workaround */
433 font->space_width = pixel_size; 438 font->space_width = pixel_size;
@@ -470,10 +475,6 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
470#endif /* HAVE_LIBOTF */ 475#endif /* HAVE_LIBOTF */
471 xftfont_info->ft_size = ft_face->size; 476 xftfont_info->ft_size = ft_face->size;
472 477
473 /* Unfortunately Xft doesn't provide a way to get minimum char
474 width. So, we use space_width instead. */
475 font->min_width = font->space_width;
476
477 font->baseline_offset = 0; 478 font->baseline_offset = 0;
478 font->relative_compose = 0; 479 font->relative_compose = 0;
479 font->default_ascent = 0; 480 font->default_ascent = 0;
@@ -764,6 +765,8 @@ syms_of_xftfont (void)
764 DEFSYM (QCembolden, ":embolden"); 765 DEFSYM (QCembolden, ":embolden");
765 DEFSYM (QClcdfilter, ":lcdfilter"); 766 DEFSYM (QClcdfilter, ":lcdfilter");
766 767
768 ascii_printable[0] = 0;
769
767 xftfont_driver = ftfont_driver; 770 xftfont_driver = ftfont_driver;
768 xftfont_driver.type = Qxft; 771 xftfont_driver.type = Qxft;
769 xftfont_driver.get_cache = xfont_driver.get_cache; 772 xftfont_driver.get_cache = xfont_driver.get_cache;
diff --git a/src/xmenu.c b/src/xmenu.c
index ab790094f85..54a7849218a 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1008,7 +1008,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1008 if (! NILP (Vlucid_menu_bar_dirty_flag)) 1008 if (! NILP (Vlucid_menu_bar_dirty_flag))
1009 call0 (Qrecompute_lucid_menubar); 1009 call0 (Qrecompute_lucid_menubar);
1010 safe_run_hooks (Qmenu_bar_update_hook); 1010 safe_run_hooks (Qmenu_bar_update_hook);
1011 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 1011 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
1012 1012
1013 items = FRAME_MENU_BAR_ITEMS (f); 1013 items = FRAME_MENU_BAR_ITEMS (f);
1014 1014
@@ -1100,7 +1100,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1100 } 1100 }
1101 1101
1102 /* The menu items are different, so store them in the frame. */ 1102 /* The menu items are different, so store them in the frame. */
1103 FSET (f, menu_bar_vector, menu_items); 1103 fset_menu_bar_vector (f, menu_items);
1104 f->menu_bar_items_used = menu_items_used; 1104 f->menu_bar_items_used = menu_items_used;
1105 1105
1106 /* This undoes save_menu_items. */ 1106 /* This undoes save_menu_items. */
@@ -1283,7 +1283,7 @@ initialize_frame_menubar (FRAME_PTR f)
1283{ 1283{
1284 /* This function is called before the first chance to redisplay 1284 /* This function is called before the first chance to redisplay
1285 the frame. It has to be, so the frame will have the right size. */ 1285 the frame. It has to be, so the frame will have the right size. */
1286 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 1286 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
1287 set_frame_menubar (f, 1, 1); 1287 set_frame_menubar (f, 1, 1);
1288} 1288}
1289 1289
diff --git a/src/xselect.c b/src/xselect.c
index 664b5f92a15..463bd6e37b0 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -353,8 +353,9 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
353 INTEGER_TO_CONS (timestamp), frame); 353 INTEGER_TO_CONS (timestamp), frame);
354 prev_value = LOCAL_SELECTION (selection_name, dpyinfo); 354 prev_value = LOCAL_SELECTION (selection_name, dpyinfo);
355 355
356 TSET (dpyinfo->terminal, Vselection_alist, 356 tset_selection_alist
357 Fcons (selection_data, dpyinfo->terminal->Vselection_alist)); 357 (dpyinfo->terminal,
358 Fcons (selection_data, dpyinfo->terminal->Vselection_alist));
358 359
359 /* If we already owned the selection, remove the old selection 360 /* If we already owned the selection, remove the old selection
360 data. Don't use Fdelq as that may QUIT. */ 361 data. Don't use Fdelq as that may QUIT. */
@@ -989,7 +990,7 @@ x_handle_selection_clear (struct input_event *event)
989 break; 990 break;
990 } 991 }
991 } 992 }
992 TSET (dpyinfo->terminal, Vselection_alist, Vselection_alist); 993 tset_selection_alist (dpyinfo->terminal, Vselection_alist);
993 994
994 /* Run the `x-lost-selection-functions' abnormal hook. */ 995 /* Run the `x-lost-selection-functions' abnormal hook. */
995 { 996 {
@@ -1039,7 +1040,7 @@ x_clear_frame_selections (FRAME_PTR f)
1039 args[1] = Fcar (Fcar (t->Vselection_alist)); 1040 args[1] = Fcar (Fcar (t->Vselection_alist));
1040 Frun_hook_with_args (2, args); 1041 Frun_hook_with_args (2, args);
1041 1042
1042 TSET (t, Vselection_alist, XCDR (t->Vselection_alist)); 1043 tset_selection_alist (t, XCDR (t->Vselection_alist));
1043 } 1044 }
1044 1045
1045 /* Delete elements after the beginning of Vselection_alist. */ 1046 /* Delete elements after the beginning of Vselection_alist. */
diff --git a/src/xterm.c b/src/xterm.c
index 2e71ccd94a0..c5a916d9d2e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -50,7 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#include "systime.h" 50#include "systime.h"
51 51
52#include <fcntl.h> 52#include <fcntl.h>
53#include <ctype.h>
54#include <errno.h> 53#include <errno.h>
55#include <setjmp.h> 54#include <setjmp.h>
56#include <sys/stat.h> 55#include <sys/stat.h>
@@ -3594,7 +3593,7 @@ x_frame_rehighlight (struct x_display_info *dpyinfo)
3594 : dpyinfo->x_focus_frame); 3593 : dpyinfo->x_focus_frame);
3595 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) 3594 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame))
3596 { 3595 {
3597 FSET (dpyinfo->x_focus_frame, focus_frame, Qnil); 3596 fset_focus_frame (dpyinfo->x_focus_frame, Qnil);
3598 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; 3597 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame;
3599 } 3598 }
3600 } 3599 }
@@ -5028,7 +5027,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
5028 bar->next = FRAME_SCROLL_BARS (f); 5027 bar->next = FRAME_SCROLL_BARS (f);
5029 bar->prev = Qnil; 5028 bar->prev = Qnil;
5030 XSETVECTOR (barobj, bar); 5029 XSETVECTOR (barobj, bar);
5031 FSET (f, scroll_bars, barobj); 5030 fset_scroll_bars (f, barobj);
5032 if (!NILP (bar->next)) 5031 if (!NILP (bar->next))
5033 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 5032 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
5034 5033
@@ -5191,7 +5190,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
5191#endif 5190#endif
5192 5191
5193 /* Dissociate this scroll bar from its window. */ 5192 /* Dissociate this scroll bar from its window. */
5194 WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil); 5193 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
5195 5194
5196 UNBLOCK_INPUT; 5195 UNBLOCK_INPUT;
5197} 5196}
@@ -5405,7 +5404,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5405#endif /* not USE_TOOLKIT_SCROLL_BARS */ 5404#endif /* not USE_TOOLKIT_SCROLL_BARS */
5406 5405
5407 XSETVECTOR (barobj, bar); 5406 XSETVECTOR (barobj, bar);
5408 WSET (w, vertical_scroll_bar, barobj); 5407 wset_vertical_scroll_bar (w, barobj);
5409} 5408}
5410 5409
5411 5410
@@ -5429,12 +5428,12 @@ XTcondemn_scroll_bars (FRAME_PTR frame)
5429 { 5428 {
5430 Lisp_Object bar; 5429 Lisp_Object bar;
5431 bar = FRAME_SCROLL_BARS (frame); 5430 bar = FRAME_SCROLL_BARS (frame);
5432 FSET (frame, scroll_bars, XSCROLL_BAR (bar)->next); 5431 fset_scroll_bars (frame, XSCROLL_BAR (bar)->next);
5433 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); 5432 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame);
5434 XSCROLL_BAR (bar)->prev = Qnil; 5433 XSCROLL_BAR (bar)->prev = Qnil;
5435 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) 5434 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame)))
5436 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; 5435 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar;
5437 FSET (frame, condemned_scroll_bars, bar); 5436 fset_condemned_scroll_bars (frame, bar);
5438 } 5437 }
5439} 5438}
5440 5439
@@ -5466,7 +5465,7 @@ XTredeem_scroll_bar (struct window *window)
5466 return; 5465 return;
5467 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), 5466 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
5468 window->vertical_scroll_bar)) 5467 window->vertical_scroll_bar))
5469 FSET (f, condemned_scroll_bars, bar->next); 5468 fset_condemned_scroll_bars (f, bar->next);
5470 else 5469 else
5471 /* If its prev pointer is nil, it must be at the front of 5470 /* If its prev pointer is nil, it must be at the front of
5472 one or the other! */ 5471 one or the other! */
@@ -5481,7 +5480,7 @@ XTredeem_scroll_bar (struct window *window)
5481 bar->next = FRAME_SCROLL_BARS (f); 5480 bar->next = FRAME_SCROLL_BARS (f);
5482 bar->prev = Qnil; 5481 bar->prev = Qnil;
5483 XSETVECTOR (barobj, bar); 5482 XSETVECTOR (barobj, bar);
5484 FSET (f, scroll_bars, barobj); 5483 fset_scroll_bars (f, barobj);
5485 if (! NILP (bar->next)) 5484 if (! NILP (bar->next))
5486 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 5485 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
5487} 5486}
@@ -5498,7 +5497,7 @@ XTjudge_scroll_bars (FRAME_PTR f)
5498 5497
5499 /* Clear out the condemned list now so we won't try to process any 5498 /* Clear out the condemned list now so we won't try to process any
5500 more events on the hapless scroll bars. */ 5499 more events on the hapless scroll bars. */
5501 FSET (f, condemned_scroll_bars, Qnil); 5500 fset_condemned_scroll_bars (f, Qnil);
5502 5501
5503 for (; ! NILP (bar); bar = next) 5502 for (; ! NILP (bar); bar = next)
5504 { 5503 {
@@ -7849,7 +7848,7 @@ x_connection_closed (Display *dpy, const char *error_message)
7849 { 7848 {
7850 /* Set this to t so that delete_frame won't get confused 7849 /* Set this to t so that delete_frame won't get confused
7851 trying to find a replacement. */ 7850 trying to find a replacement. */
7852 KSET (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame, Qt); 7851 kset_default_minibuffer_frame (FRAME_KBOARD (XFRAME (frame)), Qt);
7853 delete_frame (frame, Qnoelisp); 7852 delete_frame (frame, Qnoelisp);
7854 } 7853 }
7855 7854
@@ -10133,7 +10132,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10133 { 10132 {
10134 terminal->kboard = xmalloc (sizeof *terminal->kboard); 10133 terminal->kboard = xmalloc (sizeof *terminal->kboard);
10135 init_kboard (terminal->kboard); 10134 init_kboard (terminal->kboard);
10136 KSET (terminal->kboard, Vwindow_system, Qx); 10135 kset_window_system (terminal->kboard, Qx);
10137 10136
10138 /* Add the keyboard to the list before running Lisp code (via 10137 /* Add the keyboard to the list before running Lisp code (via
10139 Qvendor_specific_keysyms below), since these are not traced 10138 Qvendor_specific_keysyms below), since these are not traced
@@ -10155,9 +10154,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10155 /* Temporarily hide the partially initialized terminal. */ 10154 /* Temporarily hide the partially initialized terminal. */
10156 terminal_list = terminal->next_terminal; 10155 terminal_list = terminal->next_terminal;
10157 UNBLOCK_INPUT; 10156 UNBLOCK_INPUT;
10158 KSET (terminal->kboard, Vsystem_key_alist, 10157 kset_system_key_alist
10159 call1 (Qvendor_specific_keysyms, 10158 (terminal->kboard,
10160 vendor ? build_string (vendor) : empty_unibyte_string)); 10159 call1 (Qvendor_specific_keysyms,
10160 vendor ? build_string (vendor) : empty_unibyte_string));
10161 BLOCK_INPUT; 10161 BLOCK_INPUT;
10162 terminal->next_terminal = terminal_list; 10162 terminal->next_terminal = terminal_list;
10163 terminal_list = terminal; 10163 terminal_list = terminal;