aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-07-19 00:42:56 +0000
committerMiles Bader2006-07-19 00:42:56 +0000
commit63db3c1b3ffa669435b10aa362115ef664990ab2 (patch)
treea62f68b147d4265ce993136af897d4f348570594 /src
parent2988d6b36d310ba98ea1fed570142f436804fc18 (diff)
parent83676aa2e399363120942ef5ea19f8af6b75e8e8 (diff)
downloademacs-63db3c1b3ffa669435b10aa362115ef664990ab2.tar.gz
emacs-63db3c1b3ffa669435b10aa362115ef664990ab2.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 343-356) - Update from CVS - Update for ERC 5.1.3. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 113-115) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-90
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog369
-rw-r--r--src/ChangeLog.unicode4
-rw-r--r--src/Makefile.in6
-rw-r--r--src/alloc.c15
-rw-r--r--src/buffer.c8
-rw-r--r--src/buffer.h2
-rw-r--r--src/bytecode.c69
-rw-r--r--src/callint.c14
-rw-r--r--src/casetab.c7
-rw-r--r--src/category.c4
-rw-r--r--src/category.h12
-rw-r--r--src/character.h6
-rw-r--r--src/cmds.c8
-rw-r--r--src/coding.c3
-rw-r--r--src/data.c146
-rw-r--r--src/dired.c3
-rw-r--r--src/dispextern.h1
-rw-r--r--src/dispnew.c121
-rw-r--r--src/doc.c4
-rw-r--r--src/editfns.c27
-rw-r--r--src/eval.c170
-rw-r--r--src/fileio.c68
-rw-r--r--src/floatfns.c30
-rw-r--r--src/fns.c163
-rw-r--r--src/frame.c6
-rw-r--r--src/frame.h17
-rw-r--r--src/fringe.c4
-rw-r--r--src/keyboard.c129
-rw-r--r--src/keymap.c8
-rw-r--r--src/lisp.h119
-rw-r--r--src/lread.c93
-rw-r--r--src/mac.c3
-rw-r--r--src/macros.c5
-rw-r--r--src/macselect.c8
-rw-r--r--src/macterm.c218
-rw-r--r--src/marker.c3
-rw-r--r--src/minibuf.c2
-rw-r--r--src/msdos.c6
-rw-r--r--src/print.c4
-rw-r--r--src/process.c4
-rw-r--r--src/puresize.h2
-rw-r--r--src/search.c21
-rw-r--r--src/sound.c10
-rw-r--r--src/sunfns.c2
-rw-r--r--src/syntax.c69
-rw-r--r--src/textprop.c7
-rw-r--r--src/unexsol.c2
-rw-r--r--src/w32.c54
-rw-r--r--src/w32.h4
-rw-r--r--src/w32proc.c7
-rw-r--r--src/w32term.c44
-rw-r--r--src/window.c24
-rw-r--r--src/xdisp.c26
-rw-r--r--src/xfaces.c19
-rw-r--r--src/xfns.c4
-rw-r--r--src/xselect.c82
-rw-r--r--src/xterm.c4
57 files changed, 1310 insertions, 960 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4b817c11eae..1ea2005e0c4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,372 @@
12006-07-18 Francis Litterio <franl@world.std.com>
2
3 * w32term.c (x_calc_absolute_position): Fix frame positioning
4 with negative X/Y coordinates.
5
62006-07-18 Dan Nicolaescu <dann@ics.uci.edu>
7
8 * xterm.c (x_connection_closed, x_error_quitter): Mark as NO_RETURN.
9
10 * textprop.c (text_read_only): Likewise.
11
12 * lread.c (end_of_file_error): Likewise.
13
14 * lisp.h (circular_list_error, memory_full, buffer_memory_full):
15 Likewise.
16
17 * eval.c (unwind_to_catch): Likewise.
18
19 * buffer.h (buffer_slot_type_mismatch): Likewise.
20
212006-07-18 Kim F. Storm <storm@cua.dk>
22
23 Cleanup Fsignal calls that never returns; now only use it for Qquit.
24
25 * eval.c (xsignal): New func. Like Fsignal, but marked no-return.
26 (xsignal0, xsignal1, xsignal2, xsignal3): New no-return functions.
27 (signal_error): New no-return function (from xfaces.c).
28 (Fthrow): Use xsignal2 instead of Fsignal + abort.
29 (error): Use xsignal1 instead of Fsignal + abort.
30 (FletX, Flet, grow_specpdl): Use signal_error.
31 (Feval, Ffuncall, funcall_lambda): Use xsignal1, xsignal2.
32
33 * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop.
34 (list1): New function.
35
36 * lisp.h (list1): Add EXFUN.
37 (xsignal, xsignal0, xsignal1, xsignal2, xsignal3, signal_error):
38 Add prototypes. Mark them as no-return.
39
40 * buffer.c (Fbuffer_local_value, Fbarf_if_buffer_read_only):
41 Use xsignal1.
42
43 * callint.c (check_mark): Use xsignal0.
44
45 * casefiddle.c (casify_object): wrong_type_argument is no-return.
46
47 * cmds.c (Fforward_char, Fdelete_char): Use xsignal0.
48
49 * coding.c (Fcheck_coding_system): Use xsignal1. Remove loop.
50 (Fdefine_coding_system_internal): Use xsignal1.
51
52 * data.c (circular_list_error): Use xsignal.
53 (wrong_type_argument): Use xsignal2. Don't care about return value.
54 (args_out_of_range, args_out_of_range_3): Use xsignal2, xsignal3.
55 Remove loop around Fsignal.
56 (indirect_variable, Fsymbol_value, set_internal, Fdefault_value)
57 (indirect_function, Findirect_function, Fstring_to_number)
58 (Fmakunbound, Ffmakunbound, Fsymbol_function, Ffset): Use xsignal1.
59 (arith_driver, float_arith_driver, Frem, Fmod, arith_error):
60 Use xsignal0.
61
62 * doc.c (Fdocumentation): Use xsignal1.
63
64 * editfns.c (region_limit, Fget_internal_run_time): Use xsignal0.
65
66 * fileio.c (report_file_error): Use xsignal.
67 (barf_or_query_if_file_exists, Fcopy_file, Fdelete_file)
68 (Finsert_file_contents): Use xsignal2.
69 (syms_of_fileio): Use list2, list3.
70
71 * floatfns.c (arith_error, range_error, domain_error): Use xsignal2.
72 (range_error2, domain_error2): Use xsignal3.
73 (rounding_driver, fmod_float): Use xsignal0.
74 (float_error): Use xsignal1.
75 (matherr): Use xsignal.
76
77 * fns.c (Flength): wrong_type_argument is no-return.
78 (hashfn_user_defined, Fmake_hash_table): Use signal_error.
79 (Fmd5): Use xsignal1.
80
81 * frame.c (x_set_line_spacing, x_set_screen_gamma): Use signal_error.
82
83 * keyboard.c (recursive_edit_1): Use xsignal1.
84
85 * keymap.c (Fmap_keymap): Use xsignal1.
86
87 * lread.c (Fload): Use xsignal2, signal_error.
88 (end_of_file_error): Use xsignal0, xsignal1.
89 (read0): Use xsignal1.
90 (invalid_syntax): New error function marked no-return.
91 (read_integer, read1, read_list): Use it.
92
93 * macselect.c (x_get_local_selection): Use signal_error.
94
95 * msdos.c (Fmsdos_set_mouse_buttons): Use xsignal2.
96
97 * search.c (compile_pattern_1): Use xsignal1.
98 (signal_failure): Remove (was only called once).
99 (search_command): Use xsignal1 instead of signal_failure.
100
101 * syntax.c (scan_lists): Use xsignal3.
102
103 * textprop.c (text_read_only): Use xsignal0, xsignal1.
104
105 * unexsol.c (unexec): Use xsignal.
106
107 * window.c (window_scroll_pixel_based, window_scroll_line_based):
108 Use xsignal0.
109
110 * xfaces.c (signal_error): Move to eval.c.
111 (resolve_face_name): Use xsignal1.
112
113 * xfns.c (x_decode_color): Use signal_error.
114
115 * xselect.c (x_get_local_selection, copy_multiple_data)
116 (x_get_window_property_as_lisp_data)
117 (lisp_data_to_selection_data, CHECK_CUT_BUFFER)
118 (Fx_get_cut_buffer_internal): Use signal_error.
119
1202006-07-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
121
122 * macterm.c (XTread_socket): Undo previous change.
123
1242006-07-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
125
126 * macterm.c (keycode_to_xkeysym): Remove function. All uses now
127 directly lookup keycode_to_xkeysym_table.
128 [USE_MAC_TSM] (mac_handle_text_input_event): Don't construct
129 ASCII_KEYSTROKE_EVENT for non-zero keycode_to_xkeysym_table entries.
130 (XTread_socket): Use character codes to construct keypad key events.
131 (mac_initialize_display_info) [MAC_OSX]: Use CGDisplaySamplesPerPixel.
132 (x_delete_display): Apply 2006-07-04 change for xterm.c.
133
1342006-07-17 Kim F. Storm <storm@cua.dk>
135
136 * xdisp.c (handle_single_display_spec): Ensure the right value of
137 it->position is saved by push_it.
138 (pop_it): Restore it->object for GET_FROM_BUFFER and GET_FROM_STRING.
139 (reseat_1): Don't setup it->object twice.
140 (set_iterator_to_next): No need to set it->object after pop_it.
141 (move_it_to): Explicitly check to see if last move reached to_charpos.
142
1432006-07-17 Thien-Thi Nguyen <ttn@gnu.org>
144
145 * xdisp.c (display_mode_line): Preserve match data.
146
1472006-07-14 Kim F. Storm <storm@cua.dk>
148
149 * w32.c (pfn_WSACreateEvent, pfn_WSACloseEvent): New func ptrs.
150 (init_winsock): Load them. Use ws2_32.dll.
151 (sys_listen): Undo last change. Just set FILE_LISTEN flag.
152 (sys_accept): Undo last change. Instead, set child status to
153 STATUS_READ_ACKNOWLEDGED and reset char_avail event so next
154 sys_select will wakeup the reader thread.
155 (_sys_wait_accept): New function used by reader thread to wait for
156 an incoming connection on a server socket.
157
158 * w32.h (_sys_read_ahead, _sys_wait_accept): Add prototypes.
159
160 * w32proc.c (reader_thread): Use _sys_wait_accept to wait on a
161 server socket (FILE_LISTEN flag).
162
1632006-07-14 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
164
165 * sound.c (alsa_init): Call snd_pcm_close after successful snd_pcm_open.
166
1672006-07-14 Kim F. Storm <storm@cua.dk>
168
169 * w32.c: Fix high cpu load for server sockets.
170 (pfn_WSAEventSelect): New function ptr.
171 (init_winsock): Load it.
172 (sys_listen): Set FILE_LISTEN flag. Set event mask for socket's
173 char_avail event object to FD_ACCEPT.
174 (sys_accept): Check FILE_LISTEN flag. Set event mask on new
175 socket's char_avail event object to FD_READ|FD_CLOSE.
176
177 * w32.h (FILE_LISTEN): New filedesc flag value.
178
1792006-07-13 Kim F. Storm <storm@cua.dk>
180
181 * bytecode.c (Fbyte_code): Use CAR, CDR for Bcar, Bcdr.
182 Use CAR_SAFE, CDR_SAFE for Bcar_safe, Bcdr_safe.
183 Simplify loops and use CAR for Bnth and Belt.
184
185 * data.c (Findirect_function): Optimize for no indirection.
186
187 * eval.c (Fthrow): Remove loop around Fsignal.
188 (Feval, Fapply, Ffuncall): Optimize for no function indirection.
189 Use original function name in all signaled errors.
190 Simplify Fsignal calls (no return).
191 (funcall_lambda): Simplify Fsignal calls (no return).
192
1932006-07-13 Andreas Schwab <schwab@suse.de>
194
195 * syntax.c (scan_sexps_forward): Use EMACS_INT for out_bytepos and
196 out_charpos.
197
1982006-07-13 Kenichi Handa <handa@m17n.org>
199
200 * editfns.c (Fformat): Fix calculation of text property positions
201 of format string.
202
2032006-07-12 Kim F. Storm <storm@cua.dk>
204
205 * lisp.h (CHECK_TYPE): New macro for generic type checking.
206 (CAR_SAFE, CDR_SAFE): New macros.
207 (ARRAYP, CHECK_ARRAY): New macros.
208 (CHECK_VECTOR_OR_STRING, CHECK_SUBR): New macros.
209 (CHECK_WINDOW_CONFIGURATION): New macro.
210 (CHECK_LIST_CONS, CHECK_LIST_END): New checks for list traversal.
211 (CHECK_STRING_OR_BUFFER, CHECK_HASH_TABLE, CHECK_LIST)
212 (CHECK_STRING, CHECK_STRING_CAR, CHECK_CONS, CHECK_SYMBOL)
213 (CHECK_CHAR_TABLE, CHECK_VECTOR, CHECK_VECTOR_OR_CHAR_TABLE)
214 (CHECK_BUFFER, CHECK_WINDOW, CHECK_LIVE_WINDOW, CHECK_PROCESS)
215 (CHECK_NUMBER, CHECK_NATNUM, CHECK_MARKER, CHECK_OVERLAY)
216 (CHECK_NUMBER_COERCE_MARKER, CHECK_FLOAT, CHECK_NUMBER_OR_FLOAT)
217 (CHECK_NUMBER_OR_FLOAT_COERCE_MARKER): Use CHECK_TYPE.
218
219 * category.h (CHECK_CATEGORY, CHECK_CATEGORY_SET):
220 * frame.h (CHECK_FRAME, CHECK_LIVE_FRAME): Use CHECK_TYPE.
221
222 * callint.c (Fcall_interactively):
223 * casefiddle.c (casify_object):
224 * editfns.c (general_insert_function):
225 * fns.c (Flength, Felt, Ffillarray):
226 * data.c (Fcar, Fcdr): Remove loop around wrong_type_argument.
227
228 * data.c (wrong_type_argument): Remove loop around Fsignal.
229 (Farrayp, Fsequencep): Use ARRAYP.
230 (Fcar): Use CAR.
231 (Fcar_safe): Use CAR_SAFE.
232 (Fcdr): Use CDR.
233 (Fcdr_safe): Use CDR_SAFE.
234 (Fsetcar, Fsetcdr): Use CHECK_CONS.
235 (Fsubr_arity, Fsubr_name): Use CHECK_SUBR.
236 (Faset): Use CHECK_ARRAY.
237
238 * fns.c (Felt): Use CHECK_ARRAY.
239 (concat): Use CHECK_NUMBER.
240 (Fsubstring, substring_both): Use CHECK_VECTOR_OR_STRING.
241 (Fmemq): Use CHECK_LIST.
242 (Fassq, Fassoc, Frassq, Frassoc): Use CAR.
243 (assq_no_quit): Use CAR_SAFE.
244 (Fnthcdr, Fmember, Fdelq, Fdelete, Fnreverse, Fnconc):
245 Use CHECK_LIST_CONS.
246 (Freverse, Fplist_get, Flax_plist_get): Use CHECK_LIST_END.
247
248 * bytecode.c (Fbyte_code): Use CHECK_VECTOR.
249
250 * casetab.c (check_case_table):
251 * category.c (check_category_table):
252 * marker.c (Fcopy_marker):
253 * syntax.c (check_syntax_table):
254 * xfaces.c (load_pixmap): Use CHECK_TYPE.
255
256 * fns.c (Fcopy_sequence, concat):
257 * fringe.c (Fdefine_fringe_bitmap):
258 * lread.c (check_obarray): Cleanup wrong_type_argument use.
259
260 * keyboard.c (access_keymap_keyremap): Use ARRAYP.
261
262 * keymap.c (Fdefine_key, Flookup_key):
263 * macros.c (Fstart_kbd_macro): Use CHECK_VECTOR_OR_STRING.
264
265 * mac.c (Fmac_get_preference): Use CHECK_LIST_END.
266
267 * search.c (Fset_match_data): Use CHECK_LIST.
268
269 * sunfns.c (sun_item_create): Use CHECK_LIST_CONS.
270
271 * window.c (Fwindow_configuration_frame, Fset_window_configuration):
272 (compare_window_configurations): Use CHECK_WINDOW_CONFIGURATION.
273
2742006-07-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
275
276 * Makefile.in (dired.o, editfns.o, fileio.o): Depend on blockinput.h.
277
278 * dired.c: Include blockinput.h.
279 (Ffile_attributes): Add BLOCK_INPUT around getpwuid/getgrgid.
280
281 * editfns.c: Include blockinput.h.
282 (Fuser_login_name, Fuser_full_name): Add BLOCK_INPUT around
283 getpwuid/getpwnam.
284
285 * fileio.c: Include blockinput.h.
286 (Fexpand_file_name, search_embedded_absfilename): Add BLOCK_INPUT
287 around getpwnam.
288 (search_embedded_absfilename): Remove spurious xfree.
289
2902006-07-11 Kim F. Storm <storm@cua.dk>
291
292 * dispnew.c (sit_for): Reduce number of args from 5 to 3.
293 Now just one TIMEOUT arg that can be a Lisp float or Lisp int.
294 Combine args DISPLAY and INITIAL_DISPLAY into one arg DO_DISPLAY.
295 Signal error if TIMEOUT is not a number.
296 Undo 2006-06-14 change for non-preemptive display if TIMEOUT < 0.
297 The rework of sit_for args also fixes several incorrect Qt args
298 which should have been 1.
299 (Fredisplay): Pass 1 instead of Qt to swallow_events and
300 detect_input_pending_run_timers.
301
302 * lisp.h (sit_for): Update prototype.
303 (Fredisplay): Add EXFUN.
304
305 * dispextern.h (sit_for): Remove prototype.
306
307 * callint.c (Fcall_interactively):
308 * minibuf.c (temp_echo_area_glyphs):
309 * keyboard.c (command_loop_1, read_char, Fexecute_extended_command):
310 * fileio.c (Fdo_auto_save): Update/simplify sit_for calls.
311
3122006-07-11 Stefan Monnier <monnier@iro.umontreal.ca>
313
314 * syntax.c (forw_comment): Also use EMACS_INT for buffer positions.
315
3162006-07-11 Kim F. Storm <storm@cua.dk>
317
318 * dispnew.c (Fredisplay): Add FORCE argument to force redisplay when
319 input is available. Fix test for redisplay_dont_pause non-nil.
320 Specbind redisplay-dont-pause to t if FORCE non-nil.
321
3222006-07-10 Chong Yidong <cyd@stupidchicken.com>
323
324 * puresize.h (BASE_PURESIZE): Increment to 1211000.
325
326 * dispnew.c (Fredisplay): New function, equivalent to (sit-for 0).
327 (Fsit_for): Function deleted.
328
329 * keyboard.c (command_loop_1, Fexecute_extended_command):
330 Call sit_for instead of Fsit_for.
331
332 * minibuf.c (temp_echo_area_glyphs): Likewise.
333
3342006-07-09 Stefan Monnier <monnier@iro.umontreal.ca>
335
336 * syntax.c (Fforward_comment): Revert the reversion.
337 (back_comment, scan_lists): Also use EMACS_INT for buffer positions.
338
3392006-07-09 John Paul Wallington <jpw@pobox.com>
340
341 * syntax.c (Fforward_comment): Revert previous change.
342
3432006-07-09 Kim F. Storm <storm@cua.dk>
344
345 * window.c (Fforce_window_update): Doc fix.
346
3472006-07-08 Stephen Gildea <gildea@stop.mail-abuse.org>
348
349 * fileio.c (do_auto_save_make_dir): Make the auto-save-list-file
350 directory unreadable for better user privacy.
351
3522006-07-07 Stefan Monnier <monnier@iro.umontreal.ca>
353
354 * syntax.c (Fforward_comment): Fix int-32 vs EMACS_INT-64 mixup.
355
356 * lread.c (read_filtered_event): Remove `register' qualifier because it
357 causes compilation problem with gcc-4.0.2-20051125 on amd64.
358 (readevalloop): Remove unused var `bpos'.
359 Yet another int/Lisp_Object mixup (YAILOM).
360
3612006-07-07 Eli Zaretskii <eliz@gnu.org>
362
363 * keyboard.c (Fexecute_extended_command): Mention the argument
364 PREFIXARG in the doc string.
365
3662006-07-07 Kim F. Storm <storm@cua.dk>
367
368 * fringe.c (Fdefine_fringe_bitmap): Doc fix.
369
12006-07-05 Chong Yidong <cyd@stupidchicken.com> 3702006-07-05 Chong Yidong <cyd@stupidchicken.com>
2 371
3 * insdel.c (prepare_to_modify_buffer): For an indirect buffer, do 372 * insdel.c (prepare_to_modify_buffer): For an indirect buffer, do
diff --git a/src/ChangeLog.unicode b/src/ChangeLog.unicode
index fcfc9d31657..7af2aa0784c 100644
--- a/src/ChangeLog.unicode
+++ b/src/ChangeLog.unicode
@@ -1,3 +1,7 @@
12006-07-18 Miles Bader <miles@gnu.org>
2
3 * character.h (CHECK_CHARACTER): Redefine in terms of CHECK_TYPE.
4
12006-07-14 Kenichi Handa <handa@m17n.org> 52006-07-14 Kenichi Handa <handa@m17n.org>
2 6
3 * font.h (LGLYPH_XOFF, LGLYPH_YOFF, LGLYPH_WIDTH, LGLYPH_WADJUST) 7 * font.h (LGLYPH_XOFF, LGLYPH_YOFF, LGLYPH_WIDTH, LGLYPH_WADJUST)
diff --git a/src/Makefile.in b/src/Makefile.in
index 342540df7be..beee481d611 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1129,7 +1129,7 @@ pre-crt0.o: pre-crt0.c
1129ecrt0.o: ecrt0.c $(config_h) 1129ecrt0.o: ecrt0.c $(config_h)
1130 CRT0_COMPILE ${srcdir}/ecrt0.c 1130 CRT0_COMPILE ${srcdir}/ecrt0.c
1131dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \ 1131dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \
1132 coding.h regex.h systime.h 1132 coding.h regex.h systime.h blockinput.h
1133dispnew.o: dispnew.c systty.h systime.h commands.h process.h frame.h \ 1133dispnew.o: dispnew.c systty.h systime.h commands.h process.h frame.h \
1134 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \ 1134 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
1135 disptab.h indent.h intervals.h \ 1135 disptab.h indent.h intervals.h \
@@ -1140,12 +1140,12 @@ doprnt.o: doprnt.c character.h $(config_h)
1140dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ 1140dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
1141 msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h) 1141 msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h)
1142editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \ 1142editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
1143 coding.h dispextern.h frame.h $(config_h) 1143 coding.h dispextern.h frame.h blockinput.h $(config_h)
1144emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ 1144emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
1145 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \ 1145 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \
1146 window.h dispextern.h keyboard.h keymap.h 1146 window.h dispextern.h keyboard.h keymap.h
1147fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \ 1147fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
1148 coding.h msdos.h dispextern.h $(config_h) 1148 coding.h msdos.h dispextern.h blockinput.h $(config_h)
1149filelock.o: filelock.c buffer.h character.h charset.h coding.h systime.h \ 1149filelock.o: filelock.c buffer.h character.h charset.h coding.h systime.h \
1150 epaths.h $(config_h) 1150 epaths.h $(config_h)
1151filemode.o: filemode.c $(config_h) 1151filemode.o: filemode.c $(config_h)
diff --git a/src/alloc.c b/src/alloc.c
index 7fd1560708a..2cf3ff40e3b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -559,8 +559,7 @@ buffer_memory_full ()
559 559
560 /* This used to call error, but if we've run out of memory, we could 560 /* This used to call error, but if we've run out of memory, we could
561 get infinite recursion trying to build the string. */ 561 get infinite recursion trying to build the string. */
562 while (1) 562 xsignal (Qnil, Vmemory_signal_data);
563 Fsignal (Qnil, Vmemory_signal_data);
564} 563}
565 564
566 565
@@ -2777,7 +2776,14 @@ check_cons_list ()
2777#endif 2776#endif
2778} 2777}
2779 2778
2780/* Make a list of 2, 3, 4 or 5 specified objects. */ 2779/* Make a list of 1, 2, 3, 4 or 5 specified objects. */
2780
2781Lisp_Object
2782list1 (arg1)
2783 Lisp_Object arg1;
2784{
2785 return Fcons (arg1, Qnil);
2786}
2781 2787
2782Lisp_Object 2788Lisp_Object
2783list2 (arg1, arg2) 2789list2 (arg1, arg2)
@@ -3450,8 +3456,7 @@ memory_full ()
3450 3456
3451 /* This used to call error, but if we've run out of memory, we could 3457 /* This used to call error, but if we've run out of memory, we could
3452 get infinite recursion trying to build the string. */ 3458 get infinite recursion trying to build the string. */
3453 while (1) 3459 xsignal (Qnil, Vmemory_signal_data);
3454 Fsignal (Qnil, Vmemory_signal_data);
3455} 3460}
3456 3461
3457/* If we released our reserve (due to running out of memory), 3462/* If we released our reserve (due to running out of memory),
diff --git a/src/buffer.c b/src/buffer.c
index 5bdfe737767..6115f727deb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -939,10 +939,10 @@ is the default binding of the variable. */)
939 result = XCDR (result); 939 result = XCDR (result);
940 } 940 }
941 941
942 if (EQ (result, Qunbound)) 942 if (!EQ (result, Qunbound))
943 return Fsignal (Qvoid_variable, Fcons (variable, Qnil)); 943 return result;
944 944
945 return result; 945 xsignal1 (Qvoid_variable, variable);
946} 946}
947 947
948/* Return an alist of the Lisp-level buffer-local bindings of 948/* Return an alist of the Lisp-level buffer-local bindings of
@@ -1962,7 +1962,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
1962{ 1962{
1963 if (!NILP (current_buffer->read_only) 1963 if (!NILP (current_buffer->read_only)
1964 && NILP (Vinhibit_read_only)) 1964 && NILP (Vinhibit_read_only))
1965 Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil))); 1965 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
1966 return Qnil; 1966 return Qnil;
1967} 1967}
1968 1968
diff --git a/src/buffer.h b/src/buffer.h
index 8015b2be15c..9d3ca6ea463 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -837,7 +837,7 @@ extern void set_buffer_internal P_ ((struct buffer *));
837extern void set_buffer_internal_1 P_ ((struct buffer *)); 837extern void set_buffer_internal_1 P_ ((struct buffer *));
838extern void set_buffer_temp P_ ((struct buffer *)); 838extern void set_buffer_temp P_ ((struct buffer *));
839extern void record_buffer P_ ((Lisp_Object)); 839extern void record_buffer P_ ((Lisp_Object));
840extern void buffer_slot_type_mismatch P_ ((int)); 840extern void buffer_slot_type_mismatch P_ ((int)) NO_RETURN;
841extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT)); 841extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
842extern void mmap_set_vars P_ ((int)); 842extern void mmap_set_vars P_ ((int));
843 843
diff --git a/src/bytecode.c b/src/bytecode.c
index e6f84cc6c2b..3ee9b5576b4 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
@@ -1563,23 +1535,10 @@ If the third argument is incorrect, Emacs may crash. */)
1563 AFTER_POTENTIAL_GC (); 1535 AFTER_POTENTIAL_GC ();
1564 op = XINT (v2); 1536 op = XINT (v2);
1565 immediate_quit = 1; 1537 immediate_quit = 1;
1566 while (--op >= 0) 1538 while (--op >= 0 && CONSP (v1))
1567 { 1539 v1 = XCDR (v1);
1568 if (CONSP (v1))
1569 v1 = XCDR (v1);
1570 else if (!NILP (v1))
1571 {
1572 immediate_quit = 0;
1573 wrong_type_argument (Qlistp, v1);
1574 }
1575 }
1576 immediate_quit = 0; 1540 immediate_quit = 0;
1577 if (CONSP (v1)) 1541 TOP = CAR (v1);
1578 TOP = XCAR (v1);
1579 else if (NILP (v1))
1580 TOP = Qnil;
1581 else
1582 wrong_type_argument (Qlistp, v1);
1583 } 1542 }
1584 else 1543 else
1585 { 1544 {
@@ -1641,10 +1600,7 @@ If the third argument is incorrect, Emacs may crash. */)
1641 { 1600 {
1642 Lisp_Object v1; 1601 Lisp_Object v1;
1643 v1 = TOP; 1602 v1 = TOP;
1644 if (CONSP (v1)) 1603 TOP = CAR_SAFE (v1);
1645 TOP = XCAR (v1);
1646 else
1647 TOP = Qnil;
1648 break; 1604 break;
1649 } 1605 }
1650 1606
@@ -1652,10 +1608,7 @@ If the third argument is incorrect, Emacs may crash. */)
1652 { 1608 {
1653 Lisp_Object v1; 1609 Lisp_Object v1;
1654 v1 = TOP; 1610 v1 = TOP;
1655 if (CONSP (v1)) 1611 TOP = CDR_SAFE (v1);
1656 TOP = XCDR (v1);
1657 else
1658 TOP = Qnil;
1659 break; 1612 break;
1660 } 1613 }
1661 1614
diff --git a/src/callint.c b/src/callint.c
index ae10e64e1de..475042abbe1 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -174,7 +174,7 @@ check_mark (for_region)
174 : "The mark is not set now"); 174 : "The mark is not set now");
175 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) 175 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive)
176 && NILP (current_buffer->mark_active)) 176 && NILP (current_buffer->mark_active))
177 Fsignal (Qmark_inactive, Qnil); 177 xsignal0 (Qmark_inactive);
178} 178}
179 179
180/* If the list of args INPUT was produced with an explicit call to 180/* If the list of args INPUT was produced with an explicit call to
@@ -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/casetab.c b/src/casetab.c
index 89f9287c75f..15bf133a869 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 9b47e6c00e9..b9f80982ee7 100644
--- a/src/category.c
+++ b/src/category.c
@@ -168,11 +168,9 @@ Lisp_Object
168check_category_table (table) 168check_category_table (table)
169 Lisp_Object table; 169 Lisp_Object table;
170{ 170{
171 register Lisp_Object tem;
172 if (NILP (table)) 171 if (NILP (table))
173 return current_buffer->category_table; 172 return current_buffer->category_table;
174 while (tem = Fcategory_table_p (table), NILP (tem)) 173 CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table);
175 table = wrong_type_argument (Qcategory_table_p, table);
176 return table; 174 return table;
177} 175}
178 176
diff --git a/src/category.h b/src/category.h
index fc755ed7d86..4799b7a5e3d 100644
--- a/src/category.h
+++ b/src/category.h
@@ -57,10 +57,8 @@ Boston, MA 02110-1301, USA. */
57#define CATEGORYP(x) \ 57#define CATEGORYP(x) \
58 (INTEGERP ((x)) && XFASTINT ((x)) >= 0x20 && XFASTINT ((x)) <= 0x7E) 58 (INTEGERP ((x)) && XFASTINT ((x)) >= 0x20 && XFASTINT ((x)) <= 0x7E)
59 59
60#define CHECK_CATEGORY(x) \ 60#define CHECK_CATEGORY(x) \
61 do { \ 61 CHECK_TYPE (CATEGORYP (x), Qcategoryp, x)
62 if (!CATEGORYP ((x))) x = wrong_type_argument (Qcategoryp, (x)); \
63 } while (0)
64 62
65#define XCATEGORY_SET XBOOL_VECTOR 63#define XCATEGORY_SET XBOOL_VECTOR
66 64
@@ -75,10 +73,8 @@ Boston, MA 02110-1301, USA. */
75#define SET_CATEGORY_SET(category_set, category, val) \ 73#define SET_CATEGORY_SET(category_set, category, val) \
76 (Faset (category_set, category, val)) 74 (Faset (category_set, category, val))
77 75
78#define CHECK_CATEGORY_SET(x) \ 76#define CHECK_CATEGORY_SET(x) \
79 do { \ 77 CHECK_TYPE (CATEGORY_SET_P (x), Qcategorysetp, x)
80 if (!CATEGORY_SET_P ((x))) x = wrong_type_argument (Qcategorysetp, (x)); \
81 } while (0)
82 78
83/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. 79/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0.
84 The faster version of `!NILP (Faref (category_set, category))'. */ 80 The faster version of `!NILP (Faref (category_set, category))'. */
diff --git a/src/character.h b/src/character.h
index d02fdfb8b79..72823752d96 100644
--- a/src/character.h
+++ b/src/character.h
@@ -112,10 +112,8 @@ extern char unibyte_has_multibyte_table[256];
112#define CHAR_VALID_P(c, genericp) ((unsigned) (c) <= MAX_CHAR) 112#define CHAR_VALID_P(c, genericp) ((unsigned) (c) <= MAX_CHAR)
113 113
114/* Check if Lisp object X is a character or not. */ 114/* Check if Lisp object X is a character or not. */
115#define CHECK_CHARACTER(x) \ 115#define CHECK_CHARACTER(x) \
116 do { \ 116 CHECK_TYPE (CHARACTERP (x), Qcharacterp, x)
117 if (! CHARACTERP(x)) x = wrong_type_argument (Qcharacterp, (x)); \
118 } while (0)
119 117
120#define CHECK_CHARACTER_CAR(x) \ 118#define CHECK_CHARACTER_CAR(x) \
121 do { \ 119 do { \
diff --git a/src/cmds.c b/src/cmds.c
index 72d35b8cefd..096b63dd453 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -77,12 +77,12 @@ On reaching end of buffer, stop and signal error. */)
77 if (new_point < BEGV) 77 if (new_point < BEGV)
78 { 78 {
79 SET_PT (BEGV); 79 SET_PT (BEGV);
80 Fsignal (Qbeginning_of_buffer, Qnil); 80 xsignal0 (Qbeginning_of_buffer);
81 } 81 }
82 if (new_point > ZV) 82 if (new_point > ZV)
83 { 83 {
84 SET_PT (ZV); 84 SET_PT (ZV);
85 Fsignal (Qend_of_buffer, Qnil); 85 xsignal0 (Qend_of_buffer);
86 } 86 }
87 87
88 SET_PT (new_point); 88 SET_PT (new_point);
@@ -245,14 +245,14 @@ N was explicitly specified. */)
245 if (XINT (n) < 0) 245 if (XINT (n) < 0)
246 { 246 {
247 if (pos < BEGV) 247 if (pos < BEGV)
248 Fsignal (Qbeginning_of_buffer, Qnil); 248 xsignal0 (Qbeginning_of_buffer);
249 else 249 else
250 del_range (pos, PT); 250 del_range (pos, PT);
251 } 251 }
252 else 252 else
253 { 253 {
254 if (pos > ZV) 254 if (pos > ZV)
255 Fsignal (Qend_of_buffer, Qnil); 255 xsignal0 (Qend_of_buffer);
256 else 256 else
257 del_range (PT, pos); 257 del_range (PT, pos);
258 } 258 }
diff --git a/src/coding.c b/src/coding.c
index 023dc95c35e..cb6df79fca0 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7170,8 +7170,7 @@ function `define-coding-system'. */)
7170 } 7170 }
7171 if (!NILP (Fcoding_system_p (coding_system))) 7171 if (!NILP (Fcoding_system_p (coding_system)))
7172 return coding_system; 7172 return coding_system;
7173 while (1) 7173 xsignal1 (Qcoding_system_error, coding_system);
7174 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
7175} 7174}
7176 7175
7177 7176
diff --git a/src/data.c b/src/data.c
index ec9a176f078..4a846207073 100644
--- a/src/data.c
+++ b/src/data.c
@@ -105,7 +105,7 @@ void
105circular_list_error (list) 105circular_list_error (list)
106 Lisp_Object list; 106 Lisp_Object list;
107{ 107{
108 Fsignal (Qcircular_list, list); 108 xsignal (Qcircular_list, list);
109} 109}
110 110
111 111
@@ -113,26 +113,12 @@ Lisp_Object
113wrong_type_argument (predicate, value) 113wrong_type_argument (predicate, value)
114 register Lisp_Object predicate, value; 114 register Lisp_Object predicate, value;
115{ 115{
116 register Lisp_Object tem; 116 /* If VALUE is not even a valid Lisp object, abort here
117 do 117 where we can get a backtrace showing where it came from. */
118 { 118 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit)
119 /* If VALUE is not even a valid Lisp object, abort here 119 abort ();
120 where we can get a backtrace showing where it came from. */
121 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit)
122 abort ();
123 120
124 value = Fsignal (Qwrong_type_argument, Fcons (predicate, Fcons (value, Qnil))); 121 xsignal2 (Qwrong_type_argument, predicate, value);
125 tem = call1 (predicate, value);
126 }
127 while (NILP (tem));
128 /* This function is marked as NO_RETURN, gcc would warn if it has a
129 return statement or if falls off the function. Other compilers
130 warn if no return statement is present. */
131#ifndef __GNUC__
132 return value;
133#else
134 abort ();
135#endif
136} 122}
137 123
138void 124void
@@ -145,16 +131,14 @@ void
145args_out_of_range (a1, a2) 131args_out_of_range (a1, a2)
146 Lisp_Object a1, a2; 132 Lisp_Object a1, a2;
147{ 133{
148 while (1) 134 xsignal2 (Qargs_out_of_range, a1, a2);
149 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Qnil)));
150} 135}
151 136
152void 137void
153args_out_of_range_3 (a1, a2, a3) 138args_out_of_range_3 (a1, a2, a3)
154 Lisp_Object a1, a2, a3; 139 Lisp_Object a1, a2, a3;
155{ 140{
156 while (1) 141 xsignal3 (Qargs_out_of_range, a1, a2, a3);
157 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Fcons (a3, Qnil))));
158} 142}
159 143
160/* On some machines, XINT needs a temporary location. 144/* On some machines, XINT needs a temporary location.
@@ -394,8 +378,7 @@ DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0,
394 (object) 378 (object)
395 Lisp_Object object; 379 Lisp_Object object;
396{ 380{
397 if (VECTORP (object) || STRINGP (object) 381 if (ARRAYP (object))
398 || CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
399 return Qt; 382 return Qt;
400 return Qnil; 383 return Qnil;
401} 384}
@@ -405,8 +388,7 @@ DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0,
405 (object) 388 (object)
406 register Lisp_Object object; 389 register Lisp_Object object;
407{ 390{
408 if (CONSP (object) || NILP (object) || VECTORP (object) || STRINGP (object) 391 if (CONSP (object) || NILP (object) || ARRAYP (object))
409 || CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
410 return Qt; 392 return Qt;
411 return Qnil; 393 return Qnil;
412} 394}
@@ -536,15 +518,7 @@ Lisp concepts such as car, cdr, cons cell and list. */)
536 (list) 518 (list)
537 register Lisp_Object list; 519 register Lisp_Object list;
538{ 520{
539 while (1) 521 return CAR (list);
540 {
541 if (CONSP (list))
542 return XCAR (list);
543 else if (EQ (list, Qnil))
544 return Qnil;
545 else
546 list = wrong_type_argument (Qlistp, list);
547 }
548} 522}
549 523
550DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0, 524DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
@@ -552,10 +526,7 @@ DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
552 (object) 526 (object)
553 Lisp_Object object; 527 Lisp_Object object;
554{ 528{
555 if (CONSP (object)) 529 return CAR_SAFE (object);
556 return XCAR (object);
557 else
558 return Qnil;
559} 530}
560 531
561DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0, 532DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0,
@@ -567,15 +538,7 @@ Lisp concepts such as cdr, car, cons cell and list. */)
567 (list) 538 (list)
568 register Lisp_Object list; 539 register Lisp_Object list;
569{ 540{
570 while (1) 541 return CDR (list);
571 {
572 if (CONSP (list))
573 return XCDR (list);
574 else if (EQ (list, Qnil))
575 return Qnil;
576 else
577 list = wrong_type_argument (Qlistp, list);
578 }
579} 542}
580 543
581DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0, 544DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
@@ -583,10 +546,7 @@ DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
583 (object) 546 (object)
584 Lisp_Object object; 547 Lisp_Object object;
585{ 548{
586 if (CONSP (object)) 549 return CDR_SAFE (object);
587 return XCDR (object);
588 else
589 return Qnil;
590} 550}
591 551
592DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0, 552DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
@@ -594,9 +554,7 @@ DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
594 (cell, newcar) 554 (cell, newcar)
595 register Lisp_Object cell, newcar; 555 register Lisp_Object cell, newcar;
596{ 556{
597 if (!CONSP (cell)) 557 CHECK_CONS (cell);
598 cell = wrong_type_argument (Qconsp, cell);
599
600 CHECK_IMPURE (cell); 558 CHECK_IMPURE (cell);
601 XSETCAR (cell, newcar); 559 XSETCAR (cell, newcar);
602 return newcar; 560 return newcar;
@@ -607,9 +565,7 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
607 (cell, newcdr) 565 (cell, newcdr)
608 register Lisp_Object cell, newcdr; 566 register Lisp_Object cell, newcdr;
609{ 567{
610 if (!CONSP (cell)) 568 CHECK_CONS (cell);
611 cell = wrong_type_argument (Qconsp, cell);
612
613 CHECK_IMPURE (cell); 569 CHECK_IMPURE (cell);
614 XSETCDR (cell, newcdr); 570 XSETCDR (cell, newcdr);
615 return newcdr; 571 return newcdr;
@@ -651,7 +607,7 @@ Return SYMBOL. */)
651{ 607{
652 CHECK_SYMBOL (symbol); 608 CHECK_SYMBOL (symbol);
653 if (XSYMBOL (symbol)->constant) 609 if (XSYMBOL (symbol)->constant)
654 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 610 xsignal1 (Qsetting_constant, symbol);
655 Fset (symbol, Qunbound); 611 Fset (symbol, Qunbound);
656 return symbol; 612 return symbol;
657} 613}
@@ -664,7 +620,7 @@ Return SYMBOL. */)
664{ 620{
665 CHECK_SYMBOL (symbol); 621 CHECK_SYMBOL (symbol);
666 if (NILP (symbol) || EQ (symbol, Qt)) 622 if (NILP (symbol) || EQ (symbol, Qt))
667 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 623 xsignal1 (Qsetting_constant, symbol);
668 XSYMBOL (symbol)->function = Qunbound; 624 XSYMBOL (symbol)->function = Qunbound;
669 return symbol; 625 return symbol;
670} 626}
@@ -675,9 +631,9 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
675 register Lisp_Object symbol; 631 register Lisp_Object symbol;
676{ 632{
677 CHECK_SYMBOL (symbol); 633 CHECK_SYMBOL (symbol);
678 if (EQ (XSYMBOL (symbol)->function, Qunbound)) 634 if (!EQ (XSYMBOL (symbol)->function, Qunbound))
679 return Fsignal (Qvoid_function, Fcons (symbol, Qnil)); 635 return XSYMBOL (symbol)->function;
680 return XSYMBOL (symbol)->function; 636 xsignal1 (Qvoid_function, symbol);
681} 637}
682 638
683DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, 639DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
@@ -708,7 +664,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
708{ 664{
709 CHECK_SYMBOL (symbol); 665 CHECK_SYMBOL (symbol);
710 if (NILP (symbol) || EQ (symbol, Qt)) 666 if (NILP (symbol) || EQ (symbol, Qt))
711 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 667 xsignal1 (Qsetting_constant, symbol);
712 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound)) 668 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound))
713 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function), 669 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function),
714 Vautoload_queue); 670 Vautoload_queue);
@@ -764,8 +720,7 @@ function with `&rest' args, or `unevalled' for a special form. */)
764 Lisp_Object subr; 720 Lisp_Object subr;
765{ 721{
766 short minargs, maxargs; 722 short minargs, maxargs;
767 if (!SUBRP (subr)) 723 CHECK_SUBR (subr);
768 wrong_type_argument (Qsubrp, subr);
769 minargs = XSUBR (subr)->min_args; 724 minargs = XSUBR (subr)->min_args;
770 maxargs = XSUBR (subr)->max_args; 725 maxargs = XSUBR (subr)->max_args;
771 if (maxargs == MANY) 726 if (maxargs == MANY)
@@ -783,8 +738,7 @@ SUBR must be a built-in function. */)
783 Lisp_Object subr; 738 Lisp_Object subr;
784{ 739{
785 const char *name; 740 const char *name;
786 if (!SUBRP (subr)) 741 CHECK_SUBR (subr);
787 wrong_type_argument (Qsubrp, subr);
788 name = XSUBR (subr)->symbol_name; 742 name = XSUBR (subr)->symbol_name;
789 return make_string (name, strlen (name)); 743 return make_string (name, strlen (name));
790} 744}
@@ -852,7 +806,7 @@ indirect_variable (symbol)
852 tortoise = XSYMBOL (tortoise)->value; 806 tortoise = XSYMBOL (tortoise)->value;
853 807
854 if (EQ (hare, tortoise)) 808 if (EQ (hare, tortoise))
855 Fsignal (Qcyclic_variable_indirection, Fcons (symbol, Qnil)); 809 xsignal1 (Qcyclic_variable_indirection, symbol);
856 } 810 }
857 811
858 return hare; 812 return hare;
@@ -1153,10 +1107,10 @@ DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
1153 Lisp_Object val; 1107 Lisp_Object val;
1154 1108
1155 val = find_symbol_value (symbol); 1109 val = find_symbol_value (symbol);
1156 if (EQ (val, Qunbound)) 1110 if (!EQ (val, Qunbound))
1157 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil));
1158 else
1159 return val; 1111 return val;
1112
1113 xsignal1 (Qvoid_variable, symbol);
1160} 1114}
1161 1115
1162DEFUN ("set", Fset, Sset, 2, 2, 0, 1116DEFUN ("set", Fset, Sset, 2, 2, 0,
@@ -1220,7 +1174,7 @@ set_internal (symbol, newval, buf, bindflag)
1220 if (SYMBOL_CONSTANT_P (symbol) 1174 if (SYMBOL_CONSTANT_P (symbol)
1221 && (NILP (Fkeywordp (symbol)) 1175 && (NILP (Fkeywordp (symbol))
1222 || !EQ (newval, SYMBOL_VALUE (symbol)))) 1176 || !EQ (newval, SYMBOL_VALUE (symbol))))
1223 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 1177 xsignal1 (Qsetting_constant, symbol);
1224 1178
1225 innercontents = valcontents = SYMBOL_VALUE (symbol); 1179 innercontents = valcontents = SYMBOL_VALUE (symbol);
1226 1180
@@ -1414,9 +1368,10 @@ local bindings in certain buffers. */)
1414 register Lisp_Object value; 1368 register Lisp_Object value;
1415 1369
1416 value = default_value (symbol); 1370 value = default_value (symbol);
1417 if (EQ (value, Qunbound)) 1371 if (!EQ (value, Qunbound))
1418 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil)); 1372 return value;
1419 return value; 1373
1374 xsignal1 (Qvoid_variable, symbol);
1420} 1375}
1421 1376
1422DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0, 1377DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0,
@@ -1928,7 +1883,7 @@ indirect_function (object)
1928 tortoise = XSYMBOL (tortoise)->function; 1883 tortoise = XSYMBOL (tortoise)->function;
1929 1884
1930 if (EQ (hare, tortoise)) 1885 if (EQ (hare, tortoise))
1931 Fsignal (Qcyclic_function_indirection, Fcons (object, Qnil)); 1886 xsignal1 (Qcyclic_function_indirection, object);
1932 } 1887 }
1933 1888
1934 return hare; 1889 return hare;
@@ -1948,13 +1903,18 @@ function chain of symbols. */)
1948{ 1903{
1949 Lisp_Object result; 1904 Lisp_Object result;
1950 1905
1951 result = indirect_function (object); 1906 /* Optimize for no indirection. */
1907 result = object;
1908 if (SYMBOLP (result) && !EQ (result, Qunbound)
1909 && (result = XSYMBOL (result)->function, SYMBOLP (result)))
1910 result = indirect_function (result);
1911 if (!EQ (result, Qunbound))
1912 return result;
1913
1914 if (NILP (noerror))
1915 xsignal1 (Qvoid_function, object);
1952 1916
1953 if (EQ (result, Qunbound)) 1917 return Qnil;
1954 return (NILP (noerror)
1955 ? Fsignal (Qvoid_function, Fcons (object, Qnil))
1956 : Qnil);
1957 return result;
1958} 1918}
1959 1919
1960/* Extract and set vector and string elements */ 1920/* Extract and set vector and string elements */
@@ -2028,9 +1988,7 @@ bool-vector. IDX starts at 0. */)
2028 1988
2029 CHECK_NUMBER (idx); 1989 CHECK_NUMBER (idx);
2030 idxval = XINT (idx); 1990 idxval = XINT (idx);
2031 if (!VECTORP (array) && !STRINGP (array) && !BOOL_VECTOR_P (array) 1991 CHECK_ARRAY (array, Qarrayp);
2032 && ! CHAR_TABLE_P (array))
2033 array = wrong_type_argument (Qarrayp, array);
2034 CHECK_IMPURE (array); 1992 CHECK_IMPURE (array);
2035 1993
2036 if (VECTORP (array)) 1994 if (VECTORP (array))
@@ -2340,7 +2298,7 @@ If the base used is not 10, floating point is not recognized. */)
2340 CHECK_NUMBER (base); 2298 CHECK_NUMBER (base);
2341 b = XINT (base); 2299 b = XINT (base);
2342 if (b < 2 || b > 16) 2300 if (b < 2 || b > 16)
2343 Fsignal (Qargs_out_of_range, Fcons (base, Qnil)); 2301 xsignal1 (Qargs_out_of_range, base);
2344 } 2302 }
2345 2303
2346 /* Skip any whitespace at the front of the number. Some versions of 2304 /* Skip any whitespace at the front of the number. Some versions of
@@ -2452,7 +2410,7 @@ arith_driver (code, nargs, args)
2452 else 2410 else
2453 { 2411 {
2454 if (next == 0) 2412 if (next == 0)
2455 Fsignal (Qarith_error, Qnil); 2413 xsignal0 (Qarith_error);
2456 accum /= next; 2414 accum /= next;
2457 } 2415 }
2458 break; 2416 break;
@@ -2525,7 +2483,7 @@ float_arith_driver (accum, argnum, code, nargs, args)
2525 else 2483 else
2526 { 2484 {
2527 if (! IEEE_FLOATING_POINT && next == 0) 2485 if (! IEEE_FLOATING_POINT && next == 0)
2528 Fsignal (Qarith_error, Qnil); 2486 xsignal0 (Qarith_error);
2529 accum /= next; 2487 accum /= next;
2530 } 2488 }
2531 break; 2489 break;
@@ -2607,7 +2565,7 @@ Both must be integers or markers. */)
2607 CHECK_NUMBER_COERCE_MARKER (y); 2565 CHECK_NUMBER_COERCE_MARKER (y);
2608 2566
2609 if (XFASTINT (y) == 0) 2567 if (XFASTINT (y) == 0)
2610 Fsignal (Qarith_error, Qnil); 2568 xsignal0 (Qarith_error);
2611 2569
2612 XSETINT (val, XINT (x) % XINT (y)); 2570 XSETINT (val, XINT (x) % XINT (y));
2613 return val; 2571 return val;
@@ -2656,7 +2614,7 @@ Both X and Y must be numbers or markers. */)
2656 i2 = XINT (y); 2614 i2 = XINT (y);
2657 2615
2658 if (i2 == 0) 2616 if (i2 == 0)
2659 Fsignal (Qarith_error, Qnil); 2617 xsignal0 (Qarith_error);
2660 2618
2661 i1 %= i2; 2619 i1 %= i2;
2662 2620
@@ -3260,7 +3218,7 @@ arith_error (signo)
3260#endif /* not BSD4_1 */ 3218#endif /* not BSD4_1 */
3261 3219
3262 SIGNAL_THREAD_CHECK (signo); 3220 SIGNAL_THREAD_CHECK (signo);
3263 Fsignal (Qarith_error, Qnil); 3221 xsignal0 (Qarith_error);
3264} 3222}
3265 3223
3266void 3224void
diff --git a/src/dired.c b/src/dired.c
index fe3382fd7a7..1aea81c2a21 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -100,6 +100,7 @@ extern struct direct *readdir ();
100#include "charset.h" 100#include "charset.h"
101#include "coding.h" 101#include "coding.h"
102#include "regex.h" 102#include "regex.h"
103#include "blockinput.h"
103 104
104/* Returns a search buffer, with a fastmap allocated and ready to go. */ 105/* Returns a search buffer, with a fastmap allocated and ready to go. */
105extern struct re_pattern_buffer *compile_pattern (); 106extern struct re_pattern_buffer *compile_pattern ();
@@ -952,10 +953,12 @@ Elements of the attribute list are:
952 } 953 }
953 else 954 else
954 { 955 {
956 BLOCK_INPUT;
955 pw = (struct passwd *) getpwuid (s.st_uid); 957 pw = (struct passwd *) getpwuid (s.st_uid);
956 values[2] = (pw ? build_string (pw->pw_name) : make_number (s.st_uid)); 958 values[2] = (pw ? build_string (pw->pw_name) : make_number (s.st_uid));
957 gr = (struct group *) getgrgid (s.st_gid); 959 gr = (struct group *) getgrgid (s.st_gid);
958 values[3] = (gr ? build_string (gr->gr_name) : make_number (s.st_gid)); 960 values[3] = (gr ? build_string (gr->gr_name) : make_number (s.st_gid));
961 UNBLOCK_INPUT;
959 } 962 }
960 values[4] = make_time (s.st_atime); 963 values[4] = make_time (s.st_atime);
961 values[5] = make_time (s.st_mtime); 964 values[5] = make_time (s.st_mtime);
diff --git a/src/dispextern.h b/src/dispextern.h
index 0acaf6b38ec..3cd9eb6052a 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2982,7 +2982,6 @@ int scrolling P_ ((struct frame *));
2982void do_pending_window_change P_ ((int)); 2982void do_pending_window_change P_ ((int));
2983void change_frame_size P_ ((struct frame *, int, int, int, int, int)); 2983void change_frame_size P_ ((struct frame *, int, int, int, int, int));
2984void bitch_at_user P_ ((void)); 2984void bitch_at_user P_ ((void));
2985Lisp_Object sit_for P_ ((int, int, int, int, int));
2986void init_display P_ ((void)); 2985void init_display P_ ((void));
2987void syms_of_display P_ ((void)); 2986void syms_of_display P_ ((void));
2988extern Lisp_Object Qredisplay_dont_pause; 2987extern Lisp_Object Qredisplay_dont_pause;
diff --git a/src/dispnew.c b/src/dispnew.c
index bf0d0044491..f621aef273a 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6481,31 +6481,43 @@ Emacs was built without floating point support.
6481 6481
6482 6482
6483/* This is just like wait_reading_process_output, except that 6483/* This is just like wait_reading_process_output, except that
6484 it does the redisplay. 6484 it does redisplay.
6485 6485
6486 It's also much like Fsit_for, except that it can be used for 6486 TIMEOUT is number of seconds to wait (float or integer).
6487 waiting for input as well. */ 6487 READING is 1 if reading input.
6488 If DO_DISPLAY is >0 display process output while waiting.
6489 If DO_DISPLAY is >1 perform an initial redisplay before waiting.
6490*/
6488 6491
6489Lisp_Object 6492Lisp_Object
6490sit_for (sec, usec, reading, display, initial_display) 6493sit_for (timeout, reading, do_display)
6491 int sec, usec, reading, display, initial_display; 6494 Lisp_Object timeout;
6495 int reading, do_display;
6492{ 6496{
6493 int preempt = (sec > 0) || (sec == 0 && usec >= 0); 6497 int sec, usec;
6494 6498
6495 swallow_events (display); 6499 swallow_events (do_display);
6496 6500
6497 if ((detect_input_pending_run_timers (display) && preempt) 6501 if ((detect_input_pending_run_timers (do_display))
6498 || !NILP (Vexecuting_kbd_macro)) 6502 || !NILP (Vexecuting_kbd_macro))
6499 return Qnil; 6503 return Qnil;
6500 6504
6501 if (initial_display) 6505 if (do_display >= 2)
6506 redisplay_preserve_echo_area (2);
6507
6508 if (INTEGERP (timeout))
6502 { 6509 {
6503 int count = SPECPDL_INDEX (); 6510 sec = XINT (timeout);
6504 if (!preempt) 6511 usec = 0;
6505 specbind (Qredisplay_dont_pause, Qt);
6506 redisplay_preserve_echo_area (2);
6507 unbind_to (count, Qnil);
6508 } 6512 }
6513 else if (FLOATP (timeout))
6514 {
6515 double seconds = XFLOAT_DATA (timeout);
6516 sec = (int) seconds;
6517 usec = (int) ((seconds - sec) * 1000000);
6518 }
6519 else
6520 wrong_type_argument (Qnumberp, timeout);
6509 6521
6510 if (sec == 0 && usec == 0) 6522 if (sec == 0 && usec == 0)
6511 return Qt; 6523 return Qt;
@@ -6514,63 +6526,34 @@ sit_for (sec, usec, reading, display, initial_display)
6514 gobble_input (0); 6526 gobble_input (0);
6515#endif 6527#endif
6516 6528
6517 wait_reading_process_output (sec, usec, reading ? -1 : 1, display, 6529 wait_reading_process_output (sec, usec, reading ? -1 : 1, do_display,
6518 Qnil, NULL, 0); 6530 Qnil, NULL, 0);
6519 6531
6520 return detect_input_pending () ? Qnil : Qt; 6532 return detect_input_pending () ? Qnil : Qt;
6521} 6533}
6522 6534
6523 6535
6524DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0, 6536DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0,
6525 doc: /* Perform redisplay, then wait for SECONDS seconds or until input is available. 6537 doc: /* Perform redisplay if no input is available.
6526SECONDS may be a floating-point value, meaning that you can wait for a 6538If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil,
6527fraction of a second. 6539perform a full redisplay even if input is available. */)
6528\(Not all operating systems support waiting for a fraction of a second.) 6540 (force)
6529Optional arg NODISP non-nil means don't redisplay, just wait for input. 6541 Lisp_Object force;
6530Redisplay is preempted as always if input arrives, and does not happen
6531if input is available before it starts.
6532Value is t if waited the full time with no input arriving.
6533
6534Redisplay will occur even when input is available if SECONDS is negative.
6535
6536An obsolete but still supported form is
6537\(sit-for SECONDS &optional MILLISECONDS NODISP)
6538Where the optional arg MILLISECONDS specifies an additional wait period,
6539in milliseconds; this was useful when Emacs was built without
6540floating point support.
6541usage: (sit-for SECONDS &optional NODISP OLD-NODISP) */)
6542
6543/* The `old-nodisp' stuff is there so that the arglist has the correct
6544 length. Otherwise, `defdvice' will redefine it with fewer args. */
6545 (seconds, milliseconds, nodisp)
6546 Lisp_Object seconds, milliseconds, nodisp;
6547{ 6542{
6548 int sec, usec; 6543 int count;
6549
6550 if (NILP (nodisp) && !NUMBERP (milliseconds))
6551 { /* New style. */
6552 nodisp = milliseconds;
6553 milliseconds = Qnil;
6554 }
6555 6544
6556 if (NILP (milliseconds)) 6545 swallow_events (1);
6557 XSETINT (milliseconds, 0); 6546 if ((detect_input_pending_run_timers (1)
6558 else 6547 && NILP (force) && !redisplay_dont_pause)
6559 CHECK_NUMBER (milliseconds); 6548 || !NILP (Vexecuting_kbd_macro))
6560 usec = XINT (milliseconds) * 1000; 6549 return Qnil;
6561
6562 {
6563 double duration = extract_float (seconds);
6564 sec = (int) duration;
6565 usec += (duration - sec) * 1000000;
6566 }
6567
6568#ifndef EMACS_HAS_USECS
6569 if (usec != 0 && sec == 0)
6570 error ("Millisecond `sit-for' not supported on %s", SYSTEM_TYPE);
6571#endif
6572 6550
6573 return sit_for (sec, usec, 0, NILP (nodisp), NILP (nodisp)); 6551 count = SPECPDL_INDEX ();
6552 if (!NILP (force) && !redisplay_dont_pause)
6553 specbind (Qredisplay_dont_pause, Qt);
6554 redisplay_preserve_echo_area (2);
6555 unbind_to (count, Qnil);
6556 return Qt;
6574} 6557}
6575 6558
6576 6559
@@ -6828,9 +6811,15 @@ init_display ()
6828For types defined in VMS, use set term /device=TYPE.\n\ 6811For types defined in VMS, use set term /device=TYPE.\n\
6829For types not defined in VMS, use define emacs_term \"TYPE\".\n\ 6812For types not defined in VMS, use define emacs_term \"TYPE\".\n\
6830\(The quotation marks are necessary since terminal types are lower case.)\n"); 6813\(The quotation marks are necessary since terminal types are lower case.)\n");
6831#else 6814#else /* not VMS */
6832 fprintf (stderr, "Please set the environment variable TERM; see tset(1).\n"); 6815
6833#endif 6816#ifdef HAVE_WINDOW_SYSTEM
6817 if (! inhibit_window_system)
6818 fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see `tset').\n");
6819 else
6820#endif /* HAVE_WINDOW_SYSTEM */
6821 fprintf (stderr, "Please set the environment variable TERM; see `tset'.\n");
6822#endif /* not VMS */
6834 exit (1); 6823 exit (1);
6835 } 6824 }
6836 6825
@@ -6960,7 +6949,7 @@ syms_of_display ()
6960 defsubr (&Sframe_or_buffer_changed_p); 6949 defsubr (&Sframe_or_buffer_changed_p);
6961 defsubr (&Sopen_termscript); 6950 defsubr (&Sopen_termscript);
6962 defsubr (&Sding); 6951 defsubr (&Sding);
6963 defsubr (&Ssit_for); 6952 defsubr (&Sredisplay);
6964 defsubr (&Ssleep_for); 6953 defsubr (&Ssleep_for);
6965 defsubr (&Ssend_string_to_terminal); 6954 defsubr (&Ssend_string_to_terminal);
6966 defsubr (&Sinternal_show_cursor); 6955 defsubr (&Sinternal_show_cursor);
diff --git a/src/doc.c b/src/doc.c
index a69c3cf4382..ecb0197b3ca 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -416,7 +416,7 @@ string is passed through `substitute-command-keys'. */)
416 { 416 {
417 funcar = Fcar (fun); 417 funcar = Fcar (fun);
418 if (!SYMBOLP (funcar)) 418 if (!SYMBOLP (funcar))
419 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 419 xsignal1 (Qinvalid_function, fun);
420 else if (EQ (funcar, Qkeymap)) 420 else if (EQ (funcar, Qkeymap))
421 return build_string ("Prefix command (definition is a keymap associating keystrokes with commands)."); 421 return build_string ("Prefix command (definition is a keymap associating keystrokes with commands).");
422 else if (EQ (funcar, Qlambda) 422 else if (EQ (funcar, Qlambda)
@@ -443,7 +443,7 @@ string is passed through `substitute-command-keys'. */)
443 else 443 else
444 { 444 {
445 oops: 445 oops:
446 Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 446 xsignal1 (Qinvalid_function, fun);
447 } 447 }
448 448
449 /* If DOC is 0, it's typically because of a dumped file missing 449 /* If DOC is 0, it's typically because of a dumped file missing
diff --git a/src/editfns.c b/src/editfns.c
index d758e82bbb0..46d661452b2 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>
@@ -313,7 +314,7 @@ region_limit (beginningp)
313 if (!NILP (Vtransient_mark_mode) 314 if (!NILP (Vtransient_mark_mode)
314 && NILP (Vmark_even_if_inactive) 315 && NILP (Vmark_even_if_inactive)
315 && NILP (current_buffer->mark_active)) 316 && NILP (current_buffer->mark_active))
316 Fsignal (Qmark_inactive, Qnil); 317 xsignal0 (Qmark_inactive);
317 318
318 m = Fmarker_position (current_buffer->mark); 319 m = Fmarker_position (current_buffer->mark);
319 if (NILP (m)) 320 if (NILP (m))
@@ -1300,7 +1301,9 @@ with that uid, or nil if there is no such user. */)
1300 return Vuser_login_name; 1301 return Vuser_login_name;
1301 1302
1302 CHECK_NUMBER (uid); 1303 CHECK_NUMBER (uid);
1304 BLOCK_INPUT;
1303 pw = (struct passwd *) getpwuid (XINT (uid)); 1305 pw = (struct passwd *) getpwuid (XINT (uid));
1306 UNBLOCK_INPUT;
1304 return (pw ? build_string (pw->pw_name) : Qnil); 1307 return (pw ? build_string (pw->pw_name) : Qnil);
1305} 1308}
1306 1309
@@ -1354,9 +1357,17 @@ name, or nil if there is no such user. */)
1354 if (NILP (uid)) 1357 if (NILP (uid))
1355 return Vuser_full_name; 1358 return Vuser_full_name;
1356 else if (NUMBERP (uid)) 1359 else if (NUMBERP (uid))
1357 pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); 1360 {
1361 BLOCK_INPUT;
1362 pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid));
1363 UNBLOCK_INPUT;
1364 }
1358 else if (STRINGP (uid)) 1365 else if (STRINGP (uid))
1359 pw = (struct passwd *) getpwnam (SDATA (uid)); 1366 {
1367 BLOCK_INPUT;
1368 pw = (struct passwd *) getpwnam (SDATA (uid));
1369 UNBLOCK_INPUT;
1370 }
1360 else 1371 else
1361 error ("Invalid UID specification"); 1372 error ("Invalid UID specification");
1362 1373
@@ -1467,7 +1478,7 @@ systems that do not provide resolution finer than a second. */)
1467 1478
1468 if (getrusage (RUSAGE_SELF, &usage) < 0) 1479 if (getrusage (RUSAGE_SELF, &usage) < 0)
1469 /* This shouldn't happen. What action is appropriate? */ 1480 /* This shouldn't happen. What action is appropriate? */
1470 Fsignal (Qerror, Qnil); 1481 xsignal0 (Qerror);
1471 1482
1472 /* Sum up user time and system time. */ 1483 /* Sum up user time and system time. */
1473 secs = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec; 1484 secs = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec;
@@ -2127,7 +2138,6 @@ general_insert_function (insert_func, insert_from_string_func,
2127 for (argnum = 0; argnum < nargs; argnum++) 2138 for (argnum = 0; argnum < nargs; argnum++)
2128 { 2139 {
2129 val = args[argnum]; 2140 val = args[argnum];
2130 retry:
2131 if (INTEGERP (val)) 2141 if (INTEGERP (val))
2132 { 2142 {
2133 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2143 unsigned char str[MAX_MULTIBYTE_LENGTH];
@@ -2152,10 +2162,7 @@ general_insert_function (insert_func, insert_from_string_func,
2152 inherit); 2162 inherit);
2153 } 2163 }
2154 else 2164 else
2155 { 2165 wrong_type_argument (Qchar_or_string_p, val);
2156 val = wrong_type_argument (Qchar_or_string_p, val);
2157 goto retry;
2158 }
2159 } 2166 }
2160} 2167}
2161 2168
@@ -4011,7 +4018,7 @@ usage: (format STRING &rest OBJECTS) */)
4011 /* Likewise adjust the property end position. */ 4018 /* Likewise adjust the property end position. */
4012 pos = XINT (XCAR (XCDR (item))); 4019 pos = XINT (XCAR (XCDR (item)));
4013 4020
4014 for (; bytepos < pos; bytepos++) 4021 for (; position < pos; bytepos++)
4015 { 4022 {
4016 if (! discarded[bytepos]) 4023 if (! discarded[bytepos])
4017 position++, translated++; 4024 position++, translated++;
diff --git a/src/eval.c b/src/eval.c
index 30df5f8ea36..0d7a6a31038 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -198,6 +198,7 @@ Lisp_Object Vmacro_declaration_function;
198extern Lisp_Object Qrisky_local_variable; 198extern Lisp_Object Qrisky_local_variable;
199 199
200static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*)); 200static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*));
201static void unwind_to_catch P_ ((struct catchtag *, Lisp_Object)) NO_RETURN;
201 202
202void 203void
203init_eval_once () 204init_eval_once ()
@@ -983,9 +984,7 @@ usage: (let* VARLIST BODY...) */)
983 if (SYMBOLP (elt)) 984 if (SYMBOLP (elt))
984 specbind (elt, Qnil); 985 specbind (elt, Qnil);
985 else if (! NILP (Fcdr (Fcdr (elt)))) 986 else if (! NILP (Fcdr (Fcdr (elt))))
986 Fsignal (Qerror, 987 signal_error ("`let' bindings can have only one value-form", elt);
987 Fcons (build_string ("`let' bindings can have only one value-form"),
988 elt));
989 else 988 else
990 { 989 {
991 val = Feval (Fcar (Fcdr (elt))); 990 val = Feval (Fcar (Fcdr (elt)));
@@ -1032,9 +1031,7 @@ usage: (let VARLIST BODY...) */)
1032 if (SYMBOLP (elt)) 1031 if (SYMBOLP (elt))
1033 temps [argnum++] = Qnil; 1032 temps [argnum++] = Qnil;
1034 else if (! NILP (Fcdr (Fcdr (elt)))) 1033 else if (! NILP (Fcdr (Fcdr (elt))))
1035 Fsignal (Qerror, 1034 signal_error ("`let' bindings can have only one value-form", elt);
1036 Fcons (build_string ("`let' bindings can have only one value-form"),
1037 elt));
1038 else 1035 else
1039 temps [argnum++] = Feval (Fcar (Fcdr (elt))); 1036 temps [argnum++] = Feval (Fcar (Fcdr (elt)));
1040 gcpro2.nvars = argnum; 1037 gcpro2.nvars = argnum;
@@ -1289,16 +1286,13 @@ Both TAG and VALUE are evalled. */)
1289{ 1286{
1290 register struct catchtag *c; 1287 register struct catchtag *c;
1291 1288
1292 while (1) 1289 if (!NILP (tag))
1293 { 1290 for (c = catchlist; c; c = c->next)
1294 if (!NILP (tag)) 1291 {
1295 for (c = catchlist; c; c = c->next) 1292 if (EQ (c->tag, tag))
1296 { 1293 unwind_to_catch (c, value);
1297 if (EQ (c->tag, tag)) 1294 }
1298 unwind_to_catch (c, value); 1295 xsignal2 (Qno_catch, tag, value);
1299 }
1300 tag = Fsignal (Qno_catch, Fcons (tag, Fcons (value, Qnil)));
1301 }
1302} 1296}
1303 1297
1304 1298
@@ -1706,6 +1700,78 @@ See also the function `condition-case'. */)
1706 fatal ("%s", SDATA (string), 0); 1700 fatal ("%s", SDATA (string), 0);
1707} 1701}
1708 1702
1703/* Internal version of Fsignal that never returns.
1704 Used for anything but Qquit (which can return from Fsignal). */
1705
1706void
1707xsignal (error_symbol, data)
1708 Lisp_Object error_symbol, data;
1709{
1710 Fsignal (error_symbol, data);
1711 abort ();
1712}
1713
1714/* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */
1715
1716void
1717xsignal0 (error_symbol)
1718 Lisp_Object error_symbol;
1719{
1720 xsignal (error_symbol, Qnil);
1721}
1722
1723void
1724xsignal1 (error_symbol, arg)
1725 Lisp_Object error_symbol, arg;
1726{
1727 xsignal (error_symbol, list1 (arg));
1728}
1729
1730void
1731xsignal2 (error_symbol, arg1, arg2)
1732 Lisp_Object error_symbol, arg1, arg2;
1733{
1734 xsignal (error_symbol, list2 (arg1, arg2));
1735}
1736
1737void
1738xsignal3 (error_symbol, arg1, arg2, arg3)
1739 Lisp_Object error_symbol, arg1, arg2, arg3;
1740{
1741 xsignal (error_symbol, list3 (arg1, arg2, arg3));
1742}
1743
1744/* Signal `error' with message S, and additional arg ARG.
1745 If ARG is not a genuine list, make it a one-element list. */
1746
1747void
1748signal_error (s, arg)
1749 char *s;
1750 Lisp_Object arg;
1751{
1752 Lisp_Object tortoise, hare;
1753
1754 hare = tortoise = arg;
1755 while (CONSP (hare))
1756 {
1757 hare = XCDR (hare);
1758 if (!CONSP (hare))
1759 break;
1760
1761 hare = XCDR (hare);
1762 tortoise = XCDR (tortoise);
1763
1764 if (EQ (hare, tortoise))
1765 break;
1766 }
1767
1768 if (!NILP (hare))
1769 arg = Fcons (arg, Qnil); /* Make it a list. */
1770
1771 xsignal (Qerror, Fcons (build_string (s), arg));
1772}
1773
1774
1709/* Return nonzero iff LIST is a non-nil atom or 1775/* Return nonzero iff LIST is a non-nil atom or
1710 a list containing one of CONDITIONS. */ 1776 a list containing one of CONDITIONS. */
1711 1777
@@ -1920,8 +1986,7 @@ error (m, a1, a2, a3)
1920 if (allocated) 1986 if (allocated)
1921 xfree (buffer); 1987 xfree (buffer);
1922 1988
1923 Fsignal (Qerror, Fcons (string, Qnil)); 1989 xsignal1 (Qerror, string);
1924 abort ();
1925} 1990}
1926 1991
1927DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0, 1992DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0,
@@ -2166,7 +2231,12 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2166 /* At this point, only original_fun and original_args 2231 /* At this point, only original_fun and original_args
2167 have values that will be used below */ 2232 have values that will be used below */
2168 retry: 2233 retry:
2169 fun = Findirect_function (original_fun, Qnil); 2234
2235 /* Optimize for no indirection. */
2236 fun = original_fun;
2237 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2238 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2239 fun = indirect_function (fun);
2170 2240
2171 if (SUBRP (fun)) 2241 if (SUBRP (fun))
2172 { 2242 {
@@ -2182,7 +2252,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2182 2252
2183 if (XINT (numargs) < XSUBR (fun)->min_args || 2253 if (XINT (numargs) < XSUBR (fun)->min_args ||
2184 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) 2254 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs)))
2185 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil))); 2255 xsignal2 (Qwrong_number_of_arguments, original_fun, numargs);
2186 2256
2187 if (XSUBR (fun)->max_args == UNEVALLED) 2257 if (XSUBR (fun)->max_args == UNEVALLED)
2188 { 2258 {
@@ -2285,11 +2355,13 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2285 val = apply_lambda (fun, original_args, 1); 2355 val = apply_lambda (fun, original_args, 1);
2286 else 2356 else
2287 { 2357 {
2358 if (EQ (fun, Qunbound))
2359 xsignal1 (Qvoid_function, original_fun);
2288 if (!CONSP (fun)) 2360 if (!CONSP (fun))
2289 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2361 xsignal1 (Qinvalid_function, original_fun);
2290 funcar = Fcar (fun); 2362 funcar = XCAR (fun);
2291 if (!SYMBOLP (funcar)) 2363 if (!SYMBOLP (funcar))
2292 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2364 xsignal1 (Qinvalid_function, original_fun);
2293 if (EQ (funcar, Qautoload)) 2365 if (EQ (funcar, Qautoload))
2294 { 2366 {
2295 do_autoload (fun, original_fun); 2367 do_autoload (fun, original_fun);
@@ -2300,7 +2372,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2300 else if (EQ (funcar, Qlambda)) 2372 else if (EQ (funcar, Qlambda))
2301 val = apply_lambda (fun, original_args, 1); 2373 val = apply_lambda (fun, original_args, 1);
2302 else 2374 else
2303 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2375 xsignal1 (Qinvalid_function, original_fun);
2304 } 2376 }
2305 done: 2377 done:
2306 CHECK_CONS_LIST (); 2378 CHECK_CONS_LIST ();
@@ -2345,7 +2417,10 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2345 2417
2346 numargs += nargs - 2; 2418 numargs += nargs - 2;
2347 2419
2348 fun = indirect_function (fun); 2420 /* Optimize for no indirection. */
2421 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2422 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2423 fun = indirect_function (fun);
2349 if (EQ (fun, Qunbound)) 2424 if (EQ (fun, Qunbound))
2350 { 2425 {
2351 /* Let funcall get the error */ 2426 /* Let funcall get the error */
@@ -2824,7 +2899,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2824 int nargs; 2899 int nargs;
2825 Lisp_Object *args; 2900 Lisp_Object *args;
2826{ 2901{
2827 Lisp_Object fun; 2902 Lisp_Object fun, original_fun;
2828 Lisp_Object funcar; 2903 Lisp_Object funcar;
2829 int numargs = nargs - 1; 2904 int numargs = nargs - 1;
2830 Lisp_Object lisp_numargs; 2905 Lisp_Object lisp_numargs;
@@ -2861,11 +2936,15 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2861 2936
2862 CHECK_CONS_LIST (); 2937 CHECK_CONS_LIST ();
2863 2938
2864 retry: 2939 original_fun = args[0];
2865 2940
2866 fun = args[0]; 2941 retry:
2867 2942
2868 fun = Findirect_function (fun, Qnil); 2943 /* Optimize for no indirection. */
2944 fun = original_fun;
2945 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2946 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2947 fun = indirect_function (fun);
2869 2948
2870 if (SUBRP (fun)) 2949 if (SUBRP (fun))
2871 { 2950 {
@@ -2873,11 +2952,11 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2873 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 2952 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
2874 { 2953 {
2875 XSETFASTINT (lisp_numargs, numargs); 2954 XSETFASTINT (lisp_numargs, numargs);
2876 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (lisp_numargs, Qnil))); 2955 xsignal2 (Qwrong_number_of_arguments, original_fun, lisp_numargs);
2877 } 2956 }
2878 2957
2879 if (XSUBR (fun)->max_args == UNEVALLED) 2958 if (XSUBR (fun)->max_args == UNEVALLED)
2880 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2959 xsignal1 (Qinvalid_function, original_fun);
2881 2960
2882 if (XSUBR (fun)->max_args == MANY) 2961 if (XSUBR (fun)->max_args == MANY)
2883 { 2962 {
@@ -2949,21 +3028,23 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2949 val = funcall_lambda (fun, numargs, args + 1); 3028 val = funcall_lambda (fun, numargs, args + 1);
2950 else 3029 else
2951 { 3030 {
3031 if (EQ (fun, Qunbound))
3032 xsignal1 (Qvoid_function, original_fun);
2952 if (!CONSP (fun)) 3033 if (!CONSP (fun))
2953 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3034 xsignal1 (Qinvalid_function, original_fun);
2954 funcar = Fcar (fun); 3035 funcar = XCAR (fun);
2955 if (!SYMBOLP (funcar)) 3036 if (!SYMBOLP (funcar))
2956 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3037 xsignal1 (Qinvalid_function, original_fun);
2957 if (EQ (funcar, Qlambda)) 3038 if (EQ (funcar, Qlambda))
2958 val = funcall_lambda (fun, numargs, args + 1); 3039 val = funcall_lambda (fun, numargs, args + 1);
2959 else if (EQ (funcar, Qautoload)) 3040 else if (EQ (funcar, Qautoload))
2960 { 3041 {
2961 do_autoload (fun, args[0]); 3042 do_autoload (fun, original_fun);
2962 CHECK_CONS_LIST (); 3043 CHECK_CONS_LIST ();
2963 goto retry; 3044 goto retry;
2964 } 3045 }
2965 else 3046 else
2966 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3047 xsignal1 (Qinvalid_function, original_fun);
2967 } 3048 }
2968 done: 3049 done:
2969 CHECK_CONS_LIST (); 3050 CHECK_CONS_LIST ();
@@ -3039,7 +3120,7 @@ funcall_lambda (fun, nargs, arg_vector)
3039 if (CONSP (syms_left)) 3120 if (CONSP (syms_left))
3040 syms_left = XCAR (syms_left); 3121 syms_left = XCAR (syms_left);
3041 else 3122 else
3042 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3123 xsignal1 (Qinvalid_function, fun);
3043 } 3124 }
3044 else if (COMPILEDP (fun)) 3125 else if (COMPILEDP (fun))
3045 syms_left = AREF (fun, COMPILED_ARGLIST); 3126 syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3052,8 +3133,8 @@ funcall_lambda (fun, nargs, arg_vector)
3052 QUIT; 3133 QUIT;
3053 3134
3054 next = XCAR (syms_left); 3135 next = XCAR (syms_left);
3055 while (!SYMBOLP (next)) 3136 if (!SYMBOLP (next))
3056 next = Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3137 xsignal1 (Qinvalid_function, fun);
3057 3138
3058 if (EQ (next, Qand_rest)) 3139 if (EQ (next, Qand_rest))
3059 rest = 1; 3140 rest = 1;
@@ -3067,17 +3148,15 @@ funcall_lambda (fun, nargs, arg_vector)
3067 else if (i < nargs) 3148 else if (i < nargs)
3068 specbind (next, arg_vector[i++]); 3149 specbind (next, arg_vector[i++]);
3069 else if (!optional) 3150 else if (!optional)
3070 return Fsignal (Qwrong_number_of_arguments, 3151 xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs));
3071 Fcons (fun, Fcons (make_number (nargs), Qnil)));
3072 else 3152 else
3073 specbind (next, Qnil); 3153 specbind (next, Qnil);
3074 } 3154 }
3075 3155
3076 if (!NILP (syms_left)) 3156 if (!NILP (syms_left))
3077 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3157 xsignal1 (Qinvalid_function, fun);
3078 else if (i < nargs) 3158 else if (i < nargs)
3079 return Fsignal (Qwrong_number_of_arguments, 3159 xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs));
3080 Fcons (fun, Fcons (make_number (nargs), Qnil)));
3081 3160
3082 if (CONSP (fun)) 3161 if (CONSP (fun))
3083 val = Fprogn (XCDR (XCDR (fun))); 3162 val = Fprogn (XCDR (XCDR (fun)));
@@ -3129,8 +3208,7 @@ grow_specpdl ()
3129 if (max_specpdl_size < 400) 3208 if (max_specpdl_size < 400)
3130 max_specpdl_size = 400; 3209 max_specpdl_size = 400;
3131 if (specpdl_size >= max_specpdl_size) 3210 if (specpdl_size >= max_specpdl_size)
3132 Fsignal (Qerror, 3211 signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil);
3133 Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil));
3134 } 3212 }
3135 specpdl_size *= 2; 3213 specpdl_size *= 2;
3136 if (specpdl_size > max_specpdl_size) 3214 if (specpdl_size > max_specpdl_size)
diff --git a/src/fileio.c b/src/fileio.c
index 82af5cf6cf9..a8408927f5c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -77,6 +77,7 @@ extern int errno;
77#include "character.h" 77#include "character.h"
78#include "coding.h" 78#include "coding.h"
79#include "window.h" 79#include "window.h"
80#include "blockinput.h"
80 81
81#ifdef WINDOWSNT 82#ifdef WINDOWSNT
82#define NOMINMAX 1 83#define NOMINMAX 1
@@ -282,7 +283,7 @@ report_file_error (string, data)
282 switch (errorno) 283 switch (errorno)
283 { 284 {
284 case EEXIST: 285 case EEXIST:
285 Fsignal (Qfile_already_exists, Fcons (errstring, data)); 286 xsignal (Qfile_already_exists, Fcons (errstring, data));
286 break; 287 break;
287 default: 288 default:
288 /* System error messages are capitalized. Downcase the initial 289 /* System error messages are capitalized. Downcase the initial
@@ -290,7 +291,7 @@ report_file_error (string, data)
290 if (SREF (errstring, 1) != '/') 291 if (SREF (errstring, 1) != '/')
291 SSET (errstring, 0, DOWNCASE (SREF (errstring, 0))); 292 SSET (errstring, 0, DOWNCASE (SREF (errstring, 0)));
292 293
293 Fsignal (Qfile_error, 294 xsignal (Qfile_error,
294 Fcons (build_string (string), Fcons (errstring, data))); 295 Fcons (build_string (string), Fcons (errstring, data)));
295 } 296 }
296} 297}
@@ -1390,7 +1391,9 @@ See also the function `substitute-in-file-name'. */)
1390 bcopy ((char *) nm, o, p - nm); 1391 bcopy ((char *) nm, o, p - nm);
1391 o [p - nm] = 0; 1392 o [p - nm] = 0;
1392 1393
1394 BLOCK_INPUT;
1393 pw = (struct passwd *) getpwnam (o + 1); 1395 pw = (struct passwd *) getpwnam (o + 1);
1396 UNBLOCK_INPUT;
1394 if (pw) 1397 if (pw)
1395 { 1398 {
1396 newdir = (unsigned char *) pw -> pw_dir; 1399 newdir = (unsigned char *) pw -> pw_dir;
@@ -1921,7 +1924,9 @@ See also the function `substitute-in-file-name'.")
1921 o[len] = 0; 1924 o[len] = 0;
1922 1925
1923 /* Look up the user name. */ 1926 /* Look up the user name. */
1927 BLOCK_INPUT;
1924 pw = (struct passwd *) getpwnam (o + 1); 1928 pw = (struct passwd *) getpwnam (o + 1);
1929 UNBLOCK_INPUT;
1925 if (!pw) 1930 if (!pw)
1926 error ("\"%s\" isn't a registered user", o + 1); 1931 error ("\"%s\" isn't a registered user", o + 1);
1927 1932
@@ -2115,10 +2120,11 @@ search_embedded_absfilename (nm, endp)
2115 /* If we have ~user and `user' exists, discard 2120 /* If we have ~user and `user' exists, discard
2116 everything up to ~. But if `user' does not exist, leave 2121 everything up to ~. But if `user' does not exist, leave
2117 ~user alone, it might be a literal file name. */ 2122 ~user alone, it might be a literal file name. */
2118 if ((pw = getpwnam (o + 1))) 2123 BLOCK_INPUT;
2124 pw = getpwnam (o + 1);
2125 UNBLOCK_INPUT;
2126 if (pw)
2119 return p; 2127 return p;
2120 else
2121 xfree (pw);
2122 } 2128 }
2123 else 2129 else
2124 return p; 2130 return p;
@@ -2383,9 +2389,8 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2383 if (lstat (SDATA (encoded_filename), &statbuf) >= 0) 2389 if (lstat (SDATA (encoded_filename), &statbuf) >= 0)
2384 { 2390 {
2385 if (! interactive) 2391 if (! interactive)
2386 Fsignal (Qfile_already_exists, 2392 xsignal2 (Qfile_already_exists,
2387 Fcons (build_string ("File already exists"), 2393 build_string ("File already exists"), absname);
2388 Fcons (absname, Qnil)));
2389 GCPRO1 (absname); 2394 GCPRO1 (absname);
2390 tem = format2 ("File %s already exists; %s anyway? ", 2395 tem = format2 ("File %s already exists; %s anyway? ",
2391 absname, build_string (querystring)); 2396 absname, build_string (querystring));
@@ -2395,9 +2400,8 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2395 tem = do_yes_or_no_p (tem); 2400 tem = do_yes_or_no_p (tem);
2396 UNGCPRO; 2401 UNGCPRO;
2397 if (NILP (tem)) 2402 if (NILP (tem))
2398 Fsignal (Qfile_already_exists, 2403 xsignal2 (Qfile_already_exists,
2399 Fcons (build_string ("File already exists"), 2404 build_string ("File already exists"), absname);
2400 Fcons (absname, Qnil)));
2401 if (statptr) 2405 if (statptr)
2402 *statptr = statbuf; 2406 *statptr = statbuf;
2403 } 2407 }
@@ -2499,9 +2503,8 @@ uid and gid of FILE to NEWNAME. */)
2499 { 2503 {
2500 /* Restore original attributes. */ 2504 /* Restore original attributes. */
2501 SetFileAttributes (filename, attributes); 2505 SetFileAttributes (filename, attributes);
2502 Fsignal (Qfile_date_error, 2506 xsignal2 (Qfile_date_error,
2503 Fcons (build_string ("Cannot set file date"), 2507 build_string ("Cannot set file date"), newname);
2504 Fcons (newname, Qnil)));
2505 } 2508 }
2506 /* Restore original attributes. */ 2509 /* Restore original attributes. */
2507 SetFileAttributes (filename, attributes); 2510 SetFileAttributes (filename, attributes);
@@ -2597,9 +2600,8 @@ uid and gid of FILE to NEWNAME. */)
2597 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0); 2600 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
2598 if (set_file_times (SDATA (encoded_newname), 2601 if (set_file_times (SDATA (encoded_newname),
2599 atime, mtime)) 2602 atime, mtime))
2600 Fsignal (Qfile_date_error, 2603 xsignal2 (Qfile_date_error,
2601 Fcons (build_string ("Cannot set file date"), 2604 build_string ("Cannot set file date"), newname);
2602 Fcons (newname, Qnil)));
2603 } 2605 }
2604 } 2606 }
2605 2607
@@ -2695,9 +2697,9 @@ If file has multiple names, it continues to exist with the other names. */)
2695 GCPRO1 (filename); 2697 GCPRO1 (filename);
2696 if (!NILP (Ffile_directory_p (filename)) 2698 if (!NILP (Ffile_directory_p (filename))
2697 && NILP (Ffile_symlink_p (filename))) 2699 && NILP (Ffile_symlink_p (filename)))
2698 Fsignal (Qfile_error, 2700 xsignal2 (Qfile_error,
2699 Fcons (build_string ("Removing old name: is a directory"), 2701 build_string ("Removing old name: is a directory"),
2700 Fcons (filename, Qnil))); 2702 filename);
2701 UNGCPRO; 2703 UNGCPRO;
2702 filename = Fexpand_file_name (filename, Qnil); 2704 filename = Fexpand_file_name (filename, Qnil);
2703 2705
@@ -3851,9 +3853,8 @@ actually used. */)
3851 goto notfound; 3853 goto notfound;
3852 3854
3853 if (! NILP (replace) || ! NILP (beg) || ! NILP (end)) 3855 if (! NILP (replace) || ! NILP (beg) || ! NILP (end))
3854 Fsignal (Qfile_error, 3856 xsignal2 (Qfile_error,
3855 Fcons (build_string ("not a regular file"), 3857 build_string ("not a regular file"), orig_filename);
3856 Fcons (orig_filename, Qnil)));
3857 } 3858 }
3858#endif 3859#endif
3859 3860
@@ -4690,9 +4691,8 @@ actually used. */)
4690 } 4691 }
4691#endif /* CLASH_DETECTION */ 4692#endif /* CLASH_DETECTION */
4692 if (not_regular) 4693 if (not_regular)
4693 Fsignal (Qfile_error, 4694 xsignal2 (Qfile_error,
4694 Fcons (build_string ("not a regular file"), 4695 build_string ("not a regular file"), orig_filename);
4695 Fcons (orig_filename, Qnil)));
4696 } 4696 }
4697 4697
4698 if (set_coding_system) 4698 if (set_coding_system)
@@ -5763,7 +5763,11 @@ static Lisp_Object
5763do_auto_save_make_dir (dir) 5763do_auto_save_make_dir (dir)
5764 Lisp_Object dir; 5764 Lisp_Object dir;
5765{ 5765{
5766 return call2 (Qmake_directory, dir, Qt); 5766 Lisp_Object mode;
5767
5768 call2 (Qmake_directory, dir, Qt);
5769 XSETFASTINT (mode, 0700);
5770 return Fset_file_modes (dir, mode);
5767} 5771}
5768 5772
5769static Lisp_Object 5773static Lisp_Object
@@ -5961,7 +5965,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5961 { 5965 {
5962 /* If we are going to restore an old message, 5966 /* If we are going to restore an old message,
5963 give time to read ours. */ 5967 give time to read ours. */
5964 sit_for (1, 0, 0, 0, 0); 5968 sit_for (make_number (1), 0, 0);
5965 restore_message (); 5969 restore_message ();
5966 } 5970 }
5967 else 5971 else
@@ -6530,19 +6534,17 @@ of file names regardless of the current language environment. */);
6530 staticpro (&Qcar_less_than_car); 6534 staticpro (&Qcar_less_than_car);
6531 6535
6532 Fput (Qfile_error, Qerror_conditions, 6536 Fput (Qfile_error, Qerror_conditions,
6533 Fcons (Qfile_error, Fcons (Qerror, Qnil))); 6537 list2 (Qfile_error, Qerror));
6534 Fput (Qfile_error, Qerror_message, 6538 Fput (Qfile_error, Qerror_message,
6535 build_string ("File error")); 6539 build_string ("File error"));
6536 6540
6537 Fput (Qfile_already_exists, Qerror_conditions, 6541 Fput (Qfile_already_exists, Qerror_conditions,
6538 Fcons (Qfile_already_exists, 6542 list3 (Qfile_already_exists, Qfile_error, Qerror));
6539 Fcons (Qfile_error, Fcons (Qerror, Qnil))));
6540 Fput (Qfile_already_exists, Qerror_message, 6543 Fput (Qfile_already_exists, Qerror_message,
6541 build_string ("File already exists")); 6544 build_string ("File already exists"));
6542 6545
6543 Fput (Qfile_date_error, Qerror_conditions, 6546 Fput (Qfile_date_error, Qerror_conditions,
6544 Fcons (Qfile_date_error, 6547 list3 (Qfile_date_error, Qfile_error, Qerror));
6545 Fcons (Qfile_error, Fcons (Qerror, Qnil))));
6546 Fput (Qfile_date_error, Qerror_message, 6548 Fput (Qfile_date_error, Qerror_message,
6547 build_string ("Cannot set file date")); 6549 build_string ("Cannot set file date"));
6548 6550
diff --git a/src/floatfns.c b/src/floatfns.c
index d5ca50f9165..dd879de7eb8 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -201,17 +201,15 @@ static char *float_error_fn_name;
201 while (0) 201 while (0)
202 202
203#define arith_error(op,arg) \ 203#define arith_error(op,arg) \
204 Fsignal (Qarith_error, Fcons (build_string ((op)), Fcons ((arg), Qnil))) 204 xsignal2 (Qarith_error, build_string ((op)), (arg))
205#define range_error(op,arg) \ 205#define range_error(op,arg) \
206 Fsignal (Qrange_error, Fcons (build_string ((op)), Fcons ((arg), Qnil))) 206 xsignal2 (Qrange_error, build_string ((op)), (arg))
207#define range_error2(op,a1,a2) \ 207#define range_error2(op,a1,a2) \
208 Fsignal (Qrange_error, Fcons (build_string ((op)), \ 208 xsignal3 (Qrange_error, build_string ((op)), (a1), (a2))
209 Fcons ((a1), Fcons ((a2), Qnil))))
210#define domain_error(op,arg) \ 209#define domain_error(op,arg) \
211 Fsignal (Qdomain_error, Fcons (build_string ((op)), Fcons ((arg), Qnil))) 210 xsignal2 (Qdomain_error, build_string ((op)), (arg))
212#define domain_error2(op,a1,a2) \ 211#define domain_error2(op,a1,a2) \
213 Fsignal (Qdomain_error, Fcons (build_string ((op)), \ 212 xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2))
214 Fcons ((a1), Fcons ((a2), Qnil))))
215 213
216/* Extract a Lisp number as a `double', or signal an error. */ 214/* Extract a Lisp number as a `double', or signal an error. */
217 215
@@ -756,7 +754,7 @@ rounding_driver (arg, divisor, double_round, int_round2, name)
756 f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg); 754 f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg);
757 f2 = (FLOATP (divisor) ? XFLOAT_DATA (divisor) : XINT (divisor)); 755 f2 = (FLOATP (divisor) ? XFLOAT_DATA (divisor) : XINT (divisor));
758 if (! IEEE_FLOATING_POINT && f2 == 0) 756 if (! IEEE_FLOATING_POINT && f2 == 0)
759 Fsignal (Qarith_error, Qnil); 757 xsignal0 (Qarith_error);
760 758
761 IN_FLOAT2 (f1 = (*double_round) (f1 / f2), name, arg, divisor); 759 IN_FLOAT2 (f1 = (*double_round) (f1 / f2), name, arg, divisor);
762 FLOAT_TO_INT2 (f1, arg, name, arg, divisor); 760 FLOAT_TO_INT2 (f1, arg, name, arg, divisor);
@@ -767,7 +765,7 @@ rounding_driver (arg, divisor, double_round, int_round2, name)
767 i2 = XINT (divisor); 765 i2 = XINT (divisor);
768 766
769 if (i2 == 0) 767 if (i2 == 0)
770 Fsignal (Qarith_error, Qnil); 768 xsignal0 (Qarith_error);
771 769
772 XSETINT (arg, (*int_round2) (i1, i2)); 770 XSETINT (arg, (*int_round2) (i1, i2));
773 return arg; 771 return arg;
@@ -907,7 +905,7 @@ fmod_float (x, y)
907 f2 = FLOATP (y) ? XFLOAT_DATA (y) : XINT (y); 905 f2 = FLOATP (y) ? XFLOAT_DATA (y) : XINT (y);
908 906
909 if (! IEEE_FLOATING_POINT && f2 == 0) 907 if (! IEEE_FLOATING_POINT && f2 == 0)
910 Fsignal (Qarith_error, Qnil); 908 xsignal0 (Qarith_error);
911 909
912 /* If the "remainder" comes out with the wrong sign, fix it. */ 910 /* If the "remainder" comes out with the wrong sign, fix it. */
913 IN_FLOAT2 ((f1 = fmod (f1, f2), 911 IN_FLOAT2 ((f1 = fmod (f1, f2),
@@ -986,7 +984,7 @@ float_error (signo)
986 SIGNAL_THREAD_CHECK (signo); 984 SIGNAL_THREAD_CHECK (signo);
987 in_float = 0; 985 in_float = 0;
988 986
989 Fsignal (Qarith_error, Fcons (float_error_arg, Qnil)); 987 xsignal1 (Qarith_error, float_error_arg);
990} 988}
991 989
992/* Another idea was to replace the library function `infnan' 990/* Another idea was to replace the library function `infnan'
@@ -1014,11 +1012,11 @@ matherr (x)
1014 : Qnil))); 1012 : Qnil)));
1015 switch (x->type) 1013 switch (x->type)
1016 { 1014 {
1017 case DOMAIN: Fsignal (Qdomain_error, args); break; 1015 case DOMAIN: xsignal (Qdomain_error, args); break;
1018 case SING: Fsignal (Qsingularity_error, args); break; 1016 case SING: xsignal (Qsingularity_error, args); break;
1019 case OVERFLOW: Fsignal (Qoverflow_error, args); break; 1017 case OVERFLOW: xsignal (Qoverflow_error, args); break;
1020 case UNDERFLOW: Fsignal (Qunderflow_error, args); break; 1018 case UNDERFLOW: xsignal (Qunderflow_error, args); break;
1021 default: Fsignal (Qarith_error, args); break; 1019 default: xsignal (Qarith_error, args); break;
1022 } 1020 }
1023 return (1); /* don't set errno or print a message */ 1021 return (1); /* don't set errno or print a message */
1024} 1022}
diff --git a/src/fns.c b/src/fns.c
index 3b4b3e5149b..4c1e5b79ae2 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))
@@ -174,18 +173,15 @@ To get the number of bytes, use `string-bytes'. */)
174 QUIT; 173 QUIT;
175 } 174 }
176 175
177 if (!NILP (sequence)) 176 CHECK_LIST_END (sequence, sequence);
178 wrong_type_argument (Qlistp, sequence);
179 177
180 val = make_number (i); 178 val = make_number (i);
181 } 179 }
182 else if (NILP (sequence)) 180 else if (NILP (sequence))
183 XSETFASTINT (val, 0); 181 XSETFASTINT (val, 0);
184 else 182 else
185 { 183 wrong_type_argument (Qsequencep, sequence);
186 sequence = wrong_type_argument (Qsequencep, sequence); 184
187 goto retry;
188 }
189 return val; 185 return val;
190} 186}
191 187
@@ -488,7 +484,8 @@ with the original. */)
488 } 484 }
489 485
490 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg)) 486 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg))
491 arg = wrong_type_argument (Qsequencep, arg); 487 wrong_type_argument (Qsequencep, arg);
488
492 return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); 489 return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0);
493} 490}
494 491
@@ -540,15 +537,13 @@ concat (nargs, args, target_type, last_special)
540 else 537 else
541 last_tail = Qnil; 538 last_tail = Qnil;
542 539
543 /* Canonicalize each argument. */ 540 /* Check each argument. */
544 for (argnum = 0; argnum < nargs; argnum++) 541 for (argnum = 0; argnum < nargs; argnum++)
545 { 542 {
546 this = args[argnum]; 543 this = args[argnum];
547 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this) 544 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this)
548 || COMPILEDP (this) || BOOL_VECTOR_P (this))) 545 || COMPILEDP (this) || BOOL_VECTOR_P (this)))
549 { 546 wrong_type_argument (Qsequencep, this);
550 args[argnum] = wrong_type_argument (Qsequencep, this);
551 }
552 } 547 }
553 548
554 /* Compute total length in chars of arguments in RESULT_LEN. 549 /* Compute total length in chars of arguments in RESULT_LEN.
@@ -575,8 +570,7 @@ concat (nargs, args, target_type, last_special)
575 for (i = 0; i < len; i++) 570 for (i = 0; i < len; i++)
576 { 571 {
577 ch = XVECTOR (this)->contents[i]; 572 ch = XVECTOR (this)->contents[i];
578 if (! CHARACTERP (ch)) 573 CHECK_CHARACTER (ch);
579 wrong_type_argument (Qcharacterp, ch);
580 this_len_byte = CHAR_BYTES (XINT (ch)); 574 this_len_byte = CHAR_BYTES (XINT (ch));
581 result_len_byte += this_len_byte; 575 result_len_byte += this_len_byte;
582 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch))) 576 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch)))
@@ -588,8 +582,7 @@ concat (nargs, args, target_type, last_special)
588 for (; CONSP (this); this = XCDR (this)) 582 for (; CONSP (this); this = XCDR (this))
589 { 583 {
590 ch = XCAR (this); 584 ch = XCAR (this);
591 if (! CHARACTERP (ch)) 585 CHECK_CHARACTER (ch);
592 wrong_type_argument (Qcharacterp, ch);
593 this_len_byte = CHAR_BYTES (XINT (ch)); 586 this_len_byte = CHAR_BYTES (XINT (ch));
594 result_len_byte += this_len_byte; 587 result_len_byte += this_len_byte;
595 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch))) 588 if (! ASCII_CHAR_P (XINT (ch)) && ! CHAR_BYTE8_P (XINT (ch)))
@@ -1171,9 +1164,7 @@ This function allows vectors as well as strings. */)
1171 int from_char, to_char; 1164 int from_char, to_char;
1172 int from_byte = 0, to_byte = 0; 1165 int from_byte = 0, to_byte = 0;
1173 1166
1174 if (! (STRINGP (string) || VECTORP (string))) 1167 CHECK_VECTOR_OR_STRING (string);
1175 wrong_type_argument (Qarrayp, string);
1176
1177 CHECK_NUMBER (from); 1168 CHECK_NUMBER (from);
1178 1169
1179 if (STRINGP (string)) 1170 if (STRINGP (string))
@@ -1297,8 +1288,7 @@ substring_both (string, from, from_byte, to, to_byte)
1297 int size; 1288 int size;
1298 int size_byte; 1289 int size_byte;
1299 1290
1300 if (! (STRINGP (string) || VECTORP (string))) 1291 CHECK_VECTOR_OR_STRING (string);
1301 wrong_type_argument (Qarrayp, string);
1302 1292
1303 if (STRINGP (string)) 1293 if (STRINGP (string))
1304 { 1294 {
@@ -1338,8 +1328,7 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
1338 for (i = 0; i < num && !NILP (list); i++) 1328 for (i = 0; i < num && !NILP (list); i++)
1339 { 1329 {
1340 QUIT; 1330 QUIT;
1341 if (! CONSP (list)) 1331 CHECK_LIST_CONS (list, list);
1342 wrong_type_argument (Qlistp, list);
1343 list = XCDR (list); 1332 list = XCDR (list);
1344 } 1333 }
1345 return list; 1334 return list;
@@ -1360,16 +1349,12 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0,
1360 register Lisp_Object sequence, n; 1349 register Lisp_Object sequence, n;
1361{ 1350{
1362 CHECK_NUMBER (n); 1351 CHECK_NUMBER (n);
1363 while (1) 1352 if (CONSP (sequence) || NILP (sequence))
1364 { 1353 return Fcar (Fnthcdr (n, sequence));
1365 if (CONSP (sequence) || NILP (sequence)) 1354
1366 return Fcar (Fnthcdr (n, sequence)); 1355 /* Faref signals a "not array" error, so check here. */
1367 else if (STRINGP (sequence) || VECTORP (sequence) 1356 CHECK_ARRAY (sequence, Qsequencep);
1368 || BOOL_VECTOR_P (sequence) || CHAR_TABLE_P (sequence)) 1357 return Faref (sequence, n);
1369 return Faref (sequence, n);
1370 else
1371 sequence = wrong_type_argument (Qsequencep, sequence);
1372 }
1373} 1358}
1374 1359
1375DEFUN ("member", Fmember, Smember, 2, 2, 0, 1360DEFUN ("member", Fmember, Smember, 2, 2, 0,
@@ -1383,8 +1368,7 @@ The value is actually the tail of LIST whose car is ELT. */)
1383 for (tail = list; !NILP (tail); tail = XCDR (tail)) 1368 for (tail = list; !NILP (tail); tail = XCDR (tail))
1384 { 1369 {
1385 register Lisp_Object tem; 1370 register Lisp_Object tem;
1386 if (! CONSP (tail)) 1371 CHECK_LIST_CONS (tail, list);
1387 wrong_type_argument (Qlistp, list);
1388 tem = XCAR (tail); 1372 tem = XCAR (tail);
1389 if (! NILP (Fequal (elt, tem))) 1373 if (! NILP (Fequal (elt, tem)))
1390 return tail; 1374 return tail;
@@ -1417,9 +1401,7 @@ whose car is ELT. */)
1417 QUIT; 1401 QUIT;
1418 } 1402 }
1419 1403
1420 if (!CONSP (list) && !NILP (list)) 1404 CHECK_LIST (list);
1421 list = wrong_type_argument (Qlistp, list);
1422
1423 return list; 1405 return list;
1424} 1406}
1425 1407
@@ -1430,8 +1412,6 @@ Elements of LIST that are not conses are ignored. */)
1430 (key, list) 1412 (key, list)
1431 Lisp_Object key, list; 1413 Lisp_Object key, list;
1432{ 1414{
1433 Lisp_Object result;
1434
1435 while (1) 1415 while (1)
1436 { 1416 {
1437 if (!CONSP (list) 1417 if (!CONSP (list)
@@ -1455,14 +1435,7 @@ Elements of LIST that are not conses are ignored. */)
1455 QUIT; 1435 QUIT;
1456 } 1436 }
1457 1437
1458 if (CONSP (list)) 1438 return CAR (list);
1459 result = XCAR (list);
1460 else if (NILP (list))
1461 result = Qnil;
1462 else
1463 result = wrong_type_argument (Qlistp, list);
1464
1465 return result;
1466} 1439}
1467 1440
1468/* Like Fassq but never report an error and do not allow quits. 1441/* Like Fassq but never report an error and do not allow quits.
@@ -1477,7 +1450,7 @@ assq_no_quit (key, list)
1477 || !EQ (XCAR (XCAR (list)), key))) 1450 || !EQ (XCAR (XCAR (list)), key)))
1478 list = XCDR (list); 1451 list = XCDR (list);
1479 1452
1480 return CONSP (list) ? XCAR (list) : Qnil; 1453 return CAR_SAFE (list);
1481} 1454}
1482 1455
1483DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0, 1456DEFUN ("assoc", Fassoc, Sassoc, 2, 2, 0,
@@ -1486,7 +1459,7 @@ The value is actually the first element of LIST whose car equals KEY. */)
1486 (key, list) 1459 (key, list)
1487 Lisp_Object key, list; 1460 Lisp_Object key, list;
1488{ 1461{
1489 Lisp_Object result, car; 1462 Lisp_Object car;
1490 1463
1491 while (1) 1464 while (1)
1492 { 1465 {
@@ -1514,14 +1487,7 @@ The value is actually the first element of LIST whose car equals KEY. */)
1514 QUIT; 1487 QUIT;
1515 } 1488 }
1516 1489
1517 if (CONSP (list)) 1490 return CAR (list);
1518 result = XCAR (list);
1519 else if (NILP (list))
1520 result = Qnil;
1521 else
1522 result = wrong_type_argument (Qlistp, list);
1523
1524 return result;
1525} 1491}
1526 1492
1527/* Like Fassoc but never report an error and do not allow quits. 1493/* Like Fassoc but never report an error and do not allow quits.
@@ -1547,8 +1513,6 @@ The value is actually the first element of LIST whose cdr is KEY. */)
1547 register Lisp_Object key; 1513 register Lisp_Object key;
1548 Lisp_Object list; 1514 Lisp_Object list;
1549{ 1515{
1550 Lisp_Object result;
1551
1552 while (1) 1516 while (1)
1553 { 1517 {
1554 if (!CONSP (list) 1518 if (!CONSP (list)
@@ -1572,14 +1536,7 @@ The value is actually the first element of LIST whose cdr is KEY. */)
1572 QUIT; 1536 QUIT;
1573 } 1537 }
1574 1538
1575 if (NILP (list)) 1539 return CAR (list);
1576 result = Qnil;
1577 else if (CONSP (list))
1578 result = XCAR (list);
1579 else
1580 result = wrong_type_argument (Qlistp, list);
1581
1582 return result;
1583} 1540}
1584 1541
1585DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0, 1542DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0,
@@ -1588,7 +1545,7 @@ The value is actually the first element of LIST whose cdr equals KEY. */)
1588 (key, list) 1545 (key, list)
1589 Lisp_Object key, list; 1546 Lisp_Object key, list;
1590{ 1547{
1591 Lisp_Object result, cdr; 1548 Lisp_Object cdr;
1592 1549
1593 while (1) 1550 while (1)
1594 { 1551 {
@@ -1616,14 +1573,7 @@ The value is actually the first element of LIST whose cdr equals KEY. */)
1616 QUIT; 1573 QUIT;
1617 } 1574 }
1618 1575
1619 if (CONSP (list)) 1576 return CAR (list);
1620 result = XCAR (list);
1621 else if (NILP (list))
1622 result = Qnil;
1623 else
1624 result = wrong_type_argument (Qlistp, list);
1625
1626 return result;
1627} 1577}
1628 1578
1629DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0, 1579DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0,
@@ -1643,8 +1593,7 @@ to be sure of changing the value of `foo'. */)
1643 prev = Qnil; 1593 prev = Qnil;
1644 while (!NILP (tail)) 1594 while (!NILP (tail))
1645 { 1595 {
1646 if (! CONSP (tail)) 1596 CHECK_LIST_CONS (tail, list);
1647 wrong_type_argument (Qlistp, list);
1648 tem = XCAR (tail); 1597 tem = XCAR (tail);
1649 if (EQ (elt, tem)) 1598 if (EQ (elt, tem))
1650 { 1599 {
@@ -1766,8 +1715,7 @@ to be sure of changing the value of `foo'. */)
1766 1715
1767 for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail)) 1716 for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail))
1768 { 1717 {
1769 if (!CONSP (tail)) 1718 CHECK_LIST_CONS (tail, seq);
1770 wrong_type_argument (Qlistp, seq);
1771 1719
1772 if (!NILP (Fequal (elt, XCAR (tail)))) 1720 if (!NILP (Fequal (elt, XCAR (tail))))
1773 { 1721 {
@@ -1799,8 +1747,7 @@ Return the reversed list. */)
1799 while (!NILP (tail)) 1747 while (!NILP (tail))
1800 { 1748 {
1801 QUIT; 1749 QUIT;
1802 if (! CONSP (tail)) 1750 CHECK_LIST_CONS (tail, list);
1803 wrong_type_argument (Qlistp, list);
1804 next = XCDR (tail); 1751 next = XCDR (tail);
1805 Fsetcdr (tail, prev); 1752 Fsetcdr (tail, prev);
1806 prev = tail; 1753 prev = tail;
@@ -1822,8 +1769,7 @@ See also the function `nreverse', which is used more often. */)
1822 QUIT; 1769 QUIT;
1823 new = Fcons (XCAR (list), new); 1770 new = Fcons (XCAR (list), new);
1824 } 1771 }
1825 if (!NILP (list)) 1772 CHECK_LIST_END (list, list);
1826 wrong_type_argument (Qconsp, list);
1827 return new; 1773 return new;
1828} 1774}
1829 1775
@@ -1947,8 +1893,7 @@ one of the properties on the list. */)
1947 QUIT; 1893 QUIT;
1948 } 1894 }
1949 1895
1950 if (!NILP (tail)) 1896 CHECK_LIST_END (tail, prop);
1951 wrong_type_argument (Qlistp, prop);
1952 1897
1953 return Qnil; 1898 return Qnil;
1954} 1899}
@@ -2064,8 +2009,7 @@ one of the properties on the list. */)
2064 QUIT; 2009 QUIT;
2065 } 2010 }
2066 2011
2067 if (!NILP (tail)) 2012 CHECK_LIST_END (tail, prop);
2068 wrong_type_argument (Qlistp, prop);
2069 2013
2070 return Qnil; 2014 return Qnil;
2071} 2015}
@@ -2280,7 +2224,6 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2280 Lisp_Object array, item; 2224 Lisp_Object array, item;
2281{ 2225{
2282 register int size, index, charval; 2226 register int size, index, charval;
2283 retry:
2284 if (VECTORP (array)) 2227 if (VECTORP (array))
2285 { 2228 {
2286 register Lisp_Object *p = XVECTOR (array)->contents; 2229 register Lisp_Object *p = XVECTOR (array)->contents;
@@ -2344,10 +2287,7 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2344 } 2287 }
2345 } 2288 }
2346 else 2289 else
2347 { 2290 wrong_type_argument (Qarrayp, array);
2348 array = wrong_type_argument (Qarrayp, array);
2349 goto retry;
2350 }
2351 return array; 2291 return array;
2352} 2292}
2353 2293
@@ -2405,8 +2345,7 @@ usage: (nconc &rest LISTS) */)
2405 2345
2406 if (argnum + 1 == nargs) break; 2346 if (argnum + 1 == nargs) break;
2407 2347
2408 if (!CONSP (tem)) 2348 CHECK_LIST_CONS (tem, tem);
2409 tem = wrong_type_argument (Qlistp, tem);
2410 2349
2411 while (CONSP (tem)) 2350 while (CONSP (tem))
2412 { 2351 {
@@ -3923,10 +3862,7 @@ hashfn_user_defined (h, key)
3923 args[1] = key; 3862 args[1] = key;
3924 hash = Ffuncall (2, args); 3863 hash = Ffuncall (2, args);
3925 if (!INTEGERP (hash)) 3864 if (!INTEGERP (hash))
3926 Fsignal (Qerror, 3865 signal_error ("Invalid hash code returned from user-supplied hash function", hash);
3927 list2 (build_string ("Invalid hash code returned from \
3928user-supplied hash function"),
3929 hash));
3930 return XUINT (hash); 3866 return XUINT (hash);
3931} 3867}
3932 3868
@@ -4682,8 +4618,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4682 4618
4683 prop = Fget (test, Qhash_table_test); 4619 prop = Fget (test, Qhash_table_test);
4684 if (!CONSP (prop) || !CONSP (XCDR (prop))) 4620 if (!CONSP (prop) || !CONSP (XCDR (prop)))
4685 Fsignal (Qerror, list2 (build_string ("Invalid hash table test"), 4621 signal_error ("Invalid hash table test", test);
4686 test));
4687 user_test = XCAR (prop); 4622 user_test = XCAR (prop);
4688 user_hash = XCAR (XCDR (prop)); 4623 user_hash = XCAR (XCDR (prop));
4689 } 4624 }
@@ -4696,9 +4631,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4696 if (NILP (size)) 4631 if (NILP (size))
4697 size = make_number (DEFAULT_HASH_SIZE); 4632 size = make_number (DEFAULT_HASH_SIZE);
4698 else if (!INTEGERP (size) || XINT (size) < 0) 4633 else if (!INTEGERP (size) || XINT (size) < 0)
4699 Fsignal (Qerror, 4634 signal_error ("Invalid hash table size", size);
4700 list2 (build_string ("Invalid hash table size"),
4701 size));
4702 4635
4703 /* Look for `:rehash-size SIZE'. */ 4636 /* Look for `:rehash-size SIZE'. */
4704 i = get_key_arg (QCrehash_size, nargs, args, used); 4637 i = get_key_arg (QCrehash_size, nargs, args, used);
@@ -4706,9 +4639,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4706 if (!NUMBERP (rehash_size) 4639 if (!NUMBERP (rehash_size)
4707 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) 4640 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0)
4708 || XFLOATINT (rehash_size) <= 1.0) 4641 || XFLOATINT (rehash_size) <= 1.0)
4709 Fsignal (Qerror, 4642 signal_error ("Invalid hash table rehash size", rehash_size);
4710 list2 (build_string ("Invalid hash table rehash size"),
4711 rehash_size));
4712 4643
4713 /* Look for `:rehash-threshold THRESHOLD'. */ 4644 /* Look for `:rehash-threshold THRESHOLD'. */
4714 i = get_key_arg (QCrehash_threshold, nargs, args, used); 4645 i = get_key_arg (QCrehash_threshold, nargs, args, used);
@@ -4716,9 +4647,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4716 if (!FLOATP (rehash_threshold) 4647 if (!FLOATP (rehash_threshold)
4717 || XFLOATINT (rehash_threshold) <= 0.0 4648 || XFLOATINT (rehash_threshold) <= 0.0
4718 || XFLOATINT (rehash_threshold) > 1.0) 4649 || XFLOATINT (rehash_threshold) > 1.0)
4719 Fsignal (Qerror, 4650 signal_error ("Invalid hash table rehash threshold", rehash_threshold);
4720 list2 (build_string ("Invalid hash table rehash threshold"),
4721 rehash_threshold));
4722 4651
4723 /* Look for `:weakness WEAK'. */ 4652 /* Look for `:weakness WEAK'. */
4724 i = get_key_arg (QCweakness, nargs, args, used); 4653 i = get_key_arg (QCweakness, nargs, args, used);
@@ -4730,14 +4659,12 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4730 && !EQ (weak, Qvalue) 4659 && !EQ (weak, Qvalue)
4731 && !EQ (weak, Qkey_or_value) 4660 && !EQ (weak, Qkey_or_value)
4732 && !EQ (weak, Qkey_and_value)) 4661 && !EQ (weak, Qkey_and_value))
4733 Fsignal (Qerror, list2 (build_string ("Invalid hash table weakness"), 4662 signal_error ("Invalid hash table weakness", weak);
4734 weak));
4735 4663
4736 /* Now, all args should have been used up, or there's a problem. */ 4664 /* Now, all args should have been used up, or there's a problem. */
4737 for (i = 0; i < nargs; ++i) 4665 for (i = 0; i < nargs; ++i)
4738 if (!used[i]) 4666 if (!used[i])
4739 Fsignal (Qerror, 4667 signal_error ("Invalid argument list", args[i]);
4740 list2 (build_string ("Invalid argument list"), args[i]));
4741 4668
4742 return make_hash_table (test, size, rehash_size, rehash_threshold, weak, 4669 return make_hash_table (test, size, rehash_size, rehash_threshold, weak,
4743 user_test, user_hash); 4670 user_test, user_hash);
@@ -4987,8 +4914,7 @@ guesswork fails. Normally, an error is signaled in such case. */)
4987 if (!NILP (noerror)) 4914 if (!NILP (noerror))
4988 coding_system = Qraw_text; 4915 coding_system = Qraw_text;
4989 else 4916 else
4990 while (1) 4917 xsignal1 (Qcoding_system_error, coding_system);
4991 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
4992 } 4918 }
4993 4919
4994 if (STRING_MULTIBYTE (object)) 4920 if (STRING_MULTIBYTE (object))
@@ -5122,8 +5048,7 @@ guesswork fails. Normally, an error is signaled in such case. */)
5122 if (!NILP (noerror)) 5048 if (!NILP (noerror))
5123 coding_system = Qraw_text; 5049 coding_system = Qraw_text;
5124 else 5050 else
5125 while (1) 5051 xsignal1 (Qcoding_system_error, coding_system);
5126 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
5127 } 5052 }
5128 } 5053 }
5129 5054
diff --git a/src/frame.c b/src/frame.c
index 0eaab69e961..1f8c173b9db 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3037,8 +3037,7 @@ x_set_line_spacing (f, new_value, old_value)
3037 else if (NATNUMP (new_value)) 3037 else if (NATNUMP (new_value))
3038 f->extra_line_spacing = XFASTINT (new_value); 3038 f->extra_line_spacing = XFASTINT (new_value);
3039 else 3039 else
3040 Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"), 3040 signal_error ("Invalid line-spacing", new_value);
3041 Fcons (new_value, Qnil)));
3042 if (FRAME_VISIBLE_P (f)) 3041 if (FRAME_VISIBLE_P (f))
3043 redraw_frame (f); 3042 redraw_frame (f);
3044} 3043}
@@ -3058,8 +3057,7 @@ x_set_screen_gamma (f, new_value, old_value)
3058 /* The value 0.4545 is the normal viewing gamma. */ 3057 /* The value 0.4545 is the normal viewing gamma. */
3059 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); 3058 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
3060 else 3059 else
3061 Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"), 3060 signal_error ("Invalid screen-gamma", new_value);
3062 Fcons (new_value, Qnil)));
3063 3061
3064 clear_face_cache (0); 3062 clear_face_cache (0);
3065} 3063}
diff --git a/src/frame.h b/src/frame.h
index 06976875759..bbf0c45d79b 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -772,18 +772,11 @@ typedef struct frame *FRAME_PTR;
772 (f)->visible = (f)->async_visible, \ 772 (f)->visible = (f)->async_visible, \
773 (f)->iconified = (f)->async_iconified) 773 (f)->iconified = (f)->async_iconified)
774 774
775#define CHECK_FRAME(x) \ 775#define CHECK_FRAME(x) \
776 do { \ 776 CHECK_TYPE (FRAMEP (x), Qframep, x)
777 if (! FRAMEP (x)) \ 777
778 x = wrong_type_argument (Qframep, (x)); \ 778#define CHECK_LIVE_FRAME(x) \
779 } while (0) 779 CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
780
781#define CHECK_LIVE_FRAME(x) \
782 do { \
783 if (! FRAMEP (x) \
784 || ! FRAME_LIVE_P (XFRAME (x))) \
785 x = wrong_type_argument (Qframe_live_p, (x)); \
786 } while (0)
787 780
788/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a 781/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
789 `for' loop which iterates over the elements of Vframe_list. The 782 `for' loop which iterates over the elements of Vframe_list. The
diff --git a/src/fringe.c b/src/fringe.c
index ab55775189f..a42c2d70439 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1398,7 +1398,7 @@ init_fringe_bitmap (which, fb, once_p)
1398DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap, 1398DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap,
1399 2, 5, 0, 1399 2, 5, 0,
1400 doc: /* Define fringe bitmap BITMAP from BITS of size HEIGHT x WIDTH. 1400 doc: /* Define fringe bitmap BITMAP from BITS of size HEIGHT x WIDTH.
1401BITMAP is a symbol or string naming the new fringe bitmap. 1401BITMAP is a symbol identifying the new fringe bitmap.
1402BITS is either a string or a vector of integers. 1402BITS is either a string or a vector of integers.
1403HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS. 1403HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS.
1404WIDTH must be an integer between 1 and 16, or nil which defaults to 8. 1404WIDTH must be an integer between 1 and 16, or nil which defaults to 8.
@@ -1423,7 +1423,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1423 else if (VECTORP (bits)) 1423 else if (VECTORP (bits))
1424 h = XVECTOR (bits)->size; 1424 h = XVECTOR (bits)->size;
1425 else 1425 else
1426 bits = wrong_type_argument (Qsequencep, bits); 1426 wrong_type_argument (Qsequencep, bits);
1427 1427
1428 if (NILP (height)) 1428 if (NILP (height))
1429 fb.height = h; 1429 fb.height = h;
diff --git a/src/keyboard.c b/src/keyboard.c
index b47df2bec7a..e58c78c84ac 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -242,6 +242,9 @@ static int inhibit_local_menu_bar_menus;
242/* Nonzero means C-g should cause immediate error-signal. */ 242/* Nonzero means C-g should cause immediate error-signal. */
243int immediate_quit; 243int immediate_quit;
244 244
245/* The user's hook function for outputting an error message. */
246Lisp_Object Vcommand_error_function;
247
245/* The user's ERASE setting. */ 248/* The user's ERASE setting. */
246Lisp_Object Vtty_erase_char; 249Lisp_Object Vtty_erase_char;
247 250
@@ -1003,7 +1006,7 @@ recursive_edit_1 ()
1003 /* Handle throw from read_minibuf when using minibuffer 1006 /* Handle throw from read_minibuf when using minibuffer
1004 while it's active but we're in another window. */ 1007 while it's active but we're in another window. */
1005 if (STRINGP (val)) 1008 if (STRINGP (val))
1006 Fsignal (Qerror, Fcons (val, Qnil)); 1009 xsignal1 (Qerror, val);
1007 1010
1008 return unbind_to (count, Qnil); 1011 return unbind_to (count, Qnil);
1009} 1012}
@@ -1230,52 +1233,47 @@ cmd_error_internal (data, context)
1230 Lisp_Object data; 1233 Lisp_Object data;
1231 char *context; 1234 char *context;
1232{ 1235{
1233 Lisp_Object stream;
1234 int kill_emacs_p = 0;
1235 struct frame *sf = SELECTED_FRAME (); 1236 struct frame *sf = SELECTED_FRAME ();
1236 1237
1238 /* The immediate context is not interesting for Quits,
1239 since they are asyncronous. */
1240 if (EQ (XCAR (data), Qquit))
1241 Vsignaling_function = Qnil;
1242
1237 Vquit_flag = Qnil; 1243 Vquit_flag = Qnil;
1238 Vinhibit_quit = Qt; 1244 Vinhibit_quit = Qt;
1239 clear_message (1, 0);
1240 1245
1246 /* Use user's specified output function if any. */
1247 if (!NILP (Vcommand_error_function))
1248 call3 (Vcommand_error_function, data,
1249 build_string (context ? context : ""),
1250 Vsignaling_function);
1241 /* If the window system or terminal frame hasn't been initialized 1251 /* If the window system or terminal frame hasn't been initialized
1242 yet, or we're not interactive, it's best to dump this message out 1252 yet, or we're not interactive, write the message to stderr and exit. */
1243 to stderr and exit. */ 1253 else if (!sf->glyphs_initialized_p
1244 if (!sf->glyphs_initialized_p 1254 /* This is the case of the frame dumped with Emacs, when we're
1245 /* This is the case of the frame dumped with Emacs, when we're 1255 running under a window system. */
1246 running under a window system. */ 1256 || (!NILP (Vwindow_system)
1247 || (!NILP (Vwindow_system) 1257 && !inhibit_window_system
1248 && !inhibit_window_system 1258 && FRAME_TERMCAP_P (sf))
1249 && FRAME_TERMCAP_P (sf)) 1259 || noninteractive)
1250 || noninteractive) 1260 {
1251 { 1261 print_error_message (data, Qexternal_debugging_output,
1252 stream = Qexternal_debugging_output; 1262 context, Vsignaling_function);
1253 kill_emacs_p = 1; 1263 Fterpri (Qexternal_debugging_output);
1264 Fkill_emacs (make_number (-1));
1254 } 1265 }
1255 else 1266 else
1256 { 1267 {
1268 clear_message (1, 0);
1257 Fdiscard_input (); 1269 Fdiscard_input ();
1258 message_log_maybe_newline (); 1270 message_log_maybe_newline ();
1259 bitch_at_user (); 1271 bitch_at_user ();
1260 stream = Qt;
1261 }
1262
1263 /* The immediate context is not interesting for Quits,
1264 since they are asyncronous. */
1265 if (EQ (XCAR (data), Qquit))
1266 Vsignaling_function = Qnil;
1267 1272
1268 print_error_message (data, stream, context, Vsignaling_function); 1273 print_error_message (data, Qt, context, Vsignaling_function);
1274 }
1269 1275
1270 Vsignaling_function = Qnil; 1276 Vsignaling_function = Qnil;
1271
1272 /* If the window system or terminal frame hasn't been initialized
1273 yet, or we're in -batch mode, this error should cause Emacs to exit. */
1274 if (kill_emacs_p)
1275 {
1276 Fterpri (stream);
1277 Fkill_emacs (make_number (-1));
1278 }
1279} 1277}
1280 1278
1281Lisp_Object command_loop_1 (); 1279Lisp_Object command_loop_1 ();
@@ -1490,7 +1488,8 @@ command_loop_1 ()
1490 int count = SPECPDL_INDEX (); 1488 int count = SPECPDL_INDEX ();
1491 specbind (Qinhibit_quit, Qt); 1489 specbind (Qinhibit_quit, Qt);
1492 1490
1493 Fsit_for (Vminibuffer_message_timeout, Qnil, Qnil); 1491 sit_for (Vminibuffer_message_timeout, 0, 2);
1492
1494 /* Clear the echo area. */ 1493 /* Clear the echo area. */
1495 message2 (0, 0, 0); 1494 message2 (0, 0, 0);
1496 safe_run_hooks (Qecho_area_clear_hook); 1495 safe_run_hooks (Qecho_area_clear_hook);
@@ -2689,8 +2688,6 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2689 /* Or not echoing before and echoing allowed. */ 2688 /* Or not echoing before and echoing allowed. */
2690 || (!echo_kboard && ok_to_echo_at_next_pause))) 2689 || (!echo_kboard && ok_to_echo_at_next_pause)))
2691 { 2690 {
2692 Lisp_Object tem0;
2693
2694 /* After a mouse event, start echoing right away. 2691 /* After a mouse event, start echoing right away.
2695 This is because we are probably about to display a menu, 2692 This is because we are probably about to display a menu,
2696 and we don't want to delay before doing so. */ 2693 and we don't want to delay before doing so. */
@@ -2698,13 +2695,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2698 echo_now (); 2695 echo_now ();
2699 else 2696 else
2700 { 2697 {
2701 int sec, usec; 2698 Lisp_Object tem0;
2702 double duration = extract_float (Vecho_keystrokes); 2699
2703 sec = (int) duration;
2704 usec = (duration - sec) * 1000000;
2705 save_getcjmp (save_jump); 2700 save_getcjmp (save_jump);
2706 restore_getcjmp (local_getcjmp); 2701 restore_getcjmp (local_getcjmp);
2707 tem0 = sit_for (sec, usec, 1, 1, 0); 2702 tem0 = sit_for (Vecho_keystrokes, 1, 1);
2708 restore_getcjmp (save_jump); 2703 restore_getcjmp (save_jump);
2709 if (EQ (tem0, Qt) 2704 if (EQ (tem0, Qt)
2710 && ! CONSP (Vunread_command_events)) 2705 && ! CONSP (Vunread_command_events))
@@ -2771,11 +2766,11 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2771 && XINT (Vauto_save_timeout) > 0) 2766 && XINT (Vauto_save_timeout) > 0)
2772 { 2767 {
2773 Lisp_Object tem0; 2768 Lisp_Object tem0;
2769 int timeout = delay_level * XFASTINT (Vauto_save_timeout) / 4;
2774 2770
2775 save_getcjmp (save_jump); 2771 save_getcjmp (save_jump);
2776 restore_getcjmp (local_getcjmp); 2772 restore_getcjmp (local_getcjmp);
2777 tem0 = sit_for (delay_level * XFASTINT (Vauto_save_timeout) / 4, 2773 tem0 = sit_for (make_number (timeout), 1, 1);
2778 0, 1, 1, 0);
2779 restore_getcjmp (save_jump); 2774 restore_getcjmp (save_jump);
2780 2775
2781 if (EQ (tem0, Qt) 2776 if (EQ (tem0, Qt)
@@ -8387,7 +8382,7 @@ access_keymap_keyremap (map, key, prompt, do_funcall)
8387 /* Handle a symbol whose function definition is a keymap 8382 /* Handle a symbol whose function definition is a keymap
8388 or an array. */ 8383 or an array. */
8389 if (SYMBOLP (next) && !NILP (Ffboundp (next)) 8384 if (SYMBOLP (next) && !NILP (Ffboundp (next))
8390 && (!NILP (Farrayp (XSYMBOL (next)->function)) 8385 && (ARRAYP (XSYMBOL (next)->function)
8391 || KEYMAPP (XSYMBOL (next)->function))) 8386 || KEYMAPP (XSYMBOL (next)->function)))
8392 next = XSYMBOL (next)->function; 8387 next = XSYMBOL (next)->function;
8393 8388
@@ -9767,7 +9762,13 @@ a special event, so ignore the prefix argument and don't clear it. */)
9767 9762
9768DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_command, 9763DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_command,
9769 1, 1, "P", 9764 1, 1, "P",
9770 doc: /* Read function name, then read its arguments and call it. */) 9765 doc: /* Read function name, then read its arguments and call it.
9766
9767To pass a numeric argument to the command you are invoking with, specify
9768the numeric argument to this command.
9769
9770Noninteractively, the argument PREFIXARG is the prefix argument to
9771give to the command you invoke, if it asks for an argument. */)
9771 (prefixarg) 9772 (prefixarg)
9772 Lisp_Object prefixarg; 9773 Lisp_Object prefixarg;
9773{ 9774{
@@ -9873,19 +9874,18 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
9873 Qmouse_movement))) 9874 Qmouse_movement)))
9874 { 9875 {
9875 /* But first wait, and skip the message if there is input. */ 9876 /* But first wait, and skip the message if there is input. */
9876 int delay_time; 9877 Lisp_Object waited;
9877 if (!NILP (echo_area_buffer[0])) 9878
9878 /* This command displayed something in the echo area; 9879 /* If this command displayed something in the echo area;
9879 so wait a few seconds, then display our suggestion message. */ 9880 wait a few seconds, then display our suggestion message. */
9880 delay_time = (NUMBERP (Vsuggest_key_bindings) 9881 if (NILP (echo_area_buffer[0]))
9881 ? XINT (Vsuggest_key_bindings) : 2); 9882 waited = sit_for (make_number (0), 0, 2);
9883 else if (NUMBERP (Vsuggest_key_bindings))
9884 waited = sit_for (Vminibuffer_message_timeout, 0, 2);
9882 else 9885 else
9883 /* This command left the echo area empty, 9886 waited = sit_for (make_number (2), 0, 2);
9884 so display our message immediately. */
9885 delay_time = 0;
9886 9887
9887 if (!NILP (Fsit_for (make_number (delay_time), Qnil, Qnil)) 9888 if (!NILP (waited) && ! CONSP (Vunread_command_events))
9888 && ! CONSP (Vunread_command_events))
9889 { 9889 {
9890 Lisp_Object binding; 9890 Lisp_Object binding;
9891 char *newmessage; 9891 char *newmessage;
@@ -9905,10 +9905,12 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
9905 message2_nolog (newmessage, 9905 message2_nolog (newmessage,
9906 strlen (newmessage), 9906 strlen (newmessage),
9907 STRING_MULTIBYTE (binding)); 9907 STRING_MULTIBYTE (binding));
9908 if (!NILP (Fsit_for ((NUMBERP (Vsuggest_key_bindings) 9908 if (NUMBERP (Vsuggest_key_bindings))
9909 ? Vsuggest_key_bindings : make_number (2)), 9909 waited = sit_for (Vsuggest_key_bindings, 0, 2);
9910 Qnil, Qnil)) 9910 else
9911 && message_p) 9911 waited = sit_for (make_number (2), 0, 2);
9912
9913 if (!NILP (waited) && message_p)
9912 restore_message (); 9914 restore_message ();
9913 9915
9914 unbind_to (count, Qnil); 9916 unbind_to (count, Qnil);
@@ -11479,6 +11481,15 @@ The value of that variable is passed to `quit-flag' and later causes a
11479peculiar kind of quitting. */); 11481peculiar kind of quitting. */);
11480 Vthrow_on_input = Qnil; 11482 Vthrow_on_input = Qnil;
11481 11483
11484 DEFVAR_LISP ("command-error-function", &Vcommand_error_function,
11485 doc: /* If non-nil, function to output error messages.
11486The arguments are the error data, a list of the form
11487 (SIGNALED-CONDITIONS . SIGNAL-DATA)
11488such as just as `condition-case' would bind its variable to,
11489the context (a string which normally goes at the start of the message),
11490and the Lisp function within which the error was signaled. */);
11491 Vcommand_error_function = Qnil;
11492
11482 DEFVAR_LISP ("enable-disabled-menus-and-buttons", 11493 DEFVAR_LISP ("enable-disabled-menus-and-buttons",
11483 &Venable_disabled_menus_and_buttons, 11494 &Venable_disabled_menus_and_buttons,
11484 doc: /* If non-nil, don't ignore events produced by disabled menu items and tool-bar. 11495 doc: /* If non-nil, don't ignore events produced by disabled menu items and tool-bar.
diff --git a/src/keymap.c b/src/keymap.c
index c763ee71831..af9d817a1eb 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -733,7 +733,7 @@ usage: (map-keymap FUNCTION KEYMAP) */)
733 if (INTEGERP (function)) 733 if (INTEGERP (function))
734 /* We have to stop integers early since map_keymap gives them special 734 /* We have to stop integers early since map_keymap gives them special
735 significance. */ 735 significance. */
736 Fsignal (Qinvalid_function, Fcons (function, Qnil)); 736 xsignal1 (Qinvalid_function, function);
737 if (! NILP (sort_first)) 737 if (! NILP (sort_first))
738 return call3 (intern ("map-keymap-internal"), function, keymap, Qt); 738 return call3 (intern ("map-keymap-internal"), function, keymap, Qt);
739 739
@@ -1161,8 +1161,7 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1161 GCPRO3 (keymap, key, def); 1161 GCPRO3 (keymap, key, def);
1162 keymap = get_keymap (keymap, 1, 1); 1162 keymap = get_keymap (keymap, 1, 1);
1163 1163
1164 if (!VECTORP (key) && !STRINGP (key)) 1164 CHECK_VECTOR_OR_STRING (key);
1165 key = wrong_type_argument (Qarrayp, key);
1166 1165
1167 length = XFASTINT (Flength (key)); 1166 length = XFASTINT (Flength (key));
1168 if (length == 0) 1167 if (length == 0)
@@ -1282,8 +1281,7 @@ recognize the default bindings, just as `read-key-sequence' does. */)
1282 GCPRO2 (keymap, key); 1281 GCPRO2 (keymap, key);
1283 keymap = get_keymap (keymap, 1, 1); 1282 keymap = get_keymap (keymap, 1, 1);
1284 1283
1285 if (!VECTORP (key) && !STRINGP (key)) 1284 CHECK_VECTOR_OR_STRING (key);
1286 key = wrong_type_argument (Qarrayp, key);
1287 1285
1288 length = XFASTINT (Flength (key)); 1286 length = XFASTINT (Flength (key));
1289 if (length == 0) 1287 if (length == 0)
diff --git a/src/lisp.h b/src/lisp.h
index af7fae52eaf..8224117241c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -594,6 +594,12 @@ extern size_t pure_size;
594#define STRING_COPYIN(string, index, new, count) \ 594#define STRING_COPYIN(string, index, new, count) \
595 bcopy (new, XSTRING (string)->data + index, count) 595 bcopy (new, XSTRING (string)->data + index, count)
596 596
597/* Type checking. */
598
599#define CHECK_TYPE(ok, Qxxxp, x) \
600 do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0)
601
602
597 603
598/* See the macros in intervals.h. */ 604/* See the macros in intervals.h. */
599 605
@@ -601,8 +607,8 @@ typedef struct interval *INTERVAL;
601 607
602/* Complain if object is not string or buffer type */ 608/* Complain if object is not string or buffer type */
603#define CHECK_STRING_OR_BUFFER(x) \ 609#define CHECK_STRING_OR_BUFFER(x) \
604 { if (!STRINGP ((x)) && !BUFFERP ((x))) \ 610 CHECK_TYPE (STRINGP (x) || BUFFERP (x), Qbuffer_or_string_p, x)
605 x = wrong_type_argument (Qbuffer_or_string_p, (x)); } 611
606 612
607/* In a cons, the markbit of the car is the gc mark bit */ 613/* In a cons, the markbit of the car is the gc mark bit */
608 614
@@ -671,6 +677,13 @@ struct Lisp_Cons
671 : NILP ((c)) ? Qnil \ 677 : NILP ((c)) ? Qnil \
672 : wrong_type_argument (Qlistp, (c))) 678 : wrong_type_argument (Qlistp, (c)))
673 679
680/* Take the car or cdr of something whose type is not known. */
681#define CAR_SAFE(c) \
682 (CONSP ((c)) ? XCAR ((c)) : Qnil)
683
684#define CDR_SAFE(c) \
685 (CONSP ((c)) ? XCDR ((c)) : Qnil)
686
674/* Nonzero if STR is a multibyte string. */ 687/* Nonzero if STR is a multibyte string. */
675#define STRING_MULTIBYTE(STR) \ 688#define STRING_MULTIBYTE(STR) \
676 (XSTRING (STR)->size_byte >= 0) 689 (XSTRING (STR)->size_byte >= 0)
@@ -1049,13 +1062,8 @@ struct Lisp_Hash_Table
1049#define HASH_TABLE_P(OBJ) PSEUDOVECTORP (OBJ, PVEC_HASH_TABLE) 1062#define HASH_TABLE_P(OBJ) PSEUDOVECTORP (OBJ, PVEC_HASH_TABLE)
1050#define GC_HASH_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_HASH_TABLE) 1063#define GC_HASH_TABLE_P(x) GC_PSEUDOVECTORP (x, PVEC_HASH_TABLE)
1051 1064
1052#define CHECK_HASH_TABLE(x) \ 1065#define CHECK_HASH_TABLE(x) \
1053 do \ 1066 CHECK_TYPE (HASH_TABLE_P (x), Qhash_table_p, x)
1054 { \
1055 if (!HASH_TABLE_P ((x))) \
1056 x = wrong_type_argument (Qhash_table_p, (x)); \
1057 } \
1058 while (0)
1059 1067
1060/* Value is the key part of entry IDX in hash table H. */ 1068/* Value is the key part of entry IDX in hash table H. */
1061 1069
@@ -1520,41 +1528,57 @@ typedef unsigned char UCHAR;
1520/* Test for image (image . spec) */ 1528/* Test for image (image . spec) */
1521#define IMAGEP(x) (CONSP (x) && EQ (XCAR (x), Qimage)) 1529#define IMAGEP(x) (CONSP (x) && EQ (XCAR (x), Qimage))
1522 1530
1531/* Array types. */
1532
1533#define ARRAYP(x) \
1534 (VECTORP (x) || STRINGP (x) || CHAR_TABLE_P (x) || BOOL_VECTOR_P (x))
1523 1535
1524#define GC_EQ(x, y) EQ (x, y) 1536#define GC_EQ(x, y) EQ (x, y)
1525 1537
1526#define CHECK_LIST(x) \ 1538#define CHECK_LIST(x) \
1527 do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0) 1539 CHECK_TYPE (CONSP (x) || NILP (x), Qlistp, x)
1540
1541#define CHECK_LIST_CONS(x, y) \
1542 CHECK_TYPE (CONSP (x), Qlistp, y)
1543
1544#define CHECK_LIST_END(x, y) \
1545 CHECK_TYPE (NILP (x), Qlistp, y)
1528 1546
1529#define CHECK_STRING(x) \ 1547#define CHECK_STRING(x) \
1530 do { if (!STRINGP ((x))) x = wrong_type_argument (Qstringp, (x)); } while (0) 1548 CHECK_TYPE (STRINGP (x), Qstringp, x)
1531 1549
1532#define CHECK_STRING_CAR(x) \ 1550#define CHECK_STRING_CAR(x) \
1533 do { if (!STRINGP (XCAR (x))) XSETCAR (x, wrong_type_argument (Qstringp, XCAR (x))); } while (0) 1551 CHECK_TYPE (STRINGP (XCAR (x)), Qstringp, XCAR (x))
1534 1552
1535#define CHECK_CONS(x) \ 1553#define CHECK_CONS(x) \
1536 do { if (!CONSP ((x))) x = wrong_type_argument (Qconsp, (x)); } while (0) 1554 CHECK_TYPE (CONSP (x), Qconsp, x)
1537 1555
1538#define CHECK_SYMBOL(x) \ 1556#define CHECK_SYMBOL(x) \
1539 do { if (!SYMBOLP ((x))) x = wrong_type_argument (Qsymbolp, (x)); } while (0) 1557 CHECK_TYPE (SYMBOLP (x), Qsymbolp, x)
1540 1558
1541#define CHECK_CHAR_TABLE(x) \ 1559#define CHECK_CHAR_TABLE(x) \
1542 do { if (!CHAR_TABLE_P ((x))) \ 1560 CHECK_TYPE (CHAR_TABLE_P (x), Qchar_table_p, x)
1543 x = wrong_type_argument (Qchar_table_p, (x)); } while (0)
1544 1561
1545#define CHECK_VECTOR(x) \ 1562#define CHECK_VECTOR(x) \
1546 do { if (!VECTORP ((x))) x = wrong_type_argument (Qvectorp, (x)); } while (0) 1563 CHECK_TYPE (VECTORP (x), Qvectorp, x)
1547 1564
1548#define CHECK_VECTOR_OR_CHAR_TABLE(x) \ 1565#define CHECK_VECTOR_OR_STRING(x) \
1549 do { if (!VECTORP ((x)) && !CHAR_TABLE_P ((x))) \ 1566 CHECK_TYPE (VECTORP (x) || STRINGP (x), Qarrayp, x)
1550 x = wrong_type_argument (Qvector_or_char_table_p, (x)); \ 1567
1551 } while (0) 1568#define CHECK_ARRAY(x, Qxxxp) \
1569 CHECK_TYPE (ARRAYP (x), Qxxxp, x)
1570
1571#define CHECK_VECTOR_OR_CHAR_TABLE(x) \
1572 CHECK_TYPE (VECTORP (x) || CHAR_TABLE_P (x), Qvector_or_char_table_p, x)
1552 1573
1553#define CHECK_BUFFER(x) \ 1574#define CHECK_BUFFER(x) \
1554 do { if (!BUFFERP ((x))) x = wrong_type_argument (Qbufferp, (x)); } while (0) 1575 CHECK_TYPE (BUFFERP (x), Qbufferp, x)
1555 1576
1556#define CHECK_WINDOW(x) \ 1577#define CHECK_WINDOW(x) \
1557 do { if (!WINDOWP ((x))) x = wrong_type_argument (Qwindowp, (x)); } while (0) 1578 CHECK_TYPE (WINDOWP (x), Qwindowp, x)
1579
1580#define CHECK_WINDOW_CONFIGURATION(x) \
1581 CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
1558 1582
1559/* This macro rejects windows on the interior of the window tree as 1583/* This macro rejects windows on the interior of the window tree as
1560 "dead", which is what we want; this is an argument-checking macro, and 1584 "dead", which is what we want; this is an argument-checking macro, and
@@ -1563,46 +1587,42 @@ typedef unsigned char UCHAR;
1563 A window of any sort, leaf or interior, is dead iff the buffer, 1587 A window of any sort, leaf or interior, is dead iff the buffer,
1564 vchild, and hchild members are all nil. */ 1588 vchild, and hchild members are all nil. */
1565 1589
1566#define CHECK_LIVE_WINDOW(x) \ 1590#define CHECK_LIVE_WINDOW(x) \
1567 do { \ 1591 CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), Qwindow_live_p, x)
1568 if (!WINDOWP ((x)) \
1569 || NILP (XWINDOW ((x))->buffer)) \
1570 x = wrong_type_argument (Qwindow_live_p, (x)); \
1571 } while (0)
1572 1592
1573#define CHECK_PROCESS(x) \ 1593#define CHECK_PROCESS(x) \
1574 do { if (!PROCESSP ((x))) x = wrong_type_argument (Qprocessp, (x)); } while (0) 1594 CHECK_TYPE (PROCESSP (x), Qprocessp, x)
1595
1596#define CHECK_SUBR(x) \
1597 CHECK_TYPE (SUBRP (x), Qsubrp, x)
1575 1598
1576#define CHECK_NUMBER(x) \ 1599#define CHECK_NUMBER(x) \
1577 do { if (!INTEGERP ((x))) x = wrong_type_argument (Qintegerp, (x)); } while (0) 1600 CHECK_TYPE (INTEGERP (x), Qintegerp, x)
1578 1601
1579#define CHECK_NATNUM(x) \ 1602#define CHECK_NATNUM(x) \
1580 do { if (!NATNUMP (x)) x = wrong_type_argument (Qwholenump, (x)); } while (0) 1603 CHECK_TYPE (NATNUMP (x), Qwholenump, x)
1581 1604
1582#define CHECK_MARKER(x) \ 1605#define CHECK_MARKER(x) \
1583 do { if (!MARKERP ((x))) x = wrong_type_argument (Qmarkerp, (x)); } while (0) 1606 CHECK_TYPE (MARKERP (x), Qmarkerp, x)
1584 1607
1585#define CHECK_NUMBER_COERCE_MARKER(x) \ 1608#define CHECK_NUMBER_COERCE_MARKER(x) \
1586 do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \ 1609 do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \
1587 else if (!INTEGERP ((x))) x = wrong_type_argument (Qinteger_or_marker_p, (x)); } while (0) 1610 else CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); } while (0)
1588 1611
1589#define XFLOATINT(n) extract_float((n)) 1612#define XFLOATINT(n) extract_float((n))
1590 1613
1591#define CHECK_FLOAT(x) \ 1614#define CHECK_FLOAT(x) \
1592 do { if (!FLOATP (x)) \ 1615 CHECK_TYPE (FLOATP (x), Qfloatp, x)
1593 x = wrong_type_argument (Qfloatp, (x)); } while (0)
1594 1616
1595#define CHECK_NUMBER_OR_FLOAT(x) \ 1617#define CHECK_NUMBER_OR_FLOAT(x) \
1596 do { if (!FLOATP (x) && !INTEGERP (x)) \ 1618 CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x)
1597 x = wrong_type_argument (Qnumberp, (x)); } while (0)
1598 1619
1599#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \ 1620#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
1600 do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \ 1621 do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \
1601 else if (!INTEGERP (x) && !FLOATP (x)) \ 1622 else CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); } while (0)
1602 x = wrong_type_argument (Qnumber_or_marker_p, (x)); } while (0)
1603 1623
1604#define CHECK_OVERLAY(x) \ 1624#define CHECK_OVERLAY(x) \
1605 do { if (!OVERLAYP ((x))) x = wrong_type_argument (Qoverlayp, (x));} while (0) 1625 CHECK_TYPE (OVERLAYP (x), Qoverlayp, x)
1606 1626
1607/* Since we can't assign directly to the CAR or CDR fields of a cons 1627/* Since we can't assign directly to the CAR or CDR fields of a cons
1608 cell, use these when checking that those fields contain numbers. */ 1628 cell, use these when checking that those fields contain numbers. */
@@ -2164,7 +2184,7 @@ extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
2164 2184
2165extern Lisp_Object Qinteger; 2185extern Lisp_Object Qinteger;
2166 2186
2167extern void circular_list_error P_ ((Lisp_Object)); 2187extern void circular_list_error P_ ((Lisp_Object)) NO_RETURN;
2168EXFUN (Finteractive_form, 1); 2188EXFUN (Finteractive_form, 1);
2169 2189
2170/* Defined in frame.c */ 2190/* Defined in frame.c */
@@ -2482,8 +2502,8 @@ EXFUN (Fding, 1);
2482EXFUN (Fredraw_frame, 1); 2502EXFUN (Fredraw_frame, 1);
2483EXFUN (Fredraw_display, 0); 2503EXFUN (Fredraw_display, 0);
2484EXFUN (Fsleep_for, 2); 2504EXFUN (Fsleep_for, 2);
2485EXFUN (Fsit_for, 3); 2505EXFUN (Fredisplay, 1);
2486extern Lisp_Object sit_for P_ ((int, int, int, int, int)); 2506extern Lisp_Object sit_for P_ ((Lisp_Object, int, int));
2487extern void init_display P_ ((void)); 2507extern void init_display P_ ((void));
2488extern void syms_of_display P_ ((void)); 2508extern void syms_of_display P_ ((void));
2489extern void safe_bcopy P_ ((const char *, char *, int)); 2509extern void safe_bcopy P_ ((const char *, char *, int));
@@ -2542,13 +2562,14 @@ extern void allocate_string_data P_ ((struct Lisp_String *, int, int));
2542extern void reset_malloc_hooks P_ ((void)); 2562extern void reset_malloc_hooks P_ ((void));
2543extern void uninterrupt_malloc P_ ((void)); 2563extern void uninterrupt_malloc P_ ((void));
2544extern void malloc_warning P_ ((char *)); 2564extern void malloc_warning P_ ((char *));
2545extern void memory_full P_ ((void)); 2565extern void memory_full P_ ((void)) NO_RETURN;
2546extern void buffer_memory_full P_ ((void)); 2566extern void buffer_memory_full P_ ((void)) NO_RETURN;
2547extern int survives_gc_p P_ ((Lisp_Object)); 2567extern int survives_gc_p P_ ((Lisp_Object));
2548extern void mark_object P_ ((Lisp_Object)); 2568extern void mark_object P_ ((Lisp_Object));
2549extern Lisp_Object Vpurify_flag; 2569extern Lisp_Object Vpurify_flag;
2550extern Lisp_Object Vmemory_full; 2570extern Lisp_Object Vmemory_full;
2551EXFUN (Fcons, 2); 2571EXFUN (Fcons, 2);
2572EXFUN (list1, 1);
2552EXFUN (list2, 2); 2573EXFUN (list2, 2);
2553EXFUN (list3, 3); 2574EXFUN (list3, 3);
2554EXFUN (list4, 4); 2575EXFUN (list4, 4);
@@ -2724,6 +2745,12 @@ EXFUN (Fthrow, 2) NO_RETURN;
2724EXFUN (Funwind_protect, UNEVALLED); 2745EXFUN (Funwind_protect, UNEVALLED);
2725EXFUN (Fcondition_case, UNEVALLED); 2746EXFUN (Fcondition_case, UNEVALLED);
2726EXFUN (Fsignal, 2); 2747EXFUN (Fsignal, 2);
2748extern void xsignal P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2749extern void xsignal0 P_ ((Lisp_Object)) NO_RETURN;
2750extern void xsignal1 P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2751extern void xsignal2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN;
2752extern void xsignal3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN;
2753extern void signal_error P_ ((char *, Lisp_Object)) NO_RETURN;
2727EXFUN (Fautoload, 5); 2754EXFUN (Fautoload, 5);
2728EXFUN (Fcommandp, 2); 2755EXFUN (Fcommandp, 2);
2729EXFUN (Feval, 1); 2756EXFUN (Feval, 1);
diff --git a/src/lread.c b/src/lread.c
index 5d8e39d7fb1..08ba5123fcb 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -226,6 +226,9 @@ static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object,
226static Lisp_Object load_unwind P_ ((Lisp_Object)); 226static Lisp_Object load_unwind P_ ((Lisp_Object));
227static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); 227static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object));
228 228
229static void invalid_syntax P_ ((const char *, int)) NO_RETURN;
230static void end_of_file_error P_ (()) NO_RETURN;
231
229 232
230/* Functions that read one byte from the current source READCHARFUN 233/* Functions that read one byte from the current source READCHARFUN
231 or unreads one byte. If the integer argument C is -1, it returns 234 or unreads one byte. If the integer argument C is -1, it returns
@@ -634,7 +637,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
634 input_method) 637 input_method)
635 int no_switch_frame, ascii_required, error_nonascii, input_method; 638 int no_switch_frame, ascii_required, error_nonascii, input_method;
636{ 639{
637 register Lisp_Object val, delayed_switch_frame; 640 Lisp_Object val, delayed_switch_frame;
638 641
639#ifdef HAVE_WINDOW_SYSTEM 642#ifdef HAVE_WINDOW_SYSTEM
640 if (display_hourglass_p) 643 if (display_hourglass_p)
@@ -978,10 +981,8 @@ Return t if the file exists and loads successfully. */)
978 if (fd == -1) 981 if (fd == -1)
979 { 982 {
980 if (NILP (noerror)) 983 if (NILP (noerror))
981 Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"), 984 xsignal2 (Qfile_error, build_string ("Cannot open load file"), file);
982 Fcons (file, Qnil))); 985 return Qnil;
983 else
984 return Qnil;
985 } 986 }
986 987
987 /* Tell startup.el whether or not we found the user's init file. */ 988 /* Tell startup.el whether or not we found the user's init file. */
@@ -1022,8 +1023,7 @@ Return t if the file exists and loads successfully. */)
1022 { 1023 {
1023 if (fd >= 0) 1024 if (fd >= 0)
1024 emacs_close (fd); 1025 emacs_close (fd);
1025 Fsignal (Qerror, Fcons (build_string ("Recursive load"), 1026 signal_error ("Recursive load", Fcons (found, Vloads_in_progress));
1026 Fcons (found, Vloads_in_progress)));
1027 } 1027 }
1028 record_unwind_protect (record_load_unwind, Vloads_in_progress); 1028 record_unwind_protect (record_load_unwind, Vloads_in_progress);
1029 Vloads_in_progress = Fcons (found, Vloads_in_progress); 1029 Vloads_in_progress = Fcons (found, Vloads_in_progress);
@@ -1532,11 +1532,9 @@ end_of_file_error ()
1532 Lisp_Object data; 1532 Lisp_Object data;
1533 1533
1534 if (STRINGP (Vload_file_name)) 1534 if (STRINGP (Vload_file_name))
1535 data = Fcons (Vload_file_name, Qnil); 1535 xsignal1 (Qend_of_file, Vload_file_name);
1536 else
1537 data = Qnil;
1538 1536
1539 Fsignal (Qend_of_file, data); 1537 xsignal0 (Qend_of_file);
1540} 1538}
1541 1539
1542/* UNIBYTE specifies how to set load_convert_to_unibyte 1540/* UNIBYTE specifies how to set load_convert_to_unibyte
@@ -1562,7 +1560,6 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1562 int count = SPECPDL_INDEX (); 1560 int count = SPECPDL_INDEX ();
1563 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1561 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1564 struct buffer *b = 0; 1562 struct buffer *b = 0;
1565 int bpos;
1566 int continue_reading_p; 1563 int continue_reading_p;
1567 /* Nonzero if reading an entire buffer. */ 1564 /* Nonzero if reading an entire buffer. */
1568 int whole_buffer = 0; 1565 int whole_buffer = 0;
@@ -1572,7 +1569,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1572 if (MARKERP (readcharfun)) 1569 if (MARKERP (readcharfun))
1573 { 1570 {
1574 if (NILP (start)) 1571 if (NILP (start))
1575 start = readcharfun; 1572 start = readcharfun;
1576 } 1573 }
1577 1574
1578 if (BUFFERP (readcharfun)) 1575 if (BUFFERP (readcharfun))
@@ -1593,8 +1590,8 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1593 1590
1594 /* Try to ensure sourcename is a truename, except whilst preloading. */ 1591 /* Try to ensure sourcename is a truename, except whilst preloading. */
1595 if (NILP (Vpurify_flag) 1592 if (NILP (Vpurify_flag)
1596 && !NILP (sourcename) && Ffile_name_absolute_p (sourcename) 1593 && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))
1597 && (!NILP (Ffboundp (Qfile_truename)))) 1594 && !NILP (Ffboundp (Qfile_truename)))
1598 sourcename = call1 (Qfile_truename, sourcename) ; 1595 sourcename = call1 (Qfile_truename, sourcename) ;
1599 1596
1600 LOADHIST_ATTACH (sourcename); 1597 LOADHIST_ATTACH (sourcename);
@@ -1703,7 +1700,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1703 first_sexp = 0; 1700 first_sexp = 0;
1704 } 1701 }
1705 1702
1706 build_load_history (sourcename, 1703 build_load_history (sourcename,
1707 stream || whole_buffer); 1704 stream || whole_buffer);
1708 1705
1709 UNGCPRO; 1706 UNGCPRO;
@@ -1893,6 +1890,21 @@ read_internal_start (stream, start, end)
1893 return retval; 1890 return retval;
1894} 1891}
1895 1892
1893
1894/* Signal Qinvalid_read_syntax error.
1895 S is error string of length N (if > 0) */
1896
1897static void
1898invalid_syntax (s, n)
1899 const char *s;
1900 int n;
1901{
1902 if (!n)
1903 n = strlen (s);
1904 xsignal1 (Qinvalid_read_syntax, make_string (s, n));
1905}
1906
1907
1896/* Use this for recursive reads, in contexts where internal tokens 1908/* Use this for recursive reads, in contexts where internal tokens
1897 are not allowed. */ 1909 are not allowed. */
1898 1910
@@ -1904,12 +1916,11 @@ read0 (readcharfun)
1904 int c; 1916 int c;
1905 1917
1906 val = read1 (readcharfun, &c, 0); 1918 val = read1 (readcharfun, &c, 0);
1907 if (c) 1919 if (!c)
1908 Fsignal (Qinvalid_read_syntax, Fcons (Fmake_string (make_number (1), 1920 return val;
1909 make_number (c)),
1910 Qnil));
1911 1921
1912 return val; 1922 xsignal1 (Qinvalid_read_syntax,
1923 Fmake_string (make_number (1), make_number (c)));
1913} 1924}
1914 1925
1915static int read_buffer_size; 1926static int read_buffer_size;
@@ -2127,7 +2138,6 @@ read_escape (readcharfun, stringp)
2127 } 2138 }
2128} 2139}
2129 2140
2130
2131/* Read an integer in radix RADIX using READCHARFUN to read 2141/* Read an integer in radix RADIX using READCHARFUN to read
2132 characters. RADIX must be in the interval [2..36]; if it isn't, a 2142 characters. RADIX must be in the interval [2..36]; if it isn't, a
2133 read error is signaled . Value is the integer read. Signals an 2143 read error is signaled . Value is the integer read. Signals an
@@ -2187,7 +2197,7 @@ read_integer (readcharfun, radix)
2187 { 2197 {
2188 char buf[50]; 2198 char buf[50];
2189 sprintf (buf, "integer, radix %d", radix); 2199 sprintf (buf, "integer, radix %d", radix);
2190 Fsignal (Qinvalid_read_syntax, Fcons (build_string (buf), Qnil)); 2200 invalid_syntax (buf, 0);
2191 } 2201 }
2192 2202
2193 return make_number (sign * number); 2203 return make_number (sign * number);
@@ -2267,10 +2277,9 @@ read1 (readcharfun, pch, first_in_list)
2267 XSETSUB_CHAR_TABLE (tmp, XSUB_CHAR_TABLE (tmp)); 2277 XSETSUB_CHAR_TABLE (tmp, XSUB_CHAR_TABLE (tmp));
2268 return tmp; 2278 return tmp;
2269 } 2279 }
2270 Fsignal (Qinvalid_read_syntax, 2280 invalid_syntax ("#^^", 3);
2271 Fcons (make_string ("#^^", 3), Qnil));
2272 } 2281 }
2273 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#^", 2), Qnil)); 2282 invalid_syntax ("#^", 2);
2274 } 2283 }
2275 if (c == '&') 2284 if (c == '&')
2276 { 2285 {
@@ -2294,8 +2303,7 @@ read1 (readcharfun, pch, first_in_list)
2294 version. */ 2303 version. */
2295 && ! (XFASTINT (length) 2304 && ! (XFASTINT (length)
2296 == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) 2305 == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR)))
2297 Fsignal (Qinvalid_read_syntax, 2306 invalid_syntax ("#&...", 5);
2298 Fcons (make_string ("#&...", 5), Qnil));
2299 2307
2300 val = Fmake_bool_vector (length, Qnil); 2308 val = Fmake_bool_vector (length, Qnil);
2301 bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, 2309 bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,
@@ -2306,8 +2314,7 @@ read1 (readcharfun, pch, first_in_list)
2306 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; 2314 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
2307 return val; 2315 return val;
2308 } 2316 }
2309 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#&...", 5), 2317 invalid_syntax ("#&...", 5);
2310 Qnil));
2311 } 2318 }
2312 if (c == '[') 2319 if (c == '[')
2313 { 2320 {
@@ -2327,7 +2334,7 @@ read1 (readcharfun, pch, first_in_list)
2327 /* Read the string itself. */ 2334 /* Read the string itself. */
2328 tmp = read1 (readcharfun, &ch, 0); 2335 tmp = read1 (readcharfun, &ch, 0);
2329 if (ch != 0 || !STRINGP (tmp)) 2336 if (ch != 0 || !STRINGP (tmp))
2330 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); 2337 invalid_syntax ("#", 1);
2331 GCPRO1 (tmp); 2338 GCPRO1 (tmp);
2332 /* Read the intervals and their properties. */ 2339 /* Read the intervals and their properties. */
2333 while (1) 2340 while (1)
@@ -2343,9 +2350,7 @@ read1 (readcharfun, pch, first_in_list)
2343 if (ch == 0) 2350 if (ch == 0)
2344 plist = read1 (readcharfun, &ch, 0); 2351 plist = read1 (readcharfun, &ch, 0);
2345 if (ch) 2352 if (ch)
2346 Fsignal (Qinvalid_read_syntax, 2353 invalid_syntax ("Invalid string property list", 0);
2347 Fcons (build_string ("invalid string property list"),
2348 Qnil));
2349 Fset_text_properties (beg, end, plist, tmp); 2354 Fset_text_properties (beg, end, plist, tmp);
2350 } 2355 }
2351 UNGCPRO; 2356 UNGCPRO;
@@ -2502,7 +2507,7 @@ read1 (readcharfun, pch, first_in_list)
2502 return read_integer (readcharfun, 2); 2507 return read_integer (readcharfun, 2);
2503 2508
2504 UNREAD (c); 2509 UNREAD (c);
2505 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); 2510 invalid_syntax ("#", 1);
2506 2511
2507 case ';': 2512 case ';':
2508 while ((c = READCHAR) >= 0 && c != '\n'); 2513 while ((c = READCHAR) >= 0 && c != '\n');
@@ -2599,10 +2604,10 @@ read1 (readcharfun, pch, first_in_list)
2599 || (new_backquote_flag && next_char == ',')))); 2604 || (new_backquote_flag && next_char == ','))));
2600 } 2605 }
2601 UNREAD (next_char); 2606 UNREAD (next_char);
2602 if (!ok) 2607 if (ok)
2603 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("?", 1), Qnil)); 2608 return make_number (c);
2604 2609
2605 return make_number (c); 2610 invalid_syntax ("?", 1);
2606 } 2611 }
2607 2612
2608 case '"': 2613 case '"':
@@ -3238,8 +3243,7 @@ read_list (flag, readcharfun)
3238 { 3243 {
3239 if (ch == ']') 3244 if (ch == ']')
3240 return val; 3245 return val;
3241 Fsignal (Qinvalid_read_syntax, 3246 invalid_syntax (") or . in a vector", 18);
3242 Fcons (make_string (") or . in a vector", 18), Qnil));
3243 } 3247 }
3244 if (ch == ')') 3248 if (ch == ')')
3245 return val; 3249 return val;
@@ -3341,9 +3345,9 @@ read_list (flag, readcharfun)
3341 3345
3342 return val; 3346 return val;
3343 } 3347 }
3344 return Fsignal (Qinvalid_read_syntax, Fcons (make_string (". in wrong context", 18), Qnil)); 3348 invalid_syntax (". in wrong context", 18);
3345 } 3349 }
3346 return Fsignal (Qinvalid_read_syntax, Fcons (make_string ("] in a list", 11), Qnil)); 3350 invalid_syntax ("] in a list", 11);
3347 } 3351 }
3348 tem = (read_pure && flag <= 0 3352 tem = (read_pure && flag <= 0
3349 ? pure_cons (elt, Qnil) 3353 ? pure_cons (elt, Qnil)
@@ -3376,12 +3380,11 @@ Lisp_Object
3376check_obarray (obarray) 3380check_obarray (obarray)
3377 Lisp_Object obarray; 3381 Lisp_Object obarray;
3378{ 3382{
3379 while (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) 3383 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
3380 { 3384 {
3381 /* If Vobarray is now invalid, force it to be valid. */ 3385 /* If Vobarray is now invalid, force it to be valid. */
3382 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray; 3386 if (EQ (Vobarray, obarray)) Vobarray = initial_obarray;
3383 3387 wrong_type_argument (Qvectorp, obarray);
3384 obarray = wrong_type_argument (Qvectorp, obarray);
3385 } 3388 }
3386 return obarray; 3389 return obarray;
3387} 3390}
diff --git a/src/mac.c b/src/mac.c
index e25ed435342..4652757fab3 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -4625,8 +4625,7 @@ otherwise. */)
4625 CHECK_CONS (key); 4625 CHECK_CONS (key);
4626 for (tmp = key; CONSP (tmp); tmp = XCDR (tmp)) 4626 for (tmp = key; CONSP (tmp); tmp = XCDR (tmp))
4627 CHECK_STRING_CAR (tmp); 4627 CHECK_STRING_CAR (tmp);
4628 if (!NILP (tmp)) 4628 CHECK_LIST_END (tmp, key);
4629 wrong_type_argument (Qlistp, key);
4630 } 4629 }
4631 if (!NILP (application)) 4630 if (!NILP (application))
4632 CHECK_STRING (application); 4631 CHECK_STRING (application);
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/macselect.c b/src/macselect.c
index 3afea1e9813..67a28cf9e64 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -594,11 +594,9 @@ x_get_local_selection (selection_symbol, target_type, local_request)
594 && INTEGERP (XCAR (XCDR (check))) 594 && INTEGERP (XCAR (XCDR (check)))
595 && NILP (XCDR (XCDR (check)))))) 595 && NILP (XCDR (XCDR (check))))))
596 return value; 596 return value;
597 else 597
598 return 598 signal_error ("Invalid data returned by selection-conversion function",
599 Fsignal (Qerror, 599 list2 (handler_fn, value));
600 Fcons (build_string ("invalid data returned by selection-conversion function"),
601 Fcons (handler_fn, Fcons (value, Qnil))));
602} 600}
603 601
604 602
diff --git a/src/macterm.c b/src/macterm.c
index a6fc6b1a497..e98fc7729c0 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -8608,6 +8608,81 @@ extern int emacs_main (int, char **, char **);
8608extern void initialize_applescript(); 8608extern void initialize_applescript();
8609extern void terminate_applescript(); 8609extern void terminate_applescript();
8610 8610
8611/* Table for translating Mac keycode to X keysym values. Contributed
8612 by Sudhir Shenoy.
8613 Mapping for special keys is now identical to that in Apple X11
8614 except `clear' (-> <clear>) on the KeyPad, `enter' (-> <kp-enter>)
8615 on the right of the Cmd key on laptops, and fn + `enter' (->
8616 <linefeed>). */
8617static unsigned char keycode_to_xkeysym_table[] = {
8618 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8619 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8620 /*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8621
8622 /*0x30*/ 0x09 /*tab*/, 0 /*0x0020 space*/, 0, 0x08 /*backspace*/,
8623 /*0x34*/ 0x8d /*enter on laptops*/, 0x1b /*escape*/, 0, 0,
8624 /*0x38*/ 0, 0, 0, 0,
8625 /*0x3C*/ 0, 0, 0, 0,
8626
8627 /*0x40*/ 0, 0xae /*kp-decimal*/, 0, 0xaa /*kp-multiply*/,
8628 /*0x44*/ 0, 0xab /*kp-add*/, 0, 0x0b /*clear*/,
8629 /*0x48*/ 0, 0, 0, 0xaf /*kp-divide*/,
8630 /*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp-subtract*/, 0,
8631
8632 /*0x50*/ 0, 0xbd /*kp-equal*/, 0xb0 /*kp-0*/, 0xb1 /*kp-1*/,
8633 /*0x54*/ 0xb2 /*kp-2*/, 0xb3 /*kp-3*/, 0xb4 /*kp-4*/, 0xb5 /*kp-5*/,
8634 /*0x58*/ 0xb6 /*kp-6*/, 0xb7 /*kp-7*/, 0, 0xb8 /*kp-8*/,
8635 /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0,
8636
8637 /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/,
8638 /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/,
8639 /*0x68*/ 0, 0xca /*f13*/, 0xcd /*f16*/, 0xcb /*f14*/,
8640 /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/,
8641
8642 /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/,
8643 /*0x74*/ 0x55 /*pgup*/, 0xff /*delete*/, 0xc1 /*f4*/, 0x57 /*end*/,
8644 /*0x78*/ 0xbf /*f2*/, 0x56 /*pgdown*/, 0xbe /*f1*/, 0x51 /*left*/,
8645 /*0x7C*/ 0x53 /*right*/, 0x54 /*down*/, 0x52 /*up*/, 0
8646};
8647
8648#ifdef MAC_OSX
8649/* Table for translating Mac keycode with the laptop `fn' key to that
8650 without it. Destination symbols in comments are keys on US
8651 keyboard, and they may not be the same on other types of keyboards.
8652 If the destination is identical to the source (f1 ... f12), it
8653 doesn't map `fn' key to a modifier. */
8654static unsigned char fn_keycode_to_keycode_table[] = {
8655 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8656 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8657 /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8658
8659 /*0x30*/ 0, 0, 0, 0,
8660 /*0x34*/ 0, 0, 0, 0,
8661 /*0x38*/ 0, 0, 0, 0,
8662 /*0x3C*/ 0, 0, 0, 0,
8663
8664 /*0x40*/ 0, 0x2f /*kp-decimal -> '.'*/, 0, 0x23 /*kp-multiply -> 'p'*/,
8665 /*0x44*/ 0, 0x2c /*kp-add -> '/'*/, 0, 0x16 /*clear -> '6'*/,
8666 /*0x48*/ 0, 0, 0, 0x1d /*kp-/ -> '0'*/,
8667 /*0x4C*/ 0x24 /*kp-enter -> return*/, 0, 0x29 /*kp-subtract -> ';'*/, 0,
8668
8669 /*0x50*/ 0, 0x1b /*kp-equal -> '-'*/, 0x2e /*kp-0 -> 'm'*/, 0x26 /*kp-1 -> 'j'*/,
8670 /*0x54*/ 0x28 /*kp-2 -> 'k'*/, 0x25 /*kp-3 -> 'l'*/, 0x20 /*kp-4 -> 'u'*/, 0x22 /*kp-5 ->'i'*/,
8671 /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/,
8672 /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0,
8673
8674 /*0x60*/ 0x60 /*f5 = f5*/, 0x61 /*f6 = f6*/, 0x62 /*f7 = f7*/, 0x63 /*f3 = f3*/,
8675 /*0x64*/ 0x64 /*f8 = f8*/, 0x65 /*f9 = f9*/, 0, 0x67 /*f11 = f11*/,
8676 /*0x68*/ 0, 0, 0, 0,
8677 /*0x6C*/ 0, 0x6d /*f10 = f10*/, 0, 0x6f /*f12 = f12*/,
8678
8679 /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/,
8680 /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0x76 /*f4 = f4*/, 0x7c /*end -> right*/,
8681 /*0x78*/ 0x78 /*f2 = f2*/, 0x7d /*pgdown -> down*/, 0x7a /*f1 = f1*/, 0,
8682 /*0x7C*/ 0, 0, 0, 0
8683};
8684#endif /* MAC_OSX */
8685
8611static unsigned int 8686static unsigned int
8612#if USE_CARBON_EVENTS 8687#if USE_CARBON_EVENTS
8613mac_to_emacs_modifiers (UInt32 mods) 8688mac_to_emacs_modifiers (UInt32 mods)
@@ -9671,7 +9746,6 @@ mac_handle_text_input_event (next_handler, event, data)
9671 { 9746 {
9672 EventRef kbd_event; 9747 EventRef kbd_event;
9673 UInt32 actual_size, modifiers, mapped_modifiers; 9748 UInt32 actual_size, modifiers, mapped_modifiers;
9674 UniChar code;
9675 9749
9676 err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent, 9750 err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent,
9677 typeEventRef, NULL, sizeof (EventRef), NULL, 9751 typeEventRef, NULL, sizeof (EventRef), NULL,
@@ -9699,26 +9773,37 @@ mac_handle_text_input_event (next_handler, event, data)
9699 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, 9773 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes,
9700 typeUnicodeText, NULL, 0, &actual_size, 9774 typeUnicodeText, NULL, 0, &actual_size,
9701 NULL); 9775 NULL);
9702 if (err == noErr) 9776 if (err == noErr && actual_size == sizeof (UniChar))
9703 { 9777 {
9704 if (actual_size == sizeof (UniChar)) 9778 UniChar code;
9705 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, 9779
9706 typeUnicodeText, NULL, 9780 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes,
9707 sizeof (UniChar), NULL, &code); 9781 typeUnicodeText, NULL,
9782 sizeof (UniChar), NULL, &code);
9708 if (err == noErr && code < 0x80) 9783 if (err == noErr && code < 0x80)
9709 { 9784 {
9710 /* ASCII character. Process it in XTread_socket. */ 9785 /* ASCII character. Process it in XTread_socket. */
9711 if (read_socket_inev && code >= 0x20 && code <= 0x7e) 9786 if (read_socket_inev && code >= 0x20 && code <= 0x7e)
9712 { 9787 {
9713 struct frame *f = mac_focus_frame (&one_mac_display_info); 9788 UInt32 key_code;
9714 9789
9715 read_socket_inev->kind = ASCII_KEYSTROKE_EVENT; 9790 err = GetEventParameter (kbd_event, kEventParamKeyCode,
9716 read_socket_inev->code = code; 9791 typeUInt32, NULL, sizeof (UInt32),
9717 read_socket_inev->modifiers = 9792 NULL, &key_code);
9718 (extra_keyboard_modifiers 9793 if (!(err == noErr && key_code <= 0x7f
9719 & (meta_modifier | alt_modifier 9794 && keycode_to_xkeysym_table [key_code]))
9720 | hyper_modifier | super_modifier)); 9795 {
9721 XSETFRAME (read_socket_inev->frame_or_window, f); 9796 struct frame *f =
9797 mac_focus_frame (&one_mac_display_info);
9798
9799 read_socket_inev->kind = ASCII_KEYSTROKE_EVENT;
9800 read_socket_inev->code = code;
9801 read_socket_inev->modifiers =
9802 (extra_keyboard_modifiers
9803 & (meta_modifier | alt_modifier
9804 | hyper_modifier | super_modifier));
9805 XSETFRAME (read_socket_inev->frame_or_window, f);
9806 }
9722 } 9807 }
9723 return eventNotHandledErr; 9808 return eventNotHandledErr;
9724 } 9809 }
@@ -9991,89 +10076,6 @@ main (void)
9991} 10076}
9992#endif 10077#endif
9993 10078
9994/* Table for translating Mac keycode to X keysym values. Contributed
9995 by Sudhir Shenoy.
9996 Mapping for special keys is now identical to that in Apple X11
9997 except `clear' (-> <clear>) on the KeyPad, `enter' (-> <kp-enter>)
9998 on the right of the Cmd key on laptops, and fn + `enter' (->
9999 <linefeed>). */
10000static unsigned char keycode_to_xkeysym_table[] = {
10001 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10002 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10003 /*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10004
10005 /*0x30*/ 0x09 /*tab*/, 0 /*0x0020 space*/, 0, 0x08 /*backspace*/,
10006 /*0x34*/ 0x8d /*enter on laptops*/, 0x1b /*escape*/, 0, 0,
10007 /*0x38*/ 0, 0, 0, 0,
10008 /*0x3C*/ 0, 0, 0, 0,
10009
10010 /*0x40*/ 0, 0xae /*kp-.*/, 0, 0xaa /*kp-**/,
10011 /*0x44*/ 0, 0xab /*kp-+*/, 0, 0x0b /*clear*/,
10012 /*0x48*/ 0, 0, 0, 0xaf /*kp-/*/,
10013 /*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp--*/, 0,
10014
10015 /*0x50*/ 0, 0xbd /*kp-=*/, 0xb0 /*kp-0*/, 0xb1 /*kp-1*/,
10016 /*0x54*/ 0xb2 /*kp-2*/, 0xb3 /*kp-3*/, 0xb4 /*kp-4*/, 0xb5 /*kp-5*/,
10017 /*0x58*/ 0xb6 /*kp-6*/, 0xb7 /*kp-7*/, 0, 0xb8 /*kp-8*/,
10018 /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0,
10019
10020 /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/,
10021 /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/,
10022 /*0x68*/ 0, 0xca /*f13*/, 0xcd /*f16*/, 0xcb /*f14*/,
10023 /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/,
10024
10025 /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/,
10026 /*0x74*/ 0x55 /*pgup*/, 0xff /*delete*/, 0xc1 /*f4*/, 0x57 /*end*/,
10027 /*0x78*/ 0xbf /*f2*/, 0x56 /*pgdown*/, 0xbe /*f1*/, 0x51 /*left*/,
10028 /*0x7C*/ 0x53 /*right*/, 0x54 /*down*/, 0x52 /*up*/, 0
10029};
10030
10031
10032static int
10033keycode_to_xkeysym (int keyCode, int *xKeySym)
10034{
10035 *xKeySym = keycode_to_xkeysym_table [keyCode & 0x7f];
10036 return *xKeySym != 0;
10037}
10038
10039#ifdef MAC_OSX
10040/* Table for translating Mac keycode with the laptop `fn' key to that
10041 without it. Destination symbols in comments are keys on US
10042 keyboard, and they may not be the same on other types of keyboards.
10043 If the destination is identical to the source (f1 ... f12), it
10044 doesn't map `fn' key to a modifier. */
10045static unsigned char fn_keycode_to_keycode_table[] = {
10046 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10047 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10048 /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10049
10050 /*0x30*/ 0, 0, 0, 0,
10051 /*0x34*/ 0, 0, 0, 0,
10052 /*0x38*/ 0, 0, 0, 0,
10053 /*0x3C*/ 0, 0, 0, 0,
10054
10055 /*0x40*/ 0, 0x2f /*kp-. -> '.'*/, 0, 0x23 /*kp-* -> 'p'*/,
10056 /*0x44*/ 0, 0x2c /*kp-+ -> '/'*/, 0, 0x16 /*clear -> '6'*/,
10057 /*0x48*/ 0, 0, 0, 0x1d /*kp-/ -> '0'*/,
10058 /*0x4C*/ 0x24 /*kp-enter -> return*/, 0, 0x29 /*kp-- -> ';'*/, 0,
10059
10060 /*0x50*/ 0, 0x1b /*kp-= -> '-'*/, 0x2e /*kp-0 -> 'm'*/, 0x26 /*kp-1 -> 'j'*/,
10061 /*0x54*/ 0x28 /*kp-2 -> 'k'*/, 0x25 /*kp-3 -> 'l'*/, 0x20 /*kp-4 -> 'u'*/, 0x22 /*kp-5 ->'i'*/,
10062 /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/,
10063 /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0,
10064
10065 /*0x60*/ 0x60 /*f5 = f5*/, 0x61 /*f6 = f6*/, 0x62 /*f7 = f7*/, 0x63 /*f3 = f3*/,
10066 /*0x64*/ 0x64 /*f8 = f8*/, 0x65 /*f9 = f9*/, 0, 0x67 /*f11 = f11*/,
10067 /*0x68*/ 0, 0, 0, 0,
10068 /*0x6C*/ 0, 0x6d /*f10 = f10*/, 0, 0x6f /*f12 = f12*/,
10069
10070 /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/,
10071 /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0x76 /*f4 = f4*/, 0x7c /*end -> right*/,
10072 /*0x78*/ 0x78 /*f2 = f2*/, 0x7d /*pgdown -> down*/, 0x7a /*f1 = f1*/, 0,
10073 /*0x7C*/ 0, 0, 0, 0
10074};
10075#endif /* MAC_OSX */
10076
10077#if !USE_CARBON_EVENTS 10079#if !USE_CARBON_EVENTS
10078static RgnHandle mouse_region = NULL; 10080static RgnHandle mouse_region = NULL;
10079 10081
@@ -10676,7 +10678,6 @@ XTread_socket (sd, expected, hold_quit)
10676 case autoKey: 10678 case autoKey:
10677 { 10679 {
10678 int keycode = (er.message & keyCodeMask) >> 8; 10680 int keycode = (er.message & keyCodeMask) >> 8;
10679 int xkeysym;
10680 static SInt16 last_key_script = -1; 10681 static SInt16 last_key_script = -1;
10681 SInt16 current_key_script; 10682 SInt16 current_key_script;
10682 UInt32 modifiers = er.modifiers, mapped_modifiers; 10683 UInt32 modifiers = er.modifiers, mapped_modifiers;
@@ -10755,10 +10756,10 @@ XTread_socket (sd, expected, hold_quit)
10755 && fn_keycode_to_keycode_table[keycode]) 10756 && fn_keycode_to_keycode_table[keycode])
10756 keycode = fn_keycode_to_keycode_table[keycode]; 10757 keycode = fn_keycode_to_keycode_table[keycode];
10757#endif 10758#endif
10758 if (keycode_to_xkeysym (keycode, &xkeysym)) 10759 if (keycode <= 0x7f && keycode_to_xkeysym_table [keycode])
10759 { 10760 {
10760 inev.kind = NON_ASCII_KEYSTROKE_EVENT; 10761 inev.kind = NON_ASCII_KEYSTROKE_EVENT;
10761 inev.code = 0xff00 | xkeysym; 10762 inev.code = 0xff00 | keycode_to_xkeysym_table [keycode];
10762#ifdef MAC_OSX 10763#ifdef MAC_OSX
10763 if (modifiers & kEventKeyModifierFnMask 10764 if (modifiers & kEventKeyModifierFnMask
10764 && keycode <= 0x7f 10765 && keycode <= 0x7f
@@ -11098,7 +11099,7 @@ mac_initialize_display_info ()
11098#ifdef MAC_OSX 11099#ifdef MAC_OSX
11099 /* HasDepth returns true if it is possible to have a 32 bit display, 11100 /* HasDepth returns true if it is possible to have a 32 bit display,
11100 but this may not be what is actually used. Mac OSX can do better. */ 11101 but this may not be what is actually used. Mac OSX can do better. */
11101 dpyinfo->color_p = 1; 11102 dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1;
11102 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay); 11103 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay);
11103 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay); 11104 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay);
11104 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay); 11105 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay);
@@ -11229,11 +11230,14 @@ x_delete_display (dpyinfo)
11229 xfree (dpyinfo->font_table[i].name); 11230 xfree (dpyinfo->font_table[i].name);
11230 } 11231 }
11231 11232
11232 if (dpyinfo->font_table->font_encoder) 11233 if (dpyinfo->font_table)
11233 xfree (dpyinfo->font_table->font_encoder); 11234 {
11234 11235 if (dpyinfo->font_table->font_encoder)
11235 xfree (dpyinfo->font_table); 11236 xfree (dpyinfo->font_table->font_encoder);
11236 xfree (dpyinfo->mac_id_name); 11237 xfree (dpyinfo->font_table);
11238 }
11239 if (dpyinfo->mac_id_name)
11240 xfree (dpyinfo->mac_id_name);
11237 11241
11238 if (x_display_list == 0) 11242 if (x_display_list == 0)
11239 { 11243 {
diff --git a/src/marker.c b/src/marker.c
index 0511debbe54..82e62e0aa99 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 c5910b1771f..848dbd0fed0 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -2683,7 +2683,7 @@ temp_echo_area_glyphs (string)
2683 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0); 2683 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0);
2684 SET_PT_BOTH (opoint, opoint_byte); 2684 SET_PT_BOTH (opoint, opoint_byte);
2685 Vinhibit_quit = Qt; 2685 Vinhibit_quit = Qt;
2686 Fsit_for (make_number (2), Qnil, Qnil); 2686 sit_for (make_number (2), 0, 2);
2687 del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1); 2687 del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1);
2688 SET_PT_BOTH (opoint, opoint_byte); 2688 SET_PT_BOTH (opoint, opoint_byte);
2689 if (!NILP (Vquit_flag)) 2689 if (!NILP (Vquit_flag))
diff --git a/src/msdos.c b/src/msdos.c
index 026ebc572b4..581b2ea38e8 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -204,9 +204,9 @@ them. This happens with wheeled mice on Windows 9X, for example. */)
204 CHECK_NUMBER (nbuttons); 204 CHECK_NUMBER (nbuttons);
205 n = XINT (nbuttons); 205 n = XINT (nbuttons);
206 if (n < 2 || n > 3) 206 if (n < 2 || n > 3)
207 Fsignal (Qargs_out_of_range, 207 xsignal2 (Qargs_out_of_range,
208 Fcons (build_string ("only 2 or 3 mouse buttons are supported"), 208 build_string ("only 2 or 3 mouse buttons are supported"),
209 Fcons (nbuttons, Qnil))); 209 nbuttons);
210 mouse_setup_buttons (n); 210 mouse_setup_buttons (n);
211 return Qnil; 211 return Qnil;
212} 212}
diff --git a/src/print.c b/src/print.c
index 0db9780e314..6fdd41ada04 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1032,7 +1032,9 @@ error message is constructed. */)
1032} 1032}
1033 1033
1034/* Print an error message for the error DATA onto Lisp output stream 1034/* Print an error message for the error DATA onto Lisp output stream
1035 STREAM (suitable for the print functions). */ 1035 STREAM (suitable for the print functions).
1036 CONTEXT is a C string describing the context of the error.
1037 CALLER is the Lisp function inside which the error was signaled. */
1036 1038
1037void 1039void
1038print_error_message (data, stream, context, caller) 1040print_error_message (data, stream, context, caller)
diff --git a/src/process.c b/src/process.c
index 2281f1ce3f6..45bf6446644 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5158,7 +5158,7 @@ read_process_output (proc, channel)
5158#endif 5158#endif
5159 /* But do it only if the caller is actually going to read events. 5159 /* But do it only if the caller is actually going to read events.
5160 Otherwise there's no need to make him wake up, and it could 5160 Otherwise there's no need to make him wake up, and it could
5161 cause trouble (for example it would make Fsit_for return). */ 5161 cause trouble (for example it would make sit_for return). */
5162 if (waiting_for_user_input_p == -1) 5162 if (waiting_for_user_input_p == -1)
5163 record_asynch_buffer_change (); 5163 record_asynch_buffer_change ();
5164 5164
@@ -6595,7 +6595,7 @@ exec_sentinel (proc, reason)
6595#endif 6595#endif
6596 /* But do it only if the caller is actually going to read events. 6596 /* But do it only if the caller is actually going to read events.
6597 Otherwise there's no need to make him wake up, and it could 6597 Otherwise there's no need to make him wake up, and it could
6598 cause trouble (for example it would make Fsit_for return). */ 6598 cause trouble (for example it would make sit_for return). */
6599 if (waiting_for_user_input_p == -1) 6599 if (waiting_for_user_input_p == -1)
6600 record_asynch_buffer_change (); 6600 record_asynch_buffer_change ();
6601 6601
diff --git a/src/puresize.h b/src/puresize.h
index fa01ad610a1..457a75ea023 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -43,7 +43,7 @@ Boston, MA 02110-1301, USA. */
43#endif 43#endif
44 44
45#ifndef BASE_PURESIZE 45#ifndef BASE_PURESIZE
46#define BASE_PURESIZE (1210500 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) 46#define BASE_PURESIZE (1211000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
47#endif 47#endif
48 48
49/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ 49/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
diff --git a/src/search.c b/src/search.c
index 15cc51cb511..d826e2e1b05 100644
--- a/src/search.c
+++ b/src/search.c
@@ -83,6 +83,9 @@ static Lisp_Object last_thing_searched;
83 83
84Lisp_Object Qinvalid_regexp; 84Lisp_Object Qinvalid_regexp;
85 85
86/* Error condition used for failing searches */
87Lisp_Object Qsearch_failed;
88
86Lisp_Object Vsearch_spaces_regexp; 89Lisp_Object Vsearch_spaces_regexp;
87 90
88static void set_search_regs (); 91static void set_search_regs ();
@@ -145,7 +148,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
145 re_set_syntax (old); 148 re_set_syntax (old);
146 UNBLOCK_INPUT; 149 UNBLOCK_INPUT;
147 if (val) 150 if (val)
148 Fsignal (Qinvalid_regexp, Fcons (build_string (val), Qnil)); 151 xsignal1 (Qinvalid_regexp, build_string (val));
149 152
150 cp->regexp = Fcopy_sequence (pattern); 153 cp->regexp = Fcopy_sequence (pattern);
151} 154}
@@ -232,16 +235,6 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
232 return &cp->buf; 235 return &cp->buf;
233} 236}
234 237
235/* Error condition used for failing searches */
236Lisp_Object Qsearch_failed;
237
238Lisp_Object
239signal_failure (arg)
240 Lisp_Object arg;
241{
242 Fsignal (Qsearch_failed, Fcons (arg, Qnil));
243 return Qnil;
244}
245 238
246static Lisp_Object 239static Lisp_Object
247looking_at_1 (string, posix) 240looking_at_1 (string, posix)
@@ -914,7 +907,8 @@ search_command (string, bound, noerror, count, direction, RE, posix)
914 if (np <= 0) 907 if (np <= 0)
915 { 908 {
916 if (NILP (noerror)) 909 if (NILP (noerror))
917 return signal_failure (string); 910 xsignal1 (Qsearch_failed, string);
911
918 if (!EQ (noerror, Qt)) 912 if (!EQ (noerror, Qt))
919 { 913 {
920 if (lim < BEGV || lim > ZV) 914 if (lim < BEGV || lim > ZV)
@@ -2850,8 +2844,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */)
2850 if (running_asynch_code) 2844 if (running_asynch_code)
2851 save_search_regs (); 2845 save_search_regs ();
2852 2846
2853 if (!CONSP (list) && !NILP (list)) 2847 CHECK_LIST (list);
2854 list = wrong_type_argument (Qconsp, list);
2855 2848
2856 /* Unless we find a marker with a buffer or an explicit buffer 2849 /* Unless we find a marker with a buffer or an explicit buffer
2857 in LIST, assume that this match data came from a string. */ 2850 in LIST, assume that this match data came from a string. */
diff --git a/src/sound.c b/src/sound.c
index af2369040cc..6f955a7d691 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -990,6 +990,7 @@ alsa_configure (sd)
990 struct sound_device *sd; 990 struct sound_device *sd;
991{ 991{
992 int val, err, dir; 992 int val, err, dir;
993 unsigned uval;
993 struct alsa_params *p = (struct alsa_params *) sd->data; 994 struct alsa_params *p = (struct alsa_params *) sd->data;
994 snd_pcm_uframes_t buffer_size; 995 snd_pcm_uframes_t buffer_size;
995 996
@@ -1017,8 +1018,8 @@ alsa_configure (sd)
1017 if (err < 0) 1018 if (err < 0)
1018 alsa_sound_perror ("Could not set sound format", err); 1019 alsa_sound_perror ("Could not set sound format", err);
1019 1020
1020 val = sd->sample_rate; 1021 uval = sd->sample_rate;
1021 err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0); 1022 err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &uval, 0);
1022 if (err < 0) 1023 if (err < 0)
1023 alsa_sound_perror ("Could not set sample rate", err); 1024 alsa_sound_perror ("Could not set sample rate", err);
1024 1025
@@ -1123,7 +1124,7 @@ alsa_close (sd)
1123 snd_pcm_sw_params_free (p->swparams); 1124 snd_pcm_sw_params_free (p->swparams);
1124 if (p->handle) 1125 if (p->handle)
1125 { 1126 {
1126 snd_pcm_drain(p->handle); 1127 snd_pcm_drain (p->handle);
1127 snd_pcm_close (p->handle); 1128 snd_pcm_close (p->handle);
1128 } 1129 }
1129 free (p); 1130 free (p);
@@ -1269,7 +1270,8 @@ alsa_init (sd)
1269 err = snd_pcm_open (&handle, file, SND_PCM_STREAM_PLAYBACK, 0); 1270 err = snd_pcm_open (&handle, file, SND_PCM_STREAM_PLAYBACK, 0);
1270 snd_lib_error_set_handler (NULL); 1271 snd_lib_error_set_handler (NULL);
1271 if (err < 0) 1272 if (err < 0)
1272 return 0; 1273 return 0;
1274 snd_pcm_close (handle);
1273 1275
1274 sd->fd = -1; 1276 sd->fd = -1;
1275 sd->open = alsa_open; 1277 sd->open = alsa_open;
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 4f5481ca111..b0b4bdc0032 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -97,11 +97,12 @@ 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, Lisp_Object, Lisp_Object, int)); 103static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object, int));
103static Lisp_Object skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object)); 104static Lisp_Object skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object));
104static Lisp_Object scan_lists P_ ((int, int, int, int)); 105static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int));
105static void scan_sexps_forward P_ ((struct lisp_parse_state *, 106static void scan_sexps_forward P_ ((struct lisp_parse_state *,
106 int, int, int, int, 107 int, int, int, int,
107 int, Lisp_Object, int)); 108 int, Lisp_Object, int));
@@ -472,9 +473,9 @@ prev_char_comend_first (pos, pos_byte)
472 473
473static int 474static int
474back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr) 475back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr)
475 int from, from_byte, stop; 476 EMACS_INT from, from_byte, stop;
476 int comnested, comstyle; 477 int comnested, comstyle;
477 int *charpos_ptr, *bytepos_ptr; 478 EMACS_INT *charpos_ptr, *bytepos_ptr;
478{ 479{
479 /* Look back, counting the parity of string-quotes, 480 /* Look back, counting the parity of string-quotes,
480 and recording the comment-starters seen. 481 and recording the comment-starters seen.
@@ -749,9 +750,8 @@ static void
749check_syntax_table (obj) 750check_syntax_table (obj)
750 Lisp_Object obj; 751 Lisp_Object obj;
751{ 752{
752 if (!(CHAR_TABLE_P (obj) 753 CHECK_TYPE (CHAR_TABLE_P (obj) && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table),
753 && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table))) 754 Qsyntax_table_p, obj);
754 wrong_type_argument (Qsyntax_table_p, obj);
755} 755}
756 756
757DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, 757DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
@@ -2111,9 +2111,10 @@ in_classes (c, iso_classes)
2111static int 2111static int
2112forw_comment (from, from_byte, stop, nesting, style, prev_syntax, 2112forw_comment (from, from_byte, stop, nesting, style, prev_syntax,
2113 charpos_ptr, bytepos_ptr, incomment_ptr) 2113 charpos_ptr, bytepos_ptr, incomment_ptr)
2114 int from, from_byte, stop; 2114 EMACS_INT from, from_byte, stop;
2115 int nesting, style, prev_syntax; 2115 int nesting, style, prev_syntax;
2116 int *charpos_ptr, *bytepos_ptr, *incomment_ptr; 2116 EMACS_INT *charpos_ptr, *bytepos_ptr;
2117 int *incomment_ptr;
2117{ 2118{
2118 register int c, c1; 2119 register int c, c1;
2119 register enum syntaxcode code; 2120 register enum syntaxcode code;
@@ -2213,16 +2214,16 @@ between them, return t; otherwise return nil. */)
2213 (count) 2214 (count)
2214 Lisp_Object count; 2215 Lisp_Object count;
2215{ 2216{
2216 register int from; 2217 register EMACS_INT from;
2217 int from_byte; 2218 EMACS_INT from_byte;
2218 register int stop; 2219 register EMACS_INT stop;
2219 register int c, c1; 2220 register int c, c1;
2220 register enum syntaxcode code; 2221 register enum syntaxcode code;
2221 int comstyle = 0; /* style of comment encountered */ 2222 int comstyle = 0; /* style of comment encountered */
2222 int comnested = 0; /* whether the comment is nestable or not */ 2223 int comnested = 0; /* whether the comment is nestable or not */
2223 int found; 2224 int found;
2224 int count1; 2225 EMACS_INT count1;
2225 int out_charpos, out_bytepos; 2226 EMACS_INT out_charpos, out_bytepos;
2226 int dummy; 2227 int dummy;
2227 2228
2228 CHECK_NUMBER (count); 2229 CHECK_NUMBER (count);
@@ -2420,11 +2421,12 @@ between them, return t; otherwise return nil. */)
2420 2421
2421static Lisp_Object 2422static Lisp_Object
2422scan_lists (from, count, depth, sexpflag) 2423scan_lists (from, count, depth, sexpflag)
2423 register int from; 2424 register EMACS_INT from;
2424 int count, depth, sexpflag; 2425 EMACS_INT count, depth;
2426 int sexpflag;
2425{ 2427{
2426 Lisp_Object val; 2428 Lisp_Object val;
2427 register int stop = count > 0 ? ZV : BEGV; 2429 register EMACS_INT stop = count > 0 ? ZV : BEGV;
2428 register int c, c1; 2430 register int c, c1;
2429 int stringterm; 2431 int stringterm;
2430 int quoted; 2432 int quoted;
@@ -2433,11 +2435,11 @@ scan_lists (from, count, depth, sexpflag)
2433 int min_depth = depth; /* Err out if depth gets less than this. */ 2435 int min_depth = depth; /* Err out if depth gets less than this. */
2434 int comstyle = 0; /* style of comment encountered */ 2436 int comstyle = 0; /* style of comment encountered */
2435 int comnested = 0; /* whether the comment is nestable or not */ 2437 int comnested = 0; /* whether the comment is nestable or not */
2436 int temp_pos; 2438 EMACS_INT temp_pos;
2437 int last_good = from; 2439 EMACS_INT last_good = from;
2438 int found; 2440 int found;
2439 int from_byte; 2441 EMACS_INT from_byte;
2440 int out_bytepos, out_charpos; 2442 EMACS_INT out_bytepos, out_charpos;
2441 int temp, dummy; 2443 int temp, dummy;
2442 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; 2444 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol;
2443 2445
@@ -2567,10 +2569,9 @@ scan_lists (from, count, depth, sexpflag)
2567 close1: 2569 close1:
2568 if (!--depth) goto done; 2570 if (!--depth) goto done;
2569 if (depth < min_depth) 2571 if (depth < min_depth)
2570 Fsignal (Qscan_error, 2572 xsignal3 (Qscan_error,
2571 Fcons (build_string ("Containing expression ends prematurely"), 2573 build_string ("Containing expression ends prematurely"),
2572 Fcons (make_number (last_good), 2574 make_number (last_good), make_number (from));
2573 Fcons (make_number (from), Qnil))));
2574 break; 2575 break;
2575 2576
2576 case Sstring: 2577 case Sstring:
@@ -2719,10 +2720,9 @@ scan_lists (from, count, depth, sexpflag)
2719 open2: 2720 open2:
2720 if (!--depth) goto done2; 2721 if (!--depth) goto done2;
2721 if (depth < min_depth) 2722 if (depth < min_depth)
2722 Fsignal (Qscan_error, 2723 xsignal3 (Qscan_error,
2723 Fcons (build_string ("Containing expression ends prematurely"), 2724 build_string ("Containing expression ends prematurely"),
2724 Fcons (make_number (last_good), 2725 make_number (last_good), make_number (from));
2725 Fcons (make_number (from), Qnil))));
2726 break; 2726 break;
2727 2727
2728 case Sendcomment: 2728 case Sendcomment:
@@ -2792,12 +2792,9 @@ scan_lists (from, count, depth, sexpflag)
2792 return val; 2792 return val;
2793 2793
2794 lose: 2794 lose:
2795 Fsignal (Qscan_error, 2795 xsignal3 (Qscan_error,
2796 Fcons (build_string ("Unbalanced parentheses"), 2796 build_string ("Unbalanced parentheses"),
2797 Fcons (make_number (last_good), 2797 make_number (last_good), make_number (from));
2798 Fcons (make_number (from), Qnil))));
2799 abort ();
2800 /* NOTREACHED */
2801} 2798}
2802 2799
2803DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, 2800DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
@@ -2924,7 +2921,7 @@ scan_sexps_forward (stateptr, from, from_byte, end, targetdepth,
2924 int boundary_stop = commentstop == -1; 2921 int boundary_stop = commentstop == -1;
2925 int nofence; 2922 int nofence;
2926 int found; 2923 int found;
2927 int out_bytepos, out_charpos; 2924 EMACS_INT out_bytepos, out_charpos;
2928 int temp; 2925 int temp;
2929 2926
2930 prev_from = from; 2927 prev_from = from;
diff --git a/src/textprop.c b/src/textprop.c
index 0318d12913f..fd70f039d22 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -78,6 +78,8 @@ Lisp_Object Vtext_property_default_nonsticky;
78Lisp_Object interval_insert_behind_hooks; 78Lisp_Object interval_insert_behind_hooks;
79Lisp_Object interval_insert_in_front_hooks; 79Lisp_Object interval_insert_in_front_hooks;
80 80
81static void text_read_only P_ ((Lisp_Object)) NO_RETURN;
82
81 83
82/* Signal a `text-read-only' error. This function makes it easier 84/* Signal a `text-read-only' error. This function makes it easier
83 to capture that error in GDB by putting a breakpoint on it. */ 85 to capture that error in GDB by putting a breakpoint on it. */
@@ -86,7 +88,10 @@ static void
86text_read_only (propval) 88text_read_only (propval)
87 Lisp_Object propval; 89 Lisp_Object propval;
88{ 90{
89 Fsignal (Qtext_read_only, STRINGP (propval) ? Fcons (propval, Qnil) : Qnil); 91 if (STRINGP (propval))
92 xsignal1 (Qtext_read_only, propval);
93
94 xsignal0 (Qtext_read_only);
90} 95}
91 96
92 97
diff --git a/src/unexsol.c b/src/unexsol.c
index 426a7f7cb99..9f919faedc0 100644
--- a/src/unexsol.c
+++ b/src/unexsol.c
@@ -24,7 +24,7 @@ unexec (char *new_name, char *old_name, unsigned int data_start,
24 errstring = code_convert_string_norecord (build_string (dlerror ()), 24 errstring = code_convert_string_norecord (build_string (dlerror ()),
25 Vlocale_coding_system, 0); 25 Vlocale_coding_system, 0);
26 26
27 Fsignal (Qfile_error, 27 xsignal (Qfile_error,
28 Fcons (build_string ("Cannot unexec"), Fcons (errstring, data))); 28 Fcons (build_string ("Cannot unexec"), Fcons (errstring, data)));
29} 29}
30 30
diff --git a/src/w32.c b/src/w32.c
index f11ffb7a785..d01a1022a19 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2700,6 +2700,9 @@ utime (const char *name, struct utimbuf *times)
2700int (PASCAL *pfn_WSAStartup) (WORD wVersionRequired, LPWSADATA lpWSAData); 2700int (PASCAL *pfn_WSAStartup) (WORD wVersionRequired, LPWSADATA lpWSAData);
2701void (PASCAL *pfn_WSASetLastError) (int iError); 2701void (PASCAL *pfn_WSASetLastError) (int iError);
2702int (PASCAL *pfn_WSAGetLastError) (void); 2702int (PASCAL *pfn_WSAGetLastError) (void);
2703int (PASCAL *pfn_WSAEventSelect) (SOCKET s, HANDLE hEventObject, long lNetworkEvents);
2704HANDLE (PASCAL *pfn_WSACreateEvent) (void);
2705int (PASCAL *pfn_WSACloseEvent) (HANDLE hEvent);
2703int (PASCAL *pfn_socket) (int af, int type, int protocol); 2706int (PASCAL *pfn_socket) (int af, int type, int protocol);
2704int (PASCAL *pfn_bind) (SOCKET s, const struct sockaddr *addr, int namelen); 2707int (PASCAL *pfn_bind) (SOCKET s, const struct sockaddr *addr, int namelen);
2705int (PASCAL *pfn_connect) (SOCKET s, const struct sockaddr *addr, int namelen); 2708int (PASCAL *pfn_connect) (SOCKET s, const struct sockaddr *addr, int namelen);
@@ -2769,7 +2772,7 @@ init_winsock (int load_now)
2769 = (void *) GetProcAddress (GetModuleHandle ("kernel32.dll"), 2772 = (void *) GetProcAddress (GetModuleHandle ("kernel32.dll"),
2770 "SetHandleInformation"); 2773 "SetHandleInformation");
2771 2774
2772 winsock_lib = LoadLibrary ("wsock32.dll"); 2775 winsock_lib = LoadLibrary ("Ws2_32.dll");
2773 2776
2774 if (winsock_lib != NULL) 2777 if (winsock_lib != NULL)
2775 { 2778 {
@@ -2782,6 +2785,9 @@ init_winsock (int load_now)
2782 LOAD_PROC( WSAStartup ); 2785 LOAD_PROC( WSAStartup );
2783 LOAD_PROC( WSASetLastError ); 2786 LOAD_PROC( WSASetLastError );
2784 LOAD_PROC( WSAGetLastError ); 2787 LOAD_PROC( WSAGetLastError );
2788 LOAD_PROC( WSAEventSelect );
2789 LOAD_PROC( WSACreateEvent );
2790 LOAD_PROC( WSACloseEvent );
2785 LOAD_PROC( socket ); 2791 LOAD_PROC( socket );
2786 LOAD_PROC( bind ); 2792 LOAD_PROC( bind );
2787 LOAD_PROC( connect ); 2793 LOAD_PROC( connect );
@@ -3295,6 +3301,8 @@ sys_listen (int s, int backlog)
3295 int rc = pfn_listen (SOCK_HANDLE (s), backlog); 3301 int rc = pfn_listen (SOCK_HANDLE (s), backlog);
3296 if (rc == SOCKET_ERROR) 3302 if (rc == SOCKET_ERROR)
3297 set_errno (); 3303 set_errno ();
3304 else
3305 fd_info[s].flags |= FILE_LISTEN;
3298 return rc; 3306 return rc;
3299 } 3307 }
3300 h_errno = ENOTSOCK; 3308 h_errno = ENOTSOCK;
@@ -3332,14 +3340,18 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen)
3332 } 3340 }
3333 3341
3334 check_errno (); 3342 check_errno ();
3335 if (fd_info[s].flags & FILE_SOCKET) 3343 if (fd_info[s].flags & FILE_LISTEN)
3336 { 3344 {
3337 SOCKET t = pfn_accept (SOCK_HANDLE (s), addr, addrlen); 3345 SOCKET t = pfn_accept (SOCK_HANDLE (s), addr, addrlen);
3338 if (t != INVALID_SOCKET) 3346 int fd = -1;
3339 return socket_to_fd (t); 3347 if (t == INVALID_SOCKET)
3348 set_errno ();
3349 else
3350 fd = socket_to_fd (t);
3340 3351
3341 set_errno (); 3352 fd_info[s].cp->status = STATUS_READ_ACKNOWLEDGED;
3342 return -1; 3353 ResetEvent (fd_info[s].cp->char_avail);
3354 return fd;
3343 } 3355 }
3344 h_errno = ENOTSOCK; 3356 h_errno = ENOTSOCK;
3345 return -1; 3357 return -1;
@@ -3641,6 +3653,36 @@ _sys_read_ahead (int fd)
3641 return cp->status; 3653 return cp->status;
3642} 3654}
3643 3655
3656int _sys_wait_accept (int fd)
3657{
3658 HANDLE hEv;
3659 child_process * cp;
3660 int rc;
3661
3662 if (fd < 0 || fd >= MAXDESC)
3663 return STATUS_READ_ERROR;
3664
3665 cp = fd_info[fd].cp;
3666
3667 if (cp == NULL || cp->fd != fd || cp->status != STATUS_READ_READY)
3668 return STATUS_READ_ERROR;
3669
3670 cp->status = STATUS_READ_FAILED;
3671
3672 hEv = pfn_WSACreateEvent ();
3673 rc = pfn_WSAEventSelect (SOCK_HANDLE (fd), hEv, FD_ACCEPT);
3674 if (rc != SOCKET_ERROR)
3675 {
3676 rc = WaitForSingleObject (hEv, INFINITE);
3677 pfn_WSAEventSelect (SOCK_HANDLE (fd), NULL, 0);
3678 pfn_WSACloseEvent (hEv);
3679 if (rc == WAIT_OBJECT_0)
3680 cp->status = STATUS_READ_SUCCEEDED;
3681 }
3682
3683 return cp->status;
3684}
3685
3644int 3686int
3645sys_read (int fd, char * buffer, unsigned int count) 3687sys_read (int fd, char * buffer, unsigned int count)
3646{ 3688{
diff --git a/src/w32.h b/src/w32.h
index ecc986269fb..1d5dbee6d40 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -93,6 +93,7 @@ extern filedesc fd_info [ MAXDESC ];
93/* fd_info flag definitions */ 93/* fd_info flag definitions */
94#define FILE_READ 0x0001 94#define FILE_READ 0x0001
95#define FILE_WRITE 0x0002 95#define FILE_WRITE 0x0002
96#define FILE_LISTEN 0x0004
96#define FILE_BINARY 0x0010 97#define FILE_BINARY 0x0010
97#define FILE_LAST_CR 0x0020 98#define FILE_LAST_CR 0x0020
98#define FILE_AT_EOF 0x0040 99#define FILE_AT_EOF 0x0040
@@ -136,6 +137,9 @@ extern void syms_of_w32menu (void);
136extern void globals_of_w32menu (void); 137extern void globals_of_w32menu (void);
137extern void syms_of_fontset (void); 138extern void syms_of_fontset (void);
138 139
140extern int _sys_read_ahead (int fd);
141extern int _sys_wait_accept (int fd);
142
139#endif /* EMACS_W32_H */ 143#endif /* EMACS_W32_H */
140 144
141/* arch-tag: 02c36b00-312b-4c4d-a1d9-f905c5e968f0 145/* arch-tag: 02c36b00-312b-4c4d-a1d9-f905c5e968f0
diff --git a/src/w32proc.c b/src/w32proc.c
index a9e0e0cb83f..d874d183b17 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1,6 +1,6 @@
1/* Process support for GNU Emacs on the Microsoft W32 API. 1/* Process support for GNU Emacs on the Microsoft W32 API.
2 Copyright (C) 1992, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2 Copyright (C) 1992, 1995, 1999, 2000, 2001, 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.
6 6
@@ -280,7 +280,10 @@ reader_thread (void *arg)
280 { 280 {
281 int rc; 281 int rc;
282 282
283 rc = _sys_read_ahead (cp->fd); 283 if (fd_info[cp->fd].flags & FILE_LISTEN)
284 rc = _sys_wait_accept (cp->fd);
285 else
286 rc = _sys_read_ahead (cp->fd);
284 287
285 /* The name char_avail is a misnomer - it really just means the 288 /* The name char_avail is a misnomer - it really just means the
286 read-ahead has completed, whether successfully or not. */ 289 read-ahead has completed, whether successfully or not. */
diff --git a/src/w32term.c b/src/w32term.c
index 3683089cb3e..ddc15e77259 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5480,20 +5480,52 @@ x_calc_absolute_position (f)
5480{ 5480{
5481 int flags = f->size_hint_flags; 5481 int flags = f->size_hint_flags;
5482 5482
5483 /* Treat negative positions as relative to the leftmost bottommost 5483 /* The sum of the widths of the frame's left and right borders, and
5484 the sum of the heights of the frame's top and bottom borders (in
5485 pixels) drawn by Windows. */
5486 unsigned int left_right_borders_width, top_bottom_borders_height;
5487
5488 /* Try to get the actual values of these two variables. We compute
5489 the border width (height) by subtracting the width (height) of
5490 the frame's client area from the width (height) of the frame's
5491 entire window. */
5492 WINDOWPLACEMENT wp = { 0 };
5493 RECT client_rect = { 0 };
5494
5495 if (GetWindowPlacement (FRAME_W32_WINDOW (f), &wp)
5496 && GetClientRect (FRAME_W32_WINDOW (f), &client_rect))
5497 {
5498 left_right_borders_width =
5499 (wp.rcNormalPosition.right - wp.rcNormalPosition.left) -
5500 (client_rect.right - client_rect.left);
5501
5502 top_bottom_borders_height =
5503 (wp.rcNormalPosition.bottom - wp.rcNormalPosition.top) -
5504 (client_rect.bottom - client_rect.top);
5505 }
5506 else
5507 {
5508 /* Use sensible default values. */
5509 left_right_borders_width = 8;
5510 top_bottom_borders_height = 32;
5511 }
5512
5513 /* Treat negative positions as relative to the rightmost bottommost
5484 position that fits on the screen. */ 5514 position that fits on the screen. */
5485 if (flags & XNegative) 5515 if (flags & XNegative)
5486 f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width 5516 f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width
5487 - FRAME_PIXEL_WIDTH (f) 5517 - FRAME_PIXEL_WIDTH (f)
5488 + f->left_pos); 5518 + f->left_pos
5519 - (left_right_borders_width - 1));
5489 5520
5490 if (flags & YNegative) 5521 if (flags & YNegative)
5491 f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height 5522 f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height
5492 - FRAME_PIXEL_HEIGHT (f) 5523 - FRAME_PIXEL_HEIGHT (f)
5493 + f->top_pos); 5524 + f->top_pos
5494 /* The left_pos and top_pos 5525 - (top_bottom_borders_height - 1));
5495 are now relative to the top and left screen edges, 5526
5496 so the flags should correspond. */ 5527 /* The left_pos and top_pos are now relative to the top and left
5528 screen edges, so the flags should correspond. */
5497 f->size_hint_flags &= ~ (XNegative | YNegative); 5529 f->size_hint_flags &= ~ (XNegative | YNegative);
5498} 5530}
5499 5531
diff --git a/src/window.c b/src/window.c
index 5a03296a18a..2d15cdc7e4e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3676,7 +3676,7 @@ displayed. */)
3676 3676
3677DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update, 3677DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update,
3678 0, 1, 0, 3678 0, 1, 0,
3679 doc: /* Force redisplay of all windows. 3679 doc: /* Force all windows to be updated on next redisplay.
3680If optional arg OBJECT is a window, force redisplay of that window only. 3680If optional arg OBJECT is a window, force redisplay of that window only.
3681If OBJECT is a buffer or buffer name, force redisplay of all windows 3681If OBJECT is a buffer or buffer name, force redisplay of all windows
3682displaying that buffer. */) 3682displaying that buffer. */)
@@ -4959,9 +4959,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4959 else if (noerror) 4959 else if (noerror)
4960 return; 4960 return;
4961 else if (n < 0) /* could happen with empty buffers */ 4961 else if (n < 0) /* could happen with empty buffers */
4962 Fsignal (Qbeginning_of_buffer, Qnil); 4962 xsignal0 (Qbeginning_of_buffer);
4963 else 4963 else
4964 Fsignal (Qend_of_buffer, Qnil); 4964 xsignal0 (Qend_of_buffer);
4965 } 4965 }
4966 else 4966 else
4967 { 4967 {
@@ -4972,7 +4972,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4972 else if (noerror) 4972 else if (noerror)
4973 return; 4973 return;
4974 else 4974 else
4975 Fsignal (Qbeginning_of_buffer, Qnil); 4975 xsignal0 (Qbeginning_of_buffer);
4976 } 4976 }
4977 4977
4978 /* If control gets here, then we vscrolled. */ 4978 /* If control gets here, then we vscrolled. */
@@ -5173,7 +5173,7 @@ window_scroll_line_based (window, n, whole, noerror)
5173 if (noerror) 5173 if (noerror)
5174 return; 5174 return;
5175 else 5175 else
5176 Fsignal (Qbeginning_of_buffer, Qnil); 5176 xsignal0 (Qbeginning_of_buffer);
5177 } 5177 }
5178 5178
5179 if (pos < ZV) 5179 if (pos < ZV)
@@ -5259,7 +5259,7 @@ window_scroll_line_based (window, n, whole, noerror)
5259 if (noerror) 5259 if (noerror)
5260 return; 5260 return;
5261 else 5261 else
5262 Fsignal (Qend_of_buffer, Qnil); 5262 xsignal0 (Qend_of_buffer);
5263 } 5263 }
5264} 5264}
5265 5265
@@ -5883,8 +5883,7 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
5883 register struct save_window_data *data; 5883 register struct save_window_data *data;
5884 struct Lisp_Vector *saved_windows; 5884 struct Lisp_Vector *saved_windows;
5885 5885
5886 if (! WINDOW_CONFIGURATIONP (config)) 5886 CHECK_WINDOW_CONFIGURATION (config);
5887 wrong_type_argument (Qwindow_configuration_p, config);
5888 5887
5889 data = (struct save_window_data *) XVECTOR (config); 5888 data = (struct save_window_data *) XVECTOR (config);
5890 saved_windows = XVECTOR (data->saved_windows); 5889 saved_windows = XVECTOR (data->saved_windows);
@@ -5909,8 +5908,7 @@ the return value is nil. Otherwise the value is t. */)
5909 FRAME_PTR f; 5908 FRAME_PTR f;
5910 int old_point = -1; 5909 int old_point = -1;
5911 5910
5912 while (!WINDOW_CONFIGURATIONP (configuration)) 5911 CHECK_WINDOW_CONFIGURATION (configuration);
5913 wrong_type_argument (Qwindow_configuration_p, configuration);
5914 5912
5915 data = (struct save_window_data *) XVECTOR (configuration); 5913 data = (struct save_window_data *) XVECTOR (configuration);
5916 saved_windows = XVECTOR (data->saved_windows); 5914 saved_windows = XVECTOR (data->saved_windows);
@@ -6949,10 +6947,8 @@ compare_window_configurations (c1, c2, ignore_positions)
6949 struct Lisp_Vector *sw1, *sw2; 6947 struct Lisp_Vector *sw1, *sw2;
6950 int i; 6948 int i;
6951 6949
6952 if (!WINDOW_CONFIGURATIONP (c1)) 6950 CHECK_WINDOW_CONFIGURATION (c1);
6953 wrong_type_argument (Qwindow_configuration_p, c1); 6951 CHECK_WINDOW_CONFIGURATION (c2);
6954 if (!WINDOW_CONFIGURATIONP (c2))
6955 wrong_type_argument (Qwindow_configuration_p, c2);
6956 6952
6957 d1 = (struct save_window_data *) XVECTOR (c1); 6953 d1 = (struct save_window_data *) XVECTOR (c1);
6958 d2 = (struct save_window_data *) XVECTOR (c2); 6954 d2 = (struct save_window_data *) XVECTOR (c2);
diff --git a/src/xdisp.c b/src/xdisp.c
index 8a745ac778e..fbd61f7e2be 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3889,7 +3889,7 @@ handle_single_display_spec (it, spec, object, position,
3889{ 3889{
3890 Lisp_Object form; 3890 Lisp_Object form;
3891 Lisp_Object location, value; 3891 Lisp_Object location, value;
3892 struct text_pos start_pos; 3892 struct text_pos start_pos, save_pos;
3893 int valid_p; 3893 int valid_p;
3894 3894
3895 /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. 3895 /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM.
@@ -4106,7 +4106,10 @@ handle_single_display_spec (it, spec, object, position,
4106 /* Save current settings of IT so that we can restore them 4106 /* Save current settings of IT so that we can restore them
4107 when we are finished with the glyph property value. */ 4107 when we are finished with the glyph property value. */
4108 4108
4109 save_pos = it->position;
4110 it->position = *position;
4109 push_it (it); 4111 push_it (it);
4112 it->position = save_pos;
4110 4113
4111 it->area = TEXT_AREA; 4114 it->area = TEXT_AREA;
4112 it->what = IT_IMAGE; 4115 it->what = IT_IMAGE;
@@ -4180,7 +4183,10 @@ handle_single_display_spec (it, spec, object, position,
4180 { 4183 {
4181 /* Save current settings of IT so that we can restore them 4184 /* Save current settings of IT so that we can restore them
4182 when we are finished with the glyph property value. */ 4185 when we are finished with the glyph property value. */
4186 save_pos = it->position;
4187 it->position = *position;
4183 push_it (it); 4188 push_it (it);
4189 it->position = save_pos;
4184 4190
4185 if (NILP (location)) 4191 if (NILP (location))
4186 it->area = TEXT_AREA; 4192 it->area = TEXT_AREA;
@@ -5090,6 +5096,12 @@ pop_it (it)
5090 case GET_FROM_STRETCH: 5096 case GET_FROM_STRETCH:
5091 it->object = p->u.comp.object; 5097 it->object = p->u.comp.object;
5092 break; 5098 break;
5099 case GET_FROM_BUFFER:
5100 it->object = it->w->buffer;
5101 break;
5102 case GET_FROM_STRING:
5103 it->object = it->string;
5104 break;
5093 } 5105 }
5094 it->end_charpos = p->end_charpos; 5106 it->end_charpos = p->end_charpos;
5095 it->string_nchars = p->string_nchars; 5107 it->string_nchars = p->string_nchars;
@@ -5409,7 +5421,6 @@ reseat_1 (it, pos, set_stop_p)
5409 xassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV); 5421 xassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV);
5410 5422
5411 it->current.pos = it->position = pos; 5423 it->current.pos = it->position = pos;
5412 XSETBUFFER (it->object, current_buffer);
5413 it->end_charpos = ZV; 5424 it->end_charpos = ZV;
5414 it->dpvec = NULL; 5425 it->dpvec = NULL;
5415 it->current.dpvec_index = -1; 5426 it->current.dpvec_index = -1;
@@ -5905,14 +5916,12 @@ set_iterator_to_next (it, reseat_p)
5905 { 5916 {
5906 IT_STRING_BYTEPOS (*it) += it->len; 5917 IT_STRING_BYTEPOS (*it) += it->len;
5907 IT_STRING_CHARPOS (*it) += it->cmp_len; 5918 IT_STRING_CHARPOS (*it) += it->cmp_len;
5908 it->object = it->string;
5909 goto consider_string_end; 5919 goto consider_string_end;
5910 } 5920 }
5911 else if (it->method == GET_FROM_BUFFER) 5921 else if (it->method == GET_FROM_BUFFER)
5912 { 5922 {
5913 IT_BYTEPOS (*it) += it->len; 5923 IT_BYTEPOS (*it) += it->len;
5914 IT_CHARPOS (*it) += it->cmp_len; 5924 IT_CHARPOS (*it) += it->cmp_len;
5915 it->object = it->w->buffer;
5916 } 5925 }
5917 break; 5926 break;
5918 5927
@@ -6152,9 +6161,7 @@ next_element_from_string (it)
6152 } 6161 }
6153 } 6162 }
6154 6163
6155 /* Record what we have and where it came from. Note that we store a 6164 /* Record what we have and where it came from. */
6156 buffer position in IT->position although it could arguably be a
6157 string position. */
6158 it->what = IT_CHARACTER; 6165 it->what = IT_CHARACTER;
6159 it->object = it->string; 6166 it->object = it->string;
6160 it->position = position; 6167 it->position = position;
@@ -6879,6 +6886,10 @@ move_it_to (it, to_charpos, to_x, to_y, to_vpos, op)
6879 if (reached) 6886 if (reached)
6880 break; 6887 break;
6881 } 6888 }
6889 else if (BUFFERP (it->object)
6890 && it->method == GET_FROM_BUFFER
6891 && IT_CHARPOS (*it) >= to_charpos)
6892 skip = MOVE_POS_MATCH_OR_ZV;
6882 else 6893 else
6883 skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS); 6894 skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS);
6884 6895
@@ -16648,6 +16659,7 @@ display_mode_line (w, face_id, format)
16648 kboard-local variables in the mode_line_format will get the right 16659 kboard-local variables in the mode_line_format will get the right
16649 values. */ 16660 values. */
16650 push_frame_kboard (it.f); 16661 push_frame_kboard (it.f);
16662 record_unwind_save_match_data ();
16651 display_mode_element (&it, 0, 0, 0, format, Qnil, 0); 16663 display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
16652 pop_frame_kboard (); 16664 pop_frame_kboard ();
16653 16665
diff --git a/src/xfaces.c b/src/xfaces.c
index 43d1352f335..6a05611939e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -496,7 +496,6 @@ static int font_scalable_p P_ ((struct font_name *));
496static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int)); 496static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int));
497static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); 497static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *));
498static unsigned char *xstrlwr P_ ((unsigned char *)); 498static unsigned char *xstrlwr P_ ((unsigned char *));
499static void signal_error P_ ((char *, Lisp_Object));
500static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); 499static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int));
501static void load_face_font P_ ((struct frame *, struct face *)); 500static void load_face_font P_ ((struct frame *, struct face *));
502static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); 501static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *));
@@ -863,17 +862,6 @@ xstrlwr (s)
863} 862}
864 863
865 864
866/* Signal `error' with message S, and additional argument ARG. */
867
868static void
869signal_error (s, arg)
870 char *s;
871 Lisp_Object arg;
872{
873 Fsignal (Qerror, Fcons (build_string (s), Fcons (arg, Qnil)));
874}
875
876
877/* If FRAME is nil, return a pointer to the selected frame. 865/* If FRAME is nil, return a pointer to the selected frame.
878 Otherwise, check that FRAME is a live frame, and return a pointer 866 Otherwise, check that FRAME is a live frame, and return a pointer
879 to it. NPARAM is the parameter number of FRAME, for 867 to it. NPARAM is the parameter number of FRAME, for
@@ -1182,14 +1170,11 @@ load_pixmap (f, name, w_ptr, h_ptr)
1182 unsigned int *w_ptr, *h_ptr; 1170 unsigned int *w_ptr, *h_ptr;
1183{ 1171{
1184 int bitmap_id; 1172 int bitmap_id;
1185 Lisp_Object tem;
1186 1173
1187 if (NILP (name)) 1174 if (NILP (name))
1188 return 0; 1175 return 0;
1189 1176
1190 tem = Fbitmap_spec_p (name); 1177 CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name);
1191 if (NILP (tem))
1192 wrong_type_argument (Qbitmap_spec_p, name);
1193 1178
1194 BLOCK_INPUT; 1179 BLOCK_INPUT;
1195 if (CONSP (name)) 1180 if (CONSP (name))
@@ -3409,7 +3394,7 @@ resolve_face_name (face_name, signal_p)
3409 if (EQ (hare, tortoise)) 3394 if (EQ (hare, tortoise))
3410 { 3395 {
3411 if (signal_p) 3396 if (signal_p)
3412 Fsignal (Qcircular_list, Fcons (orig_face, Qnil)); 3397 xsignal1 (Qcircular_list, orig_face);
3413 return Qdefault; 3398 return Qdefault;
3414 } 3399 }
3415 } 3400 }
diff --git a/src/xfns.c b/src/xfns.c
index 253f2829f85..85296bc6c35 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -766,9 +766,7 @@ x_decode_color (f, color_name, mono_color)
766 if (x_defined_color (f, SDATA (color_name), &cdef, 1)) 766 if (x_defined_color (f, SDATA (color_name), &cdef, 1))
767 return cdef.pixel; 767 return cdef.pixel;
768 768
769 Fsignal (Qerror, Fcons (build_string ("Undefined color"), 769 signal_error ("Undefined color", color_name);
770 Fcons (color_name, Qnil)));
771 return 0;
772} 770}
773 771
774 772
diff --git a/src/xselect.c b/src/xselect.c
index 9c2c221c021..fcac2860359 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -555,11 +555,9 @@ x_get_local_selection (selection_symbol, target_type, local_request)
555 && INTEGERP (XCAR (XCDR (check))) 555 && INTEGERP (XCAR (XCDR (check)))
556 && NILP (XCDR (XCDR (check)))))) 556 && NILP (XCDR (XCDR (check))))))
557 return value; 557 return value;
558 else 558
559 return 559 signal_error ("Invalid data returned by selection-conversion function",
560 Fsignal (Qerror, 560 list2 (handler_fn, value));
561 Fcons (build_string ("invalid data returned by selection-conversion function"),
562 Fcons (handler_fn, Fcons (value, Qnil))));
563} 561}
564 562
565/* Subroutines of x_reply_selection_request. */ 563/* Subroutines of x_reply_selection_request. */
@@ -1348,8 +1346,7 @@ copy_multiple_data (obj)
1348 CHECK_VECTOR (vec2); 1346 CHECK_VECTOR (vec2);
1349 if (XVECTOR (vec2)->size != 2) 1347 if (XVECTOR (vec2)->size != 2)
1350 /* ??? Confusing error message */ 1348 /* ??? Confusing error message */
1351 Fsignal (Qerror, Fcons (build_string ("vectors must be of length 2"), 1349 signal_error ("Vectors must be of length 2", vec2);
1352 Fcons (vec2, Qnil)));
1353 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil); 1350 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil);
1354 XVECTOR (XVECTOR (vec)->contents [i])->contents [0] 1351 XVECTOR (XVECTOR (vec)->contents [i])->contents [0]
1355 = XVECTOR (vec2)->contents [0]; 1352 = XVECTOR (vec2)->contents [0];
@@ -1717,19 +1714,15 @@ x_get_window_property_as_lisp_data (display, window, property, target_type,
1717 there_is_a_selection_owner 1714 there_is_a_selection_owner
1718 = XGetSelectionOwner (display, selection_atom); 1715 = XGetSelectionOwner (display, selection_atom);
1719 UNBLOCK_INPUT; 1716 UNBLOCK_INPUT;
1720 Fsignal (Qerror, 1717 if (there_is_a_selection_owner)
1721 there_is_a_selection_owner 1718 signal_error ("Selection owner couldn't convert",
1722 ? Fcons (build_string ("selection owner couldn't convert"), 1719 actual_type
1723 actual_type 1720 ? list2 (target_type,
1724 ? Fcons (target_type, 1721 x_atom_to_symbol (display, actual_type))
1725 Fcons (x_atom_to_symbol (display, 1722 : target_type);
1726 actual_type), 1723 else
1727 Qnil)) 1724 signal_error ("No selection",
1728 : Fcons (target_type, Qnil)) 1725 x_atom_to_symbol (display, selection_atom));
1729 : Fcons (build_string ("no selection"),
1730 Fcons (x_atom_to_symbol (display,
1731 selection_atom),
1732 Qnil)));
1733 } 1726 }
1734 1727
1735 if (actual_type == dpyinfo->Xatom_INCR) 1728 if (actual_type == dpyinfo->Xatom_INCR)
@@ -1929,10 +1922,7 @@ lisp_data_to_selection_data (display, obj,
1929 { 1922 {
1930 if (SCHARS (obj) < SBYTES (obj)) 1923 if (SCHARS (obj) < SBYTES (obj))
1931 /* OBJ is a multibyte string containing a non-ASCII char. */ 1924 /* OBJ is a multibyte string containing a non-ASCII char. */
1932 Fsignal (Qerror, /* Qselection_error */ 1925 signal_error ("Non-ASCII string must be encoded in advance", obj);
1933 Fcons (build_string
1934 ("Non-ASCII string must be encoded in advance"),
1935 Fcons (obj, Qnil)));
1936 if (NILP (type)) 1926 if (NILP (type))
1937 type = QSTRING; 1927 type = QSTRING;
1938 *format_ret = 8; 1928 *format_ret = 8;
@@ -1993,10 +1983,7 @@ lisp_data_to_selection_data (display, obj,
1993 (*(Atom **) data_ret) [i] 1983 (*(Atom **) data_ret) [i]
1994 = symbol_to_x_atom (dpyinfo, display, XVECTOR (obj)->contents [i]); 1984 = symbol_to_x_atom (dpyinfo, display, XVECTOR (obj)->contents [i]);
1995 else 1985 else
1996 Fsignal (Qerror, /* Qselection_error */ 1986 signal_error ("All elements of selection vector must have same type", obj);
1997 Fcons (build_string
1998 ("all elements of selection vector must have same type"),
1999 Fcons (obj, Qnil)));
2000 } 1987 }
2001#if 0 /* #### MULTIPLE doesn't work yet */ 1988#if 0 /* #### MULTIPLE doesn't work yet */
2002 else if (VECTORP (XVECTOR (obj)->contents [0])) 1989 else if (VECTORP (XVECTOR (obj)->contents [0]))
@@ -2012,10 +1999,9 @@ lisp_data_to_selection_data (display, obj,
2012 { 1999 {
2013 Lisp_Object pair = XVECTOR (obj)->contents [i]; 2000 Lisp_Object pair = XVECTOR (obj)->contents [i];
2014 if (XVECTOR (pair)->size != 2) 2001 if (XVECTOR (pair)->size != 2)
2015 Fsignal (Qerror, 2002 signal_error (
2016 Fcons (build_string 2003 "Elements of the vector must be vectors of exactly two elements",
2017 ("elements of the vector must be vectors of exactly two elements"), 2004 pair);
2018 Fcons (pair, Qnil)));
2019 2005
2020 (*(Atom **) data_ret) [i * 2] 2006 (*(Atom **) data_ret) [i * 2]
2021 = symbol_to_x_atom (dpyinfo, display, 2007 = symbol_to_x_atom (dpyinfo, display,
@@ -2025,10 +2011,8 @@ lisp_data_to_selection_data (display, obj,
2025 XVECTOR (pair)->contents [1]); 2011 XVECTOR (pair)->contents [1]);
2026 } 2012 }
2027 else 2013 else
2028 Fsignal (Qerror, 2014 signal_error ("All elements of the vector must be of the same type",
2029 Fcons (build_string 2015 obj);
2030 ("all elements of the vector must be of the same type"),
2031 Fcons (obj, Qnil)));
2032 2016
2033 } 2017 }
2034#endif 2018#endif
@@ -2043,10 +2027,9 @@ lisp_data_to_selection_data (display, obj,
2043 if (CONSP (XVECTOR (obj)->contents [i])) 2027 if (CONSP (XVECTOR (obj)->contents [i]))
2044 *format_ret = 32; 2028 *format_ret = 32;
2045 else if (!INTEGERP (XVECTOR (obj)->contents [i])) 2029 else if (!INTEGERP (XVECTOR (obj)->contents [i]))
2046 Fsignal (Qerror, /* Qselection_error */ 2030 signal_error (/* Qselection_error */
2047 Fcons (build_string 2031 "Elements of selection vector must be integers or conses of integers",
2048 ("elements of selection vector must be integers or conses of integers"), 2032 obj);
2049 Fcons (obj, Qnil)));
2050 2033
2051 /* Use sizeof(long) even if it is more than 32 bits. See comment 2034 /* Use sizeof(long) even if it is more than 32 bits. See comment
2052 in x_get_window_property and x_fill_property_data. */ 2035 in x_get_window_property and x_fill_property_data. */
@@ -2063,9 +2046,7 @@ lisp_data_to_selection_data (display, obj,
2063 } 2046 }
2064 } 2047 }
2065 else 2048 else
2066 Fsignal (Qerror, /* Qselection_error */ 2049 signal_error (/* Qselection_error */ "Unrecognized selection data", obj);
2067 Fcons (build_string ("unrecognized selection data"),
2068 Fcons (obj, Qnil)));
2069 2050
2070 *type_ret = symbol_to_x_atom (dpyinfo, display, type); 2051 *type_ret = symbol_to_x_atom (dpyinfo, display, type);
2071} 2052}
@@ -2351,15 +2332,13 @@ initialize_cut_buffers (display, window)
2351 2332
2352 2333
2353#define CHECK_CUT_BUFFER(symbol) \ 2334#define CHECK_CUT_BUFFER(symbol) \
2354 { CHECK_SYMBOL ((symbol)); \ 2335 do { CHECK_SYMBOL ((symbol)); \
2355 if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \ 2336 if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \
2356 && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \ 2337 && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \
2357 && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \ 2338 && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \
2358 && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \ 2339 && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \
2359 Fsignal (Qerror, \ 2340 signal_error ("Doesn't name a cut buffer", (symbol)); \
2360 Fcons (build_string ("doesn't name a cut buffer"), \ 2341 } while (0)
2361 Fcons ((symbol), Qnil))); \
2362 }
2363 2342
2364DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, 2343DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
2365 Sx_get_cut_buffer_internal, 1, 1, 0, 2344 Sx_get_cut_buffer_internal, 1, 1, 0,
@@ -2392,10 +2371,9 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
2392 return Qnil; 2371 return Qnil;
2393 2372
2394 if (format != 8 || type != XA_STRING) 2373 if (format != 8 || type != XA_STRING)
2395 Fsignal (Qerror, 2374 signal_error ("Cut buffer doesn't contain 8-bit data",
2396 Fcons (build_string ("cut buffer doesn't contain 8-bit data"), 2375 list2 (x_atom_to_symbol (display, type),
2397 Fcons (x_atom_to_symbol (display, type), 2376 make_number (format)));
2398 Fcons (make_number (format), Qnil))));
2399 2377
2400 ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil); 2378 ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil);
2401 /* Use xfree, not XFree, because x_get_window_property 2379 /* Use xfree, not XFree, because x_get_window_property
diff --git a/src/xterm.c b/src/xterm.c
index 165bc1df766..ca5af4afbfc 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -363,7 +363,7 @@ static void x_check_expected_move P_ ((struct frame *, int, int));
363static void x_sync_with_move P_ ((struct frame *, int, int, int)); 363static void x_sync_with_move P_ ((struct frame *, int, int, int));
364static int handle_one_xevent P_ ((struct x_display_info *, XEvent *, 364static int handle_one_xevent P_ ((struct x_display_info *, XEvent *,
365 int *, struct input_event *)); 365 int *, struct input_event *));
366static SIGTYPE x_connection_closed P_ ((Display *, char *)); 366static SIGTYPE x_connection_closed P_ ((Display *, char *)) NO_RETURN;
367 367
368 368
369/* Flush display of frame F, or of all frames if F is null. */ 369/* Flush display of frame F, or of all frames if F is null. */
@@ -7988,7 +7988,7 @@ x_connection_closed (dpy, error_message)
7988 7988
7989/* We specifically use it before defining it, so that gcc doesn't inline it, 7989/* We specifically use it before defining it, so that gcc doesn't inline it,
7990 otherwise gdb doesn't know how to properly put a breakpoint on it. */ 7990 otherwise gdb doesn't know how to properly put a breakpoint on it. */
7991static void x_error_quitter (Display *display, XErrorEvent *error); 7991static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN;
7992 7992
7993/* This is the first-level handler for X protocol errors. 7993/* This is the first-level handler for X protocol errors.
7994 It calls x_error_quitter or x_error_catcher. */ 7994 It calls x_error_quitter or x_error_catcher. */