aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog224
-rw-r--r--src/alloc.c126
-rw-r--r--src/buffer.c8
-rw-r--r--src/buffer.h2
-rw-r--r--src/callint.c8
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/cmds.c8
-rw-r--r--src/coding.c9
-rw-r--r--src/data.c64
-rw-r--r--src/dispnew.c12
-rw-r--r--src/doc.c4
-rw-r--r--src/editfns.c4
-rw-r--r--src/eval.c126
-rw-r--r--src/fileio.c48
-rw-r--r--src/floatfns.c30
-rw-r--r--src/fns.c37
-rw-r--r--src/frame.c6
-rw-r--r--src/keyboard.c128
-rw-r--r--src/keyboard.h5
-rw-r--r--src/keymap.c16
-rw-r--r--src/lisp.h19
-rw-r--r--src/lread.c151
-rw-r--r--src/macselect.c8
-rw-r--r--src/macterm.c218
-rw-r--r--src/msdos.c6
-rw-r--r--src/print.c4
-rw-r--r--src/puresize.h2
-rw-r--r--src/search.c18
-rw-r--r--src/sound.c10
-rw-r--r--src/syntax.c23
-rw-r--r--src/textprop.c7
-rw-r--r--src/unexsol.c2
-rw-r--r--src/w32.c61
-rw-r--r--src/w32.h4
-rw-r--r--src/w32fns.c10
-rw-r--r--src/w32proc.c7
-rw-r--r--src/w32term.c44
-rw-r--r--src/window.c10
-rw-r--r--src/xdisp.c27
-rw-r--r--src/xfaces.c14
-rw-r--r--src/xfns.c4
-rw-r--r--src/xselect.c82
-rw-r--r--src/xterm.c4
43 files changed, 1058 insertions, 544 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8437853d887..79271fe23fa 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,227 @@
12006-07-26 Chong Yidong <cyd@stupidchicken.com>
2
3 * keyboard.c (read_char): New arg END_TIME specifying timeout.
4 All callers changed. Turn off echoing if END_TIME is non-NULL.
5 (kbd_buffer_get_event): New arg END_TIME.
6
7 * lread.c (read_filtered_event): New arg SECONDS to wait until.
8 (Fread_char, Fread_event, Fread_char_exclusive): New arg SECONDS.
9
10 * lisp.h: Update read-char, read-event, and read_filtered_event
11 prototypes.
12
13 * keyboard.h: Include systime.h. Update read_char prototype.
14
152006-07-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
16
17 * alloc.c (find_string_data_in_pure): New function.
18 (make_pure_string): Use it to reuse existing string data if possible.
19
20 * puresize.h (BASE_PURESIZE): Decrease to 1102000.
21
222006-07-22 Stefan Monnier <monnier@iro.umontreal.ca>
23
24 * keymap.c (Fdefine_key): If the key binding definition looks like an
25 XEmacs-style key sequence, convert it to Emacs's format.
26
272006-07-22 Ralf Angeli <angeli@caeruleus.net>
28
29 * w32fns.c (w32_createwindow): If `left' and/or `top' frame
30 parameters are bound to some values, use that instead of
31 CW_USEDEFAULT.
32
332006-07-21 Eli Zaretskii <eliz@gnu.org>
34
35 * w32.c (convert_time): Use explicit long double constants to
36 ensure long double arithmetics is used throughout.
37
382006-07-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
39
40 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): New vars.
41 (init_alloc_once): Initialize them.
42 (pure_alloc): Allocate non-Lisp objects from the end of pure storage
43 without alignment.
44
45 * puresize.h (BASE_PURESIZE): Decrease to 1141000.
46
472006-07-18 Francis Litterio <franl@world.std.com>
48
49 * w32term.c (x_calc_absolute_position): Fix frame positioning
50 with negative X/Y coordinates.
51
522006-07-18 Dan Nicolaescu <dann@ics.uci.edu>
53
54 * xterm.c (x_connection_closed, x_error_quitter): Mark as NO_RETURN.
55
56 * textprop.c (text_read_only): Likewise.
57
58 * lread.c (end_of_file_error): Likewise.
59
60 * lisp.h (circular_list_error, memory_full, buffer_memory_full):
61 Likewise.
62
63 * eval.c (unwind_to_catch): Likewise.
64
65 * buffer.h (buffer_slot_type_mismatch): Likewise.
66
672006-07-18 Kim F. Storm <storm@cua.dk>
68
69 Cleanup Fsignal calls that never returns; now only use it for Qquit.
70
71 * eval.c (xsignal): New func. Like Fsignal, but marked no-return.
72 (xsignal0, xsignal1, xsignal2, xsignal3): New no-return functions.
73 (signal_error): New no-return function (from xfaces.c).
74 (Fthrow): Use xsignal2 instead of Fsignal + abort.
75 (error): Use xsignal1 instead of Fsignal + abort.
76 (FletX, Flet, grow_specpdl): Use signal_error.
77 (Feval, Ffuncall, funcall_lambda): Use xsignal1, xsignal2.
78
79 * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop.
80 (list1): New function.
81
82 * lisp.h (list1): Add EXFUN.
83 (xsignal, xsignal0, xsignal1, xsignal2, xsignal3, signal_error):
84 Add prototypes. Mark them as no-return.
85
86 * buffer.c (Fbuffer_local_value, Fbarf_if_buffer_read_only):
87 Use xsignal1.
88
89 * callint.c (check_mark): Use xsignal0.
90
91 * casefiddle.c (casify_object): wrong_type_argument is no-return.
92
93 * cmds.c (Fforward_char, Fdelete_char): Use xsignal0.
94
95 * coding.c (Fcheck_coding_system): Use xsignal1. Remove loop.
96 (Fdefine_coding_system_internal): Use xsignal1.
97
98 * data.c (circular_list_error): Use xsignal.
99 (wrong_type_argument): Use xsignal2. Don't care about return value.
100 (args_out_of_range, args_out_of_range_3): Use xsignal2, xsignal3.
101 Remove loop around Fsignal.
102 (indirect_variable, Fsymbol_value, set_internal, Fdefault_value)
103 (indirect_function, Findirect_function, Fstring_to_number)
104 (Fmakunbound, Ffmakunbound, Fsymbol_function, Ffset): Use xsignal1.
105 (arith_driver, float_arith_driver, Frem, Fmod, arith_error):
106 Use xsignal0.
107
108 * doc.c (Fdocumentation): Use xsignal1.
109
110 * editfns.c (region_limit, Fget_internal_run_time): Use xsignal0.
111
112 * fileio.c (report_file_error): Use xsignal.
113 (barf_or_query_if_file_exists, Fcopy_file, Fdelete_file)
114 (Finsert_file_contents): Use xsignal2.
115 (syms_of_fileio): Use list2, list3.
116
117 * floatfns.c (arith_error, range_error, domain_error): Use xsignal2.
118 (range_error2, domain_error2): Use xsignal3.
119 (rounding_driver, fmod_float): Use xsignal0.
120 (float_error): Use xsignal1.
121 (matherr): Use xsignal.
122
123 * fns.c (Flength): wrong_type_argument is no-return.
124 (hashfn_user_defined, Fmake_hash_table): Use signal_error.
125 (Fmd5): Use xsignal1.
126
127 * frame.c (x_set_line_spacing, x_set_screen_gamma): Use signal_error.
128
129 * keyboard.c (recursive_edit_1): Use xsignal1.
130
131 * keymap.c (Fmap_keymap): Use xsignal1.
132
133 * lread.c (Fload): Use xsignal2, signal_error.
134 (end_of_file_error): Use xsignal0, xsignal1.
135 (read0): Use xsignal1.
136 (invalid_syntax): New error function marked no-return.
137 (read_integer, read1, read_list): Use it.
138
139 * macselect.c (x_get_local_selection): Use signal_error.
140
141 * msdos.c (Fmsdos_set_mouse_buttons): Use xsignal2.
142
143 * search.c (compile_pattern_1): Use xsignal1.
144 (signal_failure): Remove (was only called once).
145 (search_command): Use xsignal1 instead of signal_failure.
146
147 * syntax.c (scan_lists): Use xsignal3.
148
149 * textprop.c (text_read_only): Use xsignal0, xsignal1.
150
151 * unexsol.c (unexec): Use xsignal.
152
153 * window.c (window_scroll_pixel_based, window_scroll_line_based):
154 Use xsignal0.
155
156 * xfaces.c (signal_error): Move to eval.c.
157 (resolve_face_name): Use xsignal1.
158
159 * xfns.c (x_decode_color): Use signal_error.
160
161 * xselect.c (x_get_local_selection, copy_multiple_data)
162 (x_get_window_property_as_lisp_data)
163 (lisp_data_to_selection_data, CHECK_CUT_BUFFER)
164 (Fx_get_cut_buffer_internal): Use signal_error.
165
1662006-07-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
167
168 * macterm.c (XTread_socket): Undo previous change.
169
1702006-07-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
171
172 * macterm.c (keycode_to_xkeysym): Remove function. All uses now
173 directly lookup keycode_to_xkeysym_table.
174 [USE_MAC_TSM] (mac_handle_text_input_event): Don't construct
175 ASCII_KEYSTROKE_EVENT for non-zero keycode_to_xkeysym_table entries.
176 (XTread_socket): Use character codes to construct keypad key events.
177 (mac_initialize_display_info) [MAC_OSX]: Use CGDisplaySamplesPerPixel.
178 (x_delete_display): Apply 2006-07-04 change for xterm.c.
179
1802006-07-17 Kim F. Storm <storm@cua.dk>
181
182 * xdisp.c (handle_single_display_spec): Ensure the right value of
183 it->position is saved by push_it.
184 (pop_it): Restore it->object for GET_FROM_BUFFER and GET_FROM_STRING.
185 (reseat_1): Don't setup it->object twice.
186 (set_iterator_to_next): No need to set it->object after pop_it.
187 (move_it_to): Explicitly check to see if last move reached to_charpos.
188
1892006-07-17 Thien-Thi Nguyen <ttn@gnu.org>
190
191 * xdisp.c (display_mode_line): Preserve match data.
192
1932006-07-14 Kim F. Storm <storm@cua.dk>
194
195 * w32.c (pfn_WSACreateEvent, pfn_WSACloseEvent): New func ptrs.
196 (init_winsock): Load them. Use ws2_32.dll.
197 (sys_listen): Undo last change. Just set FILE_LISTEN flag.
198 (sys_accept): Undo last change. Instead, set child status to
199 STATUS_READ_ACKNOWLEDGED and reset char_avail event so next
200 sys_select will wakeup the reader thread.
201 (_sys_wait_accept): New function used by reader thread to wait for
202 an incoming connection on a server socket.
203
204 * w32.h (_sys_read_ahead, _sys_wait_accept): Add prototypes.
205
206 * w32proc.c (reader_thread): Use _sys_wait_accept to wait on a
207 server socket (FILE_LISTEN flag).
208
2092006-07-14 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
210
211 * sound.c (alsa_init): Call snd_pcm_close after successful snd_pcm_open.
212
2132006-07-14 Kim F. Storm <storm@cua.dk>
214
215 * w32.c: Fix high cpu load for server sockets.
216 (pfn_WSAEventSelect): New function ptr.
217 (init_winsock): Load it.
218 (sys_listen): Set FILE_LISTEN flag. Set event mask for socket's
219 char_avail event object to FD_ACCEPT.
220 (sys_accept): Check FILE_LISTEN flag. Set event mask on new
221 socket's char_avail event object to FD_READ|FD_CLOSE.
222
223 * w32.h (FILE_LISTEN): New filedesc flag value.
224
12006-07-13 Kim F. Storm <storm@cua.dk> 2252006-07-13 Kim F. Storm <storm@cua.dk>
2 226
3 * bytecode.c (Fbyte_code): Use CAR, CDR for Bcar, Bcdr. 227 * bytecode.c (Fbyte_code): Use CAR, CDR for Bcar, Bcdr.
diff --git a/src/alloc.c b/src/alloc.c
index 8088540bb6b..e3609292749 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -289,10 +289,18 @@ static size_t pure_bytes_used_before_overflow;
289 && ((PNTR_COMPARISON_TYPE) (P) \ 289 && ((PNTR_COMPARISON_TYPE) (P) \
290 >= (PNTR_COMPARISON_TYPE) purebeg)) 290 >= (PNTR_COMPARISON_TYPE) purebeg))
291 291
292/* Index in pure at which next pure object will be allocated.. */ 292/* Total number of bytes allocated in pure storage. */
293 293
294EMACS_INT pure_bytes_used; 294EMACS_INT pure_bytes_used;
295 295
296/* Index in pure at which next pure Lisp object will be allocated.. */
297
298static EMACS_INT pure_bytes_used_lisp;
299
300/* Number of bytes allocated for non-Lisp objects in pure storage. */
301
302static EMACS_INT pure_bytes_used_non_lisp;
303
296/* If nonzero, this is a warning delivered by malloc and not yet 304/* If nonzero, this is a warning delivered by malloc and not yet
297 displayed. */ 305 displayed. */
298 306
@@ -561,8 +569,7 @@ buffer_memory_full ()
561 569
562 /* This used to call error, but if we've run out of memory, we could 570 /* This used to call error, but if we've run out of memory, we could
563 get infinite recursion trying to build the string. */ 571 get infinite recursion trying to build the string. */
564 while (1) 572 xsignal (Qnil, Vmemory_signal_data);
565 Fsignal (Qnil, Vmemory_signal_data);
566} 573}
567 574
568 575
@@ -2779,7 +2786,14 @@ check_cons_list ()
2779#endif 2786#endif
2780} 2787}
2781 2788
2782/* Make a list of 2, 3, 4 or 5 specified objects. */ 2789/* Make a list of 1, 2, 3, 4 or 5 specified objects. */
2790
2791Lisp_Object
2792list1 (arg1)
2793 Lisp_Object arg1;
2794{
2795 return Fcons (arg1, Qnil);
2796}
2783 2797
2784Lisp_Object 2798Lisp_Object
2785list2 (arg1, arg2) 2799list2 (arg1, arg2)
@@ -3495,8 +3509,7 @@ memory_full ()
3495 3509
3496 /* This used to call error, but if we've run out of memory, we could 3510 /* This used to call error, but if we've run out of memory, we could
3497 get infinite recursion trying to build the string. */ 3511 get infinite recursion trying to build the string. */
3498 while (1) 3512 xsignal (Qnil, Vmemory_signal_data);
3499 Fsignal (Qnil, Vmemory_signal_data);
3500} 3513}
3501 3514
3502/* If we released our reserve (due to running out of memory), 3515/* If we released our reserve (due to running out of memory),
@@ -4689,10 +4702,7 @@ valid_lisp_object_p (obj)
4689 4702
4690/* Allocate room for SIZE bytes from pure Lisp storage and return a 4703/* Allocate room for SIZE bytes from pure Lisp storage and return a
4691 pointer to it. TYPE is the Lisp type for which the memory is 4704 pointer to it. TYPE is the Lisp type for which the memory is
4692 allocated. TYPE < 0 means it's not used for a Lisp object. 4705 allocated. TYPE < 0 means it's not used for a Lisp object. */
4693
4694 If store_pure_type_info is set and TYPE is >= 0, the type of
4695 the allocated object is recorded in pure_types. */
4696 4706
4697static POINTER_TYPE * 4707static POINTER_TYPE *
4698pure_alloc (size, type) 4708pure_alloc (size, type)
@@ -4717,8 +4727,21 @@ pure_alloc (size, type)
4717#endif 4727#endif
4718 4728
4719 again: 4729 again:
4720 result = ALIGN (purebeg + pure_bytes_used, alignment); 4730 if (type >= 0)
4721 pure_bytes_used = ((char *)result - (char *)purebeg) + size; 4731 {
4732 /* Allocate space for a Lisp object from the beginning of the free
4733 space with taking account of alignment. */
4734 result = ALIGN (purebeg + pure_bytes_used_lisp, alignment);
4735 pure_bytes_used_lisp = ((char *)result - (char *)purebeg) + size;
4736 }
4737 else
4738 {
4739 /* Allocate space for a non-Lisp object from the end of the free
4740 space. */
4741 pure_bytes_used_non_lisp += size;
4742 result = purebeg + pure_size - pure_bytes_used_non_lisp;
4743 }
4744 pure_bytes_used = pure_bytes_used_lisp + pure_bytes_used_non_lisp;
4722 4745
4723 if (pure_bytes_used <= pure_size) 4746 if (pure_bytes_used <= pure_size)
4724 return result; 4747 return result;
@@ -4730,6 +4753,7 @@ pure_alloc (size, type)
4730 pure_size = 10000; 4753 pure_size = 10000;
4731 pure_bytes_used_before_overflow += pure_bytes_used - size; 4754 pure_bytes_used_before_overflow += pure_bytes_used - size;
4732 pure_bytes_used = 0; 4755 pure_bytes_used = 0;
4756 pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
4733 goto again; 4757 goto again;
4734} 4758}
4735 4759
@@ -4745,6 +4769,73 @@ check_pure_size ()
4745} 4769}
4746 4770
4747 4771
4772/* Find the byte sequence {DATA[0], ..., DATA[NBYTES-1], '\0'} from
4773 the non-Lisp data pool of the pure storage, and return its start
4774 address. Return NULL if not found. */
4775
4776static char *
4777find_string_data_in_pure (data, nbytes)
4778 char *data;
4779 int nbytes;
4780{
4781 int i, skip, bm_skip[256], last_char_skip, infinity, start, start_max;
4782 unsigned char *p;
4783 char *non_lisp_beg;
4784
4785 if (pure_bytes_used_non_lisp < nbytes + 1)
4786 return NULL;
4787
4788 /* Set up the Boyer-Moore table. */
4789 skip = nbytes + 1;
4790 for (i = 0; i < 256; i++)
4791 bm_skip[i] = skip;
4792
4793 p = (unsigned char *) data;
4794 while (--skip > 0)
4795 bm_skip[*p++] = skip;
4796
4797 last_char_skip = bm_skip['\0'];
4798
4799 non_lisp_beg = purebeg + pure_size - pure_bytes_used_non_lisp;
4800 start_max = pure_bytes_used_non_lisp - (nbytes + 1);
4801
4802 /* See the comments in the function `boyer_moore' (search.c) for the
4803 use of `infinity'. */
4804 infinity = pure_bytes_used_non_lisp + 1;
4805 bm_skip['\0'] = infinity;
4806
4807 p = (unsigned char *) non_lisp_beg + nbytes;
4808 start = 0;
4809 do
4810 {
4811 /* Check the last character (== '\0'). */
4812 do
4813 {
4814 start += bm_skip[*(p + start)];
4815 }
4816 while (start <= start_max);
4817
4818 if (start < infinity)
4819 /* Couldn't find the last character. */
4820 return NULL;
4821
4822 /* No less than `infinity' means we could find the last
4823 character at `p[start - infinity]'. */
4824 start -= infinity;
4825
4826 /* Check the remaining characters. */
4827 if (memcmp (data, non_lisp_beg + start, nbytes) == 0)
4828 /* Found. */
4829 return non_lisp_beg + start;
4830
4831 start += last_char_skip;
4832 }
4833 while (start <= start_max);
4834
4835 return NULL;
4836}
4837
4838
4748/* Return a string allocated in pure space. DATA is a buffer holding 4839/* Return a string allocated in pure space. DATA is a buffer holding
4749 NCHARS characters, and NBYTES bytes of string data. MULTIBYTE 4840 NCHARS characters, and NBYTES bytes of string data. MULTIBYTE
4750 non-zero means make the result string multibyte. 4841 non-zero means make the result string multibyte.
@@ -4763,11 +4854,15 @@ make_pure_string (data, nchars, nbytes, multibyte)
4763 struct Lisp_String *s; 4854 struct Lisp_String *s;
4764 4855
4765 s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String); 4856 s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String);
4766 s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); 4857 s->data = find_string_data_in_pure (data, nbytes);
4858 if (s->data == NULL)
4859 {
4860 s->data = (unsigned char *) pure_alloc (nbytes + 1, -1);
4861 bcopy (data, s->data, nbytes);
4862 s->data[nbytes] = '\0';
4863 }
4767 s->size = nchars; 4864 s->size = nchars;
4768 s->size_byte = multibyte ? nbytes : -1; 4865 s->size_byte = multibyte ? nbytes : -1;
4769 bcopy (data, s->data, nbytes);
4770 s->data[nbytes] = '\0';
4771 s->intervals = NULL_INTERVAL; 4866 s->intervals = NULL_INTERVAL;
4772 XSETSTRING (string, s); 4867 XSETSTRING (string, s);
4773 return string; 4868 return string;
@@ -6225,6 +6320,7 @@ init_alloc_once ()
6225 purebeg = PUREBEG; 6320 purebeg = PUREBEG;
6226 pure_size = PURESIZE; 6321 pure_size = PURESIZE;
6227 pure_bytes_used = 0; 6322 pure_bytes_used = 0;
6323 pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
6228 pure_bytes_used_before_overflow = 0; 6324 pure_bytes_used_before_overflow = 0;
6229 6325
6230 /* Initialize the list of free aligned blocks. */ 6326 /* Initialize the list of free aligned blocks. */
diff --git a/src/buffer.c b/src/buffer.c
index 73db9d21419..dc6bcd8f6d3 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -951,10 +951,10 @@ is the default binding of the variable. */)
951 result = XCDR (result); 951 result = XCDR (result);
952 } 952 }
953 953
954 if (EQ (result, Qunbound)) 954 if (!EQ (result, Qunbound))
955 return Fsignal (Qvoid_variable, Fcons (variable, Qnil)); 955 return result;
956 956
957 return result; 957 xsignal1 (Qvoid_variable, variable);
958} 958}
959 959
960/* Return an alist of the Lisp-level buffer-local bindings of 960/* Return an alist of the Lisp-level buffer-local bindings of
@@ -1991,7 +1991,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
1991{ 1991{
1992 if (!NILP (current_buffer->read_only) 1992 if (!NILP (current_buffer->read_only)
1993 && NILP (Vinhibit_read_only)) 1993 && NILP (Vinhibit_read_only))
1994 Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil))); 1994 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
1995 return Qnil; 1995 return Qnil;
1996} 1996}
1997 1997
diff --git a/src/buffer.h b/src/buffer.h
index 60aa3e7aaed..efe0252453a 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -833,7 +833,7 @@ extern void set_buffer_internal P_ ((struct buffer *));
833extern void set_buffer_internal_1 P_ ((struct buffer *)); 833extern void set_buffer_internal_1 P_ ((struct buffer *));
834extern void set_buffer_temp P_ ((struct buffer *)); 834extern void set_buffer_temp P_ ((struct buffer *));
835extern void record_buffer P_ ((Lisp_Object)); 835extern void record_buffer P_ ((Lisp_Object));
836extern void buffer_slot_type_mismatch P_ ((int)); 836extern void buffer_slot_type_mismatch P_ ((int)) NO_RETURN;
837extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT)); 837extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
838extern void mmap_set_vars P_ ((int)); 838extern void mmap_set_vars P_ ((int));
839 839
diff --git a/src/callint.c b/src/callint.c
index afb576cf5f6..e48168db164 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
@@ -563,7 +563,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
563 break; 563 break;
564 564
565 case 'c': /* Character */ 565 case 'c': /* Character */
566 args[i] = Fread_char (build_string (callint_message), Qnil); 566 args[i] = Fread_char (build_string (callint_message), Qnil, Qnil);
567 message1_nolog ((char *) 0); 567 message1_nolog ((char *) 0);
568 /* Passing args[i] directly stimulates compiler bug */ 568 /* Passing args[i] directly stimulates compiler bug */
569 teml = args[i]; 569 teml = args[i];
@@ -635,7 +635,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
635 /* Ignore first element, which is the base key. */ 635 /* Ignore first element, which is the base key. */
636 tem2 = Fmemq (intern ("down"), Fcdr (teml)); 636 tem2 = Fmemq (intern ("down"), Fcdr (teml));
637 if (! NILP (tem2)) 637 if (! NILP (tem2))
638 up_event = Fread_event (Qnil, Qnil); 638 up_event = Fread_event (Qnil, Qnil, Qnil);
639 } 639 }
640 } 640 }
641 break; 641 break;
@@ -663,7 +663,7 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */)
663 /* Ignore first element, which is the base key. */ 663 /* Ignore first element, which is the base key. */
664 tem2 = Fmemq (intern ("down"), Fcdr (teml)); 664 tem2 = Fmemq (intern ("down"), Fcdr (teml));
665 if (! NILP (tem2)) 665 if (! NILP (tem2))
666 up_event = Fread_event (Qnil, Qnil); 666 up_event = Fread_event (Qnil, Qnil, Qnil);
667 } 667 }
668 } 668 }
669 break; 669 break;
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 76a24f48a82..0ad884310ed 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -111,7 +111,7 @@ casify_object (flag, obj)
111 return obj; 111 return obj;
112 } 112 }
113 113
114 return wrong_type_argument (Qchar_or_string_p, obj); 114 wrong_type_argument (Qchar_or_string_p, obj);
115} 115}
116 116
117DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0, 117DEFUN ("upcase", Fupcase, Supcase, 1, 1, 0,
diff --git a/src/cmds.c b/src/cmds.c
index 494ef14db99..b84b9d1d85e 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 e35cb5ddc09..5b067b9dd2f 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6068,7 +6068,7 @@ set_conversion_work_buffer (multibyte)
6068 /* As we are already in the work buffer, we must generate a new 6068 /* As we are already in the work buffer, we must generate a new
6069 buffer for the work. */ 6069 buffer for the work. */
6070 Lisp_Object name; 6070 Lisp_Object name;
6071 6071
6072 name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil); 6072 name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
6073 buffer = buffer_to_kill = Fget_buffer_create (name); 6073 buffer = buffer_to_kill = Fget_buffer_create (name);
6074 buf = XBUFFER (buffer); 6074 buf = XBUFFER (buffer);
@@ -6591,8 +6591,7 @@ The value of this property should be a vector of length 5. */)
6591 } 6591 }
6592 if (!NILP (Fcoding_system_p (coding_system))) 6592 if (!NILP (Fcoding_system_p (coding_system)))
6593 return coding_system; 6593 return coding_system;
6594 while (1) 6594 xsignal1 (Qcoding_system_error, coding_system);
6595 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
6596} 6595}
6597 6596
6598Lisp_Object 6597Lisp_Object
@@ -7631,11 +7630,13 @@ This function is internal use only. */)
7631 Lisp_Object safe_chars, slot; 7630 Lisp_Object safe_chars, slot;
7632 7631
7633 if (NILP (Fcheck_coding_system (coding_system))) 7632 if (NILP (Fcheck_coding_system (coding_system)))
7634 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil)); 7633 xsignal1 (Qcoding_system_error, coding_system);
7634
7635 safe_chars = coding_safe_chars (coding_system); 7635 safe_chars = coding_safe_chars (coding_system);
7636 if (! EQ (safe_chars, Qt) && ! CHAR_TABLE_P (safe_chars)) 7636 if (! EQ (safe_chars, Qt) && ! CHAR_TABLE_P (safe_chars))
7637 error ("No valid safe-chars property for %s", 7637 error ("No valid safe-chars property for %s",
7638 SDATA (SYMBOL_NAME (coding_system))); 7638 SDATA (SYMBOL_NAME (coding_system)));
7639
7639 if (EQ (safe_chars, Qt)) 7640 if (EQ (safe_chars, Qt))
7640 { 7641 {
7641 if (NILP (Fmemq (coding_system, XCAR (Vcoding_system_safe_chars)))) 7642 if (NILP (Fmemq (coding_system, XCAR (Vcoding_system_safe_chars))))
diff --git a/src/data.c b/src/data.c
index 8cca837028d..cc15431cd16 100644
--- a/src/data.c
+++ b/src/data.c
@@ -106,7 +106,7 @@ void
106circular_list_error (list) 106circular_list_error (list)
107 Lisp_Object list; 107 Lisp_Object list;
108{ 108{
109 Fsignal (Qcircular_list, list); 109 xsignal (Qcircular_list, list);
110} 110}
111 111
112 112
@@ -119,16 +119,7 @@ wrong_type_argument (predicate, value)
119 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit) 119 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit)
120 abort (); 120 abort ();
121 121
122 Fsignal (Qwrong_type_argument, list2 (predicate, value)); 122 xsignal2 (Qwrong_type_argument, predicate, value);
123
124 /* This function is marked as NO_RETURN, gcc would warn if it has a
125 return statement or if falls off the function. Other compilers
126 warn if no return statement is present. */
127#ifndef __GNUC__
128 return value;
129#else
130 abort ();
131#endif
132} 123}
133 124
134void 125void
@@ -141,16 +132,14 @@ void
141args_out_of_range (a1, a2) 132args_out_of_range (a1, a2)
142 Lisp_Object a1, a2; 133 Lisp_Object a1, a2;
143{ 134{
144 while (1) 135 xsignal2 (Qargs_out_of_range, a1, a2);
145 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Qnil)));
146} 136}
147 137
148void 138void
149args_out_of_range_3 (a1, a2, a3) 139args_out_of_range_3 (a1, a2, a3)
150 Lisp_Object a1, a2, a3; 140 Lisp_Object a1, a2, a3;
151{ 141{
152 while (1) 142 xsignal3 (Qargs_out_of_range, a1, a2, a3);
153 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Fcons (a3, Qnil))));
154} 143}
155 144
156/* On some machines, XINT needs a temporary location. 145/* On some machines, XINT needs a temporary location.
@@ -619,7 +608,7 @@ Return SYMBOL. */)
619{ 608{
620 CHECK_SYMBOL (symbol); 609 CHECK_SYMBOL (symbol);
621 if (XSYMBOL (symbol)->constant) 610 if (XSYMBOL (symbol)->constant)
622 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 611 xsignal1 (Qsetting_constant, symbol);
623 Fset (symbol, Qunbound); 612 Fset (symbol, Qunbound);
624 return symbol; 613 return symbol;
625} 614}
@@ -632,7 +621,7 @@ Return SYMBOL. */)
632{ 621{
633 CHECK_SYMBOL (symbol); 622 CHECK_SYMBOL (symbol);
634 if (NILP (symbol) || EQ (symbol, Qt)) 623 if (NILP (symbol) || EQ (symbol, Qt))
635 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 624 xsignal1 (Qsetting_constant, symbol);
636 XSYMBOL (symbol)->function = Qunbound; 625 XSYMBOL (symbol)->function = Qunbound;
637 return symbol; 626 return symbol;
638} 627}
@@ -643,9 +632,9 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
643 register Lisp_Object symbol; 632 register Lisp_Object symbol;
644{ 633{
645 CHECK_SYMBOL (symbol); 634 CHECK_SYMBOL (symbol);
646 if (EQ (XSYMBOL (symbol)->function, Qunbound)) 635 if (!EQ (XSYMBOL (symbol)->function, Qunbound))
647 return Fsignal (Qvoid_function, Fcons (symbol, Qnil)); 636 return XSYMBOL (symbol)->function;
648 return XSYMBOL (symbol)->function; 637 xsignal1 (Qvoid_function, symbol);
649} 638}
650 639
651DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, 640DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
@@ -676,7 +665,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
676{ 665{
677 CHECK_SYMBOL (symbol); 666 CHECK_SYMBOL (symbol);
678 if (NILP (symbol) || EQ (symbol, Qt)) 667 if (NILP (symbol) || EQ (symbol, Qt))
679 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 668 xsignal1 (Qsetting_constant, symbol);
680 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound)) 669 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound))
681 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function), 670 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function),
682 Vautoload_queue); 671 Vautoload_queue);
@@ -818,7 +807,7 @@ indirect_variable (symbol)
818 tortoise = XSYMBOL (tortoise)->value; 807 tortoise = XSYMBOL (tortoise)->value;
819 808
820 if (EQ (hare, tortoise)) 809 if (EQ (hare, tortoise))
821 Fsignal (Qcyclic_variable_indirection, Fcons (symbol, Qnil)); 810 xsignal1 (Qcyclic_variable_indirection, symbol);
822 } 811 }
823 812
824 return hare; 813 return hare;
@@ -1130,10 +1119,10 @@ DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
1130 Lisp_Object val; 1119 Lisp_Object val;
1131 1120
1132 val = find_symbol_value (symbol); 1121 val = find_symbol_value (symbol);
1133 if (EQ (val, Qunbound)) 1122 if (!EQ (val, Qunbound))
1134 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil));
1135 else
1136 return val; 1123 return val;
1124
1125 xsignal1 (Qvoid_variable, symbol);
1137} 1126}
1138 1127
1139DEFUN ("set", Fset, Sset, 2, 2, 0, 1128DEFUN ("set", Fset, Sset, 2, 2, 0,
@@ -1197,7 +1186,7 @@ set_internal (symbol, newval, buf, bindflag)
1197 if (SYMBOL_CONSTANT_P (symbol) 1186 if (SYMBOL_CONSTANT_P (symbol)
1198 && (NILP (Fkeywordp (symbol)) 1187 && (NILP (Fkeywordp (symbol))
1199 || !EQ (newval, SYMBOL_VALUE (symbol)))) 1188 || !EQ (newval, SYMBOL_VALUE (symbol))))
1200 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); 1189 xsignal1 (Qsetting_constant, symbol);
1201 1190
1202 innercontents = valcontents = SYMBOL_VALUE (symbol); 1191 innercontents = valcontents = SYMBOL_VALUE (symbol);
1203 1192
@@ -1391,9 +1380,10 @@ local bindings in certain buffers. */)
1391 register Lisp_Object value; 1380 register Lisp_Object value;
1392 1381
1393 value = default_value (symbol); 1382 value = default_value (symbol);
1394 if (EQ (value, Qunbound)) 1383 if (!EQ (value, Qunbound))
1395 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil)); 1384 return value;
1396 return value; 1385
1386 xsignal1 (Qvoid_variable, symbol);
1397} 1387}
1398 1388
1399DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0, 1389DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0,
@@ -1950,7 +1940,7 @@ indirect_function (object)
1950 tortoise = XSYMBOL (tortoise)->function; 1940 tortoise = XSYMBOL (tortoise)->function;
1951 1941
1952 if (EQ (hare, tortoise)) 1942 if (EQ (hare, tortoise))
1953 Fsignal (Qcyclic_function_indirection, Fcons (object, Qnil)); 1943 xsignal1 (Qcyclic_function_indirection, object);
1954 } 1944 }
1955 1945
1956 return hare; 1946 return hare;
@@ -1979,7 +1969,7 @@ function chain of symbols. */)
1979 return result; 1969 return result;
1980 1970
1981 if (NILP (noerror)) 1971 if (NILP (noerror))
1982 Fsignal (Qvoid_function, Fcons (object, Qnil)); 1972 xsignal1 (Qvoid_function, object);
1983 1973
1984 return Qnil; 1974 return Qnil;
1985} 1975}
@@ -2519,7 +2509,7 @@ If the base used is not 10, floating point is not recognized. */)
2519 CHECK_NUMBER (base); 2509 CHECK_NUMBER (base);
2520 b = XINT (base); 2510 b = XINT (base);
2521 if (b < 2 || b > 16) 2511 if (b < 2 || b > 16)
2522 Fsignal (Qargs_out_of_range, Fcons (base, Qnil)); 2512 xsignal1 (Qargs_out_of_range, base);
2523 } 2513 }
2524 2514
2525 /* Skip any whitespace at the front of the number. Some versions of 2515 /* Skip any whitespace at the front of the number. Some versions of
@@ -2631,7 +2621,7 @@ arith_driver (code, nargs, args)
2631 else 2621 else
2632 { 2622 {
2633 if (next == 0) 2623 if (next == 0)
2634 Fsignal (Qarith_error, Qnil); 2624 xsignal0 (Qarith_error);
2635 accum /= next; 2625 accum /= next;
2636 } 2626 }
2637 break; 2627 break;
@@ -2704,7 +2694,7 @@ float_arith_driver (accum, argnum, code, nargs, args)
2704 else 2694 else
2705 { 2695 {
2706 if (! IEEE_FLOATING_POINT && next == 0) 2696 if (! IEEE_FLOATING_POINT && next == 0)
2707 Fsignal (Qarith_error, Qnil); 2697 xsignal0 (Qarith_error);
2708 accum /= next; 2698 accum /= next;
2709 } 2699 }
2710 break; 2700 break;
@@ -2786,7 +2776,7 @@ Both must be integers or markers. */)
2786 CHECK_NUMBER_COERCE_MARKER (y); 2776 CHECK_NUMBER_COERCE_MARKER (y);
2787 2777
2788 if (XFASTINT (y) == 0) 2778 if (XFASTINT (y) == 0)
2789 Fsignal (Qarith_error, Qnil); 2779 xsignal0 (Qarith_error);
2790 2780
2791 XSETINT (val, XINT (x) % XINT (y)); 2781 XSETINT (val, XINT (x) % XINT (y));
2792 return val; 2782 return val;
@@ -2835,7 +2825,7 @@ Both X and Y must be numbers or markers. */)
2835 i2 = XINT (y); 2825 i2 = XINT (y);
2836 2826
2837 if (i2 == 0) 2827 if (i2 == 0)
2838 Fsignal (Qarith_error, Qnil); 2828 xsignal0 (Qarith_error);
2839 2829
2840 i1 %= i2; 2830 i1 %= i2;
2841 2831
@@ -3443,7 +3433,7 @@ arith_error (signo)
3443#endif /* not BSD4_1 */ 3433#endif /* not BSD4_1 */
3444 3434
3445 SIGNAL_THREAD_CHECK (signo); 3435 SIGNAL_THREAD_CHECK (signo);
3446 Fsignal (Qarith_error, Qnil); 3436 xsignal0 (Qarith_error);
3447} 3437}
3448 3438
3449void 3439void
diff --git a/src/dispnew.c b/src/dispnew.c
index 87d99fd9917..1d977898f60 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6866,9 +6866,15 @@ init_display ()
6866For types defined in VMS, use set term /device=TYPE.\n\ 6866For types defined in VMS, use set term /device=TYPE.\n\
6867For types not defined in VMS, use define emacs_term \"TYPE\".\n\ 6867For types not defined in VMS, use define emacs_term \"TYPE\".\n\
6868\(The quotation marks are necessary since terminal types are lower case.)\n"); 6868\(The quotation marks are necessary since terminal types are lower case.)\n");
6869#else 6869#else /* not VMS */
6870 fprintf (stderr, "Please set the environment variable TERM; see tset(1).\n"); 6870
6871#endif 6871#ifdef HAVE_WINDOW_SYSTEM
6872 if (! inhibit_window_system)
6873 fprintf (stderr, "Please set the environment variable DISPLAY or TERM (see `tset').\n");
6874 else
6875#endif /* HAVE_WINDOW_SYSTEM */
6876 fprintf (stderr, "Please set the environment variable TERM; see `tset'.\n");
6877#endif /* not VMS */
6872 exit (1); 6878 exit (1);
6873 } 6879 }
6874 6880
diff --git a/src/doc.c b/src/doc.c
index 3dd5622d9df..93f372606a4 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 cf37c10a9d5..aea044db068 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -316,7 +316,7 @@ region_limit (beginningp)
316 if (!NILP (Vtransient_mark_mode) 316 if (!NILP (Vtransient_mark_mode)
317 && NILP (Vmark_even_if_inactive) 317 && NILP (Vmark_even_if_inactive)
318 && NILP (current_buffer->mark_active)) 318 && NILP (current_buffer->mark_active))
319 Fsignal (Qmark_inactive, Qnil); 319 xsignal0 (Qmark_inactive);
320 320
321 m = Fmarker_position (current_buffer->mark); 321 m = Fmarker_position (current_buffer->mark);
322 if (NILP (m)) 322 if (NILP (m))
@@ -1480,7 +1480,7 @@ systems that do not provide resolution finer than a second. */)
1480 1480
1481 if (getrusage (RUSAGE_SELF, &usage) < 0) 1481 if (getrusage (RUSAGE_SELF, &usage) < 0)
1482 /* This shouldn't happen. What action is appropriate? */ 1482 /* This shouldn't happen. What action is appropriate? */
1483 Fsignal (Qerror, Qnil); 1483 xsignal0 (Qerror);
1484 1484
1485 /* Sum up user time and system time. */ 1485 /* Sum up user time and system time. */
1486 secs = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec; 1486 secs = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec;
diff --git a/src/eval.c b/src/eval.c
index a07ab32e76b..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;
@@ -1295,8 +1292,7 @@ Both TAG and VALUE are evalled. */)
1295 if (EQ (c->tag, tag)) 1292 if (EQ (c->tag, tag))
1296 unwind_to_catch (c, value); 1293 unwind_to_catch (c, value);
1297 } 1294 }
1298 Fsignal (Qno_catch, list2 (tag, value)); 1295 xsignal2 (Qno_catch, tag, value);
1299 abort ();
1300} 1296}
1301 1297
1302 1298
@@ -1704,6 +1700,78 @@ See also the function `condition-case'. */)
1704 fatal ("%s", SDATA (string), 0); 1700 fatal ("%s", SDATA (string), 0);
1705} 1701}
1706 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
1707/* Return nonzero iff LIST is a non-nil atom or 1775/* Return nonzero iff LIST is a non-nil atom or
1708 a list containing one of CONDITIONS. */ 1776 a list containing one of CONDITIONS. */
1709 1777
@@ -1918,8 +1986,7 @@ error (m, a1, a2, a3)
1918 if (allocated) 1986 if (allocated)
1919 xfree (buffer); 1987 xfree (buffer);
1920 1988
1921 Fsignal (Qerror, Fcons (string, Qnil)); 1989 xsignal1 (Qerror, string);
1922 abort ();
1923} 1990}
1924 1991
1925DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0, 1992DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0,
@@ -2185,7 +2252,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2185 2252
2186 if (XINT (numargs) < XSUBR (fun)->min_args || 2253 if (XINT (numargs) < XSUBR (fun)->min_args ||
2187 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) 2254 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs)))
2188 Fsignal (Qwrong_number_of_arguments, list2 (original_fun, numargs)); 2255 xsignal2 (Qwrong_number_of_arguments, original_fun, numargs);
2189 2256
2190 if (XSUBR (fun)->max_args == UNEVALLED) 2257 if (XSUBR (fun)->max_args == UNEVALLED)
2191 { 2258 {
@@ -2289,12 +2356,12 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2289 else 2356 else
2290 { 2357 {
2291 if (EQ (fun, Qunbound)) 2358 if (EQ (fun, Qunbound))
2292 Fsignal (Qvoid_function, Fcons (original_fun, Qnil)); 2359 xsignal1 (Qvoid_function, original_fun);
2293 if (!CONSP (fun)) 2360 if (!CONSP (fun))
2294 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); 2361 xsignal1 (Qinvalid_function, original_fun);
2295 funcar = Fcar (fun); 2362 funcar = XCAR (fun);
2296 if (!SYMBOLP (funcar)) 2363 if (!SYMBOLP (funcar))
2297 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); 2364 xsignal1 (Qinvalid_function, original_fun);
2298 if (EQ (funcar, Qautoload)) 2365 if (EQ (funcar, Qautoload))
2299 { 2366 {
2300 do_autoload (fun, original_fun); 2367 do_autoload (fun, original_fun);
@@ -2305,7 +2372,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2305 else if (EQ (funcar, Qlambda)) 2372 else if (EQ (funcar, Qlambda))
2306 val = apply_lambda (fun, original_args, 1); 2373 val = apply_lambda (fun, original_args, 1);
2307 else 2374 else
2308 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); 2375 xsignal1 (Qinvalid_function, original_fun);
2309 } 2376 }
2310 done: 2377 done:
2311 CHECK_CONS_LIST (); 2378 CHECK_CONS_LIST ();
@@ -2885,11 +2952,11 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2885 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 2952 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
2886 { 2953 {
2887 XSETFASTINT (lisp_numargs, numargs); 2954 XSETFASTINT (lisp_numargs, numargs);
2888 Fsignal (Qwrong_number_of_arguments, list2 (original_fun, lisp_numargs)); 2955 xsignal2 (Qwrong_number_of_arguments, original_fun, lisp_numargs);
2889 } 2956 }
2890 2957
2891 if (XSUBR (fun)->max_args == UNEVALLED) 2958 if (XSUBR (fun)->max_args == UNEVALLED)
2892 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); 2959 xsignal1 (Qinvalid_function, original_fun);
2893 2960
2894 if (XSUBR (fun)->max_args == MANY) 2961 if (XSUBR (fun)->max_args == MANY)
2895 { 2962 {
@@ -2962,12 +3029,12 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2962 else 3029 else
2963 { 3030 {
2964 if (EQ (fun, Qunbound)) 3031 if (EQ (fun, Qunbound))
2965 Fsignal (Qvoid_function, Fcons (original_fun, Qnil)); 3032 xsignal1 (Qvoid_function, original_fun);
2966 if (!CONSP (fun)) 3033 if (!CONSP (fun))
2967 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); 3034 xsignal1 (Qinvalid_function, original_fun);
2968 funcar = Fcar (fun); 3035 funcar = XCAR (fun);
2969 if (!SYMBOLP (funcar)) 3036 if (!SYMBOLP (funcar))
2970 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); 3037 xsignal1 (Qinvalid_function, original_fun);
2971 if (EQ (funcar, Qlambda)) 3038 if (EQ (funcar, Qlambda))
2972 val = funcall_lambda (fun, numargs, args + 1); 3039 val = funcall_lambda (fun, numargs, args + 1);
2973 else if (EQ (funcar, Qautoload)) 3040 else if (EQ (funcar, Qautoload))
@@ -2977,7 +3044,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2977 goto retry; 3044 goto retry;
2978 } 3045 }
2979 else 3046 else
2980 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); 3047 xsignal1 (Qinvalid_function, original_fun);
2981 } 3048 }
2982 done: 3049 done:
2983 CHECK_CONS_LIST (); 3050 CHECK_CONS_LIST ();
@@ -3053,7 +3120,7 @@ funcall_lambda (fun, nargs, arg_vector)
3053 if (CONSP (syms_left)) 3120 if (CONSP (syms_left))
3054 syms_left = XCAR (syms_left); 3121 syms_left = XCAR (syms_left);
3055 else 3122 else
3056 Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3123 xsignal1 (Qinvalid_function, fun);
3057 } 3124 }
3058 else if (COMPILEDP (fun)) 3125 else if (COMPILEDP (fun))
3059 syms_left = AREF (fun, COMPILED_ARGLIST); 3126 syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3067,7 +3134,7 @@ funcall_lambda (fun, nargs, arg_vector)
3067 3134
3068 next = XCAR (syms_left); 3135 next = XCAR (syms_left);
3069 if (!SYMBOLP (next)) 3136 if (!SYMBOLP (next))
3070 Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3137 xsignal1 (Qinvalid_function, fun);
3071 3138
3072 if (EQ (next, Qand_rest)) 3139 if (EQ (next, Qand_rest))
3073 rest = 1; 3140 rest = 1;
@@ -3081,15 +3148,15 @@ funcall_lambda (fun, nargs, arg_vector)
3081 else if (i < nargs) 3148 else if (i < nargs)
3082 specbind (next, arg_vector[i++]); 3149 specbind (next, arg_vector[i++]);
3083 else if (!optional) 3150 else if (!optional)
3084 Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs))); 3151 xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs));
3085 else 3152 else
3086 specbind (next, Qnil); 3153 specbind (next, Qnil);
3087 } 3154 }
3088 3155
3089 if (!NILP (syms_left)) 3156 if (!NILP (syms_left))
3090 Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3157 xsignal1 (Qinvalid_function, fun);
3091 else if (i < nargs) 3158 else if (i < nargs)
3092 Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs))); 3159 xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs));
3093 3160
3094 if (CONSP (fun)) 3161 if (CONSP (fun))
3095 val = Fprogn (XCDR (XCDR (fun))); 3162 val = Fprogn (XCDR (XCDR (fun)));
@@ -3141,8 +3208,7 @@ grow_specpdl ()
3141 if (max_specpdl_size < 400) 3208 if (max_specpdl_size < 400)
3142 max_specpdl_size = 400; 3209 max_specpdl_size = 400;
3143 if (specpdl_size >= max_specpdl_size) 3210 if (specpdl_size >= max_specpdl_size)
3144 Fsignal (Qerror, 3211 signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil);
3145 Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil));
3146 } 3212 }
3147 specpdl_size *= 2; 3213 specpdl_size *= 2;
3148 if (specpdl_size > max_specpdl_size) 3214 if (specpdl_size > max_specpdl_size)
diff --git a/src/fileio.c b/src/fileio.c
index 58b1863f225..8ac528cafb9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -282,7 +282,7 @@ report_file_error (string, data)
282 switch (errorno) 282 switch (errorno)
283 { 283 {
284 case EEXIST: 284 case EEXIST:
285 Fsignal (Qfile_already_exists, Fcons (errstring, data)); 285 xsignal (Qfile_already_exists, Fcons (errstring, data));
286 break; 286 break;
287 default: 287 default:
288 /* System error messages are capitalized. Downcase the initial 288 /* System error messages are capitalized. Downcase the initial
@@ -290,7 +290,7 @@ report_file_error (string, data)
290 if (SREF (errstring, 1) != '/') 290 if (SREF (errstring, 1) != '/')
291 SSET (errstring, 0, DOWNCASE (SREF (errstring, 0))); 291 SSET (errstring, 0, DOWNCASE (SREF (errstring, 0)));
292 292
293 Fsignal (Qfile_error, 293 xsignal (Qfile_error,
294 Fcons (build_string (string), Fcons (errstring, data))); 294 Fcons (build_string (string), Fcons (errstring, data)));
295 } 295 }
296} 296}
@@ -2386,9 +2386,8 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2386 if (lstat (SDATA (encoded_filename), &statbuf) >= 0) 2386 if (lstat (SDATA (encoded_filename), &statbuf) >= 0)
2387 { 2387 {
2388 if (! interactive) 2388 if (! interactive)
2389 Fsignal (Qfile_already_exists, 2389 xsignal2 (Qfile_already_exists,
2390 Fcons (build_string ("File already exists"), 2390 build_string ("File already exists"), absname);
2391 Fcons (absname, Qnil)));
2392 GCPRO1 (absname); 2391 GCPRO1 (absname);
2393 tem = format2 ("File %s already exists; %s anyway? ", 2392 tem = format2 ("File %s already exists; %s anyway? ",
2394 absname, build_string (querystring)); 2393 absname, build_string (querystring));
@@ -2398,9 +2397,8 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2398 tem = do_yes_or_no_p (tem); 2397 tem = do_yes_or_no_p (tem);
2399 UNGCPRO; 2398 UNGCPRO;
2400 if (NILP (tem)) 2399 if (NILP (tem))
2401 Fsignal (Qfile_already_exists, 2400 xsignal2 (Qfile_already_exists,
2402 Fcons (build_string ("File already exists"), 2401 build_string ("File already exists"), absname);
2403 Fcons (absname, Qnil)));
2404 if (statptr) 2402 if (statptr)
2405 *statptr = statbuf; 2403 *statptr = statbuf;
2406 } 2404 }
@@ -2502,9 +2500,8 @@ uid and gid of FILE to NEWNAME. */)
2502 { 2500 {
2503 /* Restore original attributes. */ 2501 /* Restore original attributes. */
2504 SetFileAttributes (filename, attributes); 2502 SetFileAttributes (filename, attributes);
2505 Fsignal (Qfile_date_error, 2503 xsignal2 (Qfile_date_error,
2506 Fcons (build_string ("Cannot set file date"), 2504 build_string ("Cannot set file date"), newname);
2507 Fcons (newname, Qnil)));
2508 } 2505 }
2509 /* Restore original attributes. */ 2506 /* Restore original attributes. */
2510 SetFileAttributes (filename, attributes); 2507 SetFileAttributes (filename, attributes);
@@ -2600,9 +2597,8 @@ uid and gid of FILE to NEWNAME. */)
2600 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0); 2597 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
2601 if (set_file_times (SDATA (encoded_newname), 2598 if (set_file_times (SDATA (encoded_newname),
2602 atime, mtime)) 2599 atime, mtime))
2603 Fsignal (Qfile_date_error, 2600 xsignal2 (Qfile_date_error,
2604 Fcons (build_string ("Cannot set file date"), 2601 build_string ("Cannot set file date"), newname);
2605 Fcons (newname, Qnil)));
2606 } 2602 }
2607 } 2603 }
2608 2604
@@ -2698,9 +2694,9 @@ If file has multiple names, it continues to exist with the other names. */)
2698 GCPRO1 (filename); 2694 GCPRO1 (filename);
2699 if (!NILP (Ffile_directory_p (filename)) 2695 if (!NILP (Ffile_directory_p (filename))
2700 && NILP (Ffile_symlink_p (filename))) 2696 && NILP (Ffile_symlink_p (filename)))
2701 Fsignal (Qfile_error, 2697 xsignal2 (Qfile_error,
2702 Fcons (build_string ("Removing old name: is a directory"), 2698 build_string ("Removing old name: is a directory"),
2703 Fcons (filename, Qnil))); 2699 filename);
2704 UNGCPRO; 2700 UNGCPRO;
2705 filename = Fexpand_file_name (filename, Qnil); 2701 filename = Fexpand_file_name (filename, Qnil);
2706 2702
@@ -3850,9 +3846,8 @@ actually used. */)
3850 goto notfound; 3846 goto notfound;
3851 3847
3852 if (! NILP (replace) || ! NILP (beg) || ! NILP (end)) 3848 if (! NILP (replace) || ! NILP (beg) || ! NILP (end))
3853 Fsignal (Qfile_error, 3849 xsignal2 (Qfile_error,
3854 Fcons (build_string ("not a regular file"), 3850 build_string ("not a regular file"), orig_filename);
3855 Fcons (orig_filename, Qnil)));
3856 } 3851 }
3857#endif 3852#endif
3858 3853
@@ -4725,9 +4720,8 @@ actually used. */)
4725 } 4720 }
4726#endif /* CLASH_DETECTION */ 4721#endif /* CLASH_DETECTION */
4727 if (not_regular) 4722 if (not_regular)
4728 Fsignal (Qfile_error, 4723 xsignal2 (Qfile_error,
4729 Fcons (build_string ("not a regular file"), 4724 build_string ("not a regular file"), orig_filename);
4730 Fcons (orig_filename, Qnil)));
4731 } 4725 }
4732 4726
4733 if (set_coding_system) 4727 if (set_coding_system)
@@ -6632,19 +6626,17 @@ of file names regardless of the current language environment. */);
6632 staticpro (&Qcar_less_than_car); 6626 staticpro (&Qcar_less_than_car);
6633 6627
6634 Fput (Qfile_error, Qerror_conditions, 6628 Fput (Qfile_error, Qerror_conditions,
6635 Fcons (Qfile_error, Fcons (Qerror, Qnil))); 6629 list2 (Qfile_error, Qerror));
6636 Fput (Qfile_error, Qerror_message, 6630 Fput (Qfile_error, Qerror_message,
6637 build_string ("File error")); 6631 build_string ("File error"));
6638 6632
6639 Fput (Qfile_already_exists, Qerror_conditions, 6633 Fput (Qfile_already_exists, Qerror_conditions,
6640 Fcons (Qfile_already_exists, 6634 list3 (Qfile_already_exists, Qfile_error, Qerror));
6641 Fcons (Qfile_error, Fcons (Qerror, Qnil))));
6642 Fput (Qfile_already_exists, Qerror_message, 6635 Fput (Qfile_already_exists, Qerror_message,
6643 build_string ("File already exists")); 6636 build_string ("File already exists"));
6644 6637
6645 Fput (Qfile_date_error, Qerror_conditions, 6638 Fput (Qfile_date_error, Qerror_conditions,
6646 Fcons (Qfile_date_error, 6639 list3 (Qfile_date_error, Qfile_error, Qerror));
6647 Fcons (Qfile_error, Fcons (Qerror, Qnil))));
6648 Fput (Qfile_date_error, Qerror_message, 6640 Fput (Qfile_date_error, Qerror_message,
6649 build_string ("Cannot set file date")); 6641 build_string ("Cannot set file date"));
6650 6642
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 69e12bf25ce..0054e6fc998 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -182,7 +182,7 @@ To get the number of bytes, use `string-bytes'. */)
182 else if (NILP (sequence)) 182 else if (NILP (sequence))
183 XSETFASTINT (val, 0); 183 XSETFASTINT (val, 0);
184 else 184 else
185 val = wrong_type_argument (Qsequencep, sequence); 185 wrong_type_argument (Qsequencep, sequence);
186 186
187 return val; 187 return val;
188} 188}
@@ -3251,8 +3251,7 @@ is nil and `use-dialog-box' is non-nil. */)
3251 } 3251 }
3252 3252
3253 temporarily_switch_to_single_kboard (SELECTED_FRAME ()); 3253 temporarily_switch_to_single_kboard (SELECTED_FRAME ());
3254 obj = read_filtered_event (1, 0, 0, 0); 3254 obj = read_filtered_event (1, 0, 0, 0, Qnil);
3255
3256 cursor_in_echo_area = 0; 3255 cursor_in_echo_area = 0;
3257 /* If we need to quit, quit with cursor_in_echo_area = 0. */ 3256 /* If we need to quit, quit with cursor_in_echo_area = 0. */
3258 QUIT; 3257 QUIT;
@@ -4491,10 +4490,7 @@ hashfn_user_defined (h, key)
4491 args[1] = key; 4490 args[1] = key;
4492 hash = Ffuncall (2, args); 4491 hash = Ffuncall (2, args);
4493 if (!INTEGERP (hash)) 4492 if (!INTEGERP (hash))
4494 Fsignal (Qerror, 4493 signal_error ("Invalid hash code returned from user-supplied hash function", hash);
4495 list2 (build_string ("Invalid hash code returned from \
4496user-supplied hash function"),
4497 hash));
4498 return XUINT (hash); 4494 return XUINT (hash);
4499} 4495}
4500 4496
@@ -5250,8 +5246,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5250 5246
5251 prop = Fget (test, Qhash_table_test); 5247 prop = Fget (test, Qhash_table_test);
5252 if (!CONSP (prop) || !CONSP (XCDR (prop))) 5248 if (!CONSP (prop) || !CONSP (XCDR (prop)))
5253 Fsignal (Qerror, list2 (build_string ("Invalid hash table test"), 5249 signal_error ("Invalid hash table test", test);
5254 test));
5255 user_test = XCAR (prop); 5250 user_test = XCAR (prop);
5256 user_hash = XCAR (XCDR (prop)); 5251 user_hash = XCAR (XCDR (prop));
5257 } 5252 }
@@ -5264,9 +5259,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5264 if (NILP (size)) 5259 if (NILP (size))
5265 size = make_number (DEFAULT_HASH_SIZE); 5260 size = make_number (DEFAULT_HASH_SIZE);
5266 else if (!INTEGERP (size) || XINT (size) < 0) 5261 else if (!INTEGERP (size) || XINT (size) < 0)
5267 Fsignal (Qerror, 5262 signal_error ("Invalid hash table size", size);
5268 list2 (build_string ("Invalid hash table size"),
5269 size));
5270 5263
5271 /* Look for `:rehash-size SIZE'. */ 5264 /* Look for `:rehash-size SIZE'. */
5272 i = get_key_arg (QCrehash_size, nargs, args, used); 5265 i = get_key_arg (QCrehash_size, nargs, args, used);
@@ -5274,9 +5267,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5274 if (!NUMBERP (rehash_size) 5267 if (!NUMBERP (rehash_size)
5275 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) 5268 || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0)
5276 || XFLOATINT (rehash_size) <= 1.0) 5269 || XFLOATINT (rehash_size) <= 1.0)
5277 Fsignal (Qerror, 5270 signal_error ("Invalid hash table rehash size", rehash_size);
5278 list2 (build_string ("Invalid hash table rehash size"),
5279 rehash_size));
5280 5271
5281 /* Look for `:rehash-threshold THRESHOLD'. */ 5272 /* Look for `:rehash-threshold THRESHOLD'. */
5282 i = get_key_arg (QCrehash_threshold, nargs, args, used); 5273 i = get_key_arg (QCrehash_threshold, nargs, args, used);
@@ -5284,9 +5275,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5284 if (!FLOATP (rehash_threshold) 5275 if (!FLOATP (rehash_threshold)
5285 || XFLOATINT (rehash_threshold) <= 0.0 5276 || XFLOATINT (rehash_threshold) <= 0.0
5286 || XFLOATINT (rehash_threshold) > 1.0) 5277 || XFLOATINT (rehash_threshold) > 1.0)
5287 Fsignal (Qerror, 5278 signal_error ("Invalid hash table rehash threshold", rehash_threshold);
5288 list2 (build_string ("Invalid hash table rehash threshold"),
5289 rehash_threshold));
5290 5279
5291 /* Look for `:weakness WEAK'. */ 5280 /* Look for `:weakness WEAK'. */
5292 i = get_key_arg (QCweakness, nargs, args, used); 5281 i = get_key_arg (QCweakness, nargs, args, used);
@@ -5298,14 +5287,12 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
5298 && !EQ (weak, Qvalue) 5287 && !EQ (weak, Qvalue)
5299 && !EQ (weak, Qkey_or_value) 5288 && !EQ (weak, Qkey_or_value)
5300 && !EQ (weak, Qkey_and_value)) 5289 && !EQ (weak, Qkey_and_value))
5301 Fsignal (Qerror, list2 (build_string ("Invalid hash table weakness"), 5290 signal_error ("Invalid hash table weakness", weak);
5302 weak));
5303 5291
5304 /* Now, all args should have been used up, or there's a problem. */ 5292 /* Now, all args should have been used up, or there's a problem. */
5305 for (i = 0; i < nargs; ++i) 5293 for (i = 0; i < nargs; ++i)
5306 if (!used[i]) 5294 if (!used[i])
5307 Fsignal (Qerror, 5295 signal_error ("Invalid argument list", args[i]);
5308 list2 (build_string ("Invalid argument list"), args[i]));
5309 5296
5310 return make_hash_table (test, size, rehash_size, rehash_threshold, weak, 5297 return make_hash_table (test, size, rehash_size, rehash_threshold, weak,
5311 user_test, user_hash); 5298 user_test, user_hash);
@@ -5556,8 +5543,7 @@ guesswork fails. Normally, an error is signaled in such case. */)
5556 if (!NILP (noerror)) 5543 if (!NILP (noerror))
5557 coding_system = Qraw_text; 5544 coding_system = Qraw_text;
5558 else 5545 else
5559 while (1) 5546 xsignal1 (Qcoding_system_error, coding_system);
5560 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
5561 } 5547 }
5562 5548
5563 if (STRING_MULTIBYTE (object)) 5549 if (STRING_MULTIBYTE (object))
@@ -5691,8 +5677,7 @@ guesswork fails. Normally, an error is signaled in such case. */)
5691 if (!NILP (noerror)) 5677 if (!NILP (noerror))
5692 coding_system = Qraw_text; 5678 coding_system = Qraw_text;
5693 else 5679 else
5694 while (1) 5680 xsignal1 (Qcoding_system_error, coding_system);
5695 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
5696 } 5681 }
5697 } 5682 }
5698 5683
diff --git a/src/frame.c b/src/frame.c
index 3fad2187ba4..fd10c3e273c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3337,8 +3337,7 @@ x_set_line_spacing (f, new_value, old_value)
3337 else if (NATNUMP (new_value)) 3337 else if (NATNUMP (new_value))
3338 f->extra_line_spacing = XFASTINT (new_value); 3338 f->extra_line_spacing = XFASTINT (new_value);
3339 else 3339 else
3340 Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"), 3340 signal_error ("Invalid line-spacing", new_value);
3341 Fcons (new_value, Qnil)));
3342 if (FRAME_VISIBLE_P (f)) 3341 if (FRAME_VISIBLE_P (f))
3343 redraw_frame (f); 3342 redraw_frame (f);
3344} 3343}
@@ -3358,8 +3357,7 @@ x_set_screen_gamma (f, new_value, old_value)
3358 /* The value 0.4545 is the normal viewing gamma. */ 3357 /* The value 0.4545 is the normal viewing gamma. */
3359 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); 3358 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
3360 else 3359 else
3361 Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"), 3360 signal_error ("Invalid screen-gamma", new_value);
3362 Fcons (new_value, Qnil)));
3363 3361
3364 clear_face_cache (0); 3362 clear_face_cache (0);
3365} 3363}
diff --git a/src/keyboard.c b/src/keyboard.c
index 025c8a3f85c..08b352c3c3a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -238,6 +238,9 @@ static int inhibit_local_menu_bar_menus;
238/* Nonzero means C-g should cause immediate error-signal. */ 238/* Nonzero means C-g should cause immediate error-signal. */
239int immediate_quit; 239int immediate_quit;
240 240
241/* The user's hook function for outputting an error message. */
242Lisp_Object Vcommand_error_function;
243
241/* The user's ERASE setting. */ 244/* The user's ERASE setting. */
242Lisp_Object Vtty_erase_char; 245Lisp_Object Vtty_erase_char;
243 246
@@ -682,8 +685,6 @@ static void timer_start_idle P_ ((void));
682static void timer_stop_idle P_ ((void)); 685static void timer_stop_idle P_ ((void));
683static void timer_resume_idle P_ ((void)); 686static void timer_resume_idle P_ ((void));
684 687
685Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
686
687/* Nonzero means don't try to suspend even if the operating system seems 688/* Nonzero means don't try to suspend even if the operating system seems
688 to support it. */ 689 to support it. */
689static int cannot_suspend; 690static int cannot_suspend;
@@ -990,7 +991,7 @@ recursive_edit_1 ()
990 /* Handle throw from read_minibuf when using minibuffer 991 /* Handle throw from read_minibuf when using minibuffer
991 while it's active but we're in another window. */ 992 while it's active but we're in another window. */
992 if (STRINGP (val)) 993 if (STRINGP (val))
993 Fsignal (Qerror, Fcons (val, Qnil)); 994 xsignal1 (Qerror, val);
994 995
995 return unbind_to (count, Qnil); 996 return unbind_to (count, Qnil);
996} 997}
@@ -1185,11 +1186,12 @@ temporarily_switch_to_single_kboard (f)
1185 { 1186 {
1186 if (f != NULL && FRAME_KBOARD (f) != current_kboard) 1187 if (f != NULL && FRAME_KBOARD (f) != current_kboard)
1187 /* We can not switch keyboards while in single_kboard mode. 1188 /* We can not switch keyboards while in single_kboard mode.
1188 This can legally happen when Lisp code calls 1189 In rare cases, Lisp code may call `recursive-edit' (or
1189 `recursive-edit' (or `read-minibuffer' or `y-or-n-p') after 1190 `read-minibuffer' or `y-or-n-p') after it switched to a
1190 it switched to a locked frame. This kind of situation is 1191 locked frame. For example, this is likely to happen
1191 likely to happen when server.el connects to a new 1192 when server.el connects to a new terminal while Emacs is in
1192 terminal. */ 1193 single_kboard mode. It is best to throw an error instead
1194 of presenting the user with a frozen screen. */
1193 error ("Terminal %d is locked, cannot read from it", 1195 error ("Terminal %d is locked, cannot read from it",
1194 FRAME_TERMINAL (f)->id); 1196 FRAME_TERMINAL (f)->id);
1195 else 1197 else
@@ -1304,48 +1306,43 @@ cmd_error_internal (data, context)
1304 Lisp_Object data; 1306 Lisp_Object data;
1305 char *context; 1307 char *context;
1306{ 1308{
1307 Lisp_Object stream;
1308 int kill_emacs_p = 0;
1309 struct frame *sf = SELECTED_FRAME (); 1309 struct frame *sf = SELECTED_FRAME ();
1310 1310
1311 /* The immediate context is not interesting for Quits,
1312 since they are asyncronous. */
1313 if (EQ (XCAR (data), Qquit))
1314 Vsignaling_function = Qnil;
1315
1311 Vquit_flag = Qnil; 1316 Vquit_flag = Qnil;
1312 Vinhibit_quit = Qt; 1317 Vinhibit_quit = Qt;
1313 clear_message (1, 0);
1314 1318
1319 /* Use user's specified output function if any. */
1320 if (!NILP (Vcommand_error_function))
1321 call3 (Vcommand_error_function, data,
1322 build_string (context ? context : ""),
1323 Vsignaling_function);
1315 /* If the window system or terminal frame hasn't been initialized 1324 /* If the window system or terminal frame hasn't been initialized
1316 yet, or we're not interactive, it's best to dump this message out 1325 yet, or we're not interactive, write the message to stderr and exit. */
1317 to stderr and exit. */ 1326 else if (!sf->glyphs_initialized_p
1318 if (!sf->glyphs_initialized_p 1327 || FRAME_INITIAL_P (sf)
1319 || FRAME_INITIAL_P (sf) 1328 || noninteractive)
1320 || noninteractive) 1329 {
1321 { 1330 print_error_message (data, Qexternal_debugging_output,
1322 stream = Qexternal_debugging_output; 1331 context, Vsignaling_function);
1323 kill_emacs_p = 1; 1332 Fterpri (Qexternal_debugging_output);
1333 Fkill_emacs (make_number (-1));
1324 } 1334 }
1325 else 1335 else
1326 { 1336 {
1337 clear_message (1, 0);
1327 Fdiscard_input (); 1338 Fdiscard_input ();
1328 message_log_maybe_newline (); 1339 message_log_maybe_newline ();
1329 bitch_at_user (); 1340 bitch_at_user ();
1330 stream = Qt;
1331 }
1332
1333 /* The immediate context is not interesting for Quits,
1334 since they are asyncronous. */
1335 if (EQ (XCAR (data), Qquit))
1336 Vsignaling_function = Qnil;
1337 1341
1338 print_error_message (data, stream, context, Vsignaling_function); 1342 print_error_message (data, Qt, context, Vsignaling_function);
1343 }
1339 1344
1340 Vsignaling_function = Qnil; 1345 Vsignaling_function = Qnil;
1341
1342 /* If the window system or terminal frame hasn't been initialized
1343 yet, or we're in -batch mode, this error should cause Emacs to exit. */
1344 if (kill_emacs_p)
1345 {
1346 Fterpri (stream);
1347 Fkill_emacs (make_number (-1));
1348 }
1349} 1346}
1350 1347
1351Lisp_Object command_loop_1 (); 1348Lisp_Object command_loop_1 ();
@@ -2470,15 +2467,20 @@ do { if (polling_stopped_here) start_polling (); \
2470 Value is -2 when we find input on another keyboard. A second call 2467 Value is -2 when we find input on another keyboard. A second call
2471 to read_char will read it. 2468 to read_char will read it.
2472 2469
2470 If END_TIME is non-null, it is a pointer to an EMACS_TIME
2471 specifying the maximum time to wait until. If no input arrives by
2472 that time, stop waiting and return nil.
2473
2473 Value is t if we showed a menu and the user rejected it. */ 2474 Value is t if we showed a menu and the user rejected it. */
2474 2475
2475Lisp_Object 2476Lisp_Object
2476read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) 2477read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time)
2477 int commandflag; 2478 int commandflag;
2478 int nmaps; 2479 int nmaps;
2479 Lisp_Object *maps; 2480 Lisp_Object *maps;
2480 Lisp_Object prev_event; 2481 Lisp_Object prev_event;
2481 int *used_mouse_menu; 2482 int *used_mouse_menu;
2483 EMACS_TIME *end_time;
2482{ 2484{
2483 volatile Lisp_Object c; 2485 volatile Lisp_Object c;
2484 int count; 2486 int count;
@@ -2764,6 +2766,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2764 start echoing if enough time elapses. */ 2766 start echoing if enough time elapses. */
2765 2767
2766 if (minibuf_level == 0 2768 if (minibuf_level == 0
2769 && !end_time
2767 && !current_kboard->immediate_echo 2770 && !current_kboard->immediate_echo
2768 && this_command_key_count > 0 2771 && this_command_key_count > 0
2769 && ! noninteractive 2772 && ! noninteractive
@@ -2959,11 +2962,19 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2959 { 2962 {
2960 KBOARD *kb; 2963 KBOARD *kb;
2961 2964
2965 if (end_time)
2966 {
2967 EMACS_TIME now;
2968 EMACS_GET_TIME (now);
2969 if (EMACS_TIME_GE (now, *end_time))
2970 goto exit;
2971 }
2972
2962 /* Actually read a character, waiting if necessary. */ 2973 /* Actually read a character, waiting if necessary. */
2963 save_getcjmp (save_jump); 2974 save_getcjmp (save_jump);
2964 restore_getcjmp (local_getcjmp); 2975 restore_getcjmp (local_getcjmp);
2965 timer_start_idle (); 2976 timer_start_idle ();
2966 c = kbd_buffer_get_event (&kb, used_mouse_menu); 2977 c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time);
2967 restore_getcjmp (save_jump); 2978 restore_getcjmp (save_jump);
2968 2979
2969#ifdef MULTI_KBOARD 2980#ifdef MULTI_KBOARD
@@ -3307,7 +3318,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
3307 3318
3308 cancel_echoing (); 3319 cancel_echoing ();
3309 do 3320 do
3310 c = read_char (0, 0, 0, Qnil, 0); 3321 c = read_char (0, 0, 0, Qnil, 0, NULL);
3311 while (BUFFERP (c)); 3322 while (BUFFERP (c));
3312 /* Remove the help from the frame */ 3323 /* Remove the help from the frame */
3313 unbind_to (count, Qnil); 3324 unbind_to (count, Qnil);
@@ -3317,7 +3328,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
3317 { 3328 {
3318 cancel_echoing (); 3329 cancel_echoing ();
3319 do 3330 do
3320 c = read_char (0, 0, 0, Qnil, 0); 3331 c = read_char (0, 0, 0, Qnil, 0, NULL);
3321 while (BUFFERP (c)); 3332 while (BUFFERP (c));
3322 } 3333 }
3323 } 3334 }
@@ -3994,9 +4005,10 @@ clear_event (event)
3994 We always read and discard one event. */ 4005 We always read and discard one event. */
3995 4006
3996static Lisp_Object 4007static Lisp_Object
3997kbd_buffer_get_event (kbp, used_mouse_menu) 4008kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
3998 KBOARD **kbp; 4009 KBOARD **kbp;
3999 int *used_mouse_menu; 4010 int *used_mouse_menu;
4011 EMACS_TIME *end_time;
4000{ 4012{
4001 register int c; 4013 register int c;
4002 Lisp_Object obj; 4014 Lisp_Object obj;
@@ -4040,13 +4052,24 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
4040 if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 4052 if (!NILP (do_mouse_tracking) && some_mouse_moved ())
4041 break; 4053 break;
4042#endif 4054#endif
4043 { 4055 if (end_time)
4056 {
4057 EMACS_TIME duration;
4058 EMACS_GET_TIME (duration);
4059 EMACS_SUB_TIME (duration, *end_time, duration);
4060 if (EMACS_TIME_NEG_P (duration))
4061 return Qnil;
4062 else
4063 wait_reading_process_output (EMACS_SECS (duration),
4064 EMACS_USECS (duration),
4065 -1, 1, Qnil, NULL, 0);
4066 }
4067 else
4044 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); 4068 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
4045 4069
4046 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) 4070 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
4047 /* Pass 1 for EXPECT since we just waited to have input. */ 4071 /* Pass 1 for EXPECT since we just waited to have input. */
4048 read_avail_input (1); 4072 read_avail_input (1);
4049 }
4050#endif /* not VMS */ 4073#endif /* not VMS */
4051 } 4074 }
4052 4075
@@ -8469,7 +8492,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
8469 orig_defn_macro = current_kboard->defining_kbd_macro; 8492 orig_defn_macro = current_kboard->defining_kbd_macro;
8470 current_kboard->defining_kbd_macro = Qnil; 8493 current_kboard->defining_kbd_macro = Qnil;
8471 do 8494 do
8472 obj = read_char (commandflag, 0, 0, Qt, 0); 8495 obj = read_char (commandflag, 0, 0, Qt, 0, NULL);
8473 while (BUFFERP (obj)); 8496 while (BUFFERP (obj));
8474 current_kboard->defining_kbd_macro = orig_defn_macro; 8497 current_kboard->defining_kbd_macro = orig_defn_macro;
8475 8498
@@ -8839,7 +8862,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8839 /* Read the first char of the sequence specially, before setting 8862 /* Read the first char of the sequence specially, before setting
8840 up any keymaps, in case a filter runs and switches buffers on us. */ 8863 up any keymaps, in case a filter runs and switches buffers on us. */
8841 first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event, 8864 first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event,
8842 &junk); 8865 &junk, NULL);
8843#endif /* GOBBLE_FIRST_EVENT */ 8866#endif /* GOBBLE_FIRST_EVENT */
8844 8867
8845 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); 8868 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -9018,7 +9041,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9018#endif 9041#endif
9019 key = read_char (NILP (prompt), nmaps, 9042 key = read_char (NILP (prompt), nmaps,
9020 (Lisp_Object *) submaps, last_nonmenu_event, 9043 (Lisp_Object *) submaps, last_nonmenu_event,
9021 &used_mouse_menu); 9044 &used_mouse_menu, NULL);
9022#ifdef MULTI_KBOARD 9045#ifdef MULTI_KBOARD
9023 if (INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */ 9046 if (INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */
9024 { 9047 {
@@ -11948,6 +11971,15 @@ The value of that variable is passed to `quit-flag' and later causes a
11948peculiar kind of quitting. */); 11971peculiar kind of quitting. */);
11949 Vthrow_on_input = Qnil; 11972 Vthrow_on_input = Qnil;
11950 11973
11974 DEFVAR_LISP ("command-error-function", &Vcommand_error_function,
11975 doc: /* If non-nil, function to output error messages.
11976The arguments are the error data, a list of the form
11977 (SIGNALED-CONDITIONS . SIGNAL-DATA)
11978such as just as `condition-case' would bind its variable to,
11979the context (a string which normally goes at the start of the message),
11980and the Lisp function within which the error was signaled. */);
11981 Vcommand_error_function = Qnil;
11982
11951 DEFVAR_LISP ("enable-disabled-menus-and-buttons", 11983 DEFVAR_LISP ("enable-disabled-menus-and-buttons",
11952 &Venable_disabled_menus_and_buttons, 11984 &Venable_disabled_menus_and_buttons,
11953 doc: /* If non-nil, don't ignore events produced by disabled menu items and tool-bar. 11985 doc: /* If non-nil, don't ignore events produced by disabled menu items and tool-bar.
diff --git a/src/keyboard.h b/src/keyboard.h
index a3fa54b1042..8f1c5dd31a9 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -19,6 +19,8 @@ along with GNU Emacs; see the file COPYING. If not, write to
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22#include "systime.h" /* for EMACS_TIME */
23
22/* Length of echobuf field in each KBOARD. */ 24/* Length of echobuf field in each KBOARD. */
23 25
24/* Each KBOARD represents one logical input stream from which Emacs 26/* Each KBOARD represents one logical input stream from which Emacs
@@ -305,6 +307,9 @@ struct input_event;
305 307
306extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); 308extern Lisp_Object parse_modifiers P_ ((Lisp_Object));
307extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); 309extern Lisp_Object reorder_modifiers P_ ((Lisp_Object));
310extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object,
311 int *, EMACS_TIME *));
312
308 313
309/* Parent keymap of terminal-local function-key-map instances. */ 314/* Parent keymap of terminal-local function-key-map instances. */
310extern Lisp_Object Vfunction_key_map; 315extern Lisp_Object Vfunction_key_map;
diff --git a/src/keymap.c b/src/keymap.c
index 0197319957c..9e1f01e7a79 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -751,7 +751,7 @@ usage: (map-keymap FUNCTION KEYMAP) */)
751 if (INTEGERP (function)) 751 if (INTEGERP (function))
752 /* We have to stop integers early since map_keymap gives them special 752 /* We have to stop integers early since map_keymap gives them special
753 significance. */ 753 significance. */
754 Fsignal (Qinvalid_function, Fcons (function, Qnil)); 754 xsignal1 (Qinvalid_function, function);
755 if (! NILP (sort_first)) 755 if (! NILP (sort_first))
756 return call3 (intern ("map-keymap-internal"), function, keymap, Qt); 756 return call3 (intern ("map-keymap-internal"), function, keymap, Qt);
757 757
@@ -1142,6 +1142,20 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1142 1142
1143 meta_bit = VECTORP (key) ? meta_modifier : 0x80; 1143 meta_bit = VECTORP (key) ? meta_modifier : 0x80;
1144 1144
1145 if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, make_number (0))))
1146 { /* DEF is apparently an XEmacs-style keyboard macro. */
1147 Lisp_Object tmp = Fmake_vector (make_number (ASIZE (def)), Qnil);
1148 int i = ASIZE (def);
1149 while (--i >= 0)
1150 {
1151 Lisp_Object c = AREF (def, i);
1152 if (CONSP (c) && lucid_event_type_list_p (c))
1153 c = Fevent_convert_list (c);
1154 ASET (tmp, i, c);
1155 }
1156 def = tmp;
1157 }
1158
1145 idx = 0; 1159 idx = 0;
1146 while (1) 1160 while (1)
1147 { 1161 {
diff --git a/src/lisp.h b/src/lisp.h
index 7b70b0a9d17..4bdb0e67947 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2174,7 +2174,7 @@ extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
2174 2174
2175extern Lisp_Object Qinteger; 2175extern Lisp_Object Qinteger;
2176 2176
2177extern void circular_list_error P_ ((Lisp_Object)); 2177extern void circular_list_error P_ ((Lisp_Object)) NO_RETURN;
2178EXFUN (Finteractive_form, 1); 2178EXFUN (Finteractive_form, 1);
2179 2179
2180/* Defined in frame.c */ 2180/* Defined in frame.c */
@@ -2549,13 +2549,14 @@ extern void allocate_string_data P_ ((struct Lisp_String *, int, int));
2549extern void reset_malloc_hooks P_ ((void)); 2549extern void reset_malloc_hooks P_ ((void));
2550extern void uninterrupt_malloc P_ ((void)); 2550extern void uninterrupt_malloc P_ ((void));
2551extern void malloc_warning P_ ((char *)); 2551extern void malloc_warning P_ ((char *));
2552extern void memory_full P_ ((void)); 2552extern void memory_full P_ ((void)) NO_RETURN;
2553extern void buffer_memory_full P_ ((void)); 2553extern void buffer_memory_full P_ ((void)) NO_RETURN;
2554extern int survives_gc_p P_ ((Lisp_Object)); 2554extern int survives_gc_p P_ ((Lisp_Object));
2555extern void mark_object P_ ((Lisp_Object)); 2555extern void mark_object P_ ((Lisp_Object));
2556extern Lisp_Object Vpurify_flag; 2556extern Lisp_Object Vpurify_flag;
2557extern Lisp_Object Vmemory_full; 2557extern Lisp_Object Vmemory_full;
2558EXFUN (Fcons, 2); 2558EXFUN (Fcons, 2);
2559EXFUN (list1, 1);
2559EXFUN (list2, 2); 2560EXFUN (list2, 2);
2560EXFUN (list3, 3); 2561EXFUN (list3, 3);
2561EXFUN (list4, 4); 2562EXFUN (list4, 4);
@@ -2644,9 +2645,9 @@ EXFUN (Fintern_soft, 2);
2644EXFUN (Fload, 5); 2645EXFUN (Fload, 5);
2645EXFUN (Fget_load_suffixes, 0); 2646EXFUN (Fget_load_suffixes, 0);
2646EXFUN (Fget_file_char, 0); 2647EXFUN (Fget_file_char, 0);
2647EXFUN (Fread_char, 2); 2648EXFUN (Fread_char, 3);
2648EXFUN (Fread_event, 2); 2649EXFUN (Fread_event, 3);
2649extern Lisp_Object read_filtered_event P_ ((int, int, int, int)); 2650extern Lisp_Object read_filtered_event P_ ((int, int, int, int, Lisp_Object));
2650EXFUN (Feval_region, 4); 2651EXFUN (Feval_region, 4);
2651extern Lisp_Object intern P_ ((const char *)); 2652extern Lisp_Object intern P_ ((const char *));
2652extern Lisp_Object make_symbol P_ ((char *)); 2653extern Lisp_Object make_symbol P_ ((char *));
@@ -2708,6 +2709,12 @@ EXFUN (Fthrow, 2) NO_RETURN;
2708EXFUN (Funwind_protect, UNEVALLED); 2709EXFUN (Funwind_protect, UNEVALLED);
2709EXFUN (Fcondition_case, UNEVALLED); 2710EXFUN (Fcondition_case, UNEVALLED);
2710EXFUN (Fsignal, 2); 2711EXFUN (Fsignal, 2);
2712extern void xsignal P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2713extern void xsignal0 P_ ((Lisp_Object)) NO_RETURN;
2714extern void xsignal1 P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2715extern void xsignal2 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN;
2716extern void xsignal3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)) NO_RETURN;
2717extern void signal_error P_ ((char *, Lisp_Object)) NO_RETURN;
2711EXFUN (Fautoload, 5); 2718EXFUN (Fautoload, 5);
2712EXFUN (Fcommandp, 2); 2719EXFUN (Fcommandp, 2);
2713EXFUN (Feval, 1); 2720EXFUN (Feval, 1);
diff --git a/src/lread.c b/src/lread.c
index 91825bce152..ef76e72f75f 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -216,6 +216,9 @@ static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object,
216static Lisp_Object load_unwind P_ ((Lisp_Object)); 216static Lisp_Object load_unwind P_ ((Lisp_Object));
217static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); 217static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object));
218 218
219static void invalid_syntax P_ ((const char *, int)) NO_RETURN;
220static void end_of_file_error P_ (()) NO_RETURN;
221
219 222
220/* Handle unreading and rereading of characters. 223/* Handle unreading and rereading of characters.
221 Write READCHAR to read a character, 224 Write READCHAR to read a character,
@@ -436,8 +439,6 @@ static void substitute_in_interval P_ ((INTERVAL, Lisp_Object));
436 439
437/* Get a character from the tty. */ 440/* Get a character from the tty. */
438 441
439extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
440
441/* Read input events until we get one that's acceptable for our purposes. 442/* Read input events until we get one that's acceptable for our purposes.
442 443
443 If NO_SWITCH_FRAME is non-zero, switch-frame events are stashed 444 If NO_SWITCH_FRAME is non-zero, switch-frame events are stashed
@@ -454,14 +455,19 @@ extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
454 character. 455 character.
455 456
456 If INPUT_METHOD is nonzero, we invoke the current input method 457 If INPUT_METHOD is nonzero, we invoke the current input method
457 if the character warrants that. */ 458 if the character warrants that.
459
460 If SECONDS is a number, we wait that many seconds for input, and
461 return Qnil if no input arrives within that time. */
458 462
459Lisp_Object 463Lisp_Object
460read_filtered_event (no_switch_frame, ascii_required, error_nonascii, 464read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
461 input_method) 465 input_method, seconds)
462 int no_switch_frame, ascii_required, error_nonascii, input_method; 466 int no_switch_frame, ascii_required, error_nonascii, input_method;
467 Lisp_Object seconds;
463{ 468{
464 Lisp_Object val, delayed_switch_frame; 469 Lisp_Object val, delayed_switch_frame;
470 EMACS_TIME end_time;
465 471
466#ifdef HAVE_WINDOW_SYSTEM 472#ifdef HAVE_WINDOW_SYSTEM
467 if (display_hourglass_p) 473 if (display_hourglass_p)
@@ -470,10 +476,25 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
470 476
471 delayed_switch_frame = Qnil; 477 delayed_switch_frame = Qnil;
472 478
473 /* Read until we get an acceptable event. */ 479 /* Compute timeout. */
480 if (NUMBERP (seconds))
481 {
482 EMACS_TIME wait_time;
483 int sec, usec;
484 double duration = extract_float (seconds);
485
486 sec = (int) duration;
487 usec = (duration - sec) * 1000000;
488 EMACS_GET_TIME (end_time);
489 EMACS_SET_SECS_USECS (wait_time, sec, usec);
490 EMACS_ADD_TIME (end_time, end_time, wait_time);
491 }
492
493/* Read until we get an acceptable event. */
474 retry: 494 retry:
475 do 495 do
476 val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0); 496 val = read_char (0, 0, 0, (input_method ? Qnil : Qt), 0,
497 NUMBERP (seconds) ? &end_time : NULL);
477 while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */ 498 while (INTEGERP (val) && XINT (val) == -2); /* wrong_kboard_jmpbuf */
478 499
479 if (BUFFERP (val)) 500 if (BUFFERP (val))
@@ -492,7 +513,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
492 goto retry; 513 goto retry;
493 } 514 }
494 515
495 if (ascii_required) 516 if (ascii_required && !(NUMBERP (seconds) && NILP (val)))
496 { 517 {
497 /* Convert certain symbols to their ASCII equivalents. */ 518 /* Convert certain symbols to their ASCII equivalents. */
498 if (SYMBOLP (val)) 519 if (SYMBOLP (val))
@@ -537,7 +558,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
537 return val; 558 return val;
538} 559}
539 560
540DEFUN ("read-char", Fread_char, Sread_char, 0, 2, 0, 561DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0,
541 doc: /* Read a character from the command input (keyboard or macro). 562 doc: /* Read a character from the command input (keyboard or macro).
542It is returned as a number. 563It is returned as a number.
543If the user generates an event which is not a character (i.e. a mouse 564If the user generates an event which is not a character (i.e. a mouse
@@ -550,43 +571,55 @@ If you want to read non-character events, or ignore them, call
550If the optional argument PROMPT is non-nil, display that as a prompt. 571If the optional argument PROMPT is non-nil, display that as a prompt.
551If the optional argument INHERIT-INPUT-METHOD is non-nil and some 572If the optional argument INHERIT-INPUT-METHOD is non-nil and some
552input method is turned on in the current buffer, that input method 573input method is turned on in the current buffer, that input method
553is used for reading a character. */) 574is used for reading a character.
554 (prompt, inherit_input_method) 575If the optional argument SECONDS is non-nil, it should be a number
555 Lisp_Object prompt, inherit_input_method; 576specifying the maximum number of seconds to wait for input. If no
577input arrives in that time, return nil. SECONDS may be a
578floating-point value. */)
579 (prompt, inherit_input_method, seconds)
580 Lisp_Object prompt, inherit_input_method, seconds;
556{ 581{
557 if (! NILP (prompt)) 582 if (! NILP (prompt))
558 message_with_string ("%s", prompt, 0); 583 message_with_string ("%s", prompt, 0);
559 return read_filtered_event (1, 1, 1, ! NILP (inherit_input_method)); 584 return read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds);
560} 585}
561 586
562DEFUN ("read-event", Fread_event, Sread_event, 0, 2, 0, 587DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0,
563 doc: /* Read an event object from the input stream. 588 doc: /* Read an event object from the input stream.
564If the optional argument PROMPT is non-nil, display that as a prompt. 589If the optional argument PROMPT is non-nil, display that as a prompt.
565If the optional argument INHERIT-INPUT-METHOD is non-nil and some 590If the optional argument INHERIT-INPUT-METHOD is non-nil and some
566input method is turned on in the current buffer, that input method 591input method is turned on in the current buffer, that input method
567is used for reading a character. */) 592is used for reading a character.
568 (prompt, inherit_input_method) 593If the optional argument SECONDS is non-nil, it should be a number
569 Lisp_Object prompt, inherit_input_method; 594specifying the maximum number of seconds to wait for input. If no
595input arrives in that time, return nil. SECONDS may be a
596floating-point value. */)
597 (prompt, inherit_input_method, seconds)
598 Lisp_Object prompt, inherit_input_method, seconds;
570{ 599{
571 if (! NILP (prompt)) 600 if (! NILP (prompt))
572 message_with_string ("%s", prompt, 0); 601 message_with_string ("%s", prompt, 0);
573 return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method)); 602 return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method), seconds);
574} 603}
575 604
576DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 2, 0, 605DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0,
577 doc: /* Read a character from the command input (keyboard or macro). 606 doc: /* Read a character from the command input (keyboard or macro).
578It is returned as a number. Non-character events are ignored. 607It is returned as a number. Non-character events are ignored.
579 608
580If the optional argument PROMPT is non-nil, display that as a prompt. 609If the optional argument PROMPT is non-nil, display that as a prompt.
581If the optional argument INHERIT-INPUT-METHOD is non-nil and some 610If the optional argument INHERIT-INPUT-METHOD is non-nil and some
582input method is turned on in the current buffer, that input method 611input method is turned on in the current buffer, that input method
583is used for reading a character. */) 612is used for reading a character.
584 (prompt, inherit_input_method) 613If the optional argument SECONDS is non-nil, it should be a number
585 Lisp_Object prompt, inherit_input_method; 614specifying the maximum number of seconds to wait for input. If no
615input arrives in that time, return nil. SECONDS may be a
616floating-point value. */)
617 (prompt, inherit_input_method, seconds)
618 Lisp_Object prompt, inherit_input_method, seconds;
586{ 619{
587 if (! NILP (prompt)) 620 if (! NILP (prompt))
588 message_with_string ("%s", prompt, 0); 621 message_with_string ("%s", prompt, 0);
589 return read_filtered_event (1, 1, 0, ! NILP (inherit_input_method)); 622 return read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds);
590} 623}
591 624
592DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, 625DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
@@ -799,10 +832,8 @@ Return t if the file exists and loads successfully. */)
799 if (fd == -1) 832 if (fd == -1)
800 { 833 {
801 if (NILP (noerror)) 834 if (NILP (noerror))
802 Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"), 835 xsignal2 (Qfile_error, build_string ("Cannot open load file"), file);
803 Fcons (file, Qnil))); 836 return Qnil;
804 else
805 return Qnil;
806 } 837 }
807 838
808 /* Tell startup.el whether or not we found the user's init file. */ 839 /* Tell startup.el whether or not we found the user's init file. */
@@ -843,8 +874,7 @@ Return t if the file exists and loads successfully. */)
843 { 874 {
844 if (fd >= 0) 875 if (fd >= 0)
845 emacs_close (fd); 876 emacs_close (fd);
846 Fsignal (Qerror, Fcons (build_string ("Recursive load"), 877 signal_error ("Recursive load", Fcons (found, Vloads_in_progress));
847 Fcons (found, Vloads_in_progress)));
848 } 878 }
849 record_unwind_protect (record_load_unwind, Vloads_in_progress); 879 record_unwind_protect (record_load_unwind, Vloads_in_progress);
850 Vloads_in_progress = Fcons (found, Vloads_in_progress); 880 Vloads_in_progress = Fcons (found, Vloads_in_progress);
@@ -1341,11 +1371,9 @@ end_of_file_error ()
1341 Lisp_Object data; 1371 Lisp_Object data;
1342 1372
1343 if (STRINGP (Vload_file_name)) 1373 if (STRINGP (Vload_file_name))
1344 data = Fcons (Vload_file_name, Qnil); 1374 xsignal1 (Qend_of_file, Vload_file_name);
1345 else
1346 data = Qnil;
1347 1375
1348 Fsignal (Qend_of_file, data); 1376 xsignal0 (Qend_of_file);
1349} 1377}
1350 1378
1351/* UNIBYTE specifies how to set load_convert_to_unibyte 1379/* UNIBYTE specifies how to set load_convert_to_unibyte
@@ -1696,6 +1724,21 @@ read_internal_start (stream, start, end)
1696 return retval; 1724 return retval;
1697} 1725}
1698 1726
1727
1728/* Signal Qinvalid_read_syntax error.
1729 S is error string of length N (if > 0) */
1730
1731static void
1732invalid_syntax (s, n)
1733 const char *s;
1734 int n;
1735{
1736 if (!n)
1737 n = strlen (s);
1738 xsignal1 (Qinvalid_read_syntax, make_string (s, n));
1739}
1740
1741
1699/* Use this for recursive reads, in contexts where internal tokens 1742/* Use this for recursive reads, in contexts where internal tokens
1700 are not allowed. */ 1743 are not allowed. */
1701 1744
@@ -1707,12 +1750,11 @@ read0 (readcharfun)
1707 int c; 1750 int c;
1708 1751
1709 val = read1 (readcharfun, &c, 0); 1752 val = read1 (readcharfun, &c, 0);
1710 if (c) 1753 if (!c)
1711 Fsignal (Qinvalid_read_syntax, Fcons (Fmake_string (make_number (1), 1754 return val;
1712 make_number (c)),
1713 Qnil));
1714 1755
1715 return val; 1756 xsignal1 (Qinvalid_read_syntax,
1757 Fmake_string (make_number (1), make_number (c)));
1716} 1758}
1717 1759
1718static int read_buffer_size; 1760static int read_buffer_size;
@@ -1980,7 +2022,6 @@ read_escape (readcharfun, stringp, byterep)
1980 } 2022 }
1981} 2023}
1982 2024
1983
1984/* Read an integer in radix RADIX using READCHARFUN to read 2025/* Read an integer in radix RADIX using READCHARFUN to read
1985 characters. RADIX must be in the interval [2..36]; if it isn't, a 2026 characters. RADIX must be in the interval [2..36]; if it isn't, a
1986 read error is signaled . Value is the integer read. Signals an 2027 read error is signaled . Value is the integer read. Signals an
@@ -2040,7 +2081,7 @@ read_integer (readcharfun, radix)
2040 { 2081 {
2041 char buf[50]; 2082 char buf[50];
2042 sprintf (buf, "integer, radix %d", radix); 2083 sprintf (buf, "integer, radix %d", radix);
2043 Fsignal (Qinvalid_read_syntax, Fcons (build_string (buf), Qnil)); 2084 invalid_syntax (buf, 0);
2044 } 2085 }
2045 2086
2046 return make_number (sign * number); 2087 return make_number (sign * number);
@@ -2151,10 +2192,9 @@ read1 (readcharfun, pch, first_in_list)
2151 XCHAR_TABLE (tmp)->top = Qnil; 2192 XCHAR_TABLE (tmp)->top = Qnil;
2152 return tmp; 2193 return tmp;
2153 } 2194 }
2154 Fsignal (Qinvalid_read_syntax, 2195 invalid_syntax ("#^^", 3);
2155 Fcons (make_string ("#^^", 3), Qnil));
2156 } 2196 }
2157 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#^", 2), Qnil)); 2197 invalid_syntax ("#^", 2);
2158 } 2198 }
2159 if (c == '&') 2199 if (c == '&')
2160 { 2200 {
@@ -2176,8 +2216,7 @@ read1 (readcharfun, pch, first_in_list)
2176 Accept such input in case it came from an old version. */ 2216 Accept such input in case it came from an old version. */
2177 && ! (XFASTINT (length) 2217 && ! (XFASTINT (length)
2178 == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR)) 2218 == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))
2179 Fsignal (Qinvalid_read_syntax, 2219 invalid_syntax ("#&...", 5);
2180 Fcons (make_string ("#&...", 5), Qnil));
2181 2220
2182 val = Fmake_bool_vector (length, Qnil); 2221 val = Fmake_bool_vector (length, Qnil);
2183 bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, 2222 bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,
@@ -2188,8 +2227,7 @@ read1 (readcharfun, pch, first_in_list)
2188 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; 2227 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
2189 return val; 2228 return val;
2190 } 2229 }
2191 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#&...", 5), 2230 invalid_syntax ("#&...", 5);
2192 Qnil));
2193 } 2231 }
2194 if (c == '[') 2232 if (c == '[')
2195 { 2233 {
@@ -2209,7 +2247,7 @@ read1 (readcharfun, pch, first_in_list)
2209 /* Read the string itself. */ 2247 /* Read the string itself. */
2210 tmp = read1 (readcharfun, &ch, 0); 2248 tmp = read1 (readcharfun, &ch, 0);
2211 if (ch != 0 || !STRINGP (tmp)) 2249 if (ch != 0 || !STRINGP (tmp))
2212 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); 2250 invalid_syntax ("#", 1);
2213 GCPRO1 (tmp); 2251 GCPRO1 (tmp);
2214 /* Read the intervals and their properties. */ 2252 /* Read the intervals and their properties. */
2215 while (1) 2253 while (1)
@@ -2225,9 +2263,7 @@ read1 (readcharfun, pch, first_in_list)
2225 if (ch == 0) 2263 if (ch == 0)
2226 plist = read1 (readcharfun, &ch, 0); 2264 plist = read1 (readcharfun, &ch, 0);
2227 if (ch) 2265 if (ch)
2228 Fsignal (Qinvalid_read_syntax, 2266 invalid_syntax ("Invalid string property list", 0);
2229 Fcons (build_string ("invalid string property list"),
2230 Qnil));
2231 Fset_text_properties (beg, end, plist, tmp); 2267 Fset_text_properties (beg, end, plist, tmp);
2232 } 2268 }
2233 UNGCPRO; 2269 UNGCPRO;
@@ -2380,7 +2416,7 @@ read1 (readcharfun, pch, first_in_list)
2380 return read_integer (readcharfun, 2); 2416 return read_integer (readcharfun, 2);
2381 2417
2382 UNREAD (c); 2418 UNREAD (c);
2383 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#", 1), Qnil)); 2419 invalid_syntax ("#", 1);
2384 2420
2385 case ';': 2421 case ';':
2386 while ((c = READCHAR) >= 0 && c != '\n'); 2422 while ((c = READCHAR) >= 0 && c != '\n');
@@ -2474,10 +2510,10 @@ read1 (readcharfun, pch, first_in_list)
2474 || (new_backquote_flag && next_char == ',')))); 2510 || (new_backquote_flag && next_char == ','))));
2475 } 2511 }
2476 UNREAD (next_char); 2512 UNREAD (next_char);
2477 if (!ok) 2513 if (ok)
2478 Fsignal (Qinvalid_read_syntax, Fcons (make_string ("?", 1), Qnil)); 2514 return make_number (c);
2479 2515
2480 return make_number (c); 2516 invalid_syntax ("?", 1);
2481 } 2517 }
2482 2518
2483 case '"': 2519 case '"':
@@ -3122,8 +3158,7 @@ read_list (flag, readcharfun)
3122 { 3158 {
3123 if (ch == ']') 3159 if (ch == ']')
3124 return val; 3160 return val;
3125 Fsignal (Qinvalid_read_syntax, 3161 invalid_syntax (") or . in a vector", 18);
3126 Fcons (make_string (") or . in a vector", 18), Qnil));
3127 } 3162 }
3128 if (ch == ')') 3163 if (ch == ')')
3129 return val; 3164 return val;
@@ -3216,9 +3251,9 @@ read_list (flag, readcharfun)
3216 3251
3217 return val; 3252 return val;
3218 } 3253 }
3219 return Fsignal (Qinvalid_read_syntax, Fcons (make_string (". in wrong context", 18), Qnil)); 3254 invalid_syntax (". in wrong context", 18);
3220 } 3255 }
3221 return Fsignal (Qinvalid_read_syntax, Fcons (make_string ("] in a list", 11), Qnil)); 3256 invalid_syntax ("] in a list", 11);
3222 } 3257 }
3223 tem = (read_pure && flag <= 0 3258 tem = (read_pure && flag <= 0
3224 ? pure_cons (elt, Qnil) 3259 ? pure_cons (elt, Qnil)
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 8d627446f65..c0128b496d3 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -8587,6 +8587,81 @@ extern int emacs_main (int, char **, char **);
8587extern void initialize_applescript(); 8587extern void initialize_applescript();
8588extern void terminate_applescript(); 8588extern void terminate_applescript();
8589 8589
8590/* Table for translating Mac keycode to X keysym values. Contributed
8591 by Sudhir Shenoy.
8592 Mapping for special keys is now identical to that in Apple X11
8593 except `clear' (-> <clear>) on the KeyPad, `enter' (-> <kp-enter>)
8594 on the right of the Cmd key on laptops, and fn + `enter' (->
8595 <linefeed>). */
8596static unsigned char keycode_to_xkeysym_table[] = {
8597 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8598 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8599 /*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8600
8601 /*0x30*/ 0x09 /*tab*/, 0 /*0x0020 space*/, 0, 0x08 /*backspace*/,
8602 /*0x34*/ 0x8d /*enter on laptops*/, 0x1b /*escape*/, 0, 0,
8603 /*0x38*/ 0, 0, 0, 0,
8604 /*0x3C*/ 0, 0, 0, 0,
8605
8606 /*0x40*/ 0, 0xae /*kp-decimal*/, 0, 0xaa /*kp-multiply*/,
8607 /*0x44*/ 0, 0xab /*kp-add*/, 0, 0x0b /*clear*/,
8608 /*0x48*/ 0, 0, 0, 0xaf /*kp-divide*/,
8609 /*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp-subtract*/, 0,
8610
8611 /*0x50*/ 0, 0xbd /*kp-equal*/, 0xb0 /*kp-0*/, 0xb1 /*kp-1*/,
8612 /*0x54*/ 0xb2 /*kp-2*/, 0xb3 /*kp-3*/, 0xb4 /*kp-4*/, 0xb5 /*kp-5*/,
8613 /*0x58*/ 0xb6 /*kp-6*/, 0xb7 /*kp-7*/, 0, 0xb8 /*kp-8*/,
8614 /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0,
8615
8616 /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/,
8617 /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/,
8618 /*0x68*/ 0, 0xca /*f13*/, 0xcd /*f16*/, 0xcb /*f14*/,
8619 /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/,
8620
8621 /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/,
8622 /*0x74*/ 0x55 /*pgup*/, 0xff /*delete*/, 0xc1 /*f4*/, 0x57 /*end*/,
8623 /*0x78*/ 0xbf /*f2*/, 0x56 /*pgdown*/, 0xbe /*f1*/, 0x51 /*left*/,
8624 /*0x7C*/ 0x53 /*right*/, 0x54 /*down*/, 0x52 /*up*/, 0
8625};
8626
8627#ifdef MAC_OSX
8628/* Table for translating Mac keycode with the laptop `fn' key to that
8629 without it. Destination symbols in comments are keys on US
8630 keyboard, and they may not be the same on other types of keyboards.
8631 If the destination is identical to the source (f1 ... f12), it
8632 doesn't map `fn' key to a modifier. */
8633static unsigned char fn_keycode_to_keycode_table[] = {
8634 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8635 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8636 /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8637
8638 /*0x30*/ 0, 0, 0, 0,
8639 /*0x34*/ 0, 0, 0, 0,
8640 /*0x38*/ 0, 0, 0, 0,
8641 /*0x3C*/ 0, 0, 0, 0,
8642
8643 /*0x40*/ 0, 0x2f /*kp-decimal -> '.'*/, 0, 0x23 /*kp-multiply -> 'p'*/,
8644 /*0x44*/ 0, 0x2c /*kp-add -> '/'*/, 0, 0x16 /*clear -> '6'*/,
8645 /*0x48*/ 0, 0, 0, 0x1d /*kp-/ -> '0'*/,
8646 /*0x4C*/ 0x24 /*kp-enter -> return*/, 0, 0x29 /*kp-subtract -> ';'*/, 0,
8647
8648 /*0x50*/ 0, 0x1b /*kp-equal -> '-'*/, 0x2e /*kp-0 -> 'm'*/, 0x26 /*kp-1 -> 'j'*/,
8649 /*0x54*/ 0x28 /*kp-2 -> 'k'*/, 0x25 /*kp-3 -> 'l'*/, 0x20 /*kp-4 -> 'u'*/, 0x22 /*kp-5 ->'i'*/,
8650 /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/,
8651 /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0,
8652
8653 /*0x60*/ 0x60 /*f5 = f5*/, 0x61 /*f6 = f6*/, 0x62 /*f7 = f7*/, 0x63 /*f3 = f3*/,
8654 /*0x64*/ 0x64 /*f8 = f8*/, 0x65 /*f9 = f9*/, 0, 0x67 /*f11 = f11*/,
8655 /*0x68*/ 0, 0, 0, 0,
8656 /*0x6C*/ 0, 0x6d /*f10 = f10*/, 0, 0x6f /*f12 = f12*/,
8657
8658 /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/,
8659 /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0x76 /*f4 = f4*/, 0x7c /*end -> right*/,
8660 /*0x78*/ 0x78 /*f2 = f2*/, 0x7d /*pgdown -> down*/, 0x7a /*f1 = f1*/, 0,
8661 /*0x7C*/ 0, 0, 0, 0
8662};
8663#endif /* MAC_OSX */
8664
8590static unsigned int 8665static unsigned int
8591#if USE_CARBON_EVENTS 8666#if USE_CARBON_EVENTS
8592mac_to_emacs_modifiers (UInt32 mods) 8667mac_to_emacs_modifiers (UInt32 mods)
@@ -9650,7 +9725,6 @@ mac_handle_text_input_event (next_handler, event, data)
9650 { 9725 {
9651 EventRef kbd_event; 9726 EventRef kbd_event;
9652 UInt32 actual_size, modifiers, mapped_modifiers; 9727 UInt32 actual_size, modifiers, mapped_modifiers;
9653 UniChar code;
9654 9728
9655 err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent, 9729 err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent,
9656 typeEventRef, NULL, sizeof (EventRef), NULL, 9730 typeEventRef, NULL, sizeof (EventRef), NULL,
@@ -9678,26 +9752,37 @@ mac_handle_text_input_event (next_handler, event, data)
9678 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, 9752 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes,
9679 typeUnicodeText, NULL, 0, &actual_size, 9753 typeUnicodeText, NULL, 0, &actual_size,
9680 NULL); 9754 NULL);
9681 if (err == noErr) 9755 if (err == noErr && actual_size == sizeof (UniChar))
9682 { 9756 {
9683 if (actual_size == sizeof (UniChar)) 9757 UniChar code;
9684 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes, 9758
9685 typeUnicodeText, NULL, 9759 err = GetEventParameter (kbd_event, kEventParamKeyUnicodes,
9686 sizeof (UniChar), NULL, &code); 9760 typeUnicodeText, NULL,
9761 sizeof (UniChar), NULL, &code);
9687 if (err == noErr && code < 0x80) 9762 if (err == noErr && code < 0x80)
9688 { 9763 {
9689 /* ASCII character. Process it in XTread_socket. */ 9764 /* ASCII character. Process it in XTread_socket. */
9690 if (read_socket_inev && code >= 0x20 && code <= 0x7e) 9765 if (read_socket_inev && code >= 0x20 && code <= 0x7e)
9691 { 9766 {
9692 struct frame *f = mac_focus_frame (&one_mac_display_info); 9767 UInt32 key_code;
9693 9768
9694 read_socket_inev->kind = ASCII_KEYSTROKE_EVENT; 9769 err = GetEventParameter (kbd_event, kEventParamKeyCode,
9695 read_socket_inev->code = code; 9770 typeUInt32, NULL, sizeof (UInt32),
9696 read_socket_inev->modifiers = 9771 NULL, &key_code);
9697 (extra_keyboard_modifiers 9772 if (!(err == noErr && key_code <= 0x7f
9698 & (meta_modifier | alt_modifier 9773 && keycode_to_xkeysym_table [key_code]))
9699 | hyper_modifier | super_modifier)); 9774 {
9700 XSETFRAME (read_socket_inev->frame_or_window, f); 9775 struct frame *f =
9776 mac_focus_frame (&one_mac_display_info);
9777
9778 read_socket_inev->kind = ASCII_KEYSTROKE_EVENT;
9779 read_socket_inev->code = code;
9780 read_socket_inev->modifiers =
9781 (extra_keyboard_modifiers
9782 & (meta_modifier | alt_modifier
9783 | hyper_modifier | super_modifier));
9784 XSETFRAME (read_socket_inev->frame_or_window, f);
9785 }
9701 } 9786 }
9702 return eventNotHandledErr; 9787 return eventNotHandledErr;
9703 } 9788 }
@@ -9970,89 +10055,6 @@ main (void)
9970} 10055}
9971#endif 10056#endif
9972 10057
9973/* Table for translating Mac keycode to X keysym values. Contributed
9974 by Sudhir Shenoy.
9975 Mapping for special keys is now identical to that in Apple X11
9976 except `clear' (-> <clear>) on the KeyPad, `enter' (-> <kp-enter>)
9977 on the right of the Cmd key on laptops, and fn + `enter' (->
9978 <linefeed>). */
9979static unsigned char keycode_to_xkeysym_table[] = {
9980 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9981 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9982 /*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9983
9984 /*0x30*/ 0x09 /*tab*/, 0 /*0x0020 space*/, 0, 0x08 /*backspace*/,
9985 /*0x34*/ 0x8d /*enter on laptops*/, 0x1b /*escape*/, 0, 0,
9986 /*0x38*/ 0, 0, 0, 0,
9987 /*0x3C*/ 0, 0, 0, 0,
9988
9989 /*0x40*/ 0, 0xae /*kp-.*/, 0, 0xaa /*kp-**/,
9990 /*0x44*/ 0, 0xab /*kp-+*/, 0, 0x0b /*clear*/,
9991 /*0x48*/ 0, 0, 0, 0xaf /*kp-/*/,
9992 /*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp--*/, 0,
9993
9994 /*0x50*/ 0, 0xbd /*kp-=*/, 0xb0 /*kp-0*/, 0xb1 /*kp-1*/,
9995 /*0x54*/ 0xb2 /*kp-2*/, 0xb3 /*kp-3*/, 0xb4 /*kp-4*/, 0xb5 /*kp-5*/,
9996 /*0x58*/ 0xb6 /*kp-6*/, 0xb7 /*kp-7*/, 0, 0xb8 /*kp-8*/,
9997 /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0,
9998
9999 /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/,
10000 /*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/,
10001 /*0x68*/ 0, 0xca /*f13*/, 0xcd /*f16*/, 0xcb /*f14*/,
10002 /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/,
10003
10004 /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/,
10005 /*0x74*/ 0x55 /*pgup*/, 0xff /*delete*/, 0xc1 /*f4*/, 0x57 /*end*/,
10006 /*0x78*/ 0xbf /*f2*/, 0x56 /*pgdown*/, 0xbe /*f1*/, 0x51 /*left*/,
10007 /*0x7C*/ 0x53 /*right*/, 0x54 /*down*/, 0x52 /*up*/, 0
10008};
10009
10010
10011static int
10012keycode_to_xkeysym (int keyCode, int *xKeySym)
10013{
10014 *xKeySym = keycode_to_xkeysym_table [keyCode & 0x7f];
10015 return *xKeySym != 0;
10016}
10017
10018#ifdef MAC_OSX
10019/* Table for translating Mac keycode with the laptop `fn' key to that
10020 without it. Destination symbols in comments are keys on US
10021 keyboard, and they may not be the same on other types of keyboards.
10022 If the destination is identical to the source (f1 ... f12), it
10023 doesn't map `fn' key to a modifier. */
10024static unsigned char fn_keycode_to_keycode_table[] = {
10025 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10026 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10027 /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10028
10029 /*0x30*/ 0, 0, 0, 0,
10030 /*0x34*/ 0, 0, 0, 0,
10031 /*0x38*/ 0, 0, 0, 0,
10032 /*0x3C*/ 0, 0, 0, 0,
10033
10034 /*0x40*/ 0, 0x2f /*kp-. -> '.'*/, 0, 0x23 /*kp-* -> 'p'*/,
10035 /*0x44*/ 0, 0x2c /*kp-+ -> '/'*/, 0, 0x16 /*clear -> '6'*/,
10036 /*0x48*/ 0, 0, 0, 0x1d /*kp-/ -> '0'*/,
10037 /*0x4C*/ 0x24 /*kp-enter -> return*/, 0, 0x29 /*kp-- -> ';'*/, 0,
10038
10039 /*0x50*/ 0, 0x1b /*kp-= -> '-'*/, 0x2e /*kp-0 -> 'm'*/, 0x26 /*kp-1 -> 'j'*/,
10040 /*0x54*/ 0x28 /*kp-2 -> 'k'*/, 0x25 /*kp-3 -> 'l'*/, 0x20 /*kp-4 -> 'u'*/, 0x22 /*kp-5 ->'i'*/,
10041 /*0x58*/ 0x1f /*kp-6 -> 'o'*/, 0x1a /*kp-7 -> '7'*/, 0, 0x1c /*kp-8 -> '8'*/,
10042 /*0x5C*/ 0x19 /*kp-9 -> '9'*/, 0, 0, 0,
10043
10044 /*0x60*/ 0x60 /*f5 = f5*/, 0x61 /*f6 = f6*/, 0x62 /*f7 = f7*/, 0x63 /*f3 = f3*/,
10045 /*0x64*/ 0x64 /*f8 = f8*/, 0x65 /*f9 = f9*/, 0, 0x67 /*f11 = f11*/,
10046 /*0x68*/ 0, 0, 0, 0,
10047 /*0x6C*/ 0, 0x6d /*f10 = f10*/, 0, 0x6f /*f12 = f12*/,
10048
10049 /*0x70*/ 0, 0, 0, 0x7b /*home -> left*/,
10050 /*0x74*/ 0x7e /*pgup -> up*/, 0x33 /*delete -> backspace*/, 0x76 /*f4 = f4*/, 0x7c /*end -> right*/,
10051 /*0x78*/ 0x78 /*f2 = f2*/, 0x7d /*pgdown -> down*/, 0x7a /*f1 = f1*/, 0,
10052 /*0x7C*/ 0, 0, 0, 0
10053};
10054#endif /* MAC_OSX */
10055
10056#if !USE_CARBON_EVENTS 10058#if !USE_CARBON_EVENTS
10057static RgnHandle mouse_region = NULL; 10059static RgnHandle mouse_region = NULL;
10058 10060
@@ -10679,7 +10681,6 @@ XTread_socket (sd, expected, hold_quit)
10679 case autoKey: 10681 case autoKey:
10680 { 10682 {
10681 int keycode = (er.message & keyCodeMask) >> 8; 10683 int keycode = (er.message & keyCodeMask) >> 8;
10682 int xkeysym;
10683 static SInt16 last_key_script = -1; 10684 static SInt16 last_key_script = -1;
10684 SInt16 current_key_script; 10685 SInt16 current_key_script;
10685 UInt32 modifiers = er.modifiers, mapped_modifiers; 10686 UInt32 modifiers = er.modifiers, mapped_modifiers;
@@ -10758,10 +10759,10 @@ XTread_socket (sd, expected, hold_quit)
10758 && fn_keycode_to_keycode_table[keycode]) 10759 && fn_keycode_to_keycode_table[keycode])
10759 keycode = fn_keycode_to_keycode_table[keycode]; 10760 keycode = fn_keycode_to_keycode_table[keycode];
10760#endif 10761#endif
10761 if (keycode_to_xkeysym (keycode, &xkeysym)) 10762 if (keycode <= 0x7f && keycode_to_xkeysym_table [keycode])
10762 { 10763 {
10763 inev.kind = NON_ASCII_KEYSTROKE_EVENT; 10764 inev.kind = NON_ASCII_KEYSTROKE_EVENT;
10764 inev.code = 0xff00 | xkeysym; 10765 inev.code = 0xff00 | keycode_to_xkeysym_table [keycode];
10765#ifdef MAC_OSX 10766#ifdef MAC_OSX
10766 if (modifiers & kEventKeyModifierFnMask 10767 if (modifiers & kEventKeyModifierFnMask
10767 && keycode <= 0x7f 10768 && keycode <= 0x7f
@@ -11101,7 +11102,7 @@ mac_initialize_display_info ()
11101#ifdef MAC_OSX 11102#ifdef MAC_OSX
11102 /* HasDepth returns true if it is possible to have a 32 bit display, 11103 /* HasDepth returns true if it is possible to have a 32 bit display,
11103 but this may not be what is actually used. Mac OSX can do better. */ 11104 but this may not be what is actually used. Mac OSX can do better. */
11104 dpyinfo->color_p = 1; 11105 dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1;
11105 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay); 11106 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay);
11106 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay); 11107 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay);
11107 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay); 11108 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay);
@@ -11232,11 +11233,14 @@ x_delete_display (dpyinfo)
11232 xfree (dpyinfo->font_table[i].name); 11233 xfree (dpyinfo->font_table[i].name);
11233 } 11234 }
11234 11235
11235 if (dpyinfo->font_table->font_encoder) 11236 if (dpyinfo->font_table)
11236 xfree (dpyinfo->font_table->font_encoder); 11237 {
11237 11238 if (dpyinfo->font_table->font_encoder)
11238 xfree (dpyinfo->font_table); 11239 xfree (dpyinfo->font_table->font_encoder);
11239 xfree (dpyinfo->mac_id_name); 11240 xfree (dpyinfo->font_table);
11241 }
11242 if (dpyinfo->mac_id_name)
11243 xfree (dpyinfo->mac_id_name);
11240 11244
11241 if (x_display_list == 0) 11245 if (x_display_list == 0)
11242 { 11246 {
diff --git a/src/msdos.c b/src/msdos.c
index 636ac75d000..b6f6a75ac60 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 0a560dbc2d9..5f42683753d 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/puresize.h b/src/puresize.h
index c1e4624564c..d0ba0c4e57e 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 (1240000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) 46#define BASE_PURESIZE (1124000 + 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 fe124091009..5d532a9d8dd 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 ();
@@ -179,7 +182,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
179 re_set_syntax (old); 182 re_set_syntax (old);
180 UNBLOCK_INPUT; 183 UNBLOCK_INPUT;
181 if (val) 184 if (val)
182 Fsignal (Qinvalid_regexp, Fcons (build_string (val), Qnil)); 185 xsignal1 (Qinvalid_regexp, build_string (val));
183 186
184 cp->regexp = Fcopy_sequence (pattern); 187 cp->regexp = Fcopy_sequence (pattern);
185} 188}
@@ -266,16 +269,6 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
266 return &cp->buf; 269 return &cp->buf;
267} 270}
268 271
269/* Error condition used for failing searches */
270Lisp_Object Qsearch_failed;
271
272Lisp_Object
273signal_failure (arg)
274 Lisp_Object arg;
275{
276 Fsignal (Qsearch_failed, Fcons (arg, Qnil));
277 return Qnil;
278}
279 272
280static Lisp_Object 273static Lisp_Object
281looking_at_1 (string, posix) 274looking_at_1 (string, posix)
@@ -948,7 +941,8 @@ search_command (string, bound, noerror, count, direction, RE, posix)
948 if (np <= 0) 941 if (np <= 0)
949 { 942 {
950 if (NILP (noerror)) 943 if (NILP (noerror))
951 return signal_failure (string); 944 xsignal1 (Qsearch_failed, string);
945
952 if (!EQ (noerror, Qt)) 946 if (!EQ (noerror, Qt))
953 { 947 {
954 if (lim < BEGV || lim > ZV) 948 if (lim < BEGV || lim > ZV)
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/syntax.c b/src/syntax.c
index 9959c17ad47..eee9151f878 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2347,10 +2347,9 @@ scan_lists (from, count, depth, sexpflag)
2347 close1: 2347 close1:
2348 if (!--depth) goto done; 2348 if (!--depth) goto done;
2349 if (depth < min_depth) 2349 if (depth < min_depth)
2350 Fsignal (Qscan_error, 2350 xsignal3 (Qscan_error,
2351 Fcons (build_string ("Containing expression ends prematurely"), 2351 build_string ("Containing expression ends prematurely"),
2352 Fcons (make_number (last_good), 2352 make_number (last_good), make_number (from));
2353 Fcons (make_number (from), Qnil))));
2354 break; 2353 break;
2355 2354
2356 case Sstring: 2355 case Sstring:
@@ -2499,10 +2498,9 @@ scan_lists (from, count, depth, sexpflag)
2499 open2: 2498 open2:
2500 if (!--depth) goto done2; 2499 if (!--depth) goto done2;
2501 if (depth < min_depth) 2500 if (depth < min_depth)
2502 Fsignal (Qscan_error, 2501 xsignal3 (Qscan_error,
2503 Fcons (build_string ("Containing expression ends prematurely"), 2502 build_string ("Containing expression ends prematurely"),
2504 Fcons (make_number (last_good), 2503 make_number (last_good), make_number (from));
2505 Fcons (make_number (from), Qnil))));
2506 break; 2504 break;
2507 2505
2508 case Sendcomment: 2506 case Sendcomment:
@@ -2571,12 +2569,9 @@ scan_lists (from, count, depth, sexpflag)
2571 return val; 2569 return val;
2572 2570
2573 lose: 2571 lose:
2574 Fsignal (Qscan_error, 2572 xsignal3 (Qscan_error,
2575 Fcons (build_string ("Unbalanced parentheses"), 2573 build_string ("Unbalanced parentheses"),
2576 Fcons (make_number (last_good), 2574 make_number (last_good), make_number (from));
2577 Fcons (make_number (from), Qnil))));
2578 abort ();
2579 /* NOTREACHED */
2580} 2575}
2581 2576
2582DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, 2577DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
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..c093eab599e 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2256,16 +2256,17 @@ convert_time (FILETIME ft)
2256 2256
2257 SystemTimeToFileTime (&st, &utc_base_ft); 2257 SystemTimeToFileTime (&st, &utc_base_ft);
2258 utc_base = (long double) utc_base_ft.dwHighDateTime 2258 utc_base = (long double) utc_base_ft.dwHighDateTime
2259 * 4096 * 1024 * 1024 + utc_base_ft.dwLowDateTime; 2259 * 4096.0L * 1024.0L * 1024.0L + utc_base_ft.dwLowDateTime;
2260 init = 1; 2260 init = 1;
2261 } 2261 }
2262 2262
2263 if (CompareFileTime (&ft, &utc_base_ft) < 0) 2263 if (CompareFileTime (&ft, &utc_base_ft) < 0)
2264 return 0; 2264 return 0;
2265 2265
2266 ret = (long double) ft.dwHighDateTime * 4096 * 1024 * 1024 + ft.dwLowDateTime; 2266 ret = (long double) ft.dwHighDateTime
2267 * 4096.0L * 1024.0L * 1024.0L + ft.dwLowDateTime;
2267 ret -= utc_base; 2268 ret -= utc_base;
2268 return (time_t) (ret * 1e-7); 2269 return (time_t) (ret * 1e-7L);
2269} 2270}
2270 2271
2271void 2272void
@@ -2700,6 +2701,9 @@ utime (const char *name, struct utimbuf *times)
2700int (PASCAL *pfn_WSAStartup) (WORD wVersionRequired, LPWSADATA lpWSAData); 2701int (PASCAL *pfn_WSAStartup) (WORD wVersionRequired, LPWSADATA lpWSAData);
2701void (PASCAL *pfn_WSASetLastError) (int iError); 2702void (PASCAL *pfn_WSASetLastError) (int iError);
2702int (PASCAL *pfn_WSAGetLastError) (void); 2703int (PASCAL *pfn_WSAGetLastError) (void);
2704int (PASCAL *pfn_WSAEventSelect) (SOCKET s, HANDLE hEventObject, long lNetworkEvents);
2705HANDLE (PASCAL *pfn_WSACreateEvent) (void);
2706int (PASCAL *pfn_WSACloseEvent) (HANDLE hEvent);
2703int (PASCAL *pfn_socket) (int af, int type, int protocol); 2707int (PASCAL *pfn_socket) (int af, int type, int protocol);
2704int (PASCAL *pfn_bind) (SOCKET s, const struct sockaddr *addr, int namelen); 2708int (PASCAL *pfn_bind) (SOCKET s, const struct sockaddr *addr, int namelen);
2705int (PASCAL *pfn_connect) (SOCKET s, const struct sockaddr *addr, int namelen); 2709int (PASCAL *pfn_connect) (SOCKET s, const struct sockaddr *addr, int namelen);
@@ -2769,7 +2773,7 @@ init_winsock (int load_now)
2769 = (void *) GetProcAddress (GetModuleHandle ("kernel32.dll"), 2773 = (void *) GetProcAddress (GetModuleHandle ("kernel32.dll"),
2770 "SetHandleInformation"); 2774 "SetHandleInformation");
2771 2775
2772 winsock_lib = LoadLibrary ("wsock32.dll"); 2776 winsock_lib = LoadLibrary ("Ws2_32.dll");
2773 2777
2774 if (winsock_lib != NULL) 2778 if (winsock_lib != NULL)
2775 { 2779 {
@@ -2782,6 +2786,9 @@ init_winsock (int load_now)
2782 LOAD_PROC( WSAStartup ); 2786 LOAD_PROC( WSAStartup );
2783 LOAD_PROC( WSASetLastError ); 2787 LOAD_PROC( WSASetLastError );
2784 LOAD_PROC( WSAGetLastError ); 2788 LOAD_PROC( WSAGetLastError );
2789 LOAD_PROC( WSAEventSelect );
2790 LOAD_PROC( WSACreateEvent );
2791 LOAD_PROC( WSACloseEvent );
2785 LOAD_PROC( socket ); 2792 LOAD_PROC( socket );
2786 LOAD_PROC( bind ); 2793 LOAD_PROC( bind );
2787 LOAD_PROC( connect ); 2794 LOAD_PROC( connect );
@@ -3295,6 +3302,8 @@ sys_listen (int s, int backlog)
3295 int rc = pfn_listen (SOCK_HANDLE (s), backlog); 3302 int rc = pfn_listen (SOCK_HANDLE (s), backlog);
3296 if (rc == SOCKET_ERROR) 3303 if (rc == SOCKET_ERROR)
3297 set_errno (); 3304 set_errno ();
3305 else
3306 fd_info[s].flags |= FILE_LISTEN;
3298 return rc; 3307 return rc;
3299 } 3308 }
3300 h_errno = ENOTSOCK; 3309 h_errno = ENOTSOCK;
@@ -3332,14 +3341,18 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen)
3332 } 3341 }
3333 3342
3334 check_errno (); 3343 check_errno ();
3335 if (fd_info[s].flags & FILE_SOCKET) 3344 if (fd_info[s].flags & FILE_LISTEN)
3336 { 3345 {
3337 SOCKET t = pfn_accept (SOCK_HANDLE (s), addr, addrlen); 3346 SOCKET t = pfn_accept (SOCK_HANDLE (s), addr, addrlen);
3338 if (t != INVALID_SOCKET) 3347 int fd = -1;
3339 return socket_to_fd (t); 3348 if (t == INVALID_SOCKET)
3349 set_errno ();
3350 else
3351 fd = socket_to_fd (t);
3340 3352
3341 set_errno (); 3353 fd_info[s].cp->status = STATUS_READ_ACKNOWLEDGED;
3342 return -1; 3354 ResetEvent (fd_info[s].cp->char_avail);
3355 return fd;
3343 } 3356 }
3344 h_errno = ENOTSOCK; 3357 h_errno = ENOTSOCK;
3345 return -1; 3358 return -1;
@@ -3641,6 +3654,36 @@ _sys_read_ahead (int fd)
3641 return cp->status; 3654 return cp->status;
3642} 3655}
3643 3656
3657int _sys_wait_accept (int fd)
3658{
3659 HANDLE hEv;
3660 child_process * cp;
3661 int rc;
3662
3663 if (fd < 0 || fd >= MAXDESC)
3664 return STATUS_READ_ERROR;
3665
3666 cp = fd_info[fd].cp;
3667
3668 if (cp == NULL || cp->fd != fd || cp->status != STATUS_READ_READY)
3669 return STATUS_READ_ERROR;
3670
3671 cp->status = STATUS_READ_FAILED;
3672
3673 hEv = pfn_WSACreateEvent ();
3674 rc = pfn_WSAEventSelect (SOCK_HANDLE (fd), hEv, FD_ACCEPT);
3675 if (rc != SOCKET_ERROR)
3676 {
3677 rc = WaitForSingleObject (hEv, INFINITE);
3678 pfn_WSAEventSelect (SOCK_HANDLE (fd), NULL, 0);
3679 pfn_WSACloseEvent (hEv);
3680 if (rc == WAIT_OBJECT_0)
3681 cp->status = STATUS_READ_SUCCEEDED;
3682 }
3683
3684 return cp->status;
3685}
3686
3644int 3687int
3645sys_read (int fd, char * buffer, unsigned int count) 3688sys_read (int fd, char * buffer, unsigned int count)
3646{ 3689{
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/w32fns.c b/src/w32fns.c
index 66cac34b2d9..68fcced88c2 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2066,6 +2066,7 @@ w32_createwindow (f)
2066{ 2066{
2067 HWND hwnd; 2067 HWND hwnd;
2068 RECT rect; 2068 RECT rect;
2069 Lisp_Object top, left;
2069 2070
2070 rect.left = rect.top = 0; 2071 rect.left = rect.top = 0;
2071 rect.right = FRAME_PIXEL_WIDTH (f); 2072 rect.right = FRAME_PIXEL_WIDTH (f);
@@ -2081,12 +2082,17 @@ w32_createwindow (f)
2081 w32_init_class (hinst); 2082 w32_init_class (hinst);
2082 } 2083 }
2083 2084
2085 /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
2086 for anything that is not a number and is not Qunbound. */
2087 left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
2088 top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
2089
2084 FRAME_W32_WINDOW (f) = hwnd 2090 FRAME_W32_WINDOW (f) = hwnd
2085 = CreateWindow (EMACS_CLASS, 2091 = CreateWindow (EMACS_CLASS,
2086 f->namebuf, 2092 f->namebuf,
2087 f->output_data.w32->dwStyle | WS_CLIPCHILDREN, 2093 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
2088 CW_USEDEFAULT, 2094 EQ (left, Qunbound) ? CW_USEDEFAULT : XINT (left),
2089 SW_SHOW, 2095 EQ (top, Qunbound) ? CW_USEDEFAULT : XINT (top),
2090 rect.right - rect.left, 2096 rect.right - rect.left,
2091 rect.bottom - rect.top, 2097 rect.bottom - rect.top,
2092 NULL, 2098 NULL,
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 fdbbbb6327f..b564ed3bd2b 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5312,20 +5312,52 @@ x_calc_absolute_position (f)
5312{ 5312{
5313 int flags = f->size_hint_flags; 5313 int flags = f->size_hint_flags;
5314 5314
5315 /* Treat negative positions as relative to the leftmost bottommost 5315 /* The sum of the widths of the frame's left and right borders, and
5316 the sum of the heights of the frame's top and bottom borders (in
5317 pixels) drawn by Windows. */
5318 unsigned int left_right_borders_width, top_bottom_borders_height;
5319
5320 /* Try to get the actual values of these two variables. We compute
5321 the border width (height) by subtracting the width (height) of
5322 the frame's client area from the width (height) of the frame's
5323 entire window. */
5324 WINDOWPLACEMENT wp = { 0 };
5325 RECT client_rect = { 0 };
5326
5327 if (GetWindowPlacement (FRAME_W32_WINDOW (f), &wp)
5328 && GetClientRect (FRAME_W32_WINDOW (f), &client_rect))
5329 {
5330 left_right_borders_width =
5331 (wp.rcNormalPosition.right - wp.rcNormalPosition.left) -
5332 (client_rect.right - client_rect.left);
5333
5334 top_bottom_borders_height =
5335 (wp.rcNormalPosition.bottom - wp.rcNormalPosition.top) -
5336 (client_rect.bottom - client_rect.top);
5337 }
5338 else
5339 {
5340 /* Use sensible default values. */
5341 left_right_borders_width = 8;
5342 top_bottom_borders_height = 32;
5343 }
5344
5345 /* Treat negative positions as relative to the rightmost bottommost
5316 position that fits on the screen. */ 5346 position that fits on the screen. */
5317 if (flags & XNegative) 5347 if (flags & XNegative)
5318 f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width 5348 f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width
5319 - FRAME_PIXEL_WIDTH (f) 5349 - FRAME_PIXEL_WIDTH (f)
5320 + f->left_pos); 5350 + f->left_pos
5351 - (left_right_borders_width - 1));
5321 5352
5322 if (flags & YNegative) 5353 if (flags & YNegative)
5323 f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height 5354 f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height
5324 - FRAME_PIXEL_HEIGHT (f) 5355 - FRAME_PIXEL_HEIGHT (f)
5325 + f->top_pos); 5356 + f->top_pos
5326 /* The left_pos and top_pos 5357 - (top_bottom_borders_height - 1));
5327 are now relative to the top and left screen edges, 5358
5328 so the flags should correspond. */ 5359 /* The left_pos and top_pos are now relative to the top and left
5360 screen edges, so the flags should correspond. */
5329 f->size_hint_flags &= ~ (XNegative | YNegative); 5361 f->size_hint_flags &= ~ (XNegative | YNegative);
5330} 5362}
5331 5363
diff --git a/src/window.c b/src/window.c
index 77e155675dd..879777d25e1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4961,9 +4961,9 @@ window_scroll_pixel_based (window, n, whole, noerror)
4961 else if (noerror) 4961 else if (noerror)
4962 return; 4962 return;
4963 else if (n < 0) /* could happen with empty buffers */ 4963 else if (n < 0) /* could happen with empty buffers */
4964 Fsignal (Qbeginning_of_buffer, Qnil); 4964 xsignal0 (Qbeginning_of_buffer);
4965 else 4965 else
4966 Fsignal (Qend_of_buffer, Qnil); 4966 xsignal0 (Qend_of_buffer);
4967 } 4967 }
4968 else 4968 else
4969 { 4969 {
@@ -4974,7 +4974,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4974 else if (noerror) 4974 else if (noerror)
4975 return; 4975 return;
4976 else 4976 else
4977 Fsignal (Qbeginning_of_buffer, Qnil); 4977 xsignal0 (Qbeginning_of_buffer);
4978 } 4978 }
4979 4979
4980 /* If control gets here, then we vscrolled. */ 4980 /* If control gets here, then we vscrolled. */
@@ -5175,7 +5175,7 @@ window_scroll_line_based (window, n, whole, noerror)
5175 if (noerror) 5175 if (noerror)
5176 return; 5176 return;
5177 else 5177 else
5178 Fsignal (Qbeginning_of_buffer, Qnil); 5178 xsignal0 (Qbeginning_of_buffer);
5179 } 5179 }
5180 5180
5181 if (pos < ZV) 5181 if (pos < ZV)
@@ -5261,7 +5261,7 @@ window_scroll_line_based (window, n, whole, noerror)
5261 if (noerror) 5261 if (noerror)
5262 return; 5262 return;
5263 else 5263 else
5264 Fsignal (Qend_of_buffer, Qnil); 5264 xsignal0 (Qend_of_buffer);
5265 } 5265 }
5266} 5266}
5267 5267
diff --git a/src/xdisp.c b/src/xdisp.c
index 092c5d7c520..76ab430386c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3867,7 +3867,7 @@ handle_single_display_spec (it, spec, object, position,
3867{ 3867{
3868 Lisp_Object form; 3868 Lisp_Object form;
3869 Lisp_Object location, value; 3869 Lisp_Object location, value;
3870 struct text_pos start_pos; 3870 struct text_pos start_pos, save_pos;
3871 int valid_p; 3871 int valid_p;
3872 3872
3873 /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. 3873 /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM.
@@ -4084,7 +4084,10 @@ handle_single_display_spec (it, spec, object, position,
4084 /* Save current settings of IT so that we can restore them 4084 /* Save current settings of IT so that we can restore them
4085 when we are finished with the glyph property value. */ 4085 when we are finished with the glyph property value. */
4086 4086
4087 save_pos = it->position;
4088 it->position = *position;
4087 push_it (it); 4089 push_it (it);
4090 it->position = save_pos;
4088 4091
4089 it->area = TEXT_AREA; 4092 it->area = TEXT_AREA;
4090 it->what = IT_IMAGE; 4093 it->what = IT_IMAGE;
@@ -4158,7 +4161,11 @@ handle_single_display_spec (it, spec, object, position,
4158 { 4161 {
4159 /* Save current settings of IT so that we can restore them 4162 /* Save current settings of IT so that we can restore them
4160 when we are finished with the glyph property value. */ 4163 when we are finished with the glyph property value. */
4164 save_pos = it->position;
4165 it->position = *position;
4161 push_it (it); 4166 push_it (it);
4167 it->position = save_pos;
4168
4162 if (NILP (location)) 4169 if (NILP (location))
4163 it->area = TEXT_AREA; 4170 it->area = TEXT_AREA;
4164 else if (EQ (location, Qleft_margin)) 4171 else if (EQ (location, Qleft_margin))
@@ -4969,6 +4976,12 @@ pop_it (it)
4969 case GET_FROM_STRETCH: 4976 case GET_FROM_STRETCH:
4970 it->object = p->u.comp.object; 4977 it->object = p->u.comp.object;
4971 break; 4978 break;
4979 case GET_FROM_BUFFER:
4980 it->object = it->w->buffer;
4981 break;
4982 case GET_FROM_STRING:
4983 it->object = it->string;
4984 break;
4972 } 4985 }
4973 it->end_charpos = p->end_charpos; 4986 it->end_charpos = p->end_charpos;
4974 it->string_nchars = p->string_nchars; 4987 it->string_nchars = p->string_nchars;
@@ -5288,7 +5301,6 @@ reseat_1 (it, pos, set_stop_p)
5288 xassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV); 5301 xassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV);
5289 5302
5290 it->current.pos = it->position = pos; 5303 it->current.pos = it->position = pos;
5291 XSETBUFFER (it->object, current_buffer);
5292 it->end_charpos = ZV; 5304 it->end_charpos = ZV;
5293 it->dpvec = NULL; 5305 it->dpvec = NULL;
5294 it->current.dpvec_index = -1; 5306 it->current.dpvec_index = -1;
@@ -5786,14 +5798,12 @@ set_iterator_to_next (it, reseat_p)
5786 { 5798 {
5787 IT_STRING_BYTEPOS (*it) += it->len; 5799 IT_STRING_BYTEPOS (*it) += it->len;
5788 IT_STRING_CHARPOS (*it) += it->cmp_len; 5800 IT_STRING_CHARPOS (*it) += it->cmp_len;
5789 it->object = it->string;
5790 goto consider_string_end; 5801 goto consider_string_end;
5791 } 5802 }
5792 else if (it->method == GET_FROM_BUFFER) 5803 else if (it->method == GET_FROM_BUFFER)
5793 { 5804 {
5794 IT_BYTEPOS (*it) += it->len; 5805 IT_BYTEPOS (*it) += it->len;
5795 IT_CHARPOS (*it) += it->cmp_len; 5806 IT_CHARPOS (*it) += it->cmp_len;
5796 it->object = it->w->buffer;
5797 } 5807 }
5798 break; 5808 break;
5799 5809
@@ -6033,9 +6043,7 @@ next_element_from_string (it)
6033 } 6043 }
6034 } 6044 }
6035 6045
6036 /* Record what we have and where it came from. Note that we store a 6046 /* Record what we have and where it came from. */
6037 buffer position in IT->position although it could arguably be a
6038 string position. */
6039 it->what = IT_CHARACTER; 6047 it->what = IT_CHARACTER;
6040 it->object = it->string; 6048 it->object = it->string;
6041 it->position = position; 6049 it->position = position;
@@ -6750,6 +6758,10 @@ move_it_to (it, to_charpos, to_x, to_y, to_vpos, op)
6750 if (reached) 6758 if (reached)
6751 break; 6759 break;
6752 } 6760 }
6761 else if (BUFFERP (it->object)
6762 && it->method == GET_FROM_BUFFER
6763 && IT_CHARPOS (*it) >= to_charpos)
6764 skip = MOVE_POS_MATCH_OR_ZV;
6753 else 6765 else
6754 skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS); 6766 skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS);
6755 6767
@@ -16553,6 +16565,7 @@ display_mode_line (w, face_id, format)
16553 kboard-local variables in the mode_line_format will get the right 16565 kboard-local variables in the mode_line_format will get the right
16554 values. */ 16566 values. */
16555 push_kboard (FRAME_KBOARD (it.f)); 16567 push_kboard (FRAME_KBOARD (it.f));
16568 record_unwind_save_match_data ();
16556 display_mode_element (&it, 0, 0, 0, format, Qnil, 0); 16569 display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
16557 pop_kboard (); 16570 pop_kboard ();
16558 16571
diff --git a/src/xfaces.c b/src/xfaces.c
index 398b56f42b6..18e5d9a6119 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -489,7 +489,6 @@ static int font_scalable_p P_ ((struct font_name *));
489static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int)); 489static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int));
490static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); 490static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *));
491static unsigned char *xstrlwr P_ ((unsigned char *)); 491static unsigned char *xstrlwr P_ ((unsigned char *));
492static void signal_error P_ ((char *, Lisp_Object));
493static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); 492static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int));
494static void load_face_font P_ ((struct frame *, struct face *, int)); 493static void load_face_font P_ ((struct frame *, struct face *, int));
495static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); 494static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *));
@@ -858,17 +857,6 @@ xstrlwr (s)
858} 857}
859 858
860 859
861/* Signal `error' with message S, and additional argument ARG. */
862
863static void
864signal_error (s, arg)
865 char *s;
866 Lisp_Object arg;
867{
868 Fsignal (Qerror, Fcons (build_string (s), Fcons (arg, Qnil)));
869}
870
871
872/* If FRAME is nil, return a pointer to the selected frame. 860/* If FRAME is nil, return a pointer to the selected frame.
873 Otherwise, check that FRAME is a live frame, and return a pointer 861 Otherwise, check that FRAME is a live frame, and return a pointer
874 to it. NPARAM is the parameter number of FRAME, for 862 to it. NPARAM is the parameter number of FRAME, for
@@ -3290,7 +3278,7 @@ resolve_face_name (face_name, signal_p)
3290 if (EQ (hare, tortoise)) 3278 if (EQ (hare, tortoise))
3291 { 3279 {
3292 if (signal_p) 3280 if (signal_p)
3293 Fsignal (Qcircular_list, Fcons (orig_face, Qnil)); 3281 xsignal1 (Qcircular_list, orig_face);
3294 return Qdefault; 3282 return Qdefault;
3295 } 3283 }
3296 } 3284 }
diff --git a/src/xfns.c b/src/xfns.c
index 0e4b8860464..3cadc8504f4 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -770,9 +770,7 @@ x_decode_color (f, color_name, mono_color)
770 if (x_defined_color (f, SDATA (color_name), &cdef, 1)) 770 if (x_defined_color (f, SDATA (color_name), &cdef, 1))
771 return cdef.pixel; 771 return cdef.pixel;
772 772
773 Fsignal (Qerror, Fcons (build_string ("Undefined color"), 773 signal_error ("Undefined color", color_name);
774 Fcons (color_name, Qnil)));
775 return 0;
776} 774}
777 775
778 776
diff --git a/src/xselect.c b/src/xselect.c
index 5e6ffd806f0..211d207bac4 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -562,11 +562,9 @@ x_get_local_selection (selection_symbol, target_type, local_request)
562 && INTEGERP (XCAR (XCDR (check))) 562 && INTEGERP (XCAR (XCDR (check)))
563 && NILP (XCDR (XCDR (check)))))) 563 && NILP (XCDR (XCDR (check))))))
564 return value; 564 return value;
565 else 565
566 return 566 signal_error ("Invalid data returned by selection-conversion function",
567 Fsignal (Qerror, 567 list2 (handler_fn, value));
568 Fcons (build_string ("invalid data returned by selection-conversion function"),
569 Fcons (handler_fn, Fcons (value, Qnil))));
570} 568}
571 569
572/* Subroutines of x_reply_selection_request. */ 570/* Subroutines of x_reply_selection_request. */
@@ -1356,8 +1354,7 @@ copy_multiple_data (obj)
1356 CHECK_VECTOR (vec2); 1354 CHECK_VECTOR (vec2);
1357 if (XVECTOR (vec2)->size != 2) 1355 if (XVECTOR (vec2)->size != 2)
1358 /* ??? Confusing error message */ 1356 /* ??? Confusing error message */
1359 Fsignal (Qerror, Fcons (build_string ("vectors must be of length 2"), 1357 signal_error ("Vectors must be of length 2", vec2);
1360 Fcons (vec2, Qnil)));
1361 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil); 1358 XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil);
1362 XVECTOR (XVECTOR (vec)->contents [i])->contents [0] 1359 XVECTOR (XVECTOR (vec)->contents [i])->contents [0]
1363 = XVECTOR (vec2)->contents [0]; 1360 = XVECTOR (vec2)->contents [0];
@@ -1734,19 +1731,15 @@ x_get_window_property_as_lisp_data (display, window, property, target_type,
1734 there_is_a_selection_owner 1731 there_is_a_selection_owner
1735 = XGetSelectionOwner (display, selection_atom); 1732 = XGetSelectionOwner (display, selection_atom);
1736 UNBLOCK_INPUT; 1733 UNBLOCK_INPUT;
1737 Fsignal (Qerror, 1734 if (there_is_a_selection_owner)
1738 there_is_a_selection_owner 1735 signal_error ("Selection owner couldn't convert",
1739 ? Fcons (build_string ("selection owner couldn't convert"), 1736 actual_type
1740 actual_type 1737 ? list2 (target_type,
1741 ? Fcons (target_type, 1738 x_atom_to_symbol (display, actual_type))
1742 Fcons (x_atom_to_symbol (display, 1739 : target_type);
1743 actual_type), 1740 else
1744 Qnil)) 1741 signal_error ("No selection",
1745 : Fcons (target_type, Qnil)) 1742 x_atom_to_symbol (display, selection_atom));
1746 : Fcons (build_string ("no selection"),
1747 Fcons (x_atom_to_symbol (display,
1748 selection_atom),
1749 Qnil)));
1750 } 1743 }
1751 1744
1752 if (actual_type == dpyinfo->Xatom_INCR) 1745 if (actual_type == dpyinfo->Xatom_INCR)
@@ -1946,10 +1939,7 @@ lisp_data_to_selection_data (display, obj,
1946 { 1939 {
1947 if (SCHARS (obj) < SBYTES (obj)) 1940 if (SCHARS (obj) < SBYTES (obj))
1948 /* OBJ is a multibyte string containing a non-ASCII char. */ 1941 /* OBJ is a multibyte string containing a non-ASCII char. */
1949 Fsignal (Qerror, /* Qselection_error */ 1942 signal_error ("Non-ASCII string must be encoded in advance", obj);
1950 Fcons (build_string
1951 ("Non-ASCII string must be encoded in advance"),
1952 Fcons (obj, Qnil)));
1953 if (NILP (type)) 1943 if (NILP (type))
1954 type = QSTRING; 1944 type = QSTRING;
1955 *format_ret = 8; 1945 *format_ret = 8;
@@ -2010,10 +2000,7 @@ lisp_data_to_selection_data (display, obj,
2010 (*(Atom **) data_ret) [i] 2000 (*(Atom **) data_ret) [i]
2011 = symbol_to_x_atom (dpyinfo, display, XVECTOR (obj)->contents [i]); 2001 = symbol_to_x_atom (dpyinfo, display, XVECTOR (obj)->contents [i]);
2012 else 2002 else
2013 Fsignal (Qerror, /* Qselection_error */ 2003 signal_error ("All elements of selection vector must have same type", obj);
2014 Fcons (build_string
2015 ("all elements of selection vector must have same type"),
2016 Fcons (obj, Qnil)));
2017 } 2004 }
2018#if 0 /* #### MULTIPLE doesn't work yet */ 2005#if 0 /* #### MULTIPLE doesn't work yet */
2019 else if (VECTORP (XVECTOR (obj)->contents [0])) 2006 else if (VECTORP (XVECTOR (obj)->contents [0]))
@@ -2029,10 +2016,9 @@ lisp_data_to_selection_data (display, obj,
2029 { 2016 {
2030 Lisp_Object pair = XVECTOR (obj)->contents [i]; 2017 Lisp_Object pair = XVECTOR (obj)->contents [i];
2031 if (XVECTOR (pair)->size != 2) 2018 if (XVECTOR (pair)->size != 2)
2032 Fsignal (Qerror, 2019 signal_error (
2033 Fcons (build_string 2020 "Elements of the vector must be vectors of exactly two elements",
2034 ("elements of the vector must be vectors of exactly two elements"), 2021 pair);
2035 Fcons (pair, Qnil)));
2036 2022
2037 (*(Atom **) data_ret) [i * 2] 2023 (*(Atom **) data_ret) [i * 2]
2038 = symbol_to_x_atom (dpyinfo, display, 2024 = symbol_to_x_atom (dpyinfo, display,
@@ -2042,10 +2028,8 @@ lisp_data_to_selection_data (display, obj,
2042 XVECTOR (pair)->contents [1]); 2028 XVECTOR (pair)->contents [1]);
2043 } 2029 }
2044 else 2030 else
2045 Fsignal (Qerror, 2031 signal_error ("All elements of the vector must be of the same type",
2046 Fcons (build_string 2032 obj);
2047 ("all elements of the vector must be of the same type"),
2048 Fcons (obj, Qnil)));
2049 2033
2050 } 2034 }
2051#endif 2035#endif
@@ -2060,10 +2044,9 @@ lisp_data_to_selection_data (display, obj,
2060 if (CONSP (XVECTOR (obj)->contents [i])) 2044 if (CONSP (XVECTOR (obj)->contents [i]))
2061 *format_ret = 32; 2045 *format_ret = 32;
2062 else if (!INTEGERP (XVECTOR (obj)->contents [i])) 2046 else if (!INTEGERP (XVECTOR (obj)->contents [i]))
2063 Fsignal (Qerror, /* Qselection_error */ 2047 signal_error (/* Qselection_error */
2064 Fcons (build_string 2048 "Elements of selection vector must be integers or conses of integers",
2065 ("elements of selection vector must be integers or conses of integers"), 2049 obj);
2066 Fcons (obj, Qnil)));
2067 2050
2068 /* Use sizeof(long) even if it is more than 32 bits. See comment 2051 /* Use sizeof(long) even if it is more than 32 bits. See comment
2069 in x_get_window_property and x_fill_property_data. */ 2052 in x_get_window_property and x_fill_property_data. */
@@ -2080,9 +2063,7 @@ lisp_data_to_selection_data (display, obj,
2080 } 2063 }
2081 } 2064 }
2082 else 2065 else
2083 Fsignal (Qerror, /* Qselection_error */ 2066 signal_error (/* Qselection_error */ "Unrecognized selection data", obj);
2084 Fcons (build_string ("unrecognized selection data"),
2085 Fcons (obj, Qnil)));
2086 2067
2087 *type_ret = symbol_to_x_atom (dpyinfo, display, type); 2068 *type_ret = symbol_to_x_atom (dpyinfo, display, type);
2088} 2069}
@@ -2371,15 +2352,13 @@ initialize_cut_buffers (display, window)
2371 2352
2372 2353
2373#define CHECK_CUT_BUFFER(symbol) \ 2354#define CHECK_CUT_BUFFER(symbol) \
2374 { CHECK_SYMBOL ((symbol)); \ 2355 do { CHECK_SYMBOL ((symbol)); \
2375 if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \ 2356 if (!EQ((symbol), QCUT_BUFFER0) && !EQ((symbol), QCUT_BUFFER1) \
2376 && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \ 2357 && !EQ((symbol), QCUT_BUFFER2) && !EQ((symbol), QCUT_BUFFER3) \
2377 && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \ 2358 && !EQ((symbol), QCUT_BUFFER4) && !EQ((symbol), QCUT_BUFFER5) \
2378 && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \ 2359 && !EQ((symbol), QCUT_BUFFER6) && !EQ((symbol), QCUT_BUFFER7)) \
2379 Fsignal (Qerror, \ 2360 signal_error ("Doesn't name a cut buffer", (symbol)); \
2380 Fcons (build_string ("doesn't name a cut buffer"), \ 2361 } while (0)
2381 Fcons ((symbol), Qnil))); \
2382 }
2383 2362
2384DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal, 2363DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
2385 Sx_get_cut_buffer_internal, 1, 1, 0, 2364 Sx_get_cut_buffer_internal, 1, 1, 0,
@@ -2416,10 +2395,9 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
2416 return Qnil; 2395 return Qnil;
2417 2396
2418 if (format != 8 || type != XA_STRING) 2397 if (format != 8 || type != XA_STRING)
2419 Fsignal (Qerror, 2398 signal_error ("Cut buffer doesn't contain 8-bit data",
2420 Fcons (build_string ("cut buffer doesn't contain 8-bit data"), 2399 list2 (x_atom_to_symbol (display, type),
2421 Fcons (x_atom_to_symbol (display, type), 2400 make_number (format)));
2422 Fcons (make_number (format), Qnil))));
2423 2401
2424 ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil); 2402 ret = (bytes ? make_unibyte_string ((char *) data, bytes) : Qnil);
2425 /* Use xfree, not XFree, because x_get_window_property 2403 /* Use xfree, not XFree, because x_get_window_property
diff --git a/src/xterm.c b/src/xterm.c
index 14e71fffa80..9c0b25b08bf 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. */
@@ -7807,7 +7807,7 @@ x_connection_closed (dpy, error_message)
7807 7807
7808/* We specifically use it before defining it, so that gcc doesn't inline it, 7808/* We specifically use it before defining it, so that gcc doesn't inline it,
7809 otherwise gdb doesn't know how to properly put a breakpoint on it. */ 7809 otherwise gdb doesn't know how to properly put a breakpoint on it. */
7810static void x_error_quitter (Display *display, XErrorEvent *error); 7810static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN;
7811 7811
7812/* This is the first-level handler for X protocol errors. 7812/* This is the first-level handler for X protocol errors.
7813 It calls x_error_quitter or x_error_catcher. */ 7813 It calls x_error_quitter or x_error_catcher. */