aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2006-07-14 05:56:32 +0000
committerKaroly Lorentey2006-07-14 05:56:32 +0000
commit99715bbc447eb633e45ffa23b87284771ce3ac74 (patch)
tree3a8a53dfe3dbdd9f8e36965e9f043eae522d3c0e /src
parent556b89447234f15d1784a23dadbfe429464463a8 (diff)
parent763bb2d43615bc3ae816422f965d76d5e1ae4bdd (diff)
downloademacs-99715bbc447eb633e45ffa23b87284771ce3ac74.tar.gz
emacs-99715bbc447eb633e45ffa23b87284771ce3ac74.zip
Merged from emacs@sv.gnu.org.
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-331 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-332 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-333 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-334 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-335 Add note about "link" button-class to etc/TODO * emacs@sv.gnu.org/emacs--devo--0--patch-336 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-337 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-338 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-339 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-340 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-341 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-342 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-343 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-344 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-345 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-346 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-347 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-348 Update for ERC 5.1.3. * emacs@sv.gnu.org/emacs--devo--0--patch-349 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-350 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/gnus--rel--5.10--patch-111 Update from CVS: texi/gnus.texi (Summary Buffer Lines): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-112 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-113 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-114 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-572
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog288
-rw-r--r--src/Makefile.in6
-rw-r--r--src/bytecode.c69
-rw-r--r--src/callint.c12
-rw-r--r--src/casefiddle.c108
-rw-r--r--src/casetab.c7
-rw-r--r--src/category.c4
-rw-r--r--src/category.h12
-rw-r--r--src/data.c88
-rw-r--r--src/dired.c3
-rw-r--r--src/dispextern.h1
-rw-r--r--src/dispnew.c109
-rw-r--r--src/editfns.c48
-rw-r--r--src/eval.c83
-rw-r--r--src/fileio.c20
-rw-r--r--src/fns.c131
-rw-r--r--src/fontset.c2
-rw-r--r--src/frame.h17
-rw-r--r--src/fringe.c4
-rw-r--r--src/insdel.c20
-rw-r--r--src/keyboard.c58
-rw-r--r--src/keymap.c6
-rw-r--r--src/lisp.h106
-rw-r--r--src/lread.c18
-rw-r--r--src/mac.c5
-rw-r--r--src/macfns.c3
-rw-r--r--src/macgui.h2
-rw-r--r--src/macros.c5
-rw-r--r--src/macterm.c93
-rw-r--r--src/marker.c3
-rw-r--r--src/minibuf.c2
-rw-r--r--src/process.c4
-rw-r--r--src/s/gnu-linux.h1
-rw-r--r--src/search.c3
-rw-r--r--src/sunfns.c2
-rw-r--r--src/syntax.c46
-rw-r--r--src/textprop.c11
-rw-r--r--src/w32console.c2
-rw-r--r--src/w32fns.c9
-rw-r--r--src/w32term.c17
-rw-r--r--src/window.c14
-rw-r--r--src/xdisp.c44
-rw-r--r--src/xfaces.c14
-rw-r--r--src/xfns.c4
-rw-r--r--src/xterm.c15
45 files changed, 906 insertions, 613 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 91694368fe0..8437853d887 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,291 @@
12006-07-13 Kim F. Storm <storm@cua.dk>
2
3 * bytecode.c (Fbyte_code): Use CAR, CDR for Bcar, Bcdr.
4 Use CAR_SAFE, CDR_SAFE for Bcar_safe, Bcdr_safe.
5 Simplify loops and use CAR for Bnth and Belt.
6
7 * data.c (Findirect_function): Optimize for no indirection.
8
9 * eval.c (Fthrow): Remove loop around Fsignal.
10 (Feval, Fapply, Ffuncall): Optimize for no function indirection.
11 Use original function name in all signaled errors.
12 Simplify Fsignal calls (no return).
13 (funcall_lambda): Simplify Fsignal calls (no return).
14
152006-07-13 Andreas Schwab <schwab@suse.de>
16
17 * syntax.c (scan_sexps_forward): Use EMACS_INT for out_bytepos and
18 out_charpos.
19
202006-07-13 Kenichi Handa <handa@m17n.org>
21
22 * editfns.c (Fformat): Fix calculation of text property positions
23 of format string.
24
252006-07-12 Kim F. Storm <storm@cua.dk>
26
27 * lisp.h (CHECK_TYPE): New macro for generic type checking.
28 (CAR_SAFE, CDR_SAFE): New macros.
29 (ARRAYP, CHECK_ARRAY): New macros.
30 (CHECK_VECTOR_OR_STRING, CHECK_SUBR): New macros.
31 (CHECK_WINDOW_CONFIGURATION): New macro.
32 (CHECK_LIST_CONS, CHECK_LIST_END): New checks for list traversal.
33 (CHECK_STRING_OR_BUFFER, CHECK_HASH_TABLE, CHECK_LIST)
34 (CHECK_STRING, CHECK_STRING_CAR, CHECK_CONS, CHECK_SYMBOL)
35 (CHECK_CHAR_TABLE, CHECK_VECTOR, CHECK_VECTOR_OR_CHAR_TABLE)
36 (CHECK_BUFFER, CHECK_WINDOW, CHECK_LIVE_WINDOW, CHECK_PROCESS)
37 (CHECK_NUMBER, CHECK_NATNUM, CHECK_MARKER, CHECK_OVERLAY)
38 (CHECK_NUMBER_COERCE_MARKER, CHECK_FLOAT, CHECK_NUMBER_OR_FLOAT)
39 (CHECK_NUMBER_OR_FLOAT_COERCE_MARKER): Use CHECK_TYPE.
40
41 * category.h (CHECK_CATEGORY, CHECK_CATEGORY_SET):
42 * frame.h (CHECK_FRAME, CHECK_LIVE_FRAME): Use CHECK_TYPE.
43
44 * callint.c (Fcall_interactively):
45 * casefiddle.c (casify_object):
46 * editfns.c (general_insert_function):
47 * fns.c (Flength, Felt, Ffillarray):
48 * data.c (Fcar, Fcdr): Remove loop around wrong_type_argument.
49
50 * data.c (wrong_type_argument): Remove loop around Fsignal.
51 (Farrayp, Fsequencep): Use ARRAYP.
52 (Fcar): Use CAR.
53 (Fcar_safe): Use CAR_SAFE.
54 (Fcdr): Use CDR.
55 (Fcdr_safe): Use CDR_SAFE.
56 (Fsetcar, Fsetcdr): Use CHECK_CONS.
57 (Fsubr_arity, Fsubr_name): Use CHECK_SUBR.
58 (Faset): Use CHECK_ARRAY.
59
60 * fns.c (Felt): Use CHECK_ARRAY.
61 (concat): Use CHECK_NUMBER.
62 (Fsubstring, substring_both): Use CHECK_VECTOR_OR_STRING.
63 (Fmemq): Use CHECK_LIST.
64 (Fassq, Fassoc, Frassq, Frassoc): Use CAR.
65 (assq_no_quit): Use CAR_SAFE.
66 (Fnthcdr, Fmember, Fdelq, Fdelete, Fnreverse, Fnconc):
67 Use CHECK_LIST_CONS.
68 (Freverse, Fplist_get, Flax_plist_get): Use CHECK_LIST_END.
69
70 * bytecode.c (Fbyte_code): Use CHECK_VECTOR.
71
72 * casetab.c (check_case_table):
73 * category.c (check_category_table):
74 * marker.c (Fcopy_marker):
75 * syntax.c (check_syntax_table):
76 * xfaces.c (load_pixmap): Use CHECK_TYPE.
77
78 * fns.c (Fcopy_sequence, concat):
79 * fringe.c (Fdefine_fringe_bitmap):
80 * lread.c (check_obarray): Cleanup wrong_type_argument use.
81
82 * keyboard.c (access_keymap_keyremap): Use ARRAYP.
83
84 * keymap.c (Fdefine_key, Flookup_key):
85 * macros.c (Fstart_kbd_macro): Use CHECK_VECTOR_OR_STRING.
86
87 * mac.c (Fmac_get_preference): Use CHECK_LIST_END.
88
89 * search.c (Fset_match_data): Use CHECK_LIST.
90
91 * sunfns.c (sun_item_create): Use CHECK_LIST_CONS.
92
93 * window.c (Fwindow_configuration_frame, Fset_window_configuration):
94 (compare_window_configurations): Use CHECK_WINDOW_CONFIGURATION.
95
962006-07-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
97
98 * Makefile.in (dired.o, editfns.o, fileio.o): Depend on blockinput.h.
99
100 * dired.c: Include blockinput.h.
101 (Ffile_attributes): Add BLOCK_INPUT around getpwuid/getgrgid.
102
103 * editfns.c: Include blockinput.h.
104 (Fuser_login_name, Fuser_full_name): Add BLOCK_INPUT around
105 getpwuid/getpwnam.
106
107 * fileio.c: Include blockinput.h.
108 (Fexpand_file_name, search_embedded_absfilename): Add BLOCK_INPUT
109 around getpwnam.
110 (search_embedded_absfilename): Remove spurious xfree.
111
1122006-07-11 Kim F. Storm <storm@cua.dk>
113
114 * dispnew.c (sit_for): Reduce number of args from 5 to 3.
115 Now just one TIMEOUT arg that can be a Lisp float or Lisp int.
116 Combine args DISPLAY and INITIAL_DISPLAY into one arg DO_DISPLAY.
117 Signal error if TIMEOUT is not a number.
118 Undo 2006-06-14 change for non-preemptive display if TIMEOUT < 0.
119 The rework of sit_for args also fixes several incorrect Qt args
120 which should have been 1.
121 (Fredisplay): Pass 1 instead of Qt to swallow_events and
122 detect_input_pending_run_timers.
123
124 * lisp.h (sit_for): Update prototype.
125 (Fredisplay): Add EXFUN.
126
127 * dispextern.h (sit_for): Remove prototype.
128
129 * callint.c (Fcall_interactively):
130 * minibuf.c (temp_echo_area_glyphs):
131 * keyboard.c (command_loop_1, read_char, Fexecute_extended_command):
132 * fileio.c (Fdo_auto_save): Update/simplify sit_for calls.
133
1342006-07-11 Stefan Monnier <monnier@iro.umontreal.ca>
135
136 * syntax.c (forw_comment): Also use EMACS_INT for buffer positions.
137
1382006-07-11 Kim F. Storm <storm@cua.dk>
139
140 * dispnew.c (Fredisplay): Add FORCE argument to force redisplay when
141 input is available. Fix test for redisplay_dont_pause non-nil.
142 Specbind redisplay-dont-pause to t if FORCE non-nil.
143
1442006-07-10 Chong Yidong <cyd@stupidchicken.com>
145
146 * puresize.h (BASE_PURESIZE): Increment to 1211000.
147
148 * dispnew.c (Fredisplay): New function, equivalent to (sit-for 0).
149 (Fsit_for): Function deleted.
150
151 * keyboard.c (command_loop_1, Fexecute_extended_command):
152 Call sit_for instead of Fsit_for.
153
154 * minibuf.c (temp_echo_area_glyphs): Likewise.
155
1562006-07-09 Stefan Monnier <monnier@iro.umontreal.ca>
157
158 * syntax.c (Fforward_comment): Revert the reversion.
159 (back_comment, scan_lists): Also use EMACS_INT for buffer positions.
160
1612006-07-09 John Paul Wallington <jpw@pobox.com>
162
163 * syntax.c (Fforward_comment): Revert previous change.
164
1652006-07-09 Kim F. Storm <storm@cua.dk>
166
167 * window.c (Fforce_window_update): Doc fix.
168
1692006-07-08 Stephen Gildea <gildea@stop.mail-abuse.org>
170
171 * fileio.c (do_auto_save_make_dir): Make the auto-save-list-file
172 directory unreadable for better user privacy.
173
1742006-07-07 Stefan Monnier <monnier@iro.umontreal.ca>
175
176 * syntax.c (Fforward_comment): Fix int-32 vs EMACS_INT-64 mixup.
177
178 * lread.c (read_filtered_event): Remove `register' qualifier because it
179 causes compilation problem with gcc-4.0.2-20051125 on amd64.
180 (readevalloop): Remove unused var `bpos'.
181 Yet another int/Lisp_Object mixup (YAILOM).
182
1832006-07-07 Eli Zaretskii <eliz@gnu.org>
184
185 * keyboard.c (Fexecute_extended_command): Mention the argument
186 PREFIXARG in the doc string.
187
1882006-07-07 Kim F. Storm <storm@cua.dk>
189
190 * fringe.c (Fdefine_fringe_bitmap): Doc fix.
191
1922006-07-05 Chong Yidong <cyd@stupidchicken.com>
193
194 * insdel.c (prepare_to_modify_buffer): For an indirect buffer, do
195 clash detection using the base buffer.
196
197 * puresize.h (BASE_PURESIZE): Increment to 1210500.
198
1992006-07-04 Kim F. Storm <storm@cua.dk>
200
201 * xterm.c (x_delete_display): Don't free or derefence NULL pointers.
202
2032006-07-04 Kenichi Handa <handa@m17n.org>
204
205 * fontset.c (Fset_overriding_fontspec_internal): Check if we need
206 to update Voverriding_fontspec_alist.
207
2082006-07-03 Richard Stallman <rms@gnu.org>
209
210 * xfns.c (Fx_create_frame): Move unwind_create_frame setup down.
211
212 * xfaces.c (Fface_attribute_relative_p): Doc fix.
213
214 * textprop.c (Fget_char_property_and_overlay): Doc fix.
215
216 * eval.c (Fdefvaralias): Doc fix.
217
2182006-07-03 Kim F. Storm <storm@cua.dk>
219
220 * dispnew.c (sit_for): Fix preempt condition.
221
2222006-07-02 Stefan Monnier <monnier@iro.umontreal.ca>
223
224 * lread.c (read_filtered_event): Treat select-window just like
225 switch-frame.
226
2272006-07-02 Kim F. Storm <storm@cua.dk>
228
229 * xdisp.c (display_tool_bar_line): Skip glyphs which are too big
230 to ever fit the tool-bar,
231 (MAX_FRAME_TOOL_BAR_HEIGHT): New macro.
232 (tool_bar_lines_needed): Use unused mode-line row as temp_row.
233 (redisplay_tool_bar): Only clear desired matrix if we actually
234 change the tool-bar window height. Only try to make the tool-bar
235 window bigger if there is actually room for it.
236
2372006-06-30 Ralf Angeli <angeli@caeruleus.net>
238
239 * w32term.c (x_make_frame_visible): Use SystemParametersInfo with
240 SPI_GETWORKAREA to find the dimensions of the screen work area,
241 and adjust vertical position of the frame in order to avoid being
242 covered by the task bar.
243
244 * w32fns.c (w32_createwindow): Use CW_USEDEFAULT instead of
245 f->left_pos and SH_SHOW instead of f->top_pos in the call to
246 CreateWindow. Record the actual position in f->left_pos and
247 f->top_pos.
248
2492006-06-30 John Paul Wallington <jpw@pobox.com>
250
251 * w32console.c (syms_of_ntterm) <w32-use-full-screen-buffer>:
252 Doc fix - default value has changed.
253
2542006-06-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
255
256 * mac.c [!TARGET_API_MAC_CARBON]: Don't include FixMath.h or Scrap.h.
257
258 * macfns.c (Fx_create_frame): Apply 2006-06-24 change for xfns.c.
259
260 * macgui.h (USE_MAC_TSM) [TARGET_API_MAC_CARBON]: Set default to 1.
261
262 * macterm.c (Qeql): Add extern.
263 (x_set_mouse_pixel_position) [MAC_OSX]: Use CGWarpMouseCursorPosition.
264 (fm_style_face_attributes_alist) [USE_ATSUI]: New variable.
265 (syms_of_macterm) [USE_ATSUI]: Initialize and staticpro it.
266 Change keys of Vmac_atsu_font_table from strings to numbers.
267 (fm_style_to_face_attributes) [USE_ATSUI]: New function.
268 (init_font_name_table) [USE_ATSUI]: Use it.
269 (saved_ts_script_language_on_focus) [USE_MAC_TSM]: New variable.
270 (syms_of_macterm) [USE_MAC_TSM]: Initialize and staticpro it.
271 [USE_MAC_TSM] (mac_tsm_resume): Restore script and language codes
272 only when saved_ts_script_language_on_focus coincides with
273 Vmac_ts_script_language_on_focus.
274 [USE_MAC_TSM] (mac_tsm_suspend): Save value of
275 Vmac_ts_script_language_on_focus to saved_ts_script_language_on_focus.
276 (XTread_socket) [USE_MAC_TSM]: Add Mac OS Classic support.
277 [USE_MAC_TSM] (mac_handle_text_input_event, init_tsm): Likewise.
278
2792006-06-27 Chong Yidong <cyd@stupidchicken.com>
280
281 * editfns.c (Fdelete_field, Ffield_string, Ffield_beginning)
282 (Ffield_string_no_properties, Ffield_end): Mention
283 args-out-of-range error condition in docstring.
284
2852006-06-27 Kim F. Storm <storm@cua.dk>
286
287 * xdisp.c (handle_composition_prop): Set stop_charpos before push_it.
288
12006-06-25 Kim F. Storm <storm@cua.dk> 2892006-06-25 Kim F. Storm <storm@cua.dk>
2 290
3 * s/gnu-linux.h (SIGNALS_VIA_CHARACTERS): Define for Linux kernel 291 * s/gnu-linux.h (SIGNALS_VIA_CHARACTERS): Define for Linux kernel
diff --git a/src/Makefile.in b/src/Makefile.in
index 89096b93b2d..cb9db5614a1 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1114,7 +1114,7 @@ pre-crt0.o: pre-crt0.c
1114ecrt0.o: ecrt0.c $(config_h) 1114ecrt0.o: ecrt0.c $(config_h)
1115 CRT0_COMPILE ${srcdir}/ecrt0.c 1115 CRT0_COMPILE ${srcdir}/ecrt0.c
1116dired.o: dired.c commands.h buffer.h $(config_h) charset.h coding.h regex.h \ 1116dired.o: dired.c commands.h buffer.h $(config_h) charset.h coding.h regex.h \
1117 systime.h 1117 systime.h blockinput.h
1118dispnew.o: dispnew.c systime.h commands.h process.h frame.h \ 1118dispnew.o: dispnew.c systime.h commands.h process.h frame.h \
1119 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \ 1119 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
1120 disptab.h indent.h intervals.h \ 1120 disptab.h indent.h intervals.h \
@@ -1125,12 +1125,12 @@ doprnt.o: doprnt.c charset.h $(config_h)
1125dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ 1125dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
1126 msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h) 1126 msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h)
1127editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ 1127editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \
1128 coding.h dispextern.h frame.h $(config_h) 1128 coding.h dispextern.h frame.h blockinput.h $(config_h)
1129emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ 1129emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
1130 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \ 1130 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \
1131 window.h dispextern.h keyboard.h keymap.h 1131 window.h dispextern.h keyboard.h keymap.h
1132fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ 1132fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \
1133 coding.h ccl.h msdos.h dispextern.h $(config_h) 1133 coding.h msdos.h dispextern.h blockinput.h $(config_h)
1134filelock.o: filelock.c buffer.h charset.h coding.h systime.h epaths.h $(config_h) 1134filelock.o: filelock.c buffer.h charset.h coding.h systime.h epaths.h $(config_h)
1135filemode.o: filemode.c $(config_h) 1135filemode.o: filemode.c $(config_h)
1136frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ 1136frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
diff --git a/src/bytecode.c b/src/bytecode.c
index 0d06890eabf..2facaa47062 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -433,8 +433,7 @@ If the third argument is incorrect, Emacs may crash. */)
433#endif 433#endif
434 434
435 CHECK_STRING (bytestr); 435 CHECK_STRING (bytestr);
436 if (!VECTORP (vector)) 436 CHECK_VECTOR (vector);
437 vector = wrong_type_argument (Qvectorp, vector);
438 CHECK_NUMBER (maxdepth); 437 CHECK_NUMBER (maxdepth);
439 438
440 if (STRING_MULTIBYTE (bytestr)) 439 if (STRING_MULTIBYTE (bytestr))
@@ -542,14 +541,7 @@ If the third argument is incorrect, Emacs may crash. */)
542 { 541 {
543 Lisp_Object v1; 542 Lisp_Object v1;
544 v1 = TOP; 543 v1 = TOP;
545 if (CONSP (v1)) 544 TOP = CAR (v1);
546 TOP = XCAR (v1);
547 else if (NILP (v1))
548 TOP = Qnil;
549 else
550 {
551 wrong_type_argument (Qlistp, v1);
552 }
553 break; 545 break;
554 } 546 }
555 547
@@ -575,14 +567,7 @@ If the third argument is incorrect, Emacs may crash. */)
575 { 567 {
576 Lisp_Object v1; 568 Lisp_Object v1;
577 v1 = TOP; 569 v1 = TOP;
578 if (CONSP (v1)) 570 TOP = CDR (v1);
579 TOP = XCDR (v1);
580 else if (NILP (v1))
581 TOP = Qnil;
582 else
583 {
584 wrong_type_argument (Qlistp, v1);
585 }
586 break; 571 break;
587 } 572 }
588 573
@@ -917,23 +902,10 @@ If the third argument is incorrect, Emacs may crash. */)
917 AFTER_POTENTIAL_GC (); 902 AFTER_POTENTIAL_GC ();
918 op = XINT (v2); 903 op = XINT (v2);
919 immediate_quit = 1; 904 immediate_quit = 1;
920 while (--op >= 0) 905 while (--op >= 0 && CONSP (v1))
921 { 906 v1 = XCDR (v1);
922 if (CONSP (v1))
923 v1 = XCDR (v1);
924 else if (!NILP (v1))
925 {
926 immediate_quit = 0;
927 wrong_type_argument (Qlistp, v1);
928 }
929 }
930 immediate_quit = 0; 907 immediate_quit = 0;
931 if (CONSP (v1)) 908 TOP = CAR (v1);
932 TOP = XCAR (v1);
933 else if (NILP (v1))
934 TOP = Qnil;
935 else
936 wrong_type_argument (Qlistp, v1);
937 break; 909 break;
938 } 910 }
939 911
@@ -1556,23 +1528,10 @@ If the third argument is incorrect, Emacs may crash. */)
1556 AFTER_POTENTIAL_GC (); 1528 AFTER_POTENTIAL_GC ();
1557 op = XINT (v2); 1529 op = XINT (v2);
1558 immediate_quit = 1; 1530 immediate_quit = 1;
1559 while (--op >= 0) 1531 while (--op >= 0 && CONSP (v1))
1560 { 1532 v1 = XCDR (v1);
1561 if (CONSP (v1))
1562 v1 = XCDR (v1);
1563 else if (!NILP (v1))
1564 {
1565 immediate_quit = 0;
1566 wrong_type_argument (Qlistp, v1);
1567 }
1568 }
1569 immediate_quit = 0; 1533 immediate_quit = 0;
1570 if (CONSP (v1)) 1534 TOP = CAR (v1);
1571 TOP = XCAR (v1);
1572 else if (NILP (v1))
1573 TOP = Qnil;
1574 else
1575 wrong_type_argument (Qlistp, v1);
1576 } 1535 }
1577 else 1536 else
1578 { 1537 {
@@ -1634,10 +1593,7 @@ If the third argument is incorrect, Emacs may crash. */)
1634 { 1593 {
1635 Lisp_Object v1; 1594 Lisp_Object v1;
1636 v1 = TOP; 1595 v1 = TOP;
1637 if (CONSP (v1)) 1596 TOP = CAR_SAFE (v1);
1638 TOP = XCAR (v1);
1639 else
1640 TOP = Qnil;
1641 break; 1597 break;
1642 } 1598 }
1643 1599
@@ -1645,10 +1601,7 @@ If the third argument is incorrect, Emacs may crash. */)
1645 { 1601 {
1646 Lisp_Object v1; 1602 Lisp_Object v1;
1647 v1 = TOP; 1603 v1 = TOP;
1648 if (CONSP (v1)) 1604 TOP = CDR_SAFE (v1);
1649 TOP = XCDR (v1);
1650 else
1651 TOP = Qnil;
1652 break; 1605 break;
1653 } 1606 }
1654 1607
diff --git a/src/callint.c b/src/callint.c
index 2411617917f..afb576cf5f6 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -314,8 +314,6 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
314 /* Save this now, since use of minibuffer will clobber it. */ 314 /* Save this now, since use of minibuffer will clobber it. */
315 prefix_arg = Vcurrent_prefix_arg; 315 prefix_arg = Vcurrent_prefix_arg;
316 316
317 retry:
318
319 if (SYMBOLP (function)) 317 if (SYMBOLP (function))
320 enable = Fget (function, Qenable_recursive_minibuffers); 318 enable = Fget (function, Qenable_recursive_minibuffers);
321 else 319 else
@@ -334,8 +332,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
334 up_event = Qnil; 332 up_event = Qnil;
335 333
336 /* Decode the kind of function. Either handle it and return, 334 /* Decode the kind of function. Either handle it and return,
337 or go to `lose' if not interactive, or go to `retry' 335 or go to `lose' if not interactive, or set either STRING or SPECS. */
338 to specify a different function, or set either STRING or SPECS. */
339 336
340 if (SUBRP (fun)) 337 if (SUBRP (fun))
341 { 338 {
@@ -343,8 +340,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
343 if (!string) 340 if (!string)
344 { 341 {
345 lose: 342 lose:
346 function = wrong_type_argument (Qcommandp, function); 343 wrong_type_argument (Qcommandp, function);
347 goto retry;
348 } 344 }
349 } 345 }
350 else if (COMPILEDP (fun)) 346 else if (COMPILEDP (fun))
@@ -721,10 +717,10 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
721 do 717 do
722 { 718 {
723 Lisp_Object tem; 719 Lisp_Object tem;
724 if (! first) 720 if (! first)
725 { 721 {
726 message ("Please enter a number."); 722 message ("Please enter a number.");
727 sit_for (1, 0, 0, 0, 0); 723 sit_for (make_number (1), 0, 0);
728 } 724 }
729 first = 0; 725 first = 0;
730 726
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 02ec3f76b4e..76a24f48a82 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -45,75 +45,73 @@ casify_object (flag, obj)
45 if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) 45 if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1]))
46 Fset_case_table (current_buffer->downcase_table); 46 Fset_case_table (current_buffer->downcase_table);
47 47
48 while (1) 48 if (INTEGERP (obj))
49 { 49 {
50 if (INTEGERP (obj)) 50 int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
51 | CHAR_SHIFT | CHAR_CTL | CHAR_META);
52 int flags = XINT (obj) & flagbits;
53
54 /* If the character has higher bits set
55 above the flags, return it unchanged.
56 It is not a real character. */
57 if ((unsigned) XFASTINT (obj) > (unsigned) flagbits)
58 return obj;
59
60 c = DOWNCASE (XFASTINT (obj) & ~flagbits);
61 if (inword)
62 XSETFASTINT (obj, c | flags);
63 else if (c == (XFASTINT (obj) & ~flagbits))
51 { 64 {
52 int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER 65 c = UPCASE1 ((XFASTINT (obj) & ~flagbits));
53 | CHAR_SHIFT | CHAR_CTL | CHAR_META); 66 XSETFASTINT (obj, c | flags);
54 int flags = XINT (obj) & flagbits;
55
56 /* If the character has higher bits set
57 above the flags, return it unchanged.
58 It is not a real character. */
59 if ((unsigned) XFASTINT (obj) > (unsigned) flagbits)
60 return obj;
61
62 c = DOWNCASE (XFASTINT (obj) & ~flagbits);
63 if (inword)
64 XSETFASTINT (obj, c | flags);
65 else if (c == (XFASTINT (obj) & ~flagbits))
66 {
67 c = UPCASE1 ((XFASTINT (obj) & ~flagbits));
68 XSETFASTINT (obj, c | flags);
69 }
70 return obj;
71 } 67 }
68 return obj;
69 }
70
71 if (STRINGP (obj))
72 {
73 int multibyte = STRING_MULTIBYTE (obj);
74 int n;
75
76 obj = Fcopy_sequence (obj);
77 len = SBYTES (obj);
72 78
73 if (STRINGP (obj)) 79 /* I counts bytes, and N counts chars. */
80 for (i = n = 0; i < len; n++)
74 { 81 {
75 int multibyte = STRING_MULTIBYTE (obj); 82 int from_len = 1, to_len = 1;
76 int n;
77 83
78 obj = Fcopy_sequence (obj); 84 c = SREF (obj, i);
79 len = SBYTES (obj);
80 85
81 /* I counts bytes, and N counts chars. */ 86 if (multibyte && c >= 0x80)
82 for (i = n = 0; i < len; n++) 87 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, len -i, from_len);
88 if (inword && flag != CASE_CAPITALIZE_UP)
89 c = DOWNCASE (c);
90 else if (!UPPERCASEP (c)
91 && (!inword || flag != CASE_CAPITALIZE_UP))
92 c = UPCASE1 (c);
93 if ((ASCII_BYTE_P (c) && from_len == 1)
94 || (! multibyte && SINGLE_BYTE_CHAR_P (c)))
95 SSET (obj, i, c);
96 else
83 { 97 {
84 int from_len = 1, to_len = 1; 98 to_len = CHAR_BYTES (c);
85 99 if (from_len == to_len)
86 c = SREF (obj, i); 100 CHAR_STRING (c, SDATA (obj) + i);
87
88 if (multibyte && c >= 0x80)
89 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, len -i, from_len);
90 if (inword && flag != CASE_CAPITALIZE_UP)
91 c = DOWNCASE (c);
92 else if (!UPPERCASEP (c)
93 && (!inword || flag != CASE_CAPITALIZE_UP))
94 c = UPCASE1 (c);
95 if ((ASCII_BYTE_P (c) && from_len == 1)
96 || (! multibyte && SINGLE_BYTE_CHAR_P (c)))
97 SSET (obj, i, c);
98 else 101 else
99 { 102 {
100 to_len = CHAR_BYTES (c); 103 Faset (obj, make_number (n), make_number (c));
101 if (from_len == to_len) 104 len += to_len - from_len;
102 CHAR_STRING (c, SDATA (obj) + i);
103 else
104 {
105 Faset (obj, make_number (n), make_number (c));
106 len += to_len - from_len;
107 }
108 } 105 }
109 if ((int) flag >= (int) CASE_CAPITALIZE)
110 inword = SYNTAX (c) == Sword;
111 i += to_len;
112 } 106 }
113 return obj; 107 if ((int) flag >= (int) CASE_CAPITALIZE)
108 inword = SYNTAX (c) == Sword;
109 i += to_len;
114 } 110 }
115 obj = wrong_type_argument (Qchar_or_string_p, obj); 111 return obj;
116 } 112 }
113
114 return wrong_type_argument (Qchar_or_string_p, obj);
117} 115}
118 116
119DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0, 117DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0,
diff --git a/src/casetab.c b/src/casetab.c
index 5c7530eb480..5483f5663fa 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -1,5 +1,5 @@
1/* GNU Emacs routines to deal with case tables. 1/* GNU Emacs routines to deal with case tables.
2 Copyright (C) 1993, 1994, 2002, 2003, 2004, 2 Copyright (C) 1993, 1994, 2002, 2003, 2004,
3 2005, 2006 Free Software Foundation, Inc. 3 2005, 2006 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -67,10 +67,7 @@ static Lisp_Object
67check_case_table (obj) 67check_case_table (obj)
68 Lisp_Object obj; 68 Lisp_Object obj;
69{ 69{
70 register Lisp_Object tem; 70 CHECK_TYPE (!NILP (Fcase_table_p (obj)), Qcase_table_p, obj);
71
72 while (tem = Fcase_table_p (obj), NILP (tem))
73 obj = wrong_type_argument (Qcase_table_p, obj);
74 return (obj); 71 return (obj);
75} 72}
76 73
diff --git a/src/category.c b/src/category.c
index 929cd7ea1c0..6835d00d824 100644
--- a/src/category.c
+++ b/src/category.c
@@ -164,11 +164,9 @@ Lisp_Object
164check_category_table (table) 164check_category_table (table)
165 Lisp_Object table; 165 Lisp_Object table;
166{ 166{
167 register Lisp_Object tem;
168 if (NILP (table)) 167 if (NILP (table))
169 return current_buffer->category_table; 168 return current_buffer->category_table;
170 while (tem = Fcategory_table_p (table), NILP (tem)) 169 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table);
171 table = wrong_type_argument (Qcategory_table_p, table);
172 return table; 170 return table;
173} 171}
174 172
diff --git a/src/category.h b/src/category.h
index ade8704db09..413505ece61 100644
--- a/src/category.h
+++ b/src/category.h
@@ -54,10 +54,8 @@ Boston, MA 02110-1301, USA. */
54#define CATEGORYP(x) \ 54#define CATEGORYP(x) \
55 (INTEGERP ((x)) && XFASTINT ((x)) >= 0x20 && XFASTINT ((x)) <= 0x7E) 55 (INTEGERP ((x)) && XFASTINT ((x)) >= 0x20 && XFASTINT ((x)) <= 0x7E)
56 56
57#define CHECK_CATEGORY(x) \ 57#define CHECK_CATEGORY(x) \
58 do { \ 58 CHECK_TYPE (CATEGORYP (x), Qcategoryp, x)
59 if (!CATEGORYP ((x))) x = wrong_type_argument (Qcategoryp, (x)); \
60 } while (0)
61 59
62#define XCATEGORY_SET XBOOL_VECTOR 60#define XCATEGORY_SET XBOOL_VECTOR
63 61
@@ -72,10 +70,8 @@ Boston, MA 02110-1301, USA. */
72#define SET_CATEGORY_SET(category_set, category, val) \ 70#define SET_CATEGORY_SET(category_set, category, val) \
73 (Faset (category_set, category, val)) 71 (Faset (category_set, category, val))
74 72
75#define CHECK_CATEGORY_SET(x) \ 73#define CHECK_CATEGORY_SET(x) \
76 do { \ 74 CHECK_TYPE (CATEGORY_SET_P (x), Qcategorysetp, x)
77 if (!CATEGORY_SET_P ((x))) x = wrong_type_argument (Qcategorysetp, (x)); \
78 } while (0)
79 75
80/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. 76/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0.
81 The faster version of `!NILP (Faref (category_set, category))'. */ 77 The faster version of `!NILP (Faref (category_set, category))'. */
diff --git a/src/data.c b/src/data.c
index fdad80b2727..8cca837028d 100644
--- a/src/data.c
+++ b/src/data.c
@@ -114,18 +114,13 @@ Lisp_Object
114wrong_type_argument (predicate, value) 114wrong_type_argument (predicate, value)
115 register Lisp_Object predicate, value; 115 register Lisp_Object predicate, value;
116{ 116{
117 register Lisp_Object tem; 117 /* If VALUE is not even a valid Lisp object, abort here
118 do 118 where we can get a backtrace showing where it came from. */
119 { 119 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit)
120 /* If VALUE is not even a valid Lisp object, abort here 120 abort ();
121 where we can get a backtrace showing where it came from. */ 121
122 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit) 122 Fsignal (Qwrong_type_argument, list2 (predicate, value));
123 abort ();
124 123
125 value = Fsignal (Qwrong_type_argument, Fcons (predicate, Fcons (value, Qnil)));
126 tem = call1 (predicate, value);
127 }
128 while (NILP (tem));
129 /* This function is marked as NO_RETURN, gcc would warn if it has a 124 /* This function is marked as NO_RETURN, gcc would warn if it has a
130 return statement or if falls off the function. Other compilers 125 return statement or if falls off the function. Other compilers
131 warn if no return statement is present. */ 126 warn if no return statement is present. */
@@ -395,8 +390,7 @@ DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0,
395 (object) 390 (object)
396 Lisp_Object object; 391 Lisp_Object object;
397{ 392{
398 if (VECTORP (object) || STRINGP (object) 393 if (ARRAYP (object))
399 || CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
400 return Qt; 394 return Qt;
401 return Qnil; 395 return Qnil;
402} 396}
@@ -406,8 +400,7 @@ DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0,
406 (object) 400 (object)
407 register Lisp_Object object; 401 register Lisp_Object object;
408{ 402{
409 if (CONSP (object) || NILP (object) || VECTORP (object) || STRINGP (object) 403 if (CONSP (object) || NILP (object) || ARRAYP (object))
410 || CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
411 return Qt; 404 return Qt;
412 return Qnil; 405 return Qnil;
413} 406}
@@ -537,15 +530,7 @@ Lisp concepts such as car, cdr, cons cell and list. */)
537 (list) 530 (list)
538 register Lisp_Object list; 531 register Lisp_Object list;
539{ 532{
540 while (1) 533 return CAR (list);
541 {
542 if (CONSP (list))
543 return XCAR (list);
544 else if (EQ (list, Qnil))
545 return Qnil;
546 else
547 list = wrong_type_argument (Qlistp, list);
548 }
549} 534}
550 535
551DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0, 536DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
@@ -553,10 +538,7 @@ DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
553 (object) 538 (object)
554 Lisp_Object object; 539 Lisp_Object object;
555{ 540{
556 if (CONSP (object)) 541 return CAR_SAFE (object);
557 return XCAR (object);
558 else
559 return Qnil;
560} 542}
561 543
562DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0, 544DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0,
@@ -568,15 +550,7 @@ Lisp concepts such as cdr, car, cons cell and list. */)
568 (list) 550 (list)
569 register Lisp_Object list; 551 register Lisp_Object list;
570{ 552{
571 while (1) 553 return CDR (list);
572 {
573 if (CONSP (list))
574 return XCDR (list);
575 else if (EQ (list, Qnil))
576 return Qnil;
577 else
578 list = wrong_type_argument (Qlistp, list);
579 }
580} 554}
581 555
582DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0, 556DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
@@ -584,10 +558,7 @@ DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
584 (object) 558 (object)
585 Lisp_Object object; 559 Lisp_Object object;
586{ 560{
587 if (CONSP (object)) 561 return CDR_SAFE (object);
588 return XCDR (object);
589 else
590 return Qnil;
591} 562}
592 563
593DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0, 564DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
@@ -595,9 +566,7 @@ DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
595 (cell, newcar) 566 (cell, newcar)
596 register Lisp_Object cell, newcar; 567 register Lisp_Object cell, newcar;
597{ 568{
598 if (!CONSP (cell)) 569 CHECK_CONS (cell);
599 cell = wrong_type_argument (Qconsp, cell);
600
601 CHECK_IMPURE (cell); 570 CHECK_IMPURE (cell);
602 XSETCAR (cell, newcar); 571 XSETCAR (cell, newcar);
603 return newcar; 572 return newcar;
@@ -608,9 +577,7 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
608 (cell, newcdr) 577 (cell, newcdr)
609 register Lisp_Object cell, newcdr; 578 register Lisp_Object cell, newcdr;
610{ 579{
611 if (!CONSP (cell)) 580 CHECK_CONS (cell);
612 cell = wrong_type_argument (Qconsp, cell);
613
614 CHECK_IMPURE (cell); 581 CHECK_IMPURE (cell);
615 XSETCDR (cell, newcdr); 582 XSETCDR (cell, newcdr);
616 return newcdr; 583 return newcdr;
@@ -765,8 +732,7 @@ function with `&rest' args, or `unevalled' for a special form. */)
765 Lisp_Object subr; 732 Lisp_Object subr;
766{ 733{
767 short minargs, maxargs; 734 short minargs, maxargs;
768 if (!SUBRP (subr)) 735 CHECK_SUBR (subr);
769 wrong_type_argument (Qsubrp, subr);
770 minargs = XSUBR (subr)->min_args; 736 minargs = XSUBR (subr)->min_args;
771 maxargs = XSUBR (subr)->max_args; 737 maxargs = XSUBR (subr)->max_args;
772 if (maxargs == MANY) 738 if (maxargs == MANY)
@@ -784,8 +750,7 @@ SUBR must be a built-in function. */)
784 Lisp_Object subr; 750 Lisp_Object subr;
785{ 751{
786 const char *name; 752 const char *name;
787 if (!SUBRP (subr)) 753 CHECK_SUBR (subr);
788 wrong_type_argument (Qsubrp, subr);
789 name = XSUBR (subr)->symbol_name; 754 name = XSUBR (subr)->symbol_name;
790 return make_string (name, strlen (name)); 755 return make_string (name, strlen (name));
791} 756}
@@ -2005,13 +1970,18 @@ function chain of symbols. */)
2005{ 1970{
2006 Lisp_Object result; 1971 Lisp_Object result;
2007 1972
2008 result = indirect_function (object); 1973 /* Optimize for no indirection. */
1974 result = object;
1975 if (SYMBOLP (result) && !EQ (result, Qunbound)
1976 && (result = XSYMBOL (result)->function, SYMBOLP (result)))
1977 result = indirect_function (result);
1978 if (!EQ (result, Qunbound))
1979 return result;
2009 1980
2010 if (EQ (result, Qunbound)) 1981 if (NILP (noerror))
2011 return (NILP (noerror) 1982 Fsignal (Qvoid_function, Fcons (object, Qnil));
2012 ? Fsignal (Qvoid_function, Fcons (object, Qnil)) 1983
2013 : Qnil); 1984 return Qnil;
2014 return result;
2015} 1985}
2016 1986
2017/* Extract and set vector and string elements */ 1987/* Extract and set vector and string elements */
@@ -2173,9 +2143,7 @@ bool-vector. IDX starts at 0. */)
2173 2143
2174 CHECK_NUMBER (idx); 2144 CHECK_NUMBER (idx);
2175 idxval = XINT (idx); 2145 idxval = XINT (idx);
2176 if (!VECTORP (array) && !STRINGP (array) && !BOOL_VECTOR_P (array) 2146 CHECK_ARRAY (array, Qarrayp);
2177 && ! CHAR_TABLE_P (array))
2178 array = wrong_type_argument (Qarrayp, array);
2179 CHECK_IMPURE (array); 2147 CHECK_IMPURE (array);
2180 2148
2181 if (VECTORP (array)) 2149 if (VECTORP (array))
diff --git a/src/dired.c b/src/dired.c
index 8b5d7851765..17a80a3ce4b 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -99,6 +99,7 @@ extern struct direct *readdir ();
99#include "charset.h" 99#include "charset.h"
100#include "coding.h" 100#include "coding.h"
101#include "regex.h" 101#include "regex.h"
102#include "blockinput.h"
102 103
103/* Returns a search buffer, with a fastmap allocated and ready to go. */ 104/* Returns a search buffer, with a fastmap allocated and ready to go. */
104extern struct re_pattern_buffer *compile_pattern (); 105extern struct re_pattern_buffer *compile_pattern ();
@@ -951,10 +952,12 @@ Elements of the attribute list are:
951 } 952 }
952 else 953 else
953 { 954 {
955 BLOCK_INPUT;
954 pw = (struct passwd *) getpwuid (s.st_uid); 956 pw = (struct passwd *) getpwuid (s.st_uid);
955 values[2] = (pw ? build_string (pw->pw_name) : make_number (s.st_uid)); 957 values[2] = (pw ? build_string (pw->pw_name) : make_number (s.st_uid));
956 gr = (struct group *) getgrgid (s.st_gid); 958 gr = (struct group *) getgrgid (s.st_gid);
957 values[3] = (gr ? build_string (gr->gr_name) : make_number (s.st_gid)); 959 values[3] = (gr ? build_string (gr->gr_name) : make_number (s.st_gid));
960 UNBLOCK_INPUT;
958 } 961 }
959 values[4] = make_time (s.st_atime); 962 values[4] = make_time (s.st_atime);
960 values[5] = make_time (s.st_mtime); 963 values[5] = make_time (s.st_mtime);
diff --git a/src/dispextern.h b/src/dispextern.h
index 6b5705a2865..52e549ebc0f 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2955,7 +2955,6 @@ int scrolling P_ ((struct frame *));
2955void do_pending_window_change P_ ((int)); 2955void do_pending_window_change P_ ((int));
2956void change_frame_size P_ ((struct frame *, int, int, int, int, int)); 2956void change_frame_size P_ ((struct frame *, int, int, int, int, int));
2957void bitch_at_user P_ ((void)); 2957void bitch_at_user P_ ((void));
2958Lisp_Object sit_for P_ ((int, int, int, int, int));
2959void init_display P_ ((void)); 2958void init_display P_ ((void));
2960void syms_of_display P_ ((void)); 2959void syms_of_display P_ ((void));
2961extern Lisp_Object Qredisplay_dont_pause; 2960extern Lisp_Object Qredisplay_dont_pause;
diff --git a/src/dispnew.c b/src/dispnew.c
index 4f63bfa8578..87d99fd9917 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6527,31 +6527,43 @@ Emacs was built without floating point support.
6527 6527
6528 6528
6529/* This is just like wait_reading_process_output, except that 6529/* This is just like wait_reading_process_output, except that
6530 it does the redisplay. 6530 it does redisplay.
6531 6531
6532 It's also much like Fsit_for, except that it can be used for 6532 TIMEOUT is number of seconds to wait (float or integer).
6533 waiting for input as well. */ 6533 READING is 1 if reading input.
6534 If DO_DISPLAY is >0 display process output while waiting.
6535 If DO_DISPLAY is >1 perform an initial redisplay before waiting.
6536*/
6534 6537
6535Lisp_Object 6538Lisp_Object
6536sit_for (sec, usec, reading, display, initial_display) 6539sit_for (timeout, reading, do_display)
6537 int sec, usec, reading, display, initial_display; 6540 Lisp_Object timeout;
6541 int reading, do_display;
6538{ 6542{
6539 int preempt = (sec >= 0) || (sec == 0 && usec >= 0); 6543 int sec, usec;
6540 6544
6541 swallow_events (display); 6545 swallow_events (do_display);
6542 6546
6543 if ((detect_input_pending_run_timers (display) && preempt) 6547 if ((detect_input_pending_run_timers (do_display))
6544 || !NILP (Vexecuting_kbd_macro)) 6548 || !NILP (Vexecuting_kbd_macro))
6545 return Qnil; 6549 return Qnil;
6546 6550
6547 if (initial_display) 6551 if (do_display >= 2)
6552 redisplay_preserve_echo_area (2);
6553
6554 if (INTEGERP (timeout))
6548 { 6555 {
6549 int count = SPECPDL_INDEX (); 6556 sec = XINT (timeout);
6550 if (!preempt) 6557 usec = 0;
6551 specbind (Qredisplay_dont_pause, Qt);
6552 redisplay_preserve_echo_area (2);
6553 unbind_to (count, Qnil);
6554 } 6558 }
6559 else if (FLOATP (timeout))
6560 {
6561 double seconds = XFLOAT_DATA (timeout);
6562 sec = (int) seconds;
6563 usec = (int) ((seconds - sec) * 1000000);
6564 }
6565 else
6566 wrong_type_argument (Qnumberp, timeout);
6555 6567
6556 if (sec == 0 && usec == 0) 6568 if (sec == 0 && usec == 0)
6557 return Qt; 6569 return Qt;
@@ -6560,63 +6572,34 @@ sit_for (sec, usec, reading, display, initial_display)
6560 gobble_input (0); 6572 gobble_input (0);
6561#endif 6573#endif
6562 6574
6563 wait_reading_process_output (sec, usec, reading ? -1 : 1, display, 6575 wait_reading_process_output (sec, usec, reading ? -1 : 1, do_display,
6564 Qnil, NULL, 0); 6576 Qnil, NULL, 0);
6565 6577
6566 return detect_input_pending () ? Qnil : Qt; 6578 return detect_input_pending () ? Qnil : Qt;
6567} 6579}
6568 6580
6569 6581
6570DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0, 6582DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0,
6571 doc: /* Perform redisplay, then wait for SECONDS seconds or until input is available. 6583 doc: /* Perform redisplay if no input is available.
6572SECONDS may be a floating-point value, meaning that you can wait for a 6584If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil,
6573fraction of a second. 6585perform a full redisplay even if input is available. */)
6574\(Not all operating systems support waiting for a fraction of a second.) 6586 (force)
6575Optional arg NODISP non-nil means don't redisplay, just wait for input. 6587 Lisp_Object force;
6576Redisplay is preempted as always if input arrives, and does not happen
6577if input is available before it starts.
6578Value is t if waited the full time with no input arriving.
6579
6580Redisplay will occur even when input is available if SECONDS is negative.
6581
6582An obsolete but still supported form is
6583\(sit-for SECONDS &optional MILLISECONDS NODISP)
6584Where the optional arg MILLISECONDS specifies an additional wait period,
6585in milliseconds; this was useful when Emacs was built without
6586floating point support.
6587usage: (sit-for SECONDS &optional NODISP OLD-NODISP) */)
6588
6589/* The `old-nodisp' stuff is there so that the arglist has the correct
6590 length. Otherwise, `defdvice' will redefine it with fewer args. */
6591 (seconds, milliseconds, nodisp)
6592 Lisp_Object seconds, milliseconds, nodisp;
6593{ 6588{
6594 int sec, usec; 6589 int count;
6595
6596 if (NILP (nodisp) && !NUMBERP (milliseconds))
6597 { /* New style. */
6598 nodisp = milliseconds;
6599 milliseconds = Qnil;
6600 }
6601
6602 if (NILP (milliseconds))
6603 XSETINT (milliseconds, 0);
6604 else
6605 CHECK_NUMBER (milliseconds);
6606 usec = XINT (milliseconds) * 1000;
6607
6608 {
6609 double duration = extract_float (seconds);
6610 sec = (int) duration;
6611 usec += (duration - sec) * 1000000;
6612 }
6613 6590
6614#ifndef EMACS_HAS_USECS 6591 swallow_events (1);
6615 if (usec != 0 && sec == 0) 6592 if ((detect_input_pending_run_timers (1)
6616 error ("Millisecond `sit-for' not supported on %s", SYSTEM_TYPE); 6593 && NILP (force) && !redisplay_dont_pause)
6617#endif 6594 || !NILP (Vexecuting_kbd_macro))
6595 return Qnil;
6618 6596
6619 return sit_for (sec, usec, 0, NILP (nodisp), NILP (nodisp)); 6597 count = SPECPDL_INDEX ();
6598 if (!NILP (force) && !redisplay_dont_pause)
6599 specbind (Qredisplay_dont_pause, Qt);
6600 redisplay_preserve_echo_area (2);
6601 unbind_to (count, Qnil);
6602 return Qt;
6620} 6603}
6621 6604
6622 6605
@@ -7038,7 +7021,7 @@ syms_of_display ()
7038 defsubr (&Sframe_or_buffer_changed_p); 7021 defsubr (&Sframe_or_buffer_changed_p);
7039 defsubr (&Sopen_termscript); 7022 defsubr (&Sopen_termscript);
7040 defsubr (&Sding); 7023 defsubr (&Sding);
7041 defsubr (&Ssit_for); 7024 defsubr (&Sredisplay);
7042 defsubr (&Ssleep_for); 7025 defsubr (&Ssleep_for);
7043 defsubr (&Ssend_string_to_terminal); 7026 defsubr (&Ssend_string_to_terminal);
7044 defsubr (&Sinternal_show_cursor); 7027 defsubr (&Sinternal_show_cursor);
diff --git a/src/editfns.c b/src/editfns.c
index 85ce94c8f8a..cf37c10a9d5 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -56,6 +56,7 @@ Boston, MA 02110-1301, USA. */
56#include "coding.h" 56#include "coding.h"
57#include "frame.h" 57#include "frame.h"
58#include "window.h" 58#include "window.h"
59#include "blockinput.h"
59 60
60#ifdef STDC_HEADERS 61#ifdef STDC_HEADERS
61#include <float.h> 62#include <float.h>
@@ -628,7 +629,10 @@ find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end)
628DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0, 629DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0,
629 doc: /* Delete the field surrounding POS. 630 doc: /* Delete the field surrounding POS.
630A field is a region of text with the same `field' property. 631A field is a region of text with the same `field' property.
631If POS is nil, the value of point is used for POS. */) 632If POS is nil, the value of point is used for POS.
633
634An `args-out-of-range' error is signaled if POS is outside the
635buffer's accessible portion. */)
632 (pos) 636 (pos)
633 Lisp_Object pos; 637 Lisp_Object pos;
634{ 638{
@@ -642,7 +646,10 @@ If POS is nil, the value of point is used for POS. */)
642DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0, 646DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0,
643 doc: /* Return the contents of the field surrounding POS as a string. 647 doc: /* Return the contents of the field surrounding POS as a string.
644A field is a region of text with the same `field' property. 648A field is a region of text with the same `field' property.
645If POS is nil, the value of point is used for POS. */) 649If POS is nil, the value of point is used for POS.
650
651An `args-out-of-range' error is signaled if POS is outside the
652buffer's accessible portion. */)
646 (pos) 653 (pos)
647 Lisp_Object pos; 654 Lisp_Object pos;
648{ 655{
@@ -654,7 +661,10 @@ If POS is nil, the value of point is used for POS. */)
654DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0, 661DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0,
655 doc: /* Return the contents of the field around POS, without text-properties. 662 doc: /* Return the contents of the field around POS, without text-properties.
656A field is a region of text with the same `field' property. 663A field is a region of text with the same `field' property.
657If POS is nil, the value of point is used for POS. */) 664If POS is nil, the value of point is used for POS.
665
666An `args-out-of-range' error is signaled if POS is outside the
667buffer's accessible portion. */)
658 (pos) 668 (pos)
659 Lisp_Object pos; 669 Lisp_Object pos;
660{ 670{
@@ -670,7 +680,10 @@ If POS is nil, the value of point is used for POS.
670If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its 680If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its
671field, then the beginning of the *previous* field is returned. 681field, then the beginning of the *previous* field is returned.
672If LIMIT is non-nil, it is a buffer position; if the beginning of the field 682If LIMIT is non-nil, it is a buffer position; if the beginning of the field
673is before LIMIT, then LIMIT will be returned instead. */) 683is before LIMIT, then LIMIT will be returned instead.
684
685An `args-out-of-range' error is signaled if POS is outside the
686buffer's accessible portion. */)
674 (pos, escape_from_edge, limit) 687 (pos, escape_from_edge, limit)
675 Lisp_Object pos, escape_from_edge, limit; 688 Lisp_Object pos, escape_from_edge, limit;
676{ 689{
@@ -686,7 +699,10 @@ If POS is nil, the value of point is used for POS.
686If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field, 699If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field,
687then the end of the *following* field is returned. 700then the end of the *following* field is returned.
688If LIMIT is non-nil, it is a buffer position; if the end of the field 701If LIMIT is non-nil, it is a buffer position; if the end of the field
689is after LIMIT, then LIMIT will be returned instead. */) 702is after LIMIT, then LIMIT will be returned instead.
703
704An `args-out-of-range' error is signaled if POS is outside the
705buffer's accessible portion. */)
690 (pos, escape_from_edge, limit) 706 (pos, escape_from_edge, limit)
691 Lisp_Object pos, escape_from_edge, limit; 707 Lisp_Object pos, escape_from_edge, limit;
692{ 708{
@@ -1287,7 +1303,9 @@ with that uid, or nil if there is no such user. */)
1287 return Vuser_login_name; 1303 return Vuser_login_name;
1288 1304
1289 CHECK_NUMBER (uid); 1305 CHECK_NUMBER (uid);
1306 BLOCK_INPUT;
1290 pw = (struct passwd *) getpwuid (XINT (uid)); 1307 pw = (struct passwd *) getpwuid (XINT (uid));
1308 UNBLOCK_INPUT;
1291 return (pw ? build_string (pw->pw_name) : Qnil); 1309 return (pw ? build_string (pw->pw_name) : Qnil);
1292} 1310}
1293 1311
@@ -1341,9 +1359,17 @@ name, or nil if there is no such user. */)
1341 if (NILP (uid)) 1359 if (NILP (uid))
1342 return Vuser_full_name; 1360 return Vuser_full_name;
1343 else if (NUMBERP (uid)) 1361 else if (NUMBERP (uid))
1344 pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); 1362 {
1363 BLOCK_INPUT;
1364 pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid));
1365 UNBLOCK_INPUT;
1366 }
1345 else if (STRINGP (uid)) 1367 else if (STRINGP (uid))
1346 pw = (struct passwd *) getpwnam (SDATA (uid)); 1368 {
1369 BLOCK_INPUT;
1370 pw = (struct passwd *) getpwnam (SDATA (uid));
1371 UNBLOCK_INPUT;
1372 }
1347 else 1373 else
1348 error ("Invalid UID specification"); 1374 error ("Invalid UID specification");
1349 1375
@@ -2114,7 +2140,6 @@ general_insert_function (insert_func, insert_from_string_func,
2114 for (argnum = 0; argnum < nargs; argnum++) 2140 for (argnum = 0; argnum < nargs; argnum++)
2115 { 2141 {
2116 val = args[argnum]; 2142 val = args[argnum];
2117 retry:
2118 if (INTEGERP (val)) 2143 if (INTEGERP (val))
2119 { 2144 {
2120 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2145 unsigned char str[MAX_MULTIBYTE_LENGTH];
@@ -2139,10 +2164,7 @@ general_insert_function (insert_func, insert_from_string_func,
2139 inherit); 2164 inherit);
2140 } 2165 }
2141 else 2166 else
2142 { 2167 wrong_type_argument (Qchar_or_string_p, val);
2143 val = wrong_type_argument (Qchar_or_string_p, val);
2144 goto retry;
2145 }
2146 } 2168 }
2147} 2169}
2148 2170
@@ -3864,7 +3886,7 @@ usage: (format STRING &rest OBJECTS) */)
3864 /* Likewise adjust the property end position. */ 3886 /* Likewise adjust the property end position. */
3865 pos = XINT (XCAR (XCDR (item))); 3887 pos = XINT (XCAR (XCDR (item)));
3866 3888
3867 for (; bytepos < pos; bytepos++) 3889 for (; position < pos; bytepos++)
3868 { 3890 {
3869 if (! discarded[bytepos]) 3891 if (! discarded[bytepos])
3870 position++, translated++; 3892 position++, translated++;
diff --git a/src/eval.c b/src/eval.c
index 5f8d266ec7b..a07ab32e76b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -749,8 +749,7 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */)
749 749
750DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0, 750DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0,
751 doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE. 751 doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE.
752Setting the value of NEW-ALIAS will subsequently set the value of BASE-VARIABLE, 752Aliased variables always have the same value; setting one sets the other.
753 and getting the value of NEW-ALIAS will return the value BASE-VARIABLE has.
754Third arg DOCSTRING, if non-nil, is documentation for NEW-ALIAS. If it is 753Third arg DOCSTRING, if non-nil, is documentation for NEW-ALIAS. If it is
755 omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE, 754 omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE,
756 or of the variable at the end of the chain of aliases, if BASE-VARIABLE is 755 or of the variable at the end of the chain of aliases, if BASE-VARIABLE is
@@ -1290,16 +1289,14 @@ Both TAG and VALUE are evalled. */)
1290{ 1289{
1291 register struct catchtag *c; 1290 register struct catchtag *c;
1292 1291
1293 while (1) 1292 if (!NILP (tag))
1294 { 1293 for (c = catchlist; c; c = c->next)
1295 if (!NILP (tag)) 1294 {
1296 for (c = catchlist; c; c = c->next) 1295 if (EQ (c->tag, tag))
1297 { 1296 unwind_to_catch (c, value);
1298 if (EQ (c->tag, tag)) 1297 }
1299 unwind_to_catch (c, value); 1298 Fsignal (Qno_catch, list2 (tag, value));
1300 } 1299 abort ();
1301 tag = Fsignal (Qno_catch, Fcons (tag, Fcons (value, Qnil)));
1302 }
1303} 1300}
1304 1301
1305 1302
@@ -2167,7 +2164,12 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2167 /* At this point, only original_fun and original_args 2164 /* At this point, only original_fun and original_args
2168 have values that will be used below */ 2165 have values that will be used below */
2169 retry: 2166 retry:
2170 fun = Findirect_function (original_fun, Qnil); 2167
2168 /* Optimize for no indirection. */
2169 fun = original_fun;
2170 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2171 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2172 fun = indirect_function (fun);
2171 2173
2172 if (SUBRP (fun)) 2174 if (SUBRP (fun))
2173 { 2175 {
@@ -2183,7 +2185,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2183 2185
2184 if (XINT (numargs) < XSUBR (fun)->min_args || 2186 if (XINT (numargs) < XSUBR (fun)->min_args ||
2185 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) 2187 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs)))
2186 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil))); 2188 Fsignal (Qwrong_number_of_arguments, list2 (original_fun, numargs));
2187 2189
2188 if (XSUBR (fun)->max_args == UNEVALLED) 2190 if (XSUBR (fun)->max_args == UNEVALLED)
2189 { 2191 {
@@ -2286,11 +2288,13 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2286 val = apply_lambda (fun, original_args, 1); 2288 val = apply_lambda (fun, original_args, 1);
2287 else 2289 else
2288 { 2290 {
2291 if (EQ (fun, Qunbound))
2292 Fsignal (Qvoid_function, Fcons (original_fun, Qnil));
2289 if (!CONSP (fun)) 2293 if (!CONSP (fun))
2290 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2294 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2291 funcar = Fcar (fun); 2295 funcar = Fcar (fun);
2292 if (!SYMBOLP (funcar)) 2296 if (!SYMBOLP (funcar))
2293 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2297 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2294 if (EQ (funcar, Qautoload)) 2298 if (EQ (funcar, Qautoload))
2295 { 2299 {
2296 do_autoload (fun, original_fun); 2300 do_autoload (fun, original_fun);
@@ -2301,7 +2305,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2301 else if (EQ (funcar, Qlambda)) 2305 else if (EQ (funcar, Qlambda))
2302 val = apply_lambda (fun, original_args, 1); 2306 val = apply_lambda (fun, original_args, 1);
2303 else 2307 else
2304 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2308 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2305 } 2309 }
2306 done: 2310 done:
2307 CHECK_CONS_LIST (); 2311 CHECK_CONS_LIST ();
@@ -2346,7 +2350,10 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2346 2350
2347 numargs += nargs - 2; 2351 numargs += nargs - 2;
2348 2352
2349 fun = indirect_function (fun); 2353 /* Optimize for no indirection. */
2354 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2355 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2356 fun = indirect_function (fun);
2350 if (EQ (fun, Qunbound)) 2357 if (EQ (fun, Qunbound))
2351 { 2358 {
2352 /* Let funcall get the error */ 2359 /* Let funcall get the error */
@@ -2825,7 +2832,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2825 int nargs; 2832 int nargs;
2826 Lisp_Object *args; 2833 Lisp_Object *args;
2827{ 2834{
2828 Lisp_Object fun; 2835 Lisp_Object fun, original_fun;
2829 Lisp_Object funcar; 2836 Lisp_Object funcar;
2830 int numargs = nargs - 1; 2837 int numargs = nargs - 1;
2831 Lisp_Object lisp_numargs; 2838 Lisp_Object lisp_numargs;
@@ -2862,11 +2869,15 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2862 2869
2863 CHECK_CONS_LIST (); 2870 CHECK_CONS_LIST ();
2864 2871
2872 original_fun = args[0];
2873
2865 retry: 2874 retry:
2866 2875
2867 fun = args[0]; 2876 /* Optimize for no indirection. */
2868 2877 fun = original_fun;
2869 fun = Findirect_function (fun, Qnil); 2878 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2879 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2880 fun = indirect_function (fun);
2870 2881
2871 if (SUBRP (fun)) 2882 if (SUBRP (fun))
2872 { 2883 {
@@ -2874,11 +2885,11 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2874 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 2885 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
2875 { 2886 {
2876 XSETFASTINT (lisp_numargs, numargs); 2887 XSETFASTINT (lisp_numargs, numargs);
2877 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (lisp_numargs, Qnil))); 2888 Fsignal (Qwrong_number_of_arguments, list2 (original_fun, lisp_numargs));
2878 } 2889 }
2879 2890
2880 if (XSUBR (fun)->max_args == UNEVALLED) 2891 if (XSUBR (fun)->max_args == UNEVALLED)
2881 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2892 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2882 2893
2883 if (XSUBR (fun)->max_args == MANY) 2894 if (XSUBR (fun)->max_args == MANY)
2884 { 2895 {
@@ -2950,21 +2961,23 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2950 val = funcall_lambda (fun, numargs, args + 1); 2961 val = funcall_lambda (fun, numargs, args + 1);
2951 else 2962 else
2952 { 2963 {
2964 if (EQ (fun, Qunbound))
2965 Fsignal (Qvoid_function, Fcons (original_fun, Qnil));
2953 if (!CONSP (fun)) 2966 if (!CONSP (fun))
2954 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2967 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2955 funcar = Fcar (fun); 2968 funcar = Fcar (fun);
2956 if (!SYMBOLP (funcar)) 2969 if (!SYMBOLP (funcar))
2957 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2970 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2958 if (EQ (funcar, Qlambda)) 2971 if (EQ (funcar, Qlambda))
2959 val = funcall_lambda (fun, numargs, args + 1); 2972 val = funcall_lambda (fun, numargs, args + 1);
2960 else if (EQ (funcar, Qautoload)) 2973 else if (EQ (funcar, Qautoload))
2961 { 2974 {
2962 do_autoload (fun, args[0]); 2975 do_autoload (fun, original_fun);
2963 CHECK_CONS_LIST (); 2976 CHECK_CONS_LIST ();
2964 goto retry; 2977 goto retry;
2965 } 2978 }
2966 else 2979 else
2967 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2980 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2968 } 2981 }
2969 done: 2982 done:
2970 CHECK_CONS_LIST (); 2983 CHECK_CONS_LIST ();
@@ -3040,7 +3053,7 @@ funcall_lambda (fun, nargs, arg_vector)
3040 if (CONSP (syms_left)) 3053 if (CONSP (syms_left))
3041 syms_left = XCAR (syms_left); 3054 syms_left = XCAR (syms_left);
3042 else 3055 else
3043 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3056 Fsignal (Qinvalid_function, Fcons (fun, Qnil));
3044 } 3057 }
3045 else if (COMPILEDP (fun)) 3058 else if (COMPILEDP (fun))
3046 syms_left = AREF (fun, COMPILED_ARGLIST); 3059 syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3053,8 +3066,8 @@ funcall_lambda (fun, nargs, arg_vector)
3053 QUIT; 3066 QUIT;
3054 3067
3055 next = XCAR (syms_left); 3068 next = XCAR (syms_left);
3056 while (!SYMBOLP (next)) 3069 if (!SYMBOLP (next))
3057 next = Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3070 Fsignal (Qinvalid_function, Fcons (fun, Qnil));
3058 3071
3059 if (EQ (next, Qand_rest)) 3072 if (EQ (next, Qand_rest))
3060 rest = 1; 3073 rest = 1;
@@ -3068,17 +3081,15 @@ funcall_lambda (fun, nargs, arg_vector)
3068 else if (i < nargs) 3081 else if (i < nargs)
3069 specbind (next, arg_vector[i++]); 3082 specbind (next, arg_vector[i++]);
3070 else if (!optional) 3083 else if (!optional)
3071 return Fsignal (Qwrong_number_of_arguments, 3084 Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs)));
3072 Fcons (fun, Fcons (make_number (nargs), Qnil)));
3073 else 3085 else
3074 specbind (next, Qnil); 3086 specbind (next, Qnil);
3075 } 3087 }
3076 3088
3077 if (!NILP (syms_left)) 3089 if (!NILP (syms_left))
3078 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3090 Fsignal (Qinvalid_function, Fcons (fun, Qnil));
3079 else if (i < nargs) 3091 else if (i < nargs)
3080 return Fsignal (Qwrong_number_of_arguments, 3092 Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs)));
3081 Fcons (fun, Fcons (make_number (nargs), Qnil)));
3082 3093
3083 if (CONSP (fun)) 3094 if (CONSP (fun))
3084 val = Fprogn (XCDR (XCDR (fun))); 3095 val = Fprogn (XCDR (XCDR (fun)));
diff --git a/src/fileio.c b/src/fileio.c
index e5b81ddfd7b..58b1863f225 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -77,6 +77,7 @@ extern int errno;
77#include "charset.h" 77#include "charset.h"
78#include "coding.h" 78#include "coding.h"
79#include "window.h" 79#include "window.h"
80#include "blockinput.h"
80#include "frame.h" 81#include "frame.h"
81#include "dispextern.h" 82#include "dispextern.h"
82 83
@@ -1388,7 +1389,9 @@ See also the function `substitute-in-file-name'. */)
1388 bcopy ((char *) nm, o, p - nm); 1389 bcopy ((char *) nm, o, p - nm);
1389 o [p - nm] = 0; 1390 o [p - nm] = 0;
1390 1391
1392 BLOCK_INPUT;
1391 pw = (struct passwd *) getpwnam (o + 1); 1393 pw = (struct passwd *) getpwnam (o + 1);
1394 UNBLOCK_INPUT;
1392 if (pw) 1395 if (pw)
1393 { 1396 {
1394 newdir = (unsigned char *) pw -> pw_dir; 1397 newdir = (unsigned char *) pw -> pw_dir;
@@ -1919,7 +1922,9 @@ See also the function `substitute-in-file-name'.")
1919 o[len] = 0; 1922 o[len] = 0;
1920 1923
1921 /* Look up the user name. */ 1924 /* Look up the user name. */
1925 BLOCK_INPUT;
1922 pw = (struct passwd *) getpwnam (o + 1); 1926 pw = (struct passwd *) getpwnam (o + 1);
1927 UNBLOCK_INPUT;
1923 if (!pw) 1928 if (!pw)
1924 error ("\"%s\" isn't a registered user", o + 1); 1929 error ("\"%s\" isn't a registered user", o + 1);
1925 1930
@@ -2113,10 +2118,11 @@ search_embedded_absfilename (nm, endp)
2113 /* If we have ~user and `user' exists, discard 2118 /* If we have ~user and `user' exists, discard
2114 everything up to ~. But if `user' does not exist, leave 2119 everything up to ~. But if `user' does not exist, leave
2115 ~user alone, it might be a literal file name. */ 2120 ~user alone, it might be a literal file name. */
2116 if ((pw = getpwnam (o + 1))) 2121 BLOCK_INPUT;
2122 pw = getpwnam (o + 1);
2123 UNBLOCK_INPUT;
2124 if (pw)
2117 return p; 2125 return p;
2118 else
2119 xfree (pw);
2120 } 2126 }
2121 else 2127 else
2122 return p; 2128 return p;
@@ -5855,7 +5861,11 @@ static Lisp_Object
5855do_auto_save_make_dir (dir) 5861do_auto_save_make_dir (dir)
5856 Lisp_Object dir; 5862 Lisp_Object dir;
5857{ 5863{
5858 return call2 (Qmake_directory, dir, Qt); 5864 Lisp_Object mode;
5865
5866 call2 (Qmake_directory, dir, Qt);
5867 XSETFASTINT (mode, 0700);
5868 return Fset_file_modes (dir, mode);
5859} 5869}
5860 5870
5861static Lisp_Object 5871static Lisp_Object
@@ -6053,7 +6063,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
6053 { 6063 {
6054 /* If we are going to restore an old message, 6064 /* If we are going to restore an old message,
6055 give time to read ours. */ 6065 give time to read ours. */
6056 sit_for (1, 0, 0, 0, 0); 6066 sit_for (make_number (1), 0, 0);
6057 restore_message (); 6067 restore_message ();
6058 } 6068 }
6059 else 6069 else
diff --git a/src/fns.c b/src/fns.c
index 2fea9af40cd..69e12bf25ce 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -147,7 +147,6 @@ To get the number of bytes, use `string-bytes'. */)
147 register Lisp_Object val; 147 register Lisp_Object val;
148 register int i; 148 register int i;
149 149
150 retry:
151 if (STRINGP (sequence)) 150 if (STRINGP (sequence))
152 XSETFASTINT (val, SCHARS (sequence)); 151 XSETFASTINT (val, SCHARS (sequence));
153 else if (VECTORP (sequence)) 152 else if (VECTORP (sequence))
@@ -176,18 +175,15 @@ To get the number of bytes, use `string-bytes'. */)
176 QUIT; 175 QUIT;
177 } 176 }
178 177
179 if (!NILP (sequence)) 178 CHECK_LIST_END (sequence, sequence);
180 wrong_type_argument (Qlistp, sequence);
181 179
182 val = make_number (i); 180 val = make_number (i);
183 } 181 }
184 else if (NILP (sequence)) 182 else if (NILP (sequence))
185 XSETFASTINT (val, 0); 183 XSETFASTINT (val, 0);
186 else 184 else
187 { 185 val = wrong_type_argument (Qsequencep, sequence);
188 sequence = wrong_type_argument (Qsequencep, sequence); 186
189 goto retry;
190 }
191 return val; 187 return val;
192} 188}
193 189
@@ -529,7 +525,8 @@ with the original. */)
529 } 525 }
530 526
531 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg)) 527 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg))
532 arg = wrong_type_argument (Qsequencep, arg); 528 wrong_type_argument (Qsequencep, arg);
529
533 return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); 530 return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0);
534} 531}
535 532
@@ -581,15 +578,13 @@ concat (nargs, args, target_type, last_special)
581 else 578 else
582 last_tail = Qnil; 579 last_tail = Qnil;
583 580
584 /* Canonicalize each argument. */ 581 /* Check each argument. */
585 for (argnum = 0; argnum < nargs; argnum++) 582 for (argnum = 0; argnum < nargs; argnum++)
586 { 583 {
587 this = args[argnum]; 584 this = args[argnum];
588 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this) 585 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this)
589 || COMPILEDP (this) || BOOL_VECTOR_P (this))) 586 || COMPILEDP (this) || BOOL_VECTOR_P (this)))
590 { 587 wrong_type_argument (Qsequencep, this);
591 args[argnum] = wrong_type_argument (Qsequencep, this);
592 }
593 } 588 }
594 589
595 /* Compute total length in chars of arguments in RESULT_LEN. 590 /* Compute total length in chars of arguments in RESULT_LEN.
@@ -616,8 +611,7 @@ concat (nargs, args, target_type, last_special)
616 for (i = 0; i < len; i++) 611 for (i = 0; i < len; i++)
617 { 612 {
618 ch = XVECTOR (this)->contents[i]; 613 ch = XVECTOR (this)->contents[i];
619 if (! INTEGERP (ch)) 614 CHECK_NUMBER (ch);
620 wrong_type_argument (Qintegerp, ch);
621 this_len_byte = CHAR_BYTES (XINT (ch)); 615 this_len_byte = CHAR_BYTES (XINT (ch));
622 result_len_byte += this_len_byte; 616 result_len_byte += this_len_byte;
623 if (!SINGLE_BYTE_CHAR_P (XINT (ch))) 617 if (!SINGLE_BYTE_CHAR_P (XINT (ch)))
@@ -629,8 +623,7 @@ concat (nargs, args, target_type, last_special)
629 for (; CONSP (this); this = XCDR (this)) 623 for (; CONSP (this); this = XCDR (this))
630 { 624 {
631 ch = XCAR (this); 625 ch = XCAR (this);
632 if (! INTEGERP (ch)) 626 CHECK_NUMBER (ch);
633 wrong_type_argument (Qintegerp, ch);
634 this_len_byte = CHAR_BYTES (XINT (ch)); 627 this_len_byte = CHAR_BYTES (XINT (ch));
635 result_len_byte += this_len_byte; 628 result_len_byte += this_len_byte;
636 if (!SINGLE_BYTE_CHAR_P (XINT (ch))) 629 if (!SINGLE_BYTE_CHAR_P (XINT (ch)))
@@ -1252,9 +1245,7 @@ This function allows vectors as well as strings. */)
1252 int from_char, to_char; 1245 int from_char, to_char;
1253 int from_byte = 0, to_byte = 0; 1246 int from_byte = 0, to_byte = 0;
1254 1247
1255 if (! (STRINGP (string) || VECTORP (string))) 1248 CHECK_VECTOR_OR_STRING (string);
1256 wrong_type_argument (Qarrayp, string);
1257
1258 CHECK_NUMBER (from); 1249 CHECK_NUMBER (from);
1259 1250
1260 if (STRINGP (string)) 1251 if (STRINGP (string))
@@ -1378,8 +1369,7 @@ substring_both (string, from, from_byte, to, to_byte)
1378 int size; 1369 int size;
1379 int size_byte; 1370 int size_byte;
1380 1371
1381 if (! (STRINGP (string) || VECTORP (string))) 1372 CHECK_VECTOR_OR_STRING (string);
1382 wrong_type_argument (Qarrayp, string);
1383 1373
1384 if (STRINGP (string)) 1374 if (STRINGP (string))
1385 { 1375 {
@@ -1419,8 +1409,7 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
1419 for (i = 0; i < num && !NILP (list); i++) 1409 for (i = 0; i < num && !NILP (list); i++)
1420 { 1410 {
1421 QUIT; 1411 QUIT;
1422 if (! CONSP (list)) 1412 CHECK_LIST_CONS (list, list);
1423 wrong_type_argument (Qlistp, list);
1424 list = XCDR (list); 1413 list = XCDR (list);
1425 } 1414 }
1426 return list; 1415 return list;
@@ -1441,16 +1430,12 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0,
1441 register Lisp_Object sequence, n; 1430 register Lisp_Object sequence, n;
1442{ 1431{
1443 CHECK_NUMBER (n); 1432 CHECK_NUMBER (n);
1444 while (1) 1433 if (CONSP (sequence) || NILP (sequence))
1445 { 1434 return Fcar (Fnthcdr (n, sequence));
1446 if (CONSP (sequence) || NILP (sequence)) 1435
1447 return Fcar (Fnthcdr (n, sequence)); 1436 /* Faref signals a "not array" error, so check here. */
1448 else if (STRINGP (sequence) || VECTORP (sequence) 1437 CHECK_ARRAY (sequence, Qsequencep);
1449 || BOOL_VECTOR_P (sequence) || CHAR_TABLE_P (sequence)) 1438 return Faref (sequence, n);
1450 return Faref (sequence, n);
1451 else
1452 sequence = wrong_type_argument (Qsequencep, sequence);
1453 }
1454} 1439}
1455 1440
1456DEFUN ("member", Fmember, Smember, 2, 2, 0, 1441DEFUN ("member", Fmember, Smember, 2, 2, 0,
@@ -1464,8 +1449,7 @@ The value is actually the tail of LIST whose car is ELT. */)
1464 for (tail = list; !NILP (tail); tail = XCDR (tail)) 1449 for (tail = list; !NILP (tail); tail = XCDR (tail))
1465 { 1450 {
1466 register Lisp_Object tem; 1451 register Lisp_Object tem;
1467 if (! CONSP (tail)) 1452 CHECK_LIST_CONS (tail, list);
1468 wrong_type_argument (Qlistp, list);
1469 tem = XCAR (tail); 1453 tem = XCAR (tail);
1470 if (! NILP (Fequal (elt, tem))) 1454 if (! NILP (Fequal (elt, tem)))
1471 return tail; 1455 return tail;
@@ -1498,9 +1482,7 @@ whose car is ELT. */)
1498 QUIT; 1482 QUIT;
1499 } 1483 }
1500 1484
1501 if (!CONSP (list) && !NILP (list)) 1485 CHECK_LIST (list);
1502 list = wrong_type_argument (Qlistp, list);
1503
1504 return list; 1486 return list;
1505} 1487}
1506 1488
@@ -1511,8 +1493,6 @@ Elements of LIST that are not conses are ignored. */)
1511 (key, list) 1493 (key, list)
1512 Lisp_Object key, list; 1494 Lisp_Object key, list;
1513{ 1495{
1514 Lisp_Object result;
1515
1516 while (1) 1496 while (1)
1517 { 1497 {
1518 if (!CONSP (list) 1498 if (!CONSP (list)
@@ -1536,14 +1516,7 @@ Elements of LIST that are not conses are ignored. */)
1536 QUIT; 1516 QUIT;
1537 } 1517 }
1538 1518
1539 if (CONSP (list)) 1519 return CAR (list);
1540 result = XCAR (list);
1541 else if (NILP (list))
1542 result = Qnil;
1543 else
1544 result = wrong_type_argument (Qlistp, list);
1545
1546 return result;
1547} 1520}
1548 1521
1549/* Like Fassq but never report an error and do not allow quits. 1522/* Like Fassq but never report an error and do not allow quits.
@@ -1558,7 +1531,7 @@ assq_no_quit (key, list)
1558 || !EQ (XCAR (XCAR (list)), key))) 1531 || !EQ (XCAR (XCAR (list)), key)))
1559 list = XCDR (list); 1532 list = XCDR (list);
1560 1533
1561 return CONSP (list) ? XCAR (list) : Qnil; 1534 return CAR_SAFE (list);
1562} 1535}
1563 1536
1564DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0, 1537DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0,
@@ -1567,7 +1540,7 @@ The value is actually the first element of LIST whose car equals KEY. */)
1567 (key, list) 1540 (key, list)
1568 Lisp_Object key, list; 1541 Lisp_Object key, list;
1569{ 1542{
1570 Lisp_Object result, car; 1543 Lisp_Object car;
1571 1544
1572 while (1) 1545 while (1)
1573 { 1546 {
@@ -1595,14 +1568,7 @@ The value is actually the first element of LIST whose car equals KEY. */)
1595 QUIT; 1568 QUIT;
1596 } 1569 }
1597 1570
1598 if (CONSP (list)) 1571 return CAR (list);
1599 result = XCAR (list);
1600 else if (NILP (list))
1601 result = Qnil;
1602 else
1603 result = wrong_type_argument (Qlistp, list);
1604
1605 return result;
1606} 1572}
1607 1573
1608DEFUN ("rassq", Frassq, Srassq, 2, 2, 0, 1574DEFUN ("rassq", Frassq, Srassq, 2, 2, 0,
@@ -1612,8 +1578,6 @@ The value is actually the first element of LIST whose cdr is KEY. */)
1612 register Lisp_Object key; 1578 register Lisp_Object key;
1613 Lisp_Object list; 1579 Lisp_Object list;
1614{ 1580{
1615 Lisp_Object result;
1616
1617 while (1) 1581 while (1)
1618 { 1582 {
1619 if (!CONSP (list) 1583 if (!CONSP (list)
@@ -1637,14 +1601,7 @@ The value is actually the first element of LIST whose cdr is KEY. */)
1637 QUIT; 1601 QUIT;
1638 } 1602 }
1639 1603
1640 if (NILP (list)) 1604 return CAR (list);
1641 result = Qnil;
1642 else if (CONSP (list))
1643 result = XCAR (list);
1644 else
1645 result = wrong_type_argument (Qlistp, list);
1646
1647 return result;
1648} 1605}
1649 1606
1650DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0, 1607DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0,
@@ -1653,7 +1610,7 @@ The value is actually the first element of LIST whose cdr equals KEY. */)
1653 (key, list) 1610 (key, list)
1654 Lisp_Object key, list; 1611 Lisp_Object key, list;
1655{ 1612{
1656 Lisp_Object result, cdr; 1613 Lisp_Object cdr;
1657 1614
1658 while (1) 1615 while (1)
1659 { 1616 {
@@ -1681,14 +1638,7 @@ The value is actually the first element of LIST whose cdr equals KEY. */)
1681 QUIT; 1638 QUIT;
1682 } 1639 }
1683 1640
1684 if (CONSP (list)) 1641 return CAR (list);
1685 result = XCAR (list);
1686 else if (NILP (list))
1687 result = Qnil;
1688 else
1689 result = wrong_type_argument (Qlistp, list);
1690
1691 return result;
1692} 1642}
1693 1643
1694DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0, 1644DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0,
@@ -1708,8 +1658,7 @@ to be sure of changing the value of `foo'. */)
1708 prev = Qnil; 1658 prev = Qnil;
1709 while (!NILP (tail)) 1659 while (!NILP (tail))
1710 { 1660 {
1711 if (! CONSP (tail)) 1661 CHECK_LIST_CONS (tail, list);
1712 wrong_type_argument (Qlistp, list);
1713 tem = XCAR (tail); 1662 tem = XCAR (tail);
1714 if (EQ (elt, tem)) 1663 if (EQ (elt, tem))
1715 { 1664 {
@@ -1831,8 +1780,7 @@ to be sure of changing the value of `foo'. */)
1831 1780
1832 for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail)) 1781 for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail))
1833 { 1782 {
1834 if (!CONSP (tail)) 1783 CHECK_LIST_CONS (tail, seq);
1835 wrong_type_argument (Qlistp, seq);
1836 1784
1837 if (!NILP (Fequal (elt, XCAR (tail)))) 1785 if (!NILP (Fequal (elt, XCAR (tail))))
1838 { 1786 {
@@ -1864,8 +1812,7 @@ Return the reversed list. */)
1864 while (!NILP (tail)) 1812 while (!NILP (tail))
1865 { 1813 {
1866 QUIT; 1814 QUIT;
1867 if (! CONSP (tail)) 1815 CHECK_LIST_CONS (tail, list);
1868 wrong_type_argument (Qlistp, list);
1869 next = XCDR (tail); 1816 next = XCDR (tail);
1870 Fsetcdr (tail, prev); 1817 Fsetcdr (tail, prev);
1871 prev = tail; 1818 prev = tail;
@@ -1887,8 +1834,7 @@ See also the function `nreverse', which is used more often. */)
1887 QUIT; 1834 QUIT;
1888 new = Fcons (XCAR (list), new); 1835 new = Fcons (XCAR (list), new);
1889 } 1836 }
1890 if (!NILP (list)) 1837 CHECK_LIST_END (list, list);
1891 wrong_type_argument (Qconsp, list);
1892 return new; 1838 return new;
1893} 1839}
1894 1840
@@ -2012,8 +1958,7 @@ one of the properties on the list. */)
2012 QUIT; 1958 QUIT;
2013 } 1959 }
2014 1960
2015 if (!NILP (tail)) 1961 CHECK_LIST_END (tail, prop);
2016 wrong_type_argument (Qlistp, prop);
2017 1962
2018 return Qnil; 1963 return Qnil;
2019} 1964}
@@ -2129,8 +2074,7 @@ one of the properties on the list. */)
2129 QUIT; 2074 QUIT;
2130 } 2075 }
2131 2076
2132 if (!NILP (tail)) 2077 CHECK_LIST_END (tail, prop);
2133 wrong_type_argument (Qlistp, prop);
2134 2078
2135 return Qnil; 2079 return Qnil;
2136} 2080}
@@ -2344,7 +2288,6 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2344 Lisp_Object array, item; 2288 Lisp_Object array, item;
2345{ 2289{
2346 register int size, index, charval; 2290 register int size, index, charval;
2347 retry:
2348 if (VECTORP (array)) 2291 if (VECTORP (array))
2349 { 2292 {
2350 register Lisp_Object *p = XVECTOR (array)->contents; 2293 register Lisp_Object *p = XVECTOR (array)->contents;
@@ -2408,10 +2351,7 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2408 } 2351 }
2409 } 2352 }
2410 else 2353 else
2411 { 2354 wrong_type_argument (Qarrayp, array);
2412 array = wrong_type_argument (Qarrayp, array);
2413 goto retry;
2414 }
2415 return array; 2355 return array;
2416} 2356}
2417 2357
@@ -3042,8 +2982,7 @@ usage: (nconc &rest LISTS) */)
3042 2982
3043 if (argnum + 1 == nargs) break; 2983 if (argnum + 1 == nargs) break;
3044 2984
3045 if (!CONSP (tem)) 2985 CHECK_LIST_CONS (tem, tem);
3046 tem = wrong_type_argument (Qlistp, tem);
3047 2986
3048 while (CONSP (tem)) 2987 while (CONSP (tem))
3049 { 2988 {
diff --git a/src/fontset.c b/src/fontset.c
index 23f3c57d241..47cda7f8601 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1622,6 +1622,8 @@ It is intended that this function is called only from
1622 elt = Fcons (target, Fcons (Qnil, Fcons (Qnil, elt))); 1622 elt = Fcons (target, Fcons (Qnil, Fcons (Qnil, elt)));
1623 XSETCAR (tail, elt); 1623 XSETCAR (tail, elt);
1624 } 1624 }
1625 if (! NILP (Fequal (fontlist, Voverriding_fontspec_alist)))
1626 return Qnil;
1625 Voverriding_fontspec_alist = fontlist; 1627 Voverriding_fontspec_alist = fontlist;
1626 clear_face_cache (0); 1628 clear_face_cache (0);
1627 ++windows_or_buffers_changed; 1629 ++windows_or_buffers_changed;
diff --git a/src/frame.h b/src/frame.h
index aa4a00d6dfa..9e3813c844a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -748,18 +748,11 @@ typedef struct frame *FRAME_PTR;
748 (f)->visible = (f)->async_visible, \ 748 (f)->visible = (f)->async_visible, \
749 (f)->iconified = (f)->async_iconified) 749 (f)->iconified = (f)->async_iconified)
750 750
751#define CHECK_FRAME(x) \ 751#define CHECK_FRAME(x) \
752 do { \ 752 CHECK_TYPE (FRAMEP (x), Qframep, x)
753 if (! FRAMEP (x)) \ 753
754 x = wrong_type_argument (Qframep, (x)); \ 754#define CHECK_LIVE_FRAME(x) \
755 } while (0) 755 CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
756
757#define CHECK_LIVE_FRAME(x) \
758 do { \
759 if (! FRAMEP (x) \
760 || ! FRAME_LIVE_P (XFRAME (x))) \
761 x = wrong_type_argument (Qframe_live_p, (x)); \
762 } while (0)
763 756
764/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a 757/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
765 `for' loop which iterates over the elements of Vframe_list. The 758 `for' loop which iterates over the elements of Vframe_list. The
diff --git a/src/fringe.c b/src/fringe.c
index 4b8ac34fe09..dd885beb1b6 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1404,7 +1404,7 @@ init_fringe_bitmap (which, fb, once_p)
1404DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap, 1404DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap,
1405 2, 5, 0, 1405 2, 5, 0,
1406 doc: /* Define fringe bitmap BITMAP from BITS of size HEIGHT x WIDTH. 1406 doc: /* Define fringe bitmap BITMAP from BITS of size HEIGHT x WIDTH.
1407BITMAP is a symbol or string naming the new fringe bitmap. 1407BITMAP is a symbol identifying the new fringe bitmap.
1408BITS is either a string or a vector of integers. 1408BITS is either a string or a vector of integers.
1409HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS. 1409HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS.
1410WIDTH must be an integer between 1 and 16, or nil which defaults to 8. 1410WIDTH must be an integer between 1 and 16, or nil which defaults to 8.
@@ -1429,7 +1429,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1429 else if (VECTORP (bits)) 1429 else if (VECTORP (bits))
1430 h = XVECTOR (bits)->size; 1430 h = XVECTOR (bits)->size;
1431 else 1431 else
1432 bits = wrong_type_argument (Qsequencep, bits); 1432 wrong_type_argument (Qsequencep, bits);
1433 1433
1434 if (NILP (height)) 1434 if (NILP (height))
1435 fb.height = h; 1435 fb.height = h;
diff --git a/src/insdel.c b/src/insdel.c
index b9d9574788e..b97539c1cc2 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2031,6 +2031,8 @@ prepare_to_modify_buffer (start, end, preserve_ptr)
2031 int start, end; 2031 int start, end;
2032 int *preserve_ptr; 2032 int *preserve_ptr;
2033{ 2033{
2034 struct buffer *base_buffer;
2035
2034 if (!NILP (current_buffer->read_only)) 2036 if (!NILP (current_buffer->read_only))
2035 Fbarf_if_buffer_read_only (); 2037 Fbarf_if_buffer_read_only ();
2036 2038
@@ -2056,20 +2058,26 @@ prepare_to_modify_buffer (start, end, preserve_ptr)
2056 verify_interval_modification (current_buffer, start, end); 2058 verify_interval_modification (current_buffer, start, end);
2057 } 2059 }
2058 2060
2061 /* For indirect buffers, use the base buffer to check clashes. */
2062 if (current_buffer->base_buffer != 0)
2063 base_buffer = current_buffer->base_buffer;
2064 else
2065 base_buffer = current_buffer;
2066
2059#ifdef CLASH_DETECTION 2067#ifdef CLASH_DETECTION
2060 if (!NILP (current_buffer->file_truename) 2068 if (!NILP (base_buffer->file_truename)
2061 /* Make binding buffer-file-name to nil effective. */ 2069 /* Make binding buffer-file-name to nil effective. */
2062 && !NILP (current_buffer->filename) 2070 && !NILP (base_buffer->filename)
2063 && SAVE_MODIFF >= MODIFF) 2071 && SAVE_MODIFF >= MODIFF)
2064 lock_file (current_buffer->file_truename); 2072 lock_file (base_buffer->file_truename);
2065#else 2073#else
2066 /* At least warn if this file has changed on disk since it was visited. */ 2074 /* At least warn if this file has changed on disk since it was visited. */
2067 if (!NILP (current_buffer->filename) 2075 if (!NILP (base_buffer->filename)
2068 && SAVE_MODIFF >= MODIFF 2076 && SAVE_MODIFF >= MODIFF
2069 && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ())) 2077 && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ()))
2070 && !NILP (Ffile_exists_p (current_buffer->filename))) 2078 && !NILP (Ffile_exists_p (base_buffer->filename)))
2071 call1 (intern ("ask-user-about-supersession-threat"), 2079 call1 (intern ("ask-user-about-supersession-threat"),
2072 current_buffer->filename); 2080 base_buffer->filename);
2073#endif /* not CLASH_DETECTION */ 2081#endif /* not CLASH_DETECTION */
2074 2082
2075 signal_before_change (start, end, preserve_ptr); 2083 signal_before_change (start, end, preserve_ptr);
diff --git a/src/keyboard.c b/src/keyboard.c
index 6e046aea7d6..025c8a3f85c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1564,7 +1564,8 @@ command_loop_1 ()
1564 int count = SPECPDL_INDEX (); 1564 int count = SPECPDL_INDEX ();
1565 specbind (Qinhibit_quit, Qt); 1565 specbind (Qinhibit_quit, Qt);
1566 1566
1567 Fsit_for (Vminibuffer_message_timeout, Qnil, Qnil); 1567 sit_for (Vminibuffer_message_timeout, 0, 2);
1568
1568 /* Clear the echo area. */ 1569 /* Clear the echo area. */
1569 message2 (0, 0, 0); 1570 message2 (0, 0, 0);
1570 safe_run_hooks (Qecho_area_clear_hook); 1571 safe_run_hooks (Qecho_area_clear_hook);
@@ -2778,8 +2779,6 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2778 /* Or not echoing before and echoing allowed. */ 2779 /* Or not echoing before and echoing allowed. */
2779 || (!echo_kboard && ok_to_echo_at_next_pause))) 2780 || (!echo_kboard && ok_to_echo_at_next_pause)))
2780 { 2781 {
2781 Lisp_Object tem0;
2782
2783 /* After a mouse event, start echoing right away. 2782 /* After a mouse event, start echoing right away.
2784 This is because we are probably about to display a menu, 2783 This is because we are probably about to display a menu,
2785 and we don't want to delay before doing so. */ 2784 and we don't want to delay before doing so. */
@@ -2787,13 +2786,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2787 echo_now (); 2786 echo_now ();
2788 else 2787 else
2789 { 2788 {
2790 int sec, usec; 2789 Lisp_Object tem0;
2791 double duration = extract_float (Vecho_keystrokes); 2790
2792 sec = (int) duration;
2793 usec = (duration - sec) * 1000000;
2794 save_getcjmp (save_jump); 2791 save_getcjmp (save_jump);
2795 restore_getcjmp (local_getcjmp); 2792 restore_getcjmp (local_getcjmp);
2796 tem0 = sit_for (sec, usec, 1, 1, 0); 2793 tem0 = sit_for (Vecho_keystrokes, 1, 1);
2797 restore_getcjmp (save_jump); 2794 restore_getcjmp (save_jump);
2798 if (EQ (tem0, Qt) 2795 if (EQ (tem0, Qt)
2799 && ! CONSP (Vunread_command_events)) 2796 && ! CONSP (Vunread_command_events))
@@ -2860,11 +2857,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2860 && XINT (Vauto_save_timeout) > 0) 2857 && XINT (Vauto_save_timeout) > 0)
2861 { 2858 {
2862 Lisp_Object tem0; 2859 Lisp_Object tem0;
2860 int timeout = delay_level * XFASTINT (Vauto_save_timeout) / 4;
2863 2861
2864 save_getcjmp (save_jump); 2862 save_getcjmp (save_jump);
2865 restore_getcjmp (local_getcjmp); 2863 restore_getcjmp (local_getcjmp);
2866 tem0 = sit_for (delay_level * XFASTINT (Vauto_save_timeout) / 4, 2864 tem0 = sit_for (make_number (timeout), 1, 1);
2867 0, 1, 1, 0);
2868 restore_getcjmp (save_jump); 2865 restore_getcjmp (save_jump);
2869 2866
2870 if (EQ (tem0, Qt) 2867 if (EQ (tem0, Qt)
@@ -8574,7 +8571,7 @@ access_keymap_keyremap (map, key, prompt, do_funcall)
8574 /* Handle a symbol whose function definition is a keymap 8571 /* Handle a symbol whose function definition is a keymap
8575 or an array. */ 8572 or an array. */
8576 if (SYMBOLP (next) && !NILP (Ffboundp (next)) 8573 if (SYMBOLP (next) && !NILP (Ffboundp (next))
8577 && (!NILP (Farrayp (XSYMBOL (next)->function)) 8574 && (ARRAYP (XSYMBOL (next)->function)
8578 || KEYMAPP (XSYMBOL (next)->function))) 8575 || KEYMAPP (XSYMBOL (next)->function)))
8579 next = XSYMBOL (next)->function; 8576 next = XSYMBOL (next)->function;
8580 8577
@@ -9976,7 +9973,13 @@ a special event, so ignore the prefix argument and don't clear it. */)
9976 9973
9977DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_command, 9974DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_command,
9978 1, 1, "P", 9975 1, 1, "P",
9979 doc: /* Read function name, then read its arguments and call it. */) 9976 doc: /* Read function name, then read its arguments and call it.
9977
9978To pass a numeric argument to the command you are invoking with, specify
9979the numeric argument to this command.
9980
9981Noninteractively, the argument PREFIXARG is the prefix argument to
9982give to the command you invoke, if it asks for an argument. */)
9980 (prefixarg) 9983 (prefixarg)
9981 Lisp_Object prefixarg; 9984 Lisp_Object prefixarg;
9982{ 9985{
@@ -10082,19 +10085,18 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
10082 Qmouse_movement))) 10085 Qmouse_movement)))
10083 { 10086 {
10084 /* But first wait, and skip the message if there is input. */ 10087 /* But first wait, and skip the message if there is input. */
10085 int delay_time; 10088 Lisp_Object waited;
10086 if (!NILP (echo_area_buffer[0])) 10089
10087 /* This command displayed something in the echo area; 10090 /* If this command displayed something in the echo area;
10088 so wait a few seconds, then display our suggestion message. */ 10091 wait a few seconds, then display our suggestion message. */
10089 delay_time = (NUMBERP (Vsuggest_key_bindings) 10092 if (NILP (echo_area_buffer[0]))
10090 ? XINT (Vsuggest_key_bindings) : 2); 10093 waited = sit_for (make_number (0), 0, 2);
10094 else if (NUMBERP (Vsuggest_key_bindings))
10095 waited = sit_for (Vminibuffer_message_timeout, 0, 2);
10091 else 10096 else
10092 /* This command left the echo area empty, 10097 waited = sit_for (make_number (2), 0, 2);
10093 so display our message immediately. */
10094 delay_time = 0;
10095 10098
10096 if (!NILP (Fsit_for (make_number (delay_time), Qnil, Qnil)) 10099 if (!NILP (waited) && ! CONSP (Vunread_command_events))
10097 && ! CONSP (Vunread_command_events))
10098 { 10100 {
10099 Lisp_Object binding; 10101 Lisp_Object binding;
10100 char *newmessage; 10102 char *newmessage;
@@ -10114,10 +10116,12 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
10114 message2_nolog (newmessage, 10116 message2_nolog (newmessage,
10115 strlen (newmessage), 10117 strlen (newmessage),
10116 STRING_MULTIBYTE (binding)); 10118 STRING_MULTIBYTE (binding));
10117 if (!NILP (Fsit_for ((NUMBERP (Vsuggest_key_bindings) 10119 if (NUMBERP (Vsuggest_key_bindings))
10118 ? Vsuggest_key_bindings : make_number (2)), 10120 waited = sit_for (Vsuggest_key_bindings, 0, 2);
10119 Qnil, Qnil)) 10121 else
10120 && message_p) 10122 waited = sit_for (make_number (2), 0, 2);
10123
10124 if (!NILP (waited) && message_p)
10121 restore_message (); 10125 restore_message ();
10122 10126
10123 unbind_to (count, Qnil); 10127 unbind_to (count, Qnil);
diff --git a/src/keymap.c b/src/keymap.c
index d856b058dc7..0197319957c 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1131,8 +1131,7 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1131 GCPRO3 (keymap, key, def); 1131 GCPRO3 (keymap, key, def);
1132 keymap = get_keymap (keymap, 1, 1); 1132 keymap = get_keymap (keymap, 1, 1);
1133 1133
1134 if (!VECTORP (key) && !STRINGP (key)) 1134 CHECK_VECTOR_OR_STRING (key);
1135 key = wrong_type_argument (Qarrayp, key);
1136 1135
1137 length = XFASTINT (Flength (key)); 1136 length = XFASTINT (Flength (key));
1138 if (length == 0) 1137 if (length == 0)
@@ -1242,8 +1241,7 @@ recognize the default bindings, just as `read-key-sequence' does. */)
1242 GCPRO2 (keymap, key); 1241 GCPRO2 (keymap, key);
1243 keymap = get_keymap (keymap, 1, 1); 1242 keymap = get_keymap (keymap, 1, 1);
1244 1243
1245 if (!VECTORP (key) && !STRINGP (key)) 1244 CHECK_VECTOR_OR_STRING (key);
1246 key = wrong_type_argument (Qarrayp, key);
1247 1245
1248 length = XFASTINT (Flength (key)); 1246 length = XFASTINT (Flength (key));
1249 if (length == 0) 1247 if (length == 0)
diff --git a/src/lisp.h b/src/lisp.h
index 1a9e11b54dd..7b70b0a9d17 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -591,6 +591,12 @@ extern size_t pure_size;
591#define STRING_COPYIN(string, index, new, count) \ 591#define STRING_COPYIN(string, index, new, count) \
592 bcopy (new, XSTRING (string)->data + index, count) 592 bcopy (new, XSTRING (string)->data + index, count)
593 593
594/* Type checking. */
595
596#define CHECK_TYPE(ok, Qxxxp, x) \
597 do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0)
598
599
594 600
595/* See the macros in intervals.h. */ 601/* See the macros in intervals.h. */
596 602
@@ -598,8 +604,8 @@ typedef struct interval *INTERVAL;
598 604
599/* Complain if object is not string or buffer type */ 605/* Complain if object is not string or buffer type */
600#define CHECK_STRING_OR_BUFFER(x) \ 606#define CHECK_STRING_OR_BUFFER(x) \
601 { if (!STRINGP ((x)) && !BUFFERP ((x))) \ 607 CHECK_TYPE (STRINGP (x) || BUFFERP (x), Qbuffer_or_string_p, x)
602 x = wrong_type_argument (Qbuffer_or_string_p, (x)); } 608
603 609
604/* In a cons, the markbit of the car is the gc mark bit */ 610/* In a cons, the markbit of the car is the gc mark bit */
605 611
@@ -668,6 +674,13 @@ struct Lisp_Cons
668 : NILP ((c)) ? Qnil \ 674 : NILP ((c)) ? Qnil \
669 : wrong_type_argument (Qlistp, (c))) 675 : wrong_type_argument (Qlistp, (c)))
670 676
677/* Take the car or cdr of something whose type is not known. */
678#define CAR_SAFE(c) \
679 (CONSP ((c)) ? XCAR ((c)) : Qnil)
680
681#define CDR_SAFE(c) \
682 (CONSP ((c)) ? XCDR ((c)) : Qnil)
683
671/* Nonzero if STR is a multibyte string. */ 684/* Nonzero if STR is a multibyte string. */
672#define STRING_MULTIBYTE(STR) \ 685#define STRING_MULTIBYTE(STR) \
673 (XSTRING (STR)->size_byte >= 0) 686 (XSTRING (STR)->size_byte >= 0)
@@ -1053,13 +1066,8 @@ struct Lisp_Hash_Table
1053#define HASH_TABLE_P(OBJ) PSEUDOVECTORP (OBJ, PVEC_HASH_TABLE) 1066#define HASH_TABLE_P(OBJ) PSEUDOVECTORP (OBJ, PVEC_HASH_TABLE)
1054#define GC_HASH_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_HASH_TABLE) 1067#define GC_HASH_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_HASH_TABLE)
1055 1068
1056#define CHECK_HASH_TABLE(x) \ 1069#define CHECK_HASH_TABLE(x) \
1057 do \ 1070 CHECK_TYPE (HASH_TABLE_P (x), Qhash_table_p, x)
1058 { \
1059 if (!HASH_TABLE_P ((x))) \
1060 x = wrong_type_argument (Qhash_table_p, (x)); \
1061 } \
1062 while (0)
1063 1071
1064/* Value is the key part of entry IDX in hash table H. */ 1072/* Value is the key part of entry IDX in hash table H. */
1065 1073
@@ -1524,41 +1532,57 @@ typedef unsigned char UCHAR;
1524/* Test for image (image . spec) */ 1532/* Test for image (image . spec) */
1525#define IMAGEP(x) (CONSP (x) && EQ (XCAR (x), Qimage)) 1533#define IMAGEP(x) (CONSP (x) && EQ (XCAR (x), Qimage))
1526 1534
1535/* Array types. */
1536
1537#define ARRAYP(x) \
1538 (VECTORP (x) || STRINGP (x) || CHAR_TABLE_P (x) || BOOL_VECTOR_P (x))
1527 1539
1528#define GC_EQ(x, y) EQ (x, y) 1540#define GC_EQ(x, y) EQ (x, y)
1529 1541
1530#define CHECK_LIST(x) \ 1542#define CHECK_LIST(x) \
1531 do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0) 1543 CHECK_TYPE (CONSP (x) || NILP (x), Qlistp, x)
1544
1545#define CHECK_LIST_CONS(x, y) \
1546 CHECK_TYPE (CONSP (x), Qlistp, y)
1547
1548#define CHECK_LIST_END(x, y) \
1549 CHECK_TYPE (NILP (x), Qlistp, y)
1532 1550
1533#define CHECK_STRING(x) \ 1551#define CHECK_STRING(x) \
1534 do { if (!STRINGP ((x))) x = wrong_type_argument (Qstringp, (x)); } while (0) 1552 CHECK_TYPE (STRINGP (x), Qstringp, x)
1535 1553
1536#define CHECK_STRING_CAR(x) \ 1554#define CHECK_STRING_CAR(x) \
1537 do { if (!STRINGP (XCAR (x))) XSETCAR (x, wrong_type_argument (Qstringp, XCAR (x))); } while (0) 1555 CHECK_TYPE (STRINGP (XCAR (x)), Qstringp, XCAR (x))
1538 1556
1539#define CHECK_CONS(x) \ 1557#define CHECK_CONS(x) \
1540 do { if (!CONSP ((x))) x = wrong_type_argument (Qconsp, (x)); } while (0) 1558 CHECK_TYPE (CONSP (x), Qconsp, x)
1541 1559
1542#define CHECK_SYMBOL(x) \ 1560#define CHECK_SYMBOL(x) \
1543 do { if (!SYMBOLP ((x))) x = wrong_type_argument (Qsymbolp, (x)); } while (0) 1561 CHECK_TYPE (SYMBOLP (x), Qsymbolp, x)
1544 1562
1545#define CHECK_CHAR_TABLE(x) \ 1563#define CHECK_CHAR_TABLE(x) \
1546 do { if (!CHAR_TABLE_P ((x))) \ 1564 CHECK_TYPE (CHAR_TABLE_P (x), Qchar_table_p, x)
1547 x = wrong_type_argument (Qchar_table_p, (x)); } while (0)
1548 1565
1549#define CHECK_VECTOR(x) \ 1566#define CHECK_VECTOR(x) \
1550 do { if (!VECTORP ((x))) x = wrong_type_argument (Qvectorp, (x)); } while (0) 1567 CHECK_TYPE (VECTORP (x), Qvectorp, x)
1551 1568
1552#define CHECK_VECTOR_OR_CHAR_TABLE(x) \ 1569#define CHECK_VECTOR_OR_STRING(x) \
1553 do { if (!VECTORP ((x)) && !CHAR_TABLE_P ((x))) \ 1570 CHECK_TYPE (VECTORP (x) || STRINGP (x), Qarrayp, x)
1554 x = wrong_type_argument (Qvector_or_char_table_p, (x)); \ 1571
1555 } while (0) 1572#define CHECK_ARRAY(x, Qxxxp) \
1573 CHECK_TYPE (ARRAYP (x), Qxxxp, x)
1574
1575#define CHECK_VECTOR_OR_CHAR_TABLE(x) \
1576 CHECK_TYPE (VECTORP (x) || CHAR_TABLE_P (x), Qvector_or_char_table_p, x)
1556 1577
1557#define CHECK_BUFFER(x) \ 1578#define CHECK_BUFFER(x) \
1558 do { if (!BUFFERP ((x))) x = wrong_type_argument (Qbufferp, (x)); } while (0) 1579 CHECK_TYPE (BUFFERP (x), Qbufferp, x)
1559 1580
1560#define CHECK_WINDOW(x) \ 1581#define CHECK_WINDOW(x) \
1561 do { if (!WINDOWP ((x))) x = wrong_type_argument (Qwindowp, (x)); } while (0) 1582 CHECK_TYPE (WINDOWP (x), Qwindowp, x)
1583
1584#define CHECK_WINDOW_CONFIGURATION(x) \
1585 CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
1562 1586
1563/* This macro rejects windows on the interior of the window tree as 1587/* This macro rejects windows on the interior of the window tree as
1564 "dead", which is what we want; this is an argument-checking macro, and 1588 "dead", which is what we want; this is an argument-checking macro, and
@@ -1567,46 +1591,42 @@ typedef unsigned char UCHAR;
1567 A window of any sort, leaf or interior, is dead iff the buffer, 1591 A window of any sort, leaf or interior, is dead iff the buffer,
1568 vchild, and hchild members are all nil. */ 1592 vchild, and hchild members are all nil. */
1569 1593
1570#define CHECK_LIVE_WINDOW(x) \ 1594#define CHECK_LIVE_WINDOW(x) \
1571 do { \ 1595 CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), Qwindow_live_p, x)
1572 if (!WINDOWP ((x)) \
1573 || NILP (XWINDOW ((x))->buffer)) \
1574 x = wrong_type_argument (Qwindow_live_p, (x)); \
1575 } while (0)
1576 1596
1577#define CHECK_PROCESS(x) \ 1597#define CHECK_PROCESS(x) \
1578 do { if (!PROCESSP ((x))) x = wrong_type_argument (Qprocessp, (x)); } while (0) 1598 CHECK_TYPE (PROCESSP (x), Qprocessp, x)
1599
1600#define CHECK_SUBR(x) \
1601 CHECK_TYPE (SUBRP (x), Qsubrp, x)
1579 1602
1580#define CHECK_NUMBER(x) \ 1603#define CHECK_NUMBER(x) \
1581 do { if (!INTEGERP ((x))) x = wrong_type_argument (Qintegerp, (x)); } while (0) 1604 CHECK_TYPE (INTEGERP (x), Qintegerp, x)
1582 1605
1583#define CHECK_NATNUM(x) \ 1606#define CHECK_NATNUM(x) \
1584 do { if (!NATNUMP (x)) x = wrong_type_argument (Qwholenump, (x)); } while (0) 1607 CHECK_TYPE (NATNUMP (x), Qwholenump, x)
1585 1608
1586#define CHECK_MARKER(x) \ 1609#define CHECK_MARKER(x) \
1587 do { if (!MARKERP ((x))) x = wrong_type_argument (Qmarkerp, (x)); } while (0) 1610 CHECK_TYPE (MARKERP (x), Qmarkerp, x)
1588 1611
1589#define CHECK_NUMBER_COERCE_MARKER(x) \ 1612#define CHECK_NUMBER_COERCE_MARKER(x) \
1590 do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \ 1613 do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \
1591 else if (!INTEGERP ((x))) x = wrong_type_argument (Qinteger_or_marker_p, (x)); } while (0) 1614 else CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); } while (0)
1592 1615
1593#define XFLOATINT(n) extract_float((n)) 1616#define XFLOATINT(n) extract_float((n))
1594 1617
1595#define CHECK_FLOAT(x) \ 1618#define CHECK_FLOAT(x) \
1596 do { if (!FLOATP (x)) \ 1619 CHECK_TYPE (FLOATP (x), Qfloatp, x)
1597 x = wrong_type_argument (Qfloatp, (x)); } while (0)
1598 1620
1599#define CHECK_NUMBER_OR_FLOAT(x) \ 1621#define CHECK_NUMBER_OR_FLOAT(x) \
1600 do { if (!FLOATP (x) && !INTEGERP (x)) \ 1622 CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x)
1601 x = wrong_type_argument (Qnumberp, (x)); } while (0)
1602 1623
1603#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \ 1624#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
1604 do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \ 1625 do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \
1605 else if (!INTEGERP (x) && !FLOATP (x)) \ 1626 else CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); } while (0)
1606 x = wrong_type_argument (Qnumber_or_marker_p, (x)); } while (0)
1607 1627
1608#define CHECK_OVERLAY(x) \ 1628#define CHECK_OVERLAY(x) \
1609 do { if (!OVERLAYP ((x))) x = wrong_type_argument (Qoverlayp, (x));} while (0) 1629 CHECK_TYPE (OVERLAYP (x), Qoverlayp, x)
1610 1630
1611/* Since we can't assign directly to the CAR or CDR fields of a cons 1631/* Since we can't assign directly to the CAR or CDR fields of a cons
1612 cell, use these when checking that those fields contain numbers. */ 1632 cell, use these when checking that those fields contain numbers. */
@@ -2469,8 +2489,8 @@ EXFUN (Fding, 1);
2469EXFUN (Fredraw_frame, 1); 2489EXFUN (Fredraw_frame, 1);
2470EXFUN (Fredraw_display, 0); 2490EXFUN (Fredraw_display, 0);
2471EXFUN (Fsleep_for, 2); 2491EXFUN (Fsleep_for, 2);
2472EXFUN (Fsit_for, 3); 2492EXFUN (Fredisplay, 1);
2473extern Lisp_Object sit_for P_ ((int, int, int, int, int)); 2493extern Lisp_Object sit_for P_ ((Lisp_Object, int, int));
2474extern void init_display P_ ((void)); 2494extern void init_display P_ ((void));
2475extern void syms_of_display P_ ((void)); 2495extern void syms_of_display P_ ((void));
2476extern void safe_bcopy P_ ((const char *, char *, int)); 2496extern void safe_bcopy P_ ((const char *, char *, int));
diff --git a/src/lread.c b/src/lread.c
index 8789ad03e1c..91825bce152 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -461,7 +461,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
461 input_method) 461 input_method)
462 int no_switch_frame, ascii_required, error_nonascii, input_method; 462 int no_switch_frame, ascii_required, error_nonascii, input_method;
463{ 463{
464 volatile register Lisp_Object val, delayed_switch_frame; 464 Lisp_Object val, delayed_switch_frame;
465 465
466#ifdef HAVE_WINDOW_SYSTEM 466#ifdef HAVE_WINDOW_SYSTEM
467 if (display_hourglass_p) 467 if (display_hourglass_p)
@@ -486,7 +486,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
486 switch-frame events will read it and process it. */ 486 switch-frame events will read it and process it. */
487 if (no_switch_frame 487 if (no_switch_frame
488 && EVENT_HAS_PARAMETERS (val) 488 && EVENT_HAS_PARAMETERS (val)
489 && EQ (EVENT_HEAD (val), Qswitch_frame)) 489 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (val)), Qswitch_frame))
490 { 490 {
491 delayed_switch_frame = val; 491 delayed_switch_frame = val;
492 goto retry; 492 goto retry;
@@ -1371,7 +1371,6 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1371 int count = SPECPDL_INDEX (); 1371 int count = SPECPDL_INDEX ();
1372 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1372 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1373 struct buffer *b = 0; 1373 struct buffer *b = 0;
1374 int bpos;
1375 int continue_reading_p; 1374 int continue_reading_p;
1376 /* Nonzero if reading an entire buffer. */ 1375 /* Nonzero if reading an entire buffer. */
1377 int whole_buffer = 0; 1376 int whole_buffer = 0;
@@ -1381,7 +1380,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1381 if (MARKERP (readcharfun)) 1380 if (MARKERP (readcharfun))
1382 { 1381 {
1383 if (NILP (start)) 1382 if (NILP (start))
1384 start = readcharfun; 1383 start = readcharfun;
1385 } 1384 }
1386 1385
1387 if (BUFFERP (readcharfun)) 1386 if (BUFFERP (readcharfun))
@@ -1404,8 +1403,8 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1404 1403
1405 /* Try to ensure sourcename is a truename, except whilst preloading. */ 1404 /* Try to ensure sourcename is a truename, except whilst preloading. */
1406 if (NILP (Vpurify_flag) 1405 if (NILP (Vpurify_flag)
1407 && !NILP (sourcename) && Ffile_name_absolute_p (sourcename) 1406 && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))
1408 && (!NILP (Ffboundp (Qfile_truename)))) 1407 && !NILP (Ffboundp (Qfile_truename)))
1409 sourcename = call1 (Qfile_truename, sourcename) ; 1408 sourcename = call1 (Qfile_truename, sourcename) ;
1410 1409
1411 LOADHIST_ATTACH (sourcename); 1410 LOADHIST_ATTACH (sourcename);
@@ -1514,7 +1513,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1514 first_sexp = 0; 1513 first_sexp = 0;
1515 } 1514 }
1516 1515
1517 build_load_history (sourcename, 1516 build_load_history (sourcename,
1518 stream || whole_buffer); 1517 stream || whole_buffer);
1519 1518
1520 UNGCPRO; 1519 UNGCPRO;
@@ -3252,12 +3251,11 @@ Lisp_Object
3252check_obarray (obarray) 3251check_obarray (obarray)
3253 Lisp_Object obarray; 3252 Lisp_Object obarray;
3254{ 3253{
3255 while (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3254 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
3256 { 3255 {
3257 /* If Vobarray is now invalid, force it to be valid. */ 3256 /* If Vobarray is now invalid, force it to be valid. */
3258 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray; 3257 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray;
3259 3258 wrong_type_argument (Qvectorp, obarray);
3260 obarray = wrong_type_argument (Qvectorp, obarray);
3261 } 3259 }
3262 return obarray; 3260 return obarray;
3263} 3261}
diff --git a/src/mac.c b/src/mac.c
index 5fc9ea4ee28..4652757fab3 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -46,11 +46,9 @@ Boston, MA 02110-1301, USA. */
46#include <Folders.h> 46#include <Folders.h>
47#include <Resources.h> 47#include <Resources.h>
48#include <Aliases.h> 48#include <Aliases.h>
49#include <FixMath.h>
50#include <Timer.h> 49#include <Timer.h>
51#include <OSA.h> 50#include <OSA.h>
52#include <AppleScript.h> 51#include <AppleScript.h>
53#include <Scrap.h>
54#include <Events.h> 52#include <Events.h>
55#include <Processes.h> 53#include <Processes.h>
56#include <EPPC.h> 54#include <EPPC.h>
@@ -4627,8 +4625,7 @@ otherwise. */)
4627 CHECK_CONS (key); 4625 CHECK_CONS (key);
4628 for (tmp = key; CONSP (tmp); tmp = XCDR (tmp)) 4626 for (tmp = key; CONSP (tmp); tmp = XCDR (tmp))
4629 CHECK_STRING_CAR (tmp); 4627 CHECK_STRING_CAR (tmp);
4630 if (!NILP (tmp)) 4628 CHECK_LIST_END (tmp, key);
4631 wrong_type_argument (Qlistp, key);
4632 } 4629 }
4633 if (!NILP (application)) 4630 if (!NILP (application))
4634 CHECK_STRING (application); 4631 CHECK_STRING (application);
diff --git a/src/macfns.c b/src/macfns.c
index a053bc66763..8716f072411 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -2646,8 +2646,7 @@ This function is an internal primitive--use `make-frame' instead. */)
2646 error ("Cannot find any usable font"); 2646 error ("Cannot find any usable font");
2647 UNBLOCK_INPUT; 2647 UNBLOCK_INPUT;
2648 2648
2649 x_default_parameter (f, parms, Qfont, font, 2649 x_set_frame_parameters (f, Fcons (Fcons (Qfont, font), Qnil));
2650 "font", "Font", RES_TYPE_STRING);
2651 } 2650 }
2652 2651
2653 x_default_parameter (f, parms, Qborder_width, make_number (0), 2652 x_default_parameter (f, parms, Qborder_width, make_number (0),
diff --git a/src/macgui.h b/src/macgui.h
index a93131e565e..1ea53af59be 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -112,7 +112,7 @@ typedef unsigned long Time;
112 112
113/* Whether to use Text Services Manager. */ 113/* Whether to use Text Services Manager. */
114#ifndef USE_MAC_TSM 114#ifndef USE_MAC_TSM
115#ifdef MAC_OSX 115#if TARGET_API_MAC_CARBON
116#define USE_MAC_TSM 1 116#define USE_MAC_TSM 1
117#endif 117#endif
118#endif 118#endif
diff --git a/src/macros.c b/src/macros.c
index ef3ff8c0523..fb452e4e318 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -97,10 +97,7 @@ macro before appending to it. */)
97 int cvt; 97 int cvt;
98 98
99 /* Check the type of last-kbd-macro in case Lisp code changed it. */ 99 /* Check the type of last-kbd-macro in case Lisp code changed it. */
100 if (!STRINGP (current_kboard->Vlast_kbd_macro) 100 CHECK_VECTOR_OR_STRING (current_kboard->Vlast_kbd_macro);
101 && !VECTORP (current_kboard->Vlast_kbd_macro))
102 current_kboard->Vlast_kbd_macro
103 = wrong_type_argument (Qarrayp, current_kboard->Vlast_kbd_macro);
104 101
105 len = XINT (Flength (current_kboard->Vlast_kbd_macro)); 102 len = XINT (Flength (current_kboard->Vlast_kbd_macro));
106 103
diff --git a/src/macterm.c b/src/macterm.c
index 19040392aa5..8d627446f65 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -196,6 +196,8 @@ static int input_signal_count;
196 196
197extern Lisp_Object Vsystem_name; 197extern Lisp_Object Vsystem_name;
198 198
199extern Lisp_Object Qeql;
200
199/* A mask of extra modifier bits to put into every keyboard char. */ 201/* A mask of extra modifier bits to put into every keyboard char. */
200 202
201extern EMACS_INT extra_keyboard_modifiers; 203extern EMACS_INT extra_keyboard_modifiers;
@@ -6031,13 +6033,28 @@ x_set_mouse_pixel_position (f, pix_x, pix_y)
6031 struct frame *f; 6033 struct frame *f;
6032 int pix_x, pix_y; 6034 int pix_x, pix_y;
6033{ 6035{
6034#if 0 /* MAC_TODO: CursorDeviceMoveTo is non-Carbon */ 6036#ifdef MAC_OSX
6037 Point p;
6038 CGPoint point;
6039
6040 BLOCK_INPUT;
6041 SetPortWindowPort (FRAME_MAC_WINDOW (f));
6042 p.h = pix_x;
6043 p.v = pix_y;
6044 LocalToGlobal (&p);
6045 point.x = p.h;
6046 point.y = p.v;
6047 CGWarpMouseCursorPosition (point);
6048 UNBLOCK_INPUT;
6049#else
6050#if 0 /* MAC_TODO: LMSetMouseLocation and CursorDeviceMoveTo are non-Carbon */
6035 BLOCK_INPUT; 6051 BLOCK_INPUT;
6036 6052
6037 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), 6053 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
6038 0, 0, 0, 0, pix_x, pix_y); 6054 0, 0, 0, 0, pix_x, pix_y);
6039 UNBLOCK_INPUT; 6055 UNBLOCK_INPUT;
6040#endif 6056#endif
6057#endif
6041} 6058}
6042 6059
6043/* focus shifting, raising and lowering. */ 6060/* focus shifting, raising and lowering. */
@@ -6897,6 +6914,8 @@ static Lisp_Object fm_font_family_alist;
6897#if USE_ATSUI 6914#if USE_ATSUI
6898/* Hash table linking font family names to ATSU font IDs. */ 6915/* Hash table linking font family names to ATSU font IDs. */
6899static Lisp_Object atsu_font_id_hash; 6916static Lisp_Object atsu_font_id_hash;
6917/* Alist linking Font Manager style to face attributes. */
6918static Lisp_Object fm_style_face_attributes_alist;
6900static Lisp_Object Vmac_atsu_font_table; 6919static Lisp_Object Vmac_atsu_font_table;
6901extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic; 6920extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic;
6902#endif 6921#endif
@@ -7132,6 +7151,29 @@ add_mac_font_name (name, size, style, charset)
7132 } 7151 }
7133} 7152}
7134 7153
7154#if USE_ATSUI
7155static Lisp_Object
7156fm_style_to_face_attributes (fm_style)
7157 FMFontStyle fm_style;
7158{
7159 Lisp_Object tem;
7160
7161 fm_style &= (bold | italic);
7162 tem = assq_no_quit (make_number (fm_style),
7163 fm_style_face_attributes_alist);
7164 if (!NILP (tem))
7165 return XCDR (tem);
7166
7167 tem = list4 (QCweight, fm_style & bold ? Qbold : Qnormal,
7168 QCslant, fm_style & italic ? Qitalic : Qnormal);
7169 fm_style_face_attributes_alist =
7170 Fcons (Fcons (make_number (fm_style), tem),
7171 fm_style_face_attributes_alist);
7172
7173 return tem;
7174}
7175#endif
7176
7135/* Sets up the table font_name_table to contain the list of all fonts 7177/* Sets up the table font_name_table to contain the list of all fonts
7136 in the system the first time the table is used so that the Resource 7178 in the system the first time the table is used so that the Resource
7137 Manager need not be accessed every time this information is 7179 Manager need not be accessed every time this information is
@@ -7200,14 +7242,12 @@ init_font_name_table ()
7200 decode_mac_font_name (name, name_len + 1, Qnil); 7242 decode_mac_font_name (name, name_len + 1, Qnil);
7201 family = make_unibyte_string (name, name_len); 7243 family = make_unibyte_string (name, name_len);
7202 FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style); 7244 FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style);
7203 Fputhash (make_unibyte_string ((char *)(font_ids + i), 7245 Fputhash ((font_ids[i] > MOST_POSITIVE_FIXNUM
7204 sizeof (ATSUFontID)), 7246 ? make_float (font_ids[i])
7247 : make_number (font_ids[i])),
7205 Fcons (QCfamily, 7248 Fcons (QCfamily,
7206 list5 (family, 7249 Fcons (family,
7207 QCweight, 7250 fm_style_to_face_attributes (style))),
7208 style & bold ? Qbold : Qnormal,
7209 QCslant,
7210 style & italic ? Qitalic : Qnormal)),
7211 Vmac_atsu_font_table); 7251 Vmac_atsu_font_table);
7212 if (*name != '.' 7252 if (*name != '.'
7213 && hash_lookup (h, family, &hash_code) < 0) 7253 && hash_lookup (h, family, &hash_code) < 0)
@@ -8513,6 +8553,7 @@ static Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event;
8513static Lisp_Object Vmac_ts_active_input_overlay; 8553static Lisp_Object Vmac_ts_active_input_overlay;
8514extern Lisp_Object Qbefore_string; 8554extern Lisp_Object Qbefore_string;
8515static Lisp_Object Vmac_ts_script_language_on_focus; 8555static Lisp_Object Vmac_ts_script_language_on_focus;
8556static Lisp_Object saved_ts_script_language_on_focus;
8516static ScriptLanguageRecord saved_ts_language; 8557static ScriptLanguageRecord saved_ts_language;
8517static Component saved_ts_component; 8558static Component saved_ts_component;
8518#endif 8559#endif
@@ -8875,11 +8916,17 @@ mac_tsm_resume ()
8875 8916
8876 if (err == noErr) 8917 if (err == noErr)
8877 { 8918 {
8878 if (EQ (Vmac_ts_script_language_on_focus, Qt)) 8919 if (EQ (Vmac_ts_script_language_on_focus, Qt)
8920 && EQ (saved_ts_script_language_on_focus, Qt))
8879 slptr = &saved_ts_language; 8921 slptr = &saved_ts_language;
8880 else if (CONSP (Vmac_ts_script_language_on_focus) 8922 else if (CONSP (Vmac_ts_script_language_on_focus)
8881 && INTEGERP (XCAR (Vmac_ts_script_language_on_focus)) 8923 && INTEGERP (XCAR (Vmac_ts_script_language_on_focus))
8882 && INTEGERP (XCDR (Vmac_ts_script_language_on_focus))) 8924 && INTEGERP (XCDR (Vmac_ts_script_language_on_focus))
8925 && CONSP (saved_ts_script_language_on_focus)
8926 && EQ (XCAR (saved_ts_script_language_on_focus),
8927 XCAR (Vmac_ts_script_language_on_focus))
8928 && EQ (XCDR (saved_ts_script_language_on_focus),
8929 XCDR (Vmac_ts_script_language_on_focus)))
8883 { 8930 {
8884 slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus)); 8931 slrec.fScript = XINT (XCAR (Vmac_ts_script_language_on_focus));
8885 slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus)); 8932 slrec.fLanguage = XINT (XCDR (Vmac_ts_script_language_on_focus));
@@ -8912,6 +8959,8 @@ mac_tsm_suspend ()
8912 OSStatus err; 8959 OSStatus err;
8913 ScriptLanguageRecord slrec, *slptr = NULL; 8960 ScriptLanguageRecord slrec, *slptr = NULL;
8914 8961
8962 saved_ts_script_language_on_focus = Vmac_ts_script_language_on_focus;
8963
8915 if (EQ (Vmac_ts_script_language_on_focus, Qt)) 8964 if (EQ (Vmac_ts_script_language_on_focus, Qt))
8916 { 8965 {
8917 err = GetTextServiceLanguage (&saved_ts_language); 8966 err = GetTextServiceLanguage (&saved_ts_language);
@@ -9560,7 +9609,11 @@ mac_handle_text_input_event (next_handler, event, data)
9560 typeLongInteger, 9609 typeLongInteger,
9561 typeIntlWritingCode, 9610 typeIntlWritingCode,
9562 typeLongInteger, 9611 typeLongInteger,
9612#ifdef MAC_OSX
9563 typeUnicodeText, 9613 typeUnicodeText,
9614#else
9615 typeChar,
9616#endif
9564 typeTextRangeArray, 9617 typeTextRangeArray,
9565 typeTextRangeArray, 9618 typeTextRangeArray,
9566 typeOffsetArray, 9619 typeOffsetArray,
@@ -10646,7 +10699,7 @@ XTread_socket (sd, expected, hold_quit)
10646#endif 10699#endif
10647 mapped_modifiers &= modifiers; 10700 mapped_modifiers &= modifiers;
10648 10701
10649#if USE_CARBON_EVENTS && defined (MAC_OSX) 10702#if USE_CARBON_EVENTS && (defined (MAC_OSX) || USE_MAC_TSM)
10650 /* When using Carbon Events, we need to pass raw keyboard 10703 /* When using Carbon Events, we need to pass raw keyboard
10651 events to the TSM ourselves. If TSM handles it, it 10704 events to the TSM ourselves. If TSM handles it, it
10652 will pass back noErr, otherwise it will pass back 10705 will pass back noErr, otherwise it will pass back
@@ -11302,7 +11355,11 @@ init_menu_bar ()
11302static void 11355static void
11303init_tsm () 11356init_tsm ()
11304{ 11357{
11358#ifdef MAC_OSX
11305 static InterfaceTypeList types = {kUnicodeDocument}; 11359 static InterfaceTypeList types = {kUnicodeDocument};
11360#else
11361 static InterfaceTypeList types = {kTextService};
11362#endif
11306 11363
11307 NewTSMDocument (sizeof (types) / sizeof (types[0]), types, 11364 NewTSMDocument (sizeof (types) / sizeof (types[0]), types,
11308 &tsm_document_id, 0); 11365 &tsm_document_id, 0);
@@ -11491,6 +11548,14 @@ syms_of_macterm ()
11491#if USE_ATSUI 11548#if USE_ATSUI
11492 staticpro (&atsu_font_id_hash); 11549 staticpro (&atsu_font_id_hash);
11493 atsu_font_id_hash = Qnil; 11550 atsu_font_id_hash = Qnil;
11551
11552 staticpro (&fm_style_face_attributes_alist);
11553 fm_style_face_attributes_alist = Qnil;
11554#endif
11555
11556#if USE_MAC_TSM
11557 staticpro (&saved_ts_script_language_on_focus);
11558 saved_ts_script_language_on_focus = Qnil;
11494#endif 11559#endif
11495 11560
11496 /* We don't yet support this, but defining this here avoids whining 11561 /* We don't yet support this, but defining this here avoids whining
@@ -11603,11 +11668,9 @@ CODING_SYSTEM is a coding system corresponding to TEXT-ENCODING. */);
11603 11668
11604#if USE_ATSUI 11669#if USE_ATSUI
11605 DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table, 11670 DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table,
11606 doc: /* Hash table of ATSU font IDs vs plist of attributes and values. 11671 doc: /* Hash table of ATSU font IDs vs plist of attributes and values. */);
11607Each font ID is represented as a four-byte string in native byte
11608order. */);
11609 Vmac_atsu_font_table = 11672 Vmac_atsu_font_table =
11610 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), 11673 make_hash_table (Qeql, make_number (DEFAULT_HASH_SIZE),
11611 make_float (DEFAULT_REHASH_SIZE), 11674 make_float (DEFAULT_REHASH_SIZE),
11612 make_float (DEFAULT_REHASH_THRESHOLD), 11675 make_float (DEFAULT_REHASH_THRESHOLD),
11613 Qnil, Qnil, Qnil); 11676 Qnil, Qnil, Qnil);
diff --git a/src/marker.c b/src/marker.c
index 79a7d702bdf..20b660ddadd 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -835,8 +835,7 @@ see `marker-insertion-type'. */)
835{ 835{
836 register Lisp_Object new; 836 register Lisp_Object new;
837 837
838 if (! (INTEGERP (marker) || MARKERP (marker))) 838 CHECK_TYPE (INTEGERP (marker) || MARKERP (marker), Qinteger_or_marker_p, marker);
839 marker = wrong_type_argument (Qinteger_or_marker_p, marker);
840 839
841 new = Fmake_marker (); 840 new = Fmake_marker ();
842 Fset_marker (new, marker, 841 Fset_marker (new, marker,
diff --git a/src/minibuf.c b/src/minibuf.c
index 9a1a3636e97..e4296ad8cd2 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -2698,7 +2698,7 @@ temp_echo_area_glyphs (string)
2698 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0); 2698 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0);
2699 SET_PT_BOTH (opoint, opoint_byte); 2699 SET_PT_BOTH (opoint, opoint_byte);
2700 Vinhibit_quit = Qt; 2700 Vinhibit_quit = Qt;
2701 Fsit_for (make_number (2), Qnil, Qnil); 2701 sit_for (make_number (2), 0, 2);
2702 del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1); 2702 del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1);
2703 SET_PT_BOTH (opoint, opoint_byte); 2703 SET_PT_BOTH (opoint, opoint_byte);
2704 if (!NILP (Vquit_flag)) 2704 if (!NILP (Vquit_flag))
diff --git a/src/process.c b/src/process.c
index 965b33c52c3..9dadc1ab4ab 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5165,7 +5165,7 @@ read_process_output (proc, channel)
5165#endif 5165#endif
5166 /* But do it only if the caller is actually going to read events. 5166 /* But do it only if the caller is actually going to read events.
5167 Otherwise there's no need to make him wake up, and it could 5167 Otherwise there's no need to make him wake up, and it could
5168 cause trouble (for example it would make Fsit_for return). */ 5168 cause trouble (for example it would make sit_for return). */
5169 if (waiting_for_user_input_p == -1) 5169 if (waiting_for_user_input_p == -1)
5170 record_asynch_buffer_change (); 5170 record_asynch_buffer_change ();
5171 5171
@@ -6612,7 +6612,7 @@ exec_sentinel (proc, reason)
6612#endif 6612#endif
6613 /* But do it only if the caller is actually going to read events. 6613 /* But do it only if the caller is actually going to read events.
6614 Otherwise there's no need to make him wake up, and it could 6614 Otherwise there's no need to make him wake up, and it could
6615 cause trouble (for example it would make Fsit_for return). */ 6615 cause trouble (for example it would make sit_for return). */
6616 if (waiting_for_user_input_p == -1) 6616 if (waiting_for_user_input_p == -1)
6617 record_asynch_buffer_change (); 6617 record_asynch_buffer_change ();
6618 6618
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 5d247a1c9c8..817f1facdee 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -250,6 +250,7 @@ Boston, MA 02110-1301, USA. */
250#define C_DEBUG_SWITCH 250#define C_DEBUG_SWITCH
251#endif 251#endif
252 252
253/* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works. */
253#ifdef LINUX_SIGNALS_VIA_CHARACTERS_DOES_WORK 254#ifdef LINUX_SIGNALS_VIA_CHARACTERS_DOES_WORK
254#define SIGNALS_VIA_CHARACTERS 255#define SIGNALS_VIA_CHARACTERS
255#endif 256#endif
diff --git a/src/search.c b/src/search.c
index 99db7f184fc..fe124091009 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2874,8 +2874,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */)
2874 if (running_asynch_code) 2874 if (running_asynch_code)
2875 save_search_regs (); 2875 save_search_regs ();
2876 2876
2877 if (!CONSP (list) && !NILP (list)) 2877 CHECK_LIST (list);
2878 list = wrong_type_argument (Qconsp, list);
2879 2878
2880 /* Unless we find a marker with a buffer or an explicit buffer 2879 /* Unless we find a marker with a buffer or an explicit buffer
2881 in LIST, assume that this match data came from a string. */ 2880 in LIST, assume that this match data came from a string. */
diff --git a/src/sunfns.c b/src/sunfns.c
index 1c04f1108a8..336f02221cf 100644
--- a/src/sunfns.c
+++ b/src/sunfns.c
@@ -363,7 +363,7 @@ sun_item_create (Pair)
363 Lisp_Object String; 363 Lisp_Object String;
364 Lisp_Object Value; 364 Lisp_Object Value;
365 365
366 if (!CONSP(Pair)) wrong_type_argument(Qlistp, Pair); 366 CHECK_LIST_CONS (Pair, Pair);
367 String = Fcar(Pair); 367 String = Fcar(Pair);
368 CHECK_STRING(String); 368 CHECK_STRING(String);
369 Value = Fcdr(Pair); 369 Value = Fcdr(Pair);
diff --git a/src/syntax.c b/src/syntax.c
index 9af4773a01b..9959c17ad47 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -97,10 +97,11 @@ static int find_start_modiff;
97 97
98 98
99static int find_defun_start P_ ((int, int)); 99static int find_defun_start P_ ((int, int));
100static int back_comment P_ ((int, int, int, int, int, int *, int *)); 100static int back_comment P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int, int,
101 EMACS_INT *, EMACS_INT *));
101static int char_quoted P_ ((int, int)); 102static int char_quoted P_ ((int, int));
102static Lisp_Object skip_chars P_ ((int, int, Lisp_Object, Lisp_Object, int)); 103static Lisp_Object skip_chars P_ ((int, int, Lisp_Object, Lisp_Object, int));
103static Lisp_Object scan_lists P_ ((int, int, int, int)); 104static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int));
104static void scan_sexps_forward P_ ((struct lisp_parse_state *, 105static void scan_sexps_forward P_ ((struct lisp_parse_state *,
105 int, int, int, int, 106 int, int, int, int,
106 int, Lisp_Object, int)); 107 int, Lisp_Object, int));
@@ -471,9 +472,9 @@ prev_char_comend_first (pos, pos_byte)
471 472
472static int 473static int
473back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr) 474back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr)
474 int from, from_byte, stop; 475 EMACS_INT from, from_byte, stop;
475 int comnested, comstyle; 476 int comnested, comstyle;
476 int *charpos_ptr, *bytepos_ptr; 477 EMACS_INT *charpos_ptr, *bytepos_ptr;
477{ 478{
478 /* Look back, counting the parity of string-quotes, 479 /* Look back, counting the parity of string-quotes,
479 and recording the comment-starters seen. 480 and recording the comment-starters seen.
@@ -748,9 +749,8 @@ static void
748check_syntax_table (obj) 749check_syntax_table (obj)
749 Lisp_Object obj; 750 Lisp_Object obj;
750{ 751{
751 if (!(CHAR_TABLE_P (obj) 752 CHECK_TYPE (CHAR_TABLE_P (obj) && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table),
752 && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table))) 753 Qsyntax_table_p, obj);
753 wrong_type_argument (Qsyntax_table_p, obj);
754} 754}
755 755
756DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, 756DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
@@ -1890,9 +1890,10 @@ in_classes (c, iso_classes)
1890static int 1890static int
1891forw_comment (from, from_byte, stop, nesting, style, prev_syntax, 1891forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
1892 charpos_ptr, bytepos_ptr, incomment_ptr) 1892 charpos_ptr, bytepos_ptr, incomment_ptr)
1893 int from, from_byte, stop; 1893 EMACS_INT from, from_byte, stop;
1894 int nesting, style, prev_syntax; 1894 int nesting, style, prev_syntax;
1895 int *charpos_ptr, *bytepos_ptr, *incomment_ptr; 1895 EMACS_INT *charpos_ptr, *bytepos_ptr;
1896 int *incomment_ptr;
1896{ 1897{
1897 register int c, c1; 1898 register int c, c1;
1898 register enum syntaxcode code; 1899 register enum syntaxcode code;
@@ -1992,16 +1993,16 @@ between them, return t; otherwise return nil. */)
1992 (count) 1993 (count)
1993 Lisp_Object count; 1994 Lisp_Object count;
1994{ 1995{
1995 register int from; 1996 register EMACS_INT from;
1996 int from_byte; 1997 EMACS_INT from_byte;
1997 register int stop; 1998 register EMACS_INT stop;
1998 register int c, c1; 1999 register int c, c1;
1999 register enum syntaxcode code; 2000 register enum syntaxcode code;
2000 int comstyle = 0; /* style of comment encountered */ 2001 int comstyle = 0; /* style of comment encountered */
2001 int comnested = 0; /* whether the comment is nestable or not */ 2002 int comnested = 0; /* whether the comment is nestable or not */
2002 int found; 2003 int found;
2003 int count1; 2004 EMACS_INT count1;
2004 int out_charpos, out_bytepos; 2005 EMACS_INT out_charpos, out_bytepos;
2005 int dummy; 2006 int dummy;
2006 2007
2007 CHECK_NUMBER (count); 2008 CHECK_NUMBER (count);
@@ -2199,11 +2200,12 @@ between them, return t; otherwise return nil. */)
2199 2200
2200static Lisp_Object 2201static Lisp_Object
2201scan_lists (from, count, depth, sexpflag) 2202scan_lists (from, count, depth, sexpflag)
2202 register int from; 2203 register EMACS_INT from;
2203 int count, depth, sexpflag; 2204 EMACS_INT count, depth;
2205 int sexpflag;
2204{ 2206{
2205 Lisp_Object val; 2207 Lisp_Object val;
2206 register int stop = count > 0 ? ZV : BEGV; 2208 register EMACS_INT stop = count > 0 ? ZV : BEGV;
2207 register int c, c1; 2209 register int c, c1;
2208 int stringterm; 2210 int stringterm;
2209 int quoted; 2211 int quoted;
@@ -2212,11 +2214,11 @@ scan_lists (from, count, depth, sexpflag)
2212 int min_depth = depth; /* Err out if depth gets less than this. */ 2214 int min_depth = depth; /* Err out if depth gets less than this. */
2213 int comstyle = 0; /* style of comment encountered */ 2215 int comstyle = 0; /* style of comment encountered */
2214 int comnested = 0; /* whether the comment is nestable or not */ 2216 int comnested = 0; /* whether the comment is nestable or not */
2215 int temp_pos; 2217 EMACS_INT temp_pos;
2216 int last_good = from; 2218 EMACS_INT last_good = from;
2217 int found; 2219 int found;
2218 int from_byte; 2220 EMACS_INT from_byte;
2219 int out_bytepos, out_charpos; 2221 EMACS_INT out_bytepos, out_charpos;
2220 int temp, dummy; 2222 int temp, dummy;
2221 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; 2223 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol;
2222 2224
@@ -2700,7 +2702,7 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
2700 int boundary_stop = commentstop == -1; 2702 int boundary_stop = commentstop == -1;
2701 int nofence; 2703 int nofence;
2702 int found; 2704 int found;
2703 int out_bytepos, out_charpos; 2705 EMACS_INT out_bytepos, out_charpos;
2704 int temp; 2706 int temp;
2705 2707
2706 prev_from = from; 2708 prev_from = from;
diff --git a/src/textprop.c b/src/textprop.c
index 87fa6742919..0318d12913f 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -690,10 +690,11 @@ overlays are considered only if they are associated with OBJECT. */)
690DEFUN ("get-char-property-and-overlay", Fget_char_property_and_overlay, 690DEFUN ("get-char-property-and-overlay", Fget_char_property_and_overlay,
691 Sget_char_property_and_overlay, 2, 3, 0, 691 Sget_char_property_and_overlay, 2, 3, 0,
692 doc: /* Like `get-char-property', but with extra overlay information. 692 doc: /* Like `get-char-property', but with extra overlay information.
693Return a cons whose car is the return value of `get-char-property' 693The value is a cons cell. Its car is the return value of `get-char-property'
694with the same arguments, that is, the value of POSITION's property 694with the same arguments--that is, the value of POSITION's property
695PROP in OBJECT, and whose cdr is the overlay in which the property was 695PROP in OBJECT. Its cdr is the overlay in which the property was
696found, or nil, if it was found as a text property or not found at all. 696found, or nil, if it was found as a text property or not found at all.
697
697OBJECT is optional and defaults to the current buffer. OBJECT may be 698OBJECT is optional and defaults to the current buffer. OBJECT may be
698a string, a buffer or a window. For strings, the cdr of the return 699a string, a buffer or a window. For strings, the cdr of the return
699value is always nil, since strings do not have overlays. If OBJECT is 700value is always nil, since strings do not have overlays. If OBJECT is
@@ -1787,8 +1788,12 @@ text_property_stickiness (prop, pos, buffer)
1787 /* PROP is rear-non-sticky. */ 1788 /* PROP is rear-non-sticky. */
1788 is_rear_sticky = 0; 1789 is_rear_sticky = 0;
1789 } 1790 }
1791 else
1792 return 0;
1790 1793
1791 /* Consider following character. */ 1794 /* Consider following character. */
1795 /* This signals an arg-out-of-range error if pos is outside the
1796 buffer's accessible range. */
1792 front_sticky = Fget_text_property (pos, Qfront_sticky, buffer); 1797 front_sticky = Fget_text_property (pos, Qfront_sticky, buffer);
1793 1798
1794 if (EQ (front_sticky, Qt) 1799 if (EQ (front_sticky, Qt)
diff --git a/src/w32console.c b/src/w32console.c
index dbadee3b10d..0fc652bf55f 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -705,7 +705,7 @@ syms_of_ntterm ()
705 DEFVAR_BOOL ("w32-use-full-screen-buffer", 705 DEFVAR_BOOL ("w32-use-full-screen-buffer",
706 &w32_use_full_screen_buffer, 706 &w32_use_full_screen_buffer,
707 doc: /* Non-nil means make terminal frames use the full screen buffer dimensions. 707 doc: /* Non-nil means make terminal frames use the full screen buffer dimensions.
708This is desirable when running Emacs over telnet, and is the default. 708This is desirable when running Emacs over telnet.
709A value of nil means use the current console window dimensions; this 709A value of nil means use the current console window dimensions; this
710may be preferrable when working directly at the console with a large 710may be preferrable when working directly at the console with a large
711scroll-back buffer. */); 711scroll-back buffer. */);
diff --git a/src/w32fns.c b/src/w32fns.c
index 25aa22f0683..66cac34b2d9 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2085,8 +2085,8 @@ w32_createwindow (f)
2085 = CreateWindow (EMACS_CLASS, 2085 = CreateWindow (EMACS_CLASS,
2086 f->namebuf, 2086 f->namebuf,
2087 f->output_data.w32->dwStyle | WS_CLIPCHILDREN, 2087 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
2088 f->left_pos, 2088 CW_USEDEFAULT,
2089 f->top_pos, 2089 SW_SHOW,
2090 rect.right - rect.left, 2090 rect.right - rect.left,
2091 rect.bottom - rect.top, 2091 rect.bottom - rect.top,
2092 NULL, 2092 NULL,
@@ -2107,6 +2107,11 @@ w32_createwindow (f)
2107 2107
2108 /* Do this to discard the default setting specified by our parent. */ 2108 /* Do this to discard the default setting specified by our parent. */
2109 ShowWindow (hwnd, SW_HIDE); 2109 ShowWindow (hwnd, SW_HIDE);
2110
2111 /* Update frame positions. */
2112 GetWindowRect (hwnd, &rect);
2113 f->left_pos = rect.left;
2114 f->top_pos = rect.top;
2110 } 2115 }
2111} 2116}
2112 2117
diff --git a/src/w32term.c b/src/w32term.c
index f85a5334022..fdbbbb6327f 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5665,7 +5665,22 @@ x_make_frame_visible (f)
5665 before the window gets really visible. */ 5665 before the window gets really visible. */
5666 if (! FRAME_ICONIFIED_P (f) 5666 if (! FRAME_ICONIFIED_P (f)
5667 && ! f->output_data.w32->asked_for_visible) 5667 && ! f->output_data.w32->asked_for_visible)
5668 x_set_offset (f, f->left_pos, f->top_pos, 0); 5668 {
5669 RECT workarea_rect;
5670 RECT window_rect;
5671
5672 /* Adjust vertical window position in order to avoid being
5673 covered by a task bar placed at the bottom of the desktop. */
5674 SystemParametersInfo(SPI_GETWORKAREA, 0, &workarea_rect, 0);
5675 GetWindowRect(FRAME_W32_WINDOW(f), &window_rect);
5676 if (window_rect.bottom > workarea_rect.bottom
5677 && window_rect.top > workarea_rect.top)
5678 f->top_pos = max (window_rect.top
5679 - window_rect.bottom + workarea_rect.bottom,
5680 workarea_rect.top);
5681
5682 x_set_offset (f, f->left_pos, f->top_pos, 0);
5683 }
5669 5684
5670 f->output_data.w32->asked_for_visible = 1; 5685 f->output_data.w32->asked_for_visible = 1;
5671 5686
diff --git a/src/window.c b/src/window.c
index f3960b96f2a..77e155675dd 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3678,7 +3678,7 @@ displayed. */)
3678 3678
3679DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update, 3679DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update,
3680 0, 1, 0, 3680 0, 1, 0,
3681 doc: /* Force redisplay of all windows. 3681 doc: /* Force all windows to be updated on next redisplay.
3682If optional arg OBJECT is a window, force redisplay of that window only. 3682If optional arg OBJECT is a window, force redisplay of that window only.
3683If OBJECT is a buffer or buffer name, force redisplay of all windows 3683If OBJECT is a buffer or buffer name, force redisplay of all windows
3684displaying that buffer. */) 3684displaying that buffer. */)
@@ -5885,8 +5885,7 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
5885 register struct save_window_data *data; 5885 register struct save_window_data *data;
5886 struct Lisp_Vector *saved_windows; 5886 struct Lisp_Vector *saved_windows;
5887 5887
5888 if (! WINDOW_CONFIGURATIONP (config)) 5888 CHECK_WINDOW_CONFIGURATION (config);
5889 wrong_type_argument (Qwindow_configuration_p, config);
5890 5889
5891 data = (struct save_window_data *) XVECTOR (config); 5890 data = (struct save_window_data *) XVECTOR (config);
5892 saved_windows = XVECTOR (data->saved_windows); 5891 saved_windows = XVECTOR (data->saved_windows);
@@ -5911,8 +5910,7 @@ the return value is nil. Otherwise the value is t. */)
5911 FRAME_PTR f; 5910 FRAME_PTR f;
5912 int old_point = -1; 5911 int old_point = -1;
5913 5912
5914 while (!WINDOW_CONFIGURATIONP (configuration)) 5913 CHECK_WINDOW_CONFIGURATION (configuration);
5915 wrong_type_argument (Qwindow_configuration_p, configuration);
5916 5914
5917 data = (struct save_window_data *) XVECTOR (configuration); 5915 data = (struct save_window_data *) XVECTOR (configuration);
5918 saved_windows = XVECTOR (data->saved_windows); 5916 saved_windows = XVECTOR (data->saved_windows);
@@ -6951,10 +6949,8 @@ compare_window_configurations (c1, c2, ignore_positions)
6951 struct Lisp_Vector *sw1, *sw2; 6949 struct Lisp_Vector *sw1, *sw2;
6952 int i; 6950 int i;
6953 6951
6954 if (!WINDOW_CONFIGURATIONP (c1)) 6952 CHECK_WINDOW_CONFIGURATION (c1);
6955 wrong_type_argument (Qwindow_configuration_p, c1); 6953 CHECK_WINDOW_CONFIGURATION (c2);
6956 if (!WINDOW_CONFIGURATIONP (c2))
6957 wrong_type_argument (Qwindow_configuration_p, c2);
6958 6954
6959 d1 = (struct save_window_data *) XVECTOR (c1); 6955 d1 = (struct save_window_data *) XVECTOR (c1);
6960 d2 = (struct save_window_data *) XVECTOR (c2); 6956 d2 = (struct save_window_data *) XVECTOR (c2);
diff --git a/src/xdisp.c b/src/xdisp.c
index c7e6eda58ca..092c5d7c520 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4474,7 +4474,9 @@ handle_composition_prop (it)
4474 return HANDLED_RECOMPUTE_PROPS; 4474 return HANDLED_RECOMPUTE_PROPS;
4475 } 4475 }
4476 4476
4477 it->stop_charpos = end;
4477 push_it (it); 4478 push_it (it);
4479
4478 it->method = GET_FROM_COMPOSITION; 4480 it->method = GET_FROM_COMPOSITION;
4479 it->cmp_id = id; 4481 it->cmp_id = id;
4480 it->cmp_len = COMPOSITION_LENGTH (prop); 4482 it->cmp_len = COMPOSITION_LENGTH (prop);
@@ -4484,7 +4486,6 @@ handle_composition_prop (it)
4484 it->len = (STRINGP (it->string) 4486 it->len = (STRINGP (it->string)
4485 ? string_char_to_byte (it->string, end) 4487 ? string_char_to_byte (it->string, end)
4486 : CHAR_TO_BYTE (end)) - pos_byte; 4488 : CHAR_TO_BYTE (end)) - pos_byte;
4487 it->stop_charpos = end;
4488 handled = HANDLED_RETURN; 4489 handled = HANDLED_RETURN;
4489 } 4490 }
4490 } 4491 }
@@ -9608,6 +9609,12 @@ display_tool_bar_line (it, height)
9608 /* Glyph doesn't fit on line. Backtrack. */ 9609 /* Glyph doesn't fit on line. Backtrack. */
9609 row->used[TEXT_AREA] = n_glyphs_before; 9610 row->used[TEXT_AREA] = n_glyphs_before;
9610 *it = it_before; 9611 *it = it_before;
9612 /* If this is the only glyph on this line, it will never fit on the
9613 toolbar, so skip it. But ensure there is at least one glyph,
9614 so we don't accidentally disable the tool-bar. */
9615 if (n_glyphs_before == 0
9616 && (it->vpos > 0 || IT_STRING_CHARPOS (*it) < it->end_charpos-1))
9617 break;
9611 goto out; 9618 goto out;
9612 } 9619 }
9613 9620
@@ -9666,6 +9673,11 @@ display_tool_bar_line (it, height)
9666} 9673}
9667 9674
9668 9675
9676/* Max tool-bar height. */
9677
9678#define MAX_FRAME_TOOL_BAR_HEIGHT(f) \
9679 ((FRAME_LINE_HEIGHT (f) * FRAME_LINES (f)))
9680
9669/* Value is the number of screen lines needed to make all tool-bar 9681/* Value is the number of screen lines needed to make all tool-bar
9670 items of frame F visible. The number of actual rows needed is 9682 items of frame F visible. The number of actual rows needed is
9671 returned in *N_ROWS if non-NULL. */ 9683 returned in *N_ROWS if non-NULL. */
@@ -9677,7 +9689,10 @@ tool_bar_lines_needed (f, n_rows)
9677{ 9689{
9678 struct window *w = XWINDOW (f->tool_bar_window); 9690 struct window *w = XWINDOW (f->tool_bar_window);
9679 struct it it; 9691 struct it it;
9680 struct glyph_row *temp_row = w->desired_matrix->rows; 9692 /* tool_bar_lines_needed is called from redisplay_tool_bar after building
9693 the desired matrix, so use (unused) mode-line row as temporary row to
9694 avoid destroying the first tool-bar row. */
9695 struct glyph_row *temp_row = MATRIX_MODE_LINE_ROW (w->desired_matrix);
9681 9696
9682 /* Initialize an iterator for iteration over 9697 /* Initialize an iterator for iteration over
9683 F->desired_tool_bar_string in the tool-bar window of frame F. */ 9698 F->desired_tool_bar_string in the tool-bar window of frame F. */
@@ -9783,13 +9798,13 @@ redisplay_tool_bar (f)
9783 int old_height = WINDOW_TOTAL_LINES (w); 9798 int old_height = WINDOW_TOTAL_LINES (w);
9784 9799
9785 XSETFRAME (frame, f); 9800 XSETFRAME (frame, f);
9786 clear_glyph_matrix (w->desired_matrix);
9787 Fmodify_frame_parameters (frame, 9801 Fmodify_frame_parameters (frame,
9788 Fcons (Fcons (Qtool_bar_lines, 9802 Fcons (Fcons (Qtool_bar_lines,
9789 make_number (nlines)), 9803 make_number (nlines)),
9790 Qnil)); 9804 Qnil));
9791 if (WINDOW_TOTAL_LINES (w) != old_height) 9805 if (WINDOW_TOTAL_LINES (w) != old_height)
9792 { 9806 {
9807 clear_glyph_matrix (w->desired_matrix);
9793 fonts_changed_p = 1; 9808 fonts_changed_p = 1;
9794 return 1; 9809 return 1;
9795 } 9810 }
@@ -9841,17 +9856,20 @@ redisplay_tool_bar (f)
9841 9856
9842 if (auto_resize_tool_bars_p) 9857 if (auto_resize_tool_bars_p)
9843 { 9858 {
9844 int nlines; 9859 int nlines, nrows;
9860 int max_tool_bar_height = MAX_FRAME_TOOL_BAR_HEIGHT (f);
9845 9861
9846 /* If we couldn't display everything, change the tool-bar's 9862 /* If we couldn't display everything, change the tool-bar's
9847 height. */ 9863 height if there is room for more. */
9848 if (IT_STRING_CHARPOS (it) < it.end_charpos) 9864 if (IT_STRING_CHARPOS (it) < it.end_charpos
9865 && it.current_y < max_tool_bar_height)
9849 change_height_p = 1; 9866 change_height_p = 1;
9850 9867
9868 row = it.glyph_row - 1;
9869
9851 /* If there are blank lines at the end, except for a partially 9870 /* If there are blank lines at the end, except for a partially
9852 visible blank line at the end that is smaller than 9871 visible blank line at the end that is smaller than
9853 FRAME_LINE_HEIGHT, change the tool-bar's height. */ 9872 FRAME_LINE_HEIGHT, change the tool-bar's height. */
9854 row = it.glyph_row - 1;
9855 if (!row->displays_text_p 9873 if (!row->displays_text_p
9856 && row->height >= FRAME_LINE_HEIGHT (f)) 9874 && row->height >= FRAME_LINE_HEIGHT (f))
9857 change_height_p = 1; 9875 change_height_p = 1;
@@ -9859,13 +9877,14 @@ redisplay_tool_bar (f)
9859 /* If row displays tool-bar items, but is partially visible, 9877 /* If row displays tool-bar items, but is partially visible,
9860 change the tool-bar's height. */ 9878 change the tool-bar's height. */
9861 if (row->displays_text_p 9879 if (row->displays_text_p
9862 && MATRIX_ROW_BOTTOM_Y (row) > it.last_visible_y) 9880 && MATRIX_ROW_BOTTOM_Y (row) > it.last_visible_y
9881 && MATRIX_ROW_BOTTOM_Y (row) < max_tool_bar_height)
9863 change_height_p = 1; 9882 change_height_p = 1;
9864 9883
9865 /* Resize windows as needed by changing the `tool-bar-lines' 9884 /* Resize windows as needed by changing the `tool-bar-lines'
9866 frame parameter. */ 9885 frame parameter. */
9867 if (change_height_p 9886 if (change_height_p
9868 && (nlines = tool_bar_lines_needed (f, &f->n_tool_bar_rows), 9887 && (nlines = tool_bar_lines_needed (f, &nrows),
9869 nlines != WINDOW_TOTAL_LINES (w))) 9888 nlines != WINDOW_TOTAL_LINES (w)))
9870 { 9889 {
9871 extern Lisp_Object Qtool_bar_lines; 9890 extern Lisp_Object Qtool_bar_lines;
@@ -9873,13 +9892,16 @@ redisplay_tool_bar (f)
9873 int old_height = WINDOW_TOTAL_LINES (w); 9892 int old_height = WINDOW_TOTAL_LINES (w);
9874 9893
9875 XSETFRAME (frame, f); 9894 XSETFRAME (frame, f);
9876 clear_glyph_matrix (w->desired_matrix);
9877 Fmodify_frame_parameters (frame, 9895 Fmodify_frame_parameters (frame,
9878 Fcons (Fcons (Qtool_bar_lines, 9896 Fcons (Fcons (Qtool_bar_lines,
9879 make_number (nlines)), 9897 make_number (nlines)),
9880 Qnil)); 9898 Qnil));
9881 if (WINDOW_TOTAL_LINES (w) != old_height) 9899 if (WINDOW_TOTAL_LINES (w) != old_height)
9882 fonts_changed_p = 1; 9900 {
9901 clear_glyph_matrix (w->desired_matrix);
9902 f->n_tool_bar_rows = nrows;
9903 fonts_changed_p = 1;
9904 }
9883 } 9905 }
9884 } 9906 }
9885 9907
diff --git a/src/xfaces.c b/src/xfaces.c
index 1b9a9c079f1..398b56f42b6 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1174,14 +1174,11 @@ load_pixmap (f, name, w_ptr, h_ptr)
1174 unsigned int *w_ptr, *h_ptr; 1174 unsigned int *w_ptr, *h_ptr;
1175{ 1175{
1176 int bitmap_id; 1176 int bitmap_id;
1177 Lisp_Object tem;
1178 1177
1179 if (NILP (name)) 1178 if (NILP (name))
1180 return 0; 1179 return 0;
1181 1180
1182 tem = Fbitmap_spec_p (name); 1181 CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name);
1183 if (NILP (tem))
1184 wrong_type_argument (Qbitmap_spec_p, name);
1185 1182
1186 BLOCK_INPUT; 1183 BLOCK_INPUT;
1187 if (CONSP (name)) 1184 if (CONSP (name))
@@ -4816,7 +4813,14 @@ x_update_menu_appearance (f)
4816DEFUN ("face-attribute-relative-p", Fface_attribute_relative_p, 4813DEFUN ("face-attribute-relative-p", Fface_attribute_relative_p,
4817 Sface_attribute_relative_p, 4814 Sface_attribute_relative_p,
4818 2, 2, 0, 4815 2, 2, 0,
4819 doc: /* Return non-nil if face ATTRIBUTE VALUE is relative. */) 4816 doc: /* Check whether a face attribute value is relative.
4817Specifically, this function returns t if the attribute ATTRIBUTE
4818with the value VALUE is relative.
4819
4820A relative value is one that doesn't entirely override whatever is
4821inherited from another face. For most possible attributes,
4822the only relative value that users see is `unspecified'.
4823However, for :height, floating point values are also relative. */)
4820 (attribute, value) 4824 (attribute, value)
4821 Lisp_Object attribute, value; 4825 Lisp_Object attribute, value;
4822{ 4826{
diff --git a/src/xfns.c b/src/xfns.c
index e0cc89c6ebe..0e4b8860464 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3096,7 +3096,6 @@ This function is an internal primitive--use `make-frame' instead. */)
3096 f->output_data.x->scroll_bar_top_shadow_pixel = -1; 3096 f->output_data.x->scroll_bar_top_shadow_pixel = -1;
3097 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 3097 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
3098#endif /* USE_TOOLKIT_SCROLL_BARS */ 3098#endif /* USE_TOOLKIT_SCROLL_BARS */
3099 record_unwind_protect (unwind_create_frame, frame);
3100 3099
3101 f->icon_name 3100 f->icon_name
3102 = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", 3101 = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
@@ -3105,6 +3104,9 @@ This function is an internal primitive--use `make-frame' instead. */)
3105 f->icon_name = Qnil; 3104 f->icon_name = Qnil;
3106 3105
3107 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 3106 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
3107
3108 /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */
3109 record_unwind_protect (unwind_create_frame, frame);
3108#if GLYPH_DEBUG 3110#if GLYPH_DEBUG
3109 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; 3111 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
3110 dpyinfo_refcount = dpyinfo->reference_count; 3112 dpyinfo_refcount = dpyinfo->reference_count;
diff --git a/src/xterm.c b/src/xterm.c
index 975c9c68f39..14e71fffa80 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10841,13 +10841,16 @@ x_delete_display (dpyinfo)
10841 xfree (dpyinfo->font_table[i].name); 10841 xfree (dpyinfo->font_table[i].name);
10842 } 10842 }
10843 10843
10844 if (dpyinfo->font_table && dpyinfo->font_table->font_encoder)
10845 xfree (dpyinfo->font_table->font_encoder);
10846
10847 if (dpyinfo->font_table) 10844 if (dpyinfo->font_table)
10848 xfree (dpyinfo->font_table); 10845 {
10849 xfree (dpyinfo->x_id_name); 10846 if (dpyinfo->font_table->font_encoder)
10850 xfree (dpyinfo->color_cells); 10847 xfree (dpyinfo->font_table->font_encoder);
10848 xfree (dpyinfo->font_table);
10849 }
10850 if (dpyinfo->x_id_name)
10851 xfree (dpyinfo->x_id_name);
10852 if (dpyinfo->color_cells)
10853 xfree (dpyinfo->color_cells);
10851 xfree (dpyinfo); 10854 xfree (dpyinfo);
10852} 10855}
10853 10856