aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2007-07-15 04:47:46 +0000
committerMiles Bader2007-07-15 04:47:46 +0000
commit8c406a9bc42ee77fcbbb4201fe8bda855eafd832 (patch)
tree14c8fa2e72341edd9db40b17079fd5208b1554c8 /src
parent9bdeb5e9bedd773cc6845bc29a98e1e2a208f1ff (diff)
parent6f8a87c027ebd6f9cfdac5c0df97d651227bec62 (diff)
downloademacs-8c406a9bc42ee77fcbbb4201fe8bda855eafd832.tar.gz
emacs-8c406a9bc42ee77fcbbb4201fe8bda855eafd832.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 806-813) - Merge from emacs--rel--22 - Update from CVS * emacs--rel--22 (patch 51-58) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 233-236) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-230
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog105
-rw-r--r--src/alloc.c13
-rw-r--r--src/editfns.c6
-rw-r--r--src/eval.c123
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keymap.c55
-rw-r--r--src/keymap.h2
-rw-r--r--src/lisp.h4
-rw-r--r--src/makefile.w32-in3
-rw-r--r--src/print.c2
-rw-r--r--src/process.c299
-rw-r--r--src/process.h76
-rw-r--r--src/search.c179
-rw-r--r--src/term.c11
-rw-r--r--src/w32fns.c12
-rw-r--r--src/window.c2
16 files changed, 553 insertions, 341 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 101dd489fb3..76c8c8ef163 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,98 @@
12007-07-14 Jason Rumney <jasonr@gnu.org>
2
3 * process.c [WINDOWSNT]: Don't undefine AF_INET6.
4
52007-07-14 Richard Stallman <rms@gnu.org>
6
7 * eval.c (maybe_call_debugger): New function.
8 (find_handler_clause): Use maybe_call_debugger.
9 Call it when the handler says `debug'.
10 Eliminate DEBUGGER_VALUE_PTR.
11 (Fsignal): Eliminate debugger_value.
12 (Qdebug): New variable.
13 (syms_of_eval): Initialize it.
14
152007-07-14 Juanma Barranquero <lekktu@gmail.com>
16
17 * eval.c (Fprogn):
18 * keyboard.c (Ftrack_mouse):
19 * print.c (Fwith_output_to_temp_buffer):
20 * window.c (Fsave_window_excursion): Doc fix.
21
222007-07-13 Stefan Monnier <monnier@iro.umontreal.ca>
23
24 * eval.c (init_eval_once): Bump max_lisp_eval_depth to 400.
25
262007-07-12 Stefan Monnier <monnier@iro.umontreal.ca>
27
28 * process.h (struct Lisp_Process): Turn slots infd, outfd,
29 kill_without_query, pty_flag, tick, update_tick, decoding_carryover,
30 inherit_coding_system_flag, filter_multibyte, adaptive_read_buffering,
31 read_output_delay, and read_output_skip from Lisp_Objects to ints.
32 Remove unused encoding_carryover.
33 * process.c: Adjust all functions accordingly.
34
352007-07-12 Richard Stallman <rms@gnu.org>
36
37 * term.c: Include unistd.h only if HAVE_UNISTD_H.
38
392007-07-11 Jason Rumney <jasonr@gnu.org>
40
41 * makefile.w32-in (LIBS): Include OLE32.
42
43 * w32fns.c (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
44 (w32_msg_pump) <WM_DESTROY>: Uninitialize COM.
45
462007-07-11 Stefan Monnier <monnier@iro.umontreal.ca>
47
48 * lisp.h (struct Lisp_Hash_Table): Turn next_weak into a bare pointer.
49 * fns.c (weak_hash_tables): Rename from Vweak_hash_tables and turned
50 from a Lisp_Object into a bare pointer.
51 (make_hash_table, copy_hash_table, sweep_weak_hash_tables, init_fns):
52 Adjust the code correspondingly.
53
54 * alloc.c (emacs_blocked_free): Remove unused var `bytes_used_now'.
55
56 * term.c: Include unistd.h for ttyname, used in handle_one_term_event.
57 (term_show_mouse_face): Remove unused var `j'.
58 (handle_one_term_event): Remove unused vars `i' and `j'.
59 Don't cast return value of ttyname since it's not necessary.
60
612007-07-10 Stefan Monnier <monnier@iro.umontreal.ca>
62
63 * alloc.c (mark_maybe_pointer): Enforce mult-of-8 alignment when using
64 USE_LSB_TAG. Suggested by Dmitry Antipov <dmantipov@yandex.ru>.
65
66 * fns.c (map_char_table): Use an array of int for `indices' rather than
67 an array of Lisp_Objects (which are only ever integers anyway).
68 (Fmap_char_table): Update caller.
69 * lisp.h: Update prototype.
70 * keymap.c (Fset_keymap_parent, map_keymap, Fcopy_keymap):
71 * fontset.c (Ffontset_info):
72 * casetab.c (set_case_table): Update callers.
73
74 * editfns.c (Ftranspose_regions): Use EMACS_INT for positions.
75
76 * keymap.c (struct accessible_keymaps_data)
77 (struct where_is_internal_data): New structures.
78 (accessible_keymaps_1, where_is_internal_1): Use them to change
79 interface to adhere to the one used by map_keymap.
80 (Faccessible_keymaps, where_is_internal): Use map_keymap.
81 (accessible_keymaps_char_table, where_is_internal_2): Remove.
82
83 * keymap.h (map_keymap_function_t): More informative prototype.
84
852007-07-10 Guanpeng Xu <herberteuler@hotmail.com>
86
87 * search.c (Vinhibit_changing_match_data, search_regs_1): New vars.
88 (looking_at_1): Don't change search_regs and last_thing_searched
89 if `inhibit-changing-match-data' is non-nil.
90 (string_match_1, search_buffer, set_search_regs): Likewise.
91 (syms_of_search): Add Lisp level definition for
92 `inhibit-changing-match-data' and set it to nil.
93 (boyer_moore): If `inhibit-changing-match-data' is non-nil, compute
94 start and end of the match, instead of using values in search_regs.
95
12007-07-01 Stefan Monnier <monnier@iro.umontreal.ca> 962007-07-01 Stefan Monnier <monnier@iro.umontreal.ca>
2 97
3 * minibuf.c (Fcompleting_read): New value `confirm-only' 98 * minibuf.c (Fcompleting_read): New value `confirm-only'
@@ -1118,13 +1213,13 @@
1118 when popup menu finishes. 1213 when popup menu finishes.
1119 1214
1120 * w32fns.c (menubar_in_use): New flag. 1215 * w32fns.c (menubar_in_use): New flag.
1121 (w32_wnd_proc) [WM_INITMENU, WM_EXITMENULOOP, WM_TIMER, WM_COMMAND]: 1216 (w32_wnd_proc) <WM_INITMENU, WM_EXITMENULOOP, WM_TIMER, WM_COMMAND>:
1122 Use it. 1217 Use it.
1123 1218
1124 * w32menu.c (Fx_popup_menu): Don't free menu strings here. 1219 * w32menu.c (Fx_popup_menu): Don't free menu strings here.
1125 (w32_menu_show): Do it here instead. 1220 (w32_menu_show): Do it here instead.
1126 1221
1127 * w32fns.c (w32_wnd_proc) [WM_INITMENU]: Set menubar_active frame 1222 * w32fns.c (w32_wnd_proc) <WM_INITMENU>: Set menubar_active frame
1128 parameter. 1223 parameter.
1129 1224
1130 * w32menu.c (current_popup_menu): Make available globally. 1225 * w32menu.c (current_popup_menu): Make available globally.
@@ -1132,7 +1227,7 @@
1132 menu event into the keyboard buffer. Remove menu_command_in_progress. 1227 menu event into the keyboard buffer. Remove menu_command_in_progress.
1133 1228
1134 * w32fns.c (current_popup_menu): Use from w32menu.c. 1229 * w32fns.c (current_popup_menu): Use from w32menu.c.
1135 (w32_wnd_proc) [WM_EXITMENULOOP, WM_TIMER]: Use menubar_active 1230 (w32_wnd_proc) <WM_EXITMENULOOP, WM_TIMER>: Use menubar_active
1136 and current_popup_menu to determine whether a menubar menu has 1231 and current_popup_menu to determine whether a menubar menu has
1137 been cancelled. 1232 been cancelled.
1138 1233
@@ -10243,7 +10338,7 @@
10243 * w32term.h (x_output): Add focus_state. 10338 * w32term.h (x_output): Add focus_state.
10244 10339
10245 * w32term.c (x_focus_changed, w32_detect_focus_change): New functions. 10340 * w32term.c (x_focus_changed, w32_detect_focus_change): New functions.
10246 (w32_read_socket) [WM_SETFOCUS]: Call w32_detect_focus_change. 10341 (w32_read_socket) <WM_SETFOCUS>: Call w32_detect_focus_change.
10247 10342
102482005-03-25 Stefan Monnier <monnier@iro.umontreal.ca> 103432005-03-25 Stefan Monnier <monnier@iro.umontreal.ca>
10249 10344
@@ -13531,7 +13626,7 @@
13531 13626
13532 * w32term.h (AppendMenuW_Proc): Move declaration from w32menu.c. 13627 * w32term.h (AppendMenuW_Proc): Move declaration from w32menu.c.
13533 13628
13534 * w32fns.c (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: 13629 * w32fns.c (w32_wnd_proc) <WM_MEASUREITEM, WM_DRAWITEM>:
13535 Handle Unicode menu titles. 13630 Handle Unicode menu titles.
13536 13631
135372004-09-07 Kim F. Storm <storm@cua.dk> 136322004-09-07 Kim F. Storm <storm@cua.dk>
diff --git a/src/alloc.c b/src/alloc.c
index d5de5f7296b..fd366339a53 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1179,8 +1179,6 @@ emacs_blocked_free (ptr, ptr2)
1179 void *ptr; 1179 void *ptr;
1180 const void *ptr2; 1180 const void *ptr2;
1181{ 1181{
1182 EMACS_INT bytes_used_now;
1183
1184 BLOCK_INPUT_ALLOC; 1182 BLOCK_INPUT_ALLOC;
1185 1183
1186#ifdef GC_MALLOC_CHECK 1184#ifdef GC_MALLOC_CHECK
@@ -4220,9 +4218,14 @@ mark_maybe_pointer (p)
4220{ 4218{
4221 struct mem_node *m; 4219 struct mem_node *m;
4222 4220
4223 /* Quickly rule out some values which can't point to Lisp data. We 4221 /* Quickly rule out some values which can't point to Lisp data. */
4224 assume that Lisp data is aligned on even addresses. */ 4222 if ((EMACS_INT) p %
4225 if ((EMACS_INT) p & 1) 4223#ifdef USE_LSB_TAG
4224 8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8. */
4225#else
4226 2 /* We assume that Lisp data is aligned on even addresses. */
4227#endif
4228 )
4226 return; 4229 return;
4227 4230
4228 m = mem_find (p); 4231 m = mem_find (p);
diff --git a/src/editfns.c b/src/editfns.c
index b615012c700..43dc59e78b3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4256,9 +4256,9 @@ Transposing beyond buffer boundaries is an error. */)
4256 (startr1, endr1, startr2, endr2, leave_markers) 4256 (startr1, endr1, startr2, endr2, leave_markers)
4257 Lisp_Object startr1, endr1, startr2, endr2, leave_markers; 4257 Lisp_Object startr1, endr1, startr2, endr2, leave_markers;
4258{ 4258{
4259 register int start1, end1, start2, end2; 4259 register EMACS_INT start1, end1, start2, end2;
4260 int start1_byte, start2_byte, len1_byte, len2_byte; 4260 EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte;
4261 int gap, len1, len_mid, len2; 4261 EMACS_INT gap, len1, len_mid, len2;
4262 unsigned char *start1_addr, *start2_addr, *temp; 4262 unsigned char *start1_addr, *start2_addr, *temp;
4263 4263
4264 INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3; 4264 INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3;
diff --git a/src/eval.c b/src/eval.c
index 6707849a840..cd0d0fc1c5c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -97,6 +97,7 @@ Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag;
97Lisp_Object Qand_rest, Qand_optional; 97Lisp_Object Qand_rest, Qand_optional;
98Lisp_Object Qdebug_on_error; 98Lisp_Object Qdebug_on_error;
99Lisp_Object Qdeclare; 99Lisp_Object Qdeclare;
100Lisp_Object Qdebug;
100 101
101/* This holds either the symbol `run-hooks' or nil. 102/* This holds either the symbol `run-hooks' or nil.
102 It is nil at an early stage of startup, and when Emacs 103 It is nil at an early stage of startup, and when Emacs
@@ -220,7 +221,7 @@ init_eval_once ()
220 specpdl_ptr = specpdl; 221 specpdl_ptr = specpdl;
221 /* Don't forget to update docs (lispref node "Local Variables"). */ 222 /* Don't forget to update docs (lispref node "Local Variables"). */
222 max_specpdl_size = 1000; 223 max_specpdl_size = 1000;
223 max_lisp_eval_depth = 300; 224 max_lisp_eval_depth = 400;
224 225
225 Vrun_hooks = Qnil; 226 Vrun_hooks = Qnil;
226} 227}
@@ -433,7 +434,7 @@ usage: (cond CLAUSES...) */)
433 434
434DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, 435DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0,
435 doc: /* Eval BODY forms sequentially and return value of last one. 436 doc: /* Eval BODY forms sequentially and return value of last one.
436usage: (progn BODY ...) */) 437usage: (progn BODY...) */)
437 (args) 438 (args)
438 Lisp_Object args; 439 Lisp_Object args;
439{ 440{
@@ -1585,8 +1586,7 @@ internal_condition_case_2 (bfun, nargs, args, handlers, hfun)
1585 1586
1586 1587
1587static Lisp_Object find_handler_clause P_ ((Lisp_Object, Lisp_Object, 1588static Lisp_Object find_handler_clause P_ ((Lisp_Object, Lisp_Object,
1588 Lisp_Object, Lisp_Object, 1589 Lisp_Object, Lisp_Object));
1589 Lisp_Object *));
1590 1590
1591DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, 1591DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0,
1592 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA. 1592 doc: /* Signal an error. Args are ERROR-SYMBOL and associated DATA.
@@ -1612,7 +1612,6 @@ See also the function `condition-case'. */)
1612 Lisp_Object conditions; 1612 Lisp_Object conditions;
1613 extern int gc_in_progress; 1613 extern int gc_in_progress;
1614 extern int waiting_for_input; 1614 extern int waiting_for_input;
1615 Lisp_Object debugger_value;
1616 Lisp_Object string; 1615 Lisp_Object string;
1617 Lisp_Object real_error_symbol; 1616 Lisp_Object real_error_symbol;
1618 struct backtrace *bp; 1617 struct backtrace *bp;
@@ -1670,7 +1669,7 @@ See also the function `condition-case'. */)
1670 register Lisp_Object clause; 1669 register Lisp_Object clause;
1671 1670
1672 clause = find_handler_clause (handlerlist->handler, conditions, 1671 clause = find_handler_clause (handlerlist->handler, conditions,
1673 error_symbol, data, &debugger_value); 1672 error_symbol, data);
1674 1673
1675 if (EQ (clause, Qlambda)) 1674 if (EQ (clause, Qlambda))
1676 { 1675 {
@@ -1701,7 +1700,7 @@ See also the function `condition-case'. */)
1701 handlerlist = allhandlers; 1700 handlerlist = allhandlers;
1702 /* If no handler is present now, try to run the debugger, 1701 /* If no handler is present now, try to run the debugger,
1703 and if that fails, throw to top level. */ 1702 and if that fails, throw to top level. */
1704 find_handler_clause (Qerror, conditions, error_symbol, data, &debugger_value); 1703 find_handler_clause (Qerror, conditions, error_symbol, data);
1705 if (catchlist != 0) 1704 if (catchlist != 0)
1706 Fthrow (Qtop_level, Qt); 1705 Fthrow (Qtop_level, Qt);
1707 1706
@@ -1853,75 +1852,54 @@ skip_debugger (conditions, data)
1853 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). 1852 = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
1854 This is for memory-full errors only. 1853 This is for memory-full errors only.
1855 1854
1856 Store value returned from debugger into *DEBUGGER_VALUE_PTR.
1857
1858 We need to increase max_specpdl_size temporarily around 1855 We need to increase max_specpdl_size temporarily around
1859 anything we do that can push on the specpdl, so as not to get 1856 anything we do that can push on the specpdl, so as not to get
1860 a second error here in case we're handling specpdl overflow. */ 1857 a second error here in case we're handling specpdl overflow. */
1861 1858
1862static Lisp_Object 1859static Lisp_Object
1863find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) 1860find_handler_clause (handlers, conditions, sig, data)
1864 Lisp_Object handlers, conditions, sig, data; 1861 Lisp_Object handlers, conditions, sig, data;
1865 Lisp_Object *debugger_value_ptr;
1866{ 1862{
1867 register Lisp_Object h; 1863 register Lisp_Object h;
1868 register Lisp_Object tem; 1864 register Lisp_Object tem;
1865 int debugger_called = 0;
1866 int debugger_considered = 0;
1869 1867
1870 if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ 1868 /* t is used by handlers for all conditions, set up by C code. */
1869 if (EQ (handlers, Qt))
1871 return Qt; 1870 return Qt;
1871
1872 /* Don't run the debugger for a memory-full error.
1873 (There is no room in memory to do that!) */
1874 if (NILP (sig))
1875 debugger_considered = 1;
1876
1872 /* error is used similarly, but means print an error message 1877 /* error is used similarly, but means print an error message
1873 and run the debugger if that is enabled. */ 1878 and run the debugger if that is enabled. */
1874 if (EQ (handlers, Qerror) 1879 if (EQ (handlers, Qerror)
1875 || !NILP (Vdebug_on_signal)) /* This says call debugger even if 1880 || !NILP (Vdebug_on_signal)) /* This says call debugger even if
1876 there is a handler. */ 1881 there is a handler. */
1877 { 1882 {
1878 int debugger_called = 0; 1883 if (!NILP (sig) && wants_debugger (Vstack_trace_on_error, conditions))
1879 Lisp_Object sig_symbol, combined_data;
1880 /* This is set to 1 if we are handling a memory-full error,
1881 because these must not run the debugger.
1882 (There is no room in memory to do that!) */
1883 int no_debugger = 0;
1884
1885 if (NILP (sig))
1886 {
1887 combined_data = data;
1888 sig_symbol = Fcar (data);
1889 no_debugger = 1;
1890 }
1891 else
1892 {
1893 combined_data = Fcons (sig, data);
1894 sig_symbol = sig;
1895 }
1896
1897 if (wants_debugger (Vstack_trace_on_error, conditions))
1898 { 1884 {
1899 max_specpdl_size++; 1885 max_specpdl_size++;
1900#ifdef PROTOTYPES 1886 #ifdef PROTOTYPES
1901 internal_with_output_to_temp_buffer ("*Backtrace*", 1887 internal_with_output_to_temp_buffer ("*Backtrace*",
1902 (Lisp_Object (*) (Lisp_Object)) Fbacktrace, 1888 (Lisp_Object (*) (Lisp_Object)) Fbacktrace,
1903 Qnil); 1889 Qnil);
1904#else 1890 #else
1905 internal_with_output_to_temp_buffer ("*Backtrace*", 1891 internal_with_output_to_temp_buffer ("*Backtrace*",
1906 Fbacktrace, Qnil); 1892 Fbacktrace, Qnil);
1907#endif 1893 #endif
1908 max_specpdl_size--; 1894 max_specpdl_size--;
1909 } 1895 }
1910 if (! no_debugger 1896
1911 /* Don't try to run the debugger with interrupts blocked. 1897 if (!debugger_considered)
1912 The editing loop would return anyway. */
1913 && ! INPUT_BLOCKED_P
1914 && (EQ (sig_symbol, Qquit)
1915 ? debug_on_quit
1916 : wants_debugger (Vdebug_on_error, conditions))
1917 && ! skip_debugger (conditions, combined_data)
1918 && when_entered_debugger < num_nonmacro_input_events)
1919 { 1898 {
1920 *debugger_value_ptr 1899 debugger_considered = 1;
1921 = call_debugger (Fcons (Qerror, 1900 debugger_called = maybe_call_debugger (conditions, sig, data);
1922 Fcons (combined_data, Qnil)));
1923 debugger_called = 1;
1924 } 1901 }
1902
1925 /* If there is no handler, return saying whether we ran the debugger. */ 1903 /* If there is no handler, return saying whether we ran the debugger. */
1926 if (EQ (handlers, Qerror)) 1904 if (EQ (handlers, Qerror))
1927 { 1905 {
@@ -1930,6 +1908,7 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1930 return Qt; 1908 return Qt;
1931 } 1909 }
1932 } 1910 }
1911
1933 for (h = handlers; CONSP (h); h = Fcdr (h)) 1912 for (h = handlers; CONSP (h); h = Fcdr (h))
1934 { 1913 {
1935 Lisp_Object handler, condit; 1914 Lisp_Object handler, condit;
@@ -1948,18 +1927,55 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
1948 /* Handle a list of condition names in handler HANDLER. */ 1927 /* Handle a list of condition names in handler HANDLER. */
1949 else if (CONSP (condit)) 1928 else if (CONSP (condit))
1950 { 1929 {
1951 while (CONSP (condit)) 1930 Lisp_Object tail;
1931 for (tail = condit; CONSP (tail); tail = XCDR (tail))
1952 { 1932 {
1953 tem = Fmemq (Fcar (condit), conditions); 1933 tem = Fmemq (Fcar (tail), conditions);
1954 if (!NILP (tem)) 1934 if (!NILP (tem))
1955 return handler; 1935 {
1956 condit = XCDR (condit); 1936 /* This handler is going to apply.
1937 Does it allow the debugger to run first? */
1938 if (! debugger_considered && !NILP (Fmemq (Qdebug, condit)))
1939 maybe_call_debugger (conditions, sig, data);
1940 return handler;
1941 }
1957 } 1942 }
1958 } 1943 }
1959 } 1944 }
1945
1960 return Qnil; 1946 return Qnil;
1961} 1947}
1962 1948
1949/* Call the debugger if calling it is currently enabled for CONDITIONS.
1950 SIG and DATA describe the signal, as in find_handler_clause. */
1951
1952int
1953maybe_call_debugger (conditions, sig, data)
1954 Lisp_Object conditions, sig, data;
1955{
1956 Lisp_Object combined_data;
1957
1958 combined_data = Fcons (sig, data);
1959
1960 if (
1961 /* Don't try to run the debugger with interrupts blocked.
1962 The editing loop would return anyway. */
1963 ! INPUT_BLOCKED_P
1964 /* Does user wants to enter debugger for this kind of error? */
1965 && (EQ (sig, Qquit)
1966 ? debug_on_quit
1967 : wants_debugger (Vdebug_on_error, conditions))
1968 && ! skip_debugger (conditions, combined_data)
1969 /* rms: what's this for? */
1970 && when_entered_debugger < num_nonmacro_input_events)
1971 {
1972 call_debugger (Fcons (Qerror, Fcons (combined_data, Qnil)));
1973 return 1;
1974 }
1975
1976 return 0;
1977}
1978
1963/* dump an error message; called like printf */ 1979/* dump an error message; called like printf */
1964 1980
1965/* VARARGS 1 */ 1981/* VARARGS 1 */
@@ -3600,6 +3616,9 @@ before making `inhibit-quit' nil. */);
3600 Qand_optional = intern ("&optional"); 3616 Qand_optional = intern ("&optional");
3601 staticpro (&Qand_optional); 3617 staticpro (&Qand_optional);
3602 3618
3619 Qdebug = intern ("debug");
3620 staticpro (&Qdebug);
3621
3603 DEFVAR_LISP ("stack-trace-on-error", &Vstack_trace_on_error, 3622 DEFVAR_LISP ("stack-trace-on-error", &Vstack_trace_on_error,
3604 doc: /* *Non-nil means errors display a backtrace buffer. 3623 doc: /* *Non-nil means errors display a backtrace buffer.
3605More precisely, this happens for any error that is handled 3624More precisely, this happens for any error that is handled
diff --git a/src/keyboard.c b/src/keyboard.c
index 6df2d1b0b25..b21242f7918 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1422,7 +1422,7 @@ DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0,
1422Within a `track-mouse' form, mouse motion generates input events that 1422Within a `track-mouse' form, mouse motion generates input events that
1423you can read with `read-event'. 1423you can read with `read-event'.
1424Normally, mouse motion is ignored. 1424Normally, mouse motion is ignored.
1425usage: (track-mouse BODY ...) */) 1425usage: (track-mouse BODY...) */)
1426 (args) 1426 (args)
1427 Lisp_Object args; 1427 Lisp_Object args;
1428{ 1428{
diff --git a/src/keymap.c b/src/keymap.c
index 29898fe7a8e..413de76f7d5 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1179,7 +1179,7 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1179 if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt)) 1179 if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt))
1180 Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands); 1180 Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands);
1181 1181
1182 meta_bit = (VECTORP (key) || STRINGP (key) && STRING_MULTIBYTE (key) 1182 meta_bit = (VECTORP (key) || (STRINGP (key) && STRING_MULTIBYTE (key))
1183 ? meta_modifier : 0x80); 1183 ? meta_modifier : 0x80);
1184 1184
1185 if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0))) 1185 if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
@@ -2079,12 +2079,23 @@ DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_
2079 2079
2080/* Help functions for describing and documenting keymaps. */ 2080/* Help functions for describing and documenting keymaps. */
2081 2081
2082struct accessible_keymaps_data {
2083 Lisp_Object maps, tail, thisseq;
2084 /* Does the current sequence end in the meta-prefix-char? */
2085 int is_metized;
2086};
2082 2087
2083static void 2088static void
2084accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized) 2089accessible_keymaps_1 (key, cmd, args, data)
2085 Lisp_Object maps, tail, thisseq, key, cmd; 2090 Lisp_Object key, cmd, args;
2086 int is_metized; /* If 1, `key' is assumed to be INTEGERP. */ 2091 /* Use void* to be compatible with map_keymap_function_t. */
2092 void *data;
2087{ 2093{
2094 struct accessible_keymaps_data *d = data; /* Cast! */
2095 Lisp_Object maps = d->maps;
2096 Lisp_Object tail = d->tail;
2097 Lisp_Object thisseq = d->thisseq;
2098 int is_metized = d->is_metized && INTEGERP (key);
2088 Lisp_Object tem; 2099 Lisp_Object tem;
2089 2100
2090 cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); 2101 cmd = get_keymap (get_keyelt (cmd, 0), 0, 0);
@@ -2138,17 +2149,6 @@ accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized)
2138 } 2149 }
2139} 2150}
2140 2151
2141static void
2142accessible_keymaps_char_table (args, index, cmd)
2143 Lisp_Object args, index, cmd;
2144{
2145 accessible_keymaps_1 (index, cmd,
2146 XCAR (XCAR (args)),
2147 XCAR (XCDR (args)),
2148 XCDR (XCDR (args)),
2149 XINT (XCDR (XCAR (args))));
2150}
2151
2152/* This function cannot GC. */ 2152/* This function cannot GC. */
2153 2153
2154DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps, 2154DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps,
@@ -2163,14 +2163,11 @@ then the value includes only maps for prefixes that start with PREFIX. */)
2163 Lisp_Object keymap, prefix; 2163 Lisp_Object keymap, prefix;
2164{ 2164{
2165 Lisp_Object maps, tail; 2165 Lisp_Object maps, tail;
2166 int prefixlen = 0; 2166 int prefixlen = XINT (Flength (prefix));
2167 2167
2168 /* no need for gcpro because we don't autoload any keymaps. */ 2168 /* no need for gcpro because we don't autoload any keymaps. */
2169 2169
2170 if (!NILP (prefix)) 2170 if (!NILP (prefix))
2171 prefixlen = XINT (Flength (prefix));
2172
2173 if (!NILP (prefix))
2174 { 2171 {
2175 /* If a prefix was specified, start with the keymap (if any) for 2172 /* If a prefix was specified, start with the keymap (if any) for
2176 that prefix, so we don't waste time considering other prefixes. */ 2173 that prefix, so we don't waste time considering other prefixes. */
@@ -2180,7 +2177,9 @@ then the value includes only maps for prefixes that start with PREFIX. */)
2180 if the prefix is not defined in this particular map. 2177 if the prefix is not defined in this particular map.
2181 It might even give us a list that isn't a keymap. */ 2178 It might even give us a list that isn't a keymap. */
2182 tem = get_keymap (tem, 0, 0); 2179 tem = get_keymap (tem, 0, 0);
2183 if (CONSP (tem)) 2180 /* If the keymap is autoloaded `tem' is not a cons-cell, but we still
2181 want to return it. */
2182 if (!NILP (tem))
2184 { 2183 {
2185 /* Convert PREFIX to a vector now, so that later on 2184 /* Convert PREFIX to a vector now, so that later on
2186 we don't have to deal with the possibility of a string. */ 2185 we don't have to deal with the possibility of a string. */
@@ -2620,8 +2619,8 @@ ascii_sequence_p (seq)
2620/* where-is - finding a command in a set of keymaps. */ 2619/* where-is - finding a command in a set of keymaps. */
2621 2620
2622static Lisp_Object where_is_internal (); 2621static Lisp_Object where_is_internal ();
2623static Lisp_Object where_is_internal_1 (); 2622static void where_is_internal_1 P_ ((Lisp_Object key, Lisp_Object binding,
2624static void where_is_internal_2 (); 2623 Lisp_Object args, void *data));
2625 2624
2626/* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map. 2625/* Like Flookup_key, but uses a list of keymaps SHADOW instead of a single map.
2627 Returns the first non-nil binding found in any of those maps. */ 2626 Returns the first non-nil binding found in any of those maps. */
@@ -2650,6 +2649,12 @@ shadow_lookup (shadow, key, flag)
2650 2649
2651static Lisp_Object Vmouse_events; 2650static Lisp_Object Vmouse_events;
2652 2651
2652struct where_is_internal_data {
2653 Lisp_Object definition, noindirect, this, last;
2654 int last_is_meta;
2655 Lisp_Object sequences;
2656};
2657
2653/* This function can GC if Flookup_key autoloads any keymaps. */ 2658/* This function can GC if Flookup_key autoloads any keymaps. */
2654 2659
2655static Lisp_Object 2660static Lisp_Object
@@ -2687,6 +2692,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2687 { 2692 {
2688 /* Key sequence to reach map, and the map that it reaches */ 2693 /* Key sequence to reach map, and the map that it reaches */
2689 register Lisp_Object this, map, tem; 2694 register Lisp_Object this, map, tem;
2695 struct where_is_internal_data data;
2690 2696
2691 /* In order to fold [META-PREFIX-CHAR CHAR] sequences into 2697 /* In order to fold [META-PREFIX-CHAR CHAR] sequences into
2692 [M-CHAR] sequences, check if last character of the sequence 2698 [M-CHAR] sequences, check if last character of the sequence
@@ -3059,7 +3065,7 @@ where_is_internal_1 (binding, key, definition, noindirect, this, last,
3059 || EQ (binding, definition) 3065 || EQ (binding, definition)
3060 || (CONSP (definition) && !NILP (Fequal (binding, definition))))) 3066 || (CONSP (definition) && !NILP (Fequal (binding, definition)))))
3061 /* Doesn't match. */ 3067 /* Doesn't match. */
3062 return Qnil; 3068 return;
3063 3069
3064 /* We have found a match. Construct the key sequence where we found it. */ 3070 /* We have found a match. Construct the key sequence where we found it. */
3065 if (INTEGERP (key) && last_is_meta) 3071 if (INTEGERP (key) && last_is_meta)
@@ -3074,10 +3080,9 @@ where_is_internal_1 (binding, key, definition, noindirect, this, last,
3074 { 3080 {
3075 Lisp_Object sequences = Fgethash (binding, where_is_cache, Qnil); 3081 Lisp_Object sequences = Fgethash (binding, where_is_cache, Qnil);
3076 Fputhash (binding, Fcons (sequence, sequences), where_is_cache); 3082 Fputhash (binding, Fcons (sequence, sequences), where_is_cache);
3077 return Qnil;
3078 } 3083 }
3079 else 3084 else
3080 return sequence; 3085 d->sequences = Fcons (sequence, d->sequences);
3081} 3086}
3082 3087
3083/* describe-bindings - summarizing all the bindings in a set of keymaps. */ 3088/* describe-bindings - summarizing all the bindings in a set of keymaps. */
diff --git a/src/keymap.h b/src/keymap.h
index 185ae70d945..df135114c87 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -47,7 +47,7 @@ extern void syms_of_keymap P_ ((void));
47extern void keys_of_keymap P_ ((void)); 47extern void keys_of_keymap P_ ((void));
48 48
49typedef void (*map_keymap_function_t) 49typedef void (*map_keymap_function_t)
50 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, void*)); 50 P_ ((Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data));
51extern void map_keymap P_ ((Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload)); 51extern void map_keymap P_ ((Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload));
52 52
53#endif 53#endif
diff --git a/src/lisp.h b/src/lisp.h
index 9f144c4c973..188749b2cfb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -56,7 +56,7 @@ Boston, MA 02110-1301, USA. */
56#ifdef GC_CHECK_CONS_LIST 56#ifdef GC_CHECK_CONS_LIST
57#define CHECK_CONS_LIST() check_cons_list() 57#define CHECK_CONS_LIST() check_cons_list()
58#else 58#else
59#define CHECK_CONS_LIST() 0 59#define CHECK_CONS_LIST() ((void)0)
60#endif 60#endif
61 61
62/* These are default choices for the types to use. */ 62/* These are default choices for the types to use. */
@@ -3234,6 +3234,7 @@ EXFUN (Fx_file_dialog, 5);
3234#endif 3234#endif
3235 3235
3236/* Defined in xfaces.c */ 3236/* Defined in xfaces.c */
3237EXFUN (Fclear_face_cache, 1);
3237extern void syms_of_xfaces P_ ((void)); 3238extern void syms_of_xfaces P_ ((void));
3238 3239
3239#ifndef HAVE_GETLOADAVG 3240#ifndef HAVE_GETLOADAVG
@@ -3249,6 +3250,7 @@ extern void syms_of_xfns P_ ((void));
3249extern void syms_of_xsmfns P_ ((void)); 3250extern void syms_of_xsmfns P_ ((void));
3250 3251
3251/* Defined in xselect.c */ 3252/* Defined in xselect.c */
3253EXFUN (Fx_send_client_event, 6);
3252extern void syms_of_xselect P_ ((void)); 3254extern void syms_of_xselect P_ ((void));
3253 3255
3254/* Defined in xterm.c */ 3256/* Defined in xterm.c */
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 40f921961ac..280429b5a71 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -147,7 +147,7 @@ LIBS = $(TLIB0) \
147 $(TLIB1) \ 147 $(TLIB1) \
148 $(TLIBW32) \ 148 $(TLIBW32) \
149 $(TLASTLIB) \ 149 $(TLASTLIB) \
150 $(WINMM) \ 150 $(WINMM) \
151 $(ADVAPI32) \ 151 $(ADVAPI32) \
152 $(GDI32) \ 152 $(GDI32) \
153 $(COMDLG32) \ 153 $(COMDLG32) \
@@ -155,6 +155,7 @@ LIBS = $(TLIB0) \
155 $(MPR) \ 155 $(MPR) \
156 $(SHELL32) \ 156 $(SHELL32) \
157 $(WINSPOOL) \ 157 $(WINSPOOL) \
158 $(OLE32) \
158 $(libc) 159 $(libc)
159 160
160# 161#
diff --git a/src/print.c b/src/print.c
index 524207ce298..f4b02868703 100644
--- a/src/print.c
+++ b/src/print.c
@@ -690,7 +690,7 @@ If variable `temp-buffer-show-function' is non-nil, call it at the end
690to get the buffer displayed instead of just displaying the non-selected 690to get the buffer displayed instead of just displaying the non-selected
691buffer and calling the hook. It gets one argument, the buffer to display. 691buffer and calling the hook. It gets one argument, the buffer to display.
692 692
693usage: (with-output-to-temp-buffer BUFNAME BODY ...) */) 693usage: (with-output-to-temp-buffer BUFNAME BODY...) */)
694 (args) 694 (args)
695 Lisp_Object args; 695 Lisp_Object args;
696{ 696{
diff --git a/src/process.c b/src/process.c
index 067eae7f286..5551c0610d0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -121,14 +121,6 @@ Boston, MA 02110-1301, USA. */
121#include <sys/wait.h> 121#include <sys/wait.h>
122#endif 122#endif
123 123
124/* Disable IPv6 support for w32 until someone figures out how to do it
125 properly. */
126#ifdef WINDOWSNT
127# ifdef AF_INET6
128# undef AF_INET6
129# endif
130#endif
131
132#include "lisp.h" 124#include "lisp.h"
133#include "systime.h" 125#include "systime.h"
134#include "systty.h" 126#include "systty.h"
@@ -393,7 +385,7 @@ struct sockaddr_and_len {
393 int len; 385 int len;
394} datagram_address[MAXDESC]; 386} datagram_address[MAXDESC];
395#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) 387#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0)
396#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XINT (XPROCESS (proc)->infd)].sa != 0) 388#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0)
397#else 389#else
398#define DATAGRAM_CHAN_P(chan) (0) 390#define DATAGRAM_CHAN_P(chan) (0)
399#define DATAGRAM_CONN_P(proc) (0) 391#define DATAGRAM_CONN_P(proc) (0)
@@ -628,19 +620,19 @@ make_process (name)
628 620
629 p = allocate_process (); 621 p = allocate_process ();
630 622
631 XSETINT (p->infd, -1); 623 p->infd = -1;
632 XSETINT (p->outfd, -1); 624 p->outfd = -1;
633 XSETFASTINT (p->tick, 0); 625 p->tick = 0;
634 XSETFASTINT (p->update_tick, 0); 626 p->update_tick = 0;
635 p->pid = 0; 627 p->pid = 0;
636 p->raw_status_new = 0; 628 p->raw_status_new = 0;
637 p->status = Qrun; 629 p->status = Qrun;
638 p->mark = Fmake_marker (); 630 p->mark = Fmake_marker ();
639 631
640#ifdef ADAPTIVE_READ_BUFFERING 632#ifdef ADAPTIVE_READ_BUFFERING
641 p->adaptive_read_buffering = Qnil; 633 p->adaptive_read_buffering = 0;
642 XSETFASTINT (p->read_output_delay, 0); 634 p->read_output_delay = 0;
643 p->read_output_skip = Qnil; 635 p->read_output_skip = 0;
644#endif 636#endif
645 637
646 /* If name is already in use, modify it until it is unused. */ 638 /* If name is already in use, modify it until it is unused. */
@@ -679,8 +671,8 @@ setup_process_coding_systems (process)
679 Lisp_Object process; 671 Lisp_Object process;
680{ 672{
681 struct Lisp_Process *p = XPROCESS (process); 673 struct Lisp_Process *p = XPROCESS (process);
682 int inch = XINT (p->infd); 674 int inch = p->infd;
683 int outch = XINT (p->outfd); 675 int outch = p->outfd;
684 Lisp_Object coding_system; 676 Lisp_Object coding_system;
685 677
686 if (inch < 0 || outch < 0) 678 if (inch < 0 || outch < 0)
@@ -692,7 +684,7 @@ setup_process_coding_systems (process)
692 coding_system = p->decode_coding_system; 684 coding_system = p->decode_coding_system;
693 if (! NILP (p->filter)) 685 if (! NILP (p->filter))
694 { 686 {
695 if (NILP (p->filter_multibyte)) 687 if (!p->filter_multibyte)
696 coding_system = raw_text_coding_system (coding_system); 688 coding_system = raw_text_coding_system (coding_system);
697 } 689 }
698 else if (BUFFERP (p->buffer)) 690 else if (BUFFERP (p->buffer))
@@ -814,10 +806,10 @@ nil, indicating the current buffer's process. */)
814 if (NETCONN1_P (p)) 806 if (NETCONN1_P (p))
815 { 807 {
816 p->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); 808 p->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
817 XSETINT (p->tick, ++process_tick); 809 p->tick = ++process_tick;
818 status_notify (p); 810 status_notify (p);
819 } 811 }
820 else if (XINT (p->infd) >= 0) 812 else if (p->infd >= 0)
821 { 813 {
822#ifdef SIGCHLD 814#ifdef SIGCHLD
823 Lisp_Object symbol; 815 Lisp_Object symbol;
@@ -845,7 +837,7 @@ nil, indicating the current buffer's process. */)
845 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 837 /* Do this now, since remove_process will make sigchld_handler do nothing. */
846 p->status 838 p->status
847 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); 839 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
848 XSETINT (p->tick, ++process_tick); 840 p->tick = ++process_tick;
849 status_notify (p); 841 status_notify (p);
850 } 842 }
851 } 843 }
@@ -1037,18 +1029,18 @@ The string argument is normally a multibyte string, except:
1037 (debug) 1029 (debug)
1038 (set-process-filter process ...) */ 1030 (set-process-filter process ...) */
1039 1031
1040 if (XINT (p->infd) >= 0) 1032 if (p->infd >= 0)
1041 { 1033 {
1042 if (EQ (filter, Qt) && !EQ (p->status, Qlisten)) 1034 if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
1043 { 1035 {
1044 FD_CLR (XINT (p->infd), &input_wait_mask); 1036 FD_CLR (p->infd, &input_wait_mask);
1045 FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); 1037 FD_CLR (p->infd, &non_keyboard_wait_mask);
1046 } 1038 }
1047 else if (EQ (p->filter, Qt) 1039 else if (EQ (p->filter, Qt)
1048 && !EQ (p->command, Qt)) /* Network process not stopped. */ 1040 && !EQ (p->command, Qt)) /* Network process not stopped. */
1049 { 1041 {
1050 FD_SET (XINT (p->infd), &input_wait_mask); 1042 FD_SET (p->infd, &input_wait_mask);
1051 FD_SET (XINT (p->infd), &non_keyboard_wait_mask); 1043 FD_SET (p->infd, &non_keyboard_wait_mask);
1052 } 1044 }
1053 } 1045 }
1054 1046
@@ -1110,8 +1102,8 @@ DEFUN ("set-process-window-size", Fset_process_window_size,
1110 CHECK_NATNUM (height); 1102 CHECK_NATNUM (height);
1111 CHECK_NATNUM (width); 1103 CHECK_NATNUM (width);
1112 1104
1113 if (XINT (XPROCESS (process)->infd) < 0 1105 if (XPROCESS (process)->infd < 0
1114 || set_window_size (XINT (XPROCESS (process)->infd), 1106 || set_window_size (XPROCESS (process)->infd,
1115 XINT (height), XINT (width)) <= 0) 1107 XINT (height), XINT (width)) <= 0)
1116 return Qnil; 1108 return Qnil;
1117 else 1109 else
@@ -1139,7 +1131,7 @@ for the process which will run. */)
1139 register Lisp_Object process, flag; 1131 register Lisp_Object process, flag;
1140{ 1132{
1141 CHECK_PROCESS (process); 1133 CHECK_PROCESS (process);
1142 XPROCESS (process)->inherit_coding_system_flag = flag; 1134 XPROCESS (process)->inherit_coding_system_flag = !NILP (flag);
1143 return flag; 1135 return flag;
1144} 1136}
1145 1137
@@ -1154,7 +1146,7 @@ the process output. */)
1154 register Lisp_Object process; 1146 register Lisp_Object process;
1155{ 1147{
1156 CHECK_PROCESS (process); 1148 CHECK_PROCESS (process);
1157 return XPROCESS (process)->inherit_coding_system_flag; 1149 return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
1158} 1150}
1159 1151
1160DEFUN ("set-process-query-on-exit-flag", 1152DEFUN ("set-process-query-on-exit-flag",
@@ -1167,7 +1159,7 @@ exiting if PROCESS is running. */)
1167 register Lisp_Object process, flag; 1159 register Lisp_Object process, flag;
1168{ 1160{
1169 CHECK_PROCESS (process); 1161 CHECK_PROCESS (process);
1170 XPROCESS (process)->kill_without_query = Fnull (flag); 1162 XPROCESS (process)->kill_without_query = NILP (flag);
1171 return flag; 1163 return flag;
1172} 1164}
1173 1165
@@ -1179,7 +1171,7 @@ DEFUN ("process-query-on-exit-flag",
1179 register Lisp_Object process; 1171 register Lisp_Object process;
1180{ 1172{
1181 CHECK_PROCESS (process); 1173 CHECK_PROCESS (process);
1182 return Fnull (XPROCESS (process)->kill_without_query); 1174 return (XPROCESS (process)->kill_without_query ? Qnil : Qt);
1183} 1175}
1184 1176
1185#ifdef DATAGRAM_SOCKETS 1177#ifdef DATAGRAM_SOCKETS
@@ -1354,7 +1346,7 @@ list_processes_1 (query_only)
1354 p = XPROCESS (proc); 1346 p = XPROCESS (proc);
1355 if (NILP (p->childp)) 1347 if (NILP (p->childp))
1356 continue; 1348 continue;
1357 if (!NILP (query_only) && !NILP (p->kill_without_query)) 1349 if (!NILP (query_only) && p->kill_without_query)
1358 continue; 1350 continue;
1359 if (STRINGP (p->name) 1351 if (STRINGP (p->name)
1360 && ( i = SCHARS (p->name), (i > w_proc))) 1352 && ( i = SCHARS (p->name), (i > w_proc)))
@@ -1417,7 +1409,7 @@ list_processes_1 (query_only)
1417 p = XPROCESS (proc); 1409 p = XPROCESS (proc);
1418 if (NILP (p->childp)) 1410 if (NILP (p->childp))
1419 continue; 1411 continue;
1420 if (!NILP (query_only) && !NILP (p->kill_without_query)) 1412 if (!NILP (query_only) && p->kill_without_query)
1421 continue; 1413 continue;
1422 1414
1423 Finsert (1, &p->name); 1415 Finsert (1, &p->name);
@@ -1493,7 +1485,7 @@ list_processes_1 (query_only)
1493 if (NILP (port)) 1485 if (NILP (port))
1494 port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil); 1486 port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil);
1495 sprintf (tembuf, "(network %s server on %s)\n", 1487 sprintf (tembuf, "(network %s server on %s)\n",
1496 (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), 1488 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
1497 (STRINGP (port) ? (char *)SDATA (port) : "?")); 1489 (STRINGP (port) ? (char *)SDATA (port) : "?"));
1498 insert_string (tembuf); 1490 insert_string (tembuf);
1499 } 1491 }
@@ -1511,7 +1503,7 @@ list_processes_1 (query_only)
1511 if (NILP (host)) 1503 if (NILP (host))
1512 host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil); 1504 host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil);
1513 sprintf (tembuf, "(network %s connection to %s)\n", 1505 sprintf (tembuf, "(network %s connection to %s)\n",
1514 (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), 1506 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
1515 (STRINGP (host) ? (char *)SDATA (host) : "?")); 1507 (STRINGP (host) ? (char *)SDATA (host) : "?"));
1516 insert_string (tembuf); 1508 insert_string (tembuf);
1517 } 1509 }
@@ -1642,11 +1634,13 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1642 XPROCESS (proc)->sentinel = Qnil; 1634 XPROCESS (proc)->sentinel = Qnil;
1643 XPROCESS (proc)->filter = Qnil; 1635 XPROCESS (proc)->filter = Qnil;
1644 XPROCESS (proc)->filter_multibyte 1636 XPROCESS (proc)->filter_multibyte
1645 = buffer_defaults.enable_multibyte_characters; 1637 = !NILP (buffer_defaults.enable_multibyte_characters);
1646 XPROCESS (proc)->command = Flist (nargs - 2, args + 2); 1638 XPROCESS (proc)->command = Flist (nargs - 2, args + 2);
1647 1639
1648#ifdef ADAPTIVE_READ_BUFFERING 1640#ifdef ADAPTIVE_READ_BUFFERING
1649 XPROCESS (proc)->adaptive_read_buffering = Vprocess_adaptive_read_buffering; 1641 XPROCESS (proc)->adaptive_read_buffering
1642 = (NILP (Vprocess_adaptive_read_buffering) ? 0
1643 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2);
1650#endif 1644#endif
1651 1645
1652 /* Make the process marker point into the process buffer (if any). */ 1646 /* Make the process marker point into the process buffer (if any). */
@@ -1777,13 +1771,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1777#endif /* not VMS */ 1771#endif /* not VMS */
1778 1772
1779 XPROCESS (proc)->decoding_buf = make_uninit_string (0); 1773 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1780 XPROCESS (proc)->decoding_carryover = make_number (0); 1774 XPROCESS (proc)->decoding_carryover = 0;
1781 XPROCESS (proc)->encoding_buf = make_uninit_string (0); 1775 XPROCESS (proc)->encoding_buf = make_uninit_string (0);
1782 XPROCESS (proc)->encoding_carryover = make_number (0);
1783 1776
1784 XPROCESS (proc)->inherit_coding_system_flag 1777 XPROCESS (proc)->inherit_coding_system_flag
1785 = (NILP (buffer) || !inherit_process_coding_system 1778 = (NILP (buffer) || !inherit_process_coding_system);
1786 ? Qnil : Qt);
1787 1779
1788 create_process (proc, (char **) new_argv, current_dir); 1780 create_process (proc, (char **) new_argv, current_dir);
1789 1781
@@ -1955,15 +1947,15 @@ create_process (process, new_argv, current_dir)
1955 /* Record this as an active process, with its channels. 1947 /* Record this as an active process, with its channels.
1956 As a result, child_setup will close Emacs's side of the pipes. */ 1948 As a result, child_setup will close Emacs's side of the pipes. */
1957 chan_process[inchannel] = process; 1949 chan_process[inchannel] = process;
1958 XSETINT (XPROCESS (process)->infd, inchannel); 1950 XPROCESS (process)->infd = inchannel;
1959 XSETINT (XPROCESS (process)->outfd, outchannel); 1951 XPROCESS (process)->outfd = outchannel;
1960 1952
1961 /* Previously we recorded the tty descriptor used in the subprocess. 1953 /* Previously we recorded the tty descriptor used in the subprocess.
1962 It was only used for getting the foreground tty process, so now 1954 It was only used for getting the foreground tty process, so now
1963 we just reopen the device (see emacs_get_tty_pgrp) as this is 1955 we just reopen the device (see emacs_get_tty_pgrp) as this is
1964 more portable (see USG_SUBTTY_WORKS above). */ 1956 more portable (see USG_SUBTTY_WORKS above). */
1965 1957
1966 XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil); 1958 XPROCESS (process)->pty_flag = pty_flag;
1967 XPROCESS (process)->status = Qrun; 1959 XPROCESS (process)->status = Qrun;
1968 setup_process_coding_systems (process); 1960 setup_process_coding_systems (process);
1969 1961
@@ -2480,7 +2472,7 @@ DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_
2480 if (!DATAGRAM_CONN_P (process)) 2472 if (!DATAGRAM_CONN_P (process))
2481 return Qnil; 2473 return Qnil;
2482 2474
2483 channel = XINT (XPROCESS (process)->infd); 2475 channel = XPROCESS (process)->infd;
2484 return conv_sockaddr_to_lisp (datagram_address[channel].sa, 2476 return conv_sockaddr_to_lisp (datagram_address[channel].sa,
2485 datagram_address[channel].len); 2477 datagram_address[channel].len);
2486} 2478}
@@ -2500,7 +2492,7 @@ Returns nil upon error setting address, ADDRESS otherwise. */)
2500 if (!DATAGRAM_CONN_P (process)) 2492 if (!DATAGRAM_CONN_P (process))
2501 return Qnil; 2493 return Qnil;
2502 2494
2503 channel = XINT (XPROCESS (process)->infd); 2495 channel = XPROCESS (process)->infd;
2504 2496
2505 len = get_lisp_to_sockaddr_size (address, &family); 2497 len = get_lisp_to_sockaddr_size (address, &family);
2506 if (datagram_address[channel].len != len) 2498 if (datagram_address[channel].len != len)
@@ -2665,7 +2657,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2665 if (!NETCONN1_P (p)) 2657 if (!NETCONN1_P (p))
2666 error ("Process is not a network process"); 2658 error ("Process is not a network process");
2667 2659
2668 s = XINT (p->infd); 2660 s = p->infd;
2669 if (s < 0) 2661 if (s < 0)
2670 error ("Process is not running"); 2662 error ("Process is not running");
2671 2663
@@ -3419,18 +3411,18 @@ usage: (make-network-process &rest ARGS) */)
3419 p->buffer = buffer; 3411 p->buffer = buffer;
3420 p->sentinel = sentinel; 3412 p->sentinel = sentinel;
3421 p->filter = filter; 3413 p->filter = filter;
3422 p->filter_multibyte = buffer_defaults.enable_multibyte_characters; 3414 p->filter_multibyte = !NILP (buffer_defaults.enable_multibyte_characters);
3423 /* Override the above only if :filter-multibyte is specified. */ 3415 /* Override the above only if :filter-multibyte is specified. */
3424 if (! NILP (Fplist_member (contact, QCfilter_multibyte))) 3416 if (! NILP (Fplist_member (contact, QCfilter_multibyte)))
3425 p->filter_multibyte = Fplist_get (contact, QCfilter_multibyte); 3417 p->filter_multibyte = !NILP (Fplist_get (contact, QCfilter_multibyte));
3426 p->log = Fplist_get (contact, QClog); 3418 p->log = Fplist_get (contact, QClog);
3427 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3419 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3428 p->kill_without_query = Qt; 3420 p->kill_without_query = 1;
3429 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3421 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3430 p->command = Qt; 3422 p->command = Qt;
3431 p->pid = 0; 3423 p->pid = 0;
3432 XSETINT (p->infd, inch); 3424 p->infd = inch;
3433 XSETINT (p->outfd, outch); 3425 p->outfd = outch;
3434 if (is_server && socktype == SOCK_STREAM) 3426 if (is_server && socktype == SOCK_STREAM)
3435 p->status = Qlisten; 3427 p->status = Qlisten;
3436 3428
@@ -3551,13 +3543,11 @@ usage: (make-network-process &rest ARGS) */)
3551 setup_process_coding_systems (proc); 3543 setup_process_coding_systems (proc);
3552 3544
3553 p->decoding_buf = make_uninit_string (0); 3545 p->decoding_buf = make_uninit_string (0);
3554 p->decoding_carryover = make_number (0); 3546 p->decoding_carryover = 0;
3555 p->encoding_buf = make_uninit_string (0); 3547 p->encoding_buf = make_uninit_string (0);
3556 p->encoding_carryover = make_number (0);
3557 3548
3558 p->inherit_coding_system_flag 3549 p->inherit_coding_system_flag
3559 = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system 3550 = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
3560 ? Qnil : Qt);
3561 3551
3562 UNGCPRO; 3552 UNGCPRO;
3563 return proc; 3553 return proc;
@@ -3820,16 +3810,16 @@ deactivate_process (proc)
3820 register int inchannel, outchannel; 3810 register int inchannel, outchannel;
3821 register struct Lisp_Process *p = XPROCESS (proc); 3811 register struct Lisp_Process *p = XPROCESS (proc);
3822 3812
3823 inchannel = XINT (p->infd); 3813 inchannel = p->infd;
3824 outchannel = XINT (p->outfd); 3814 outchannel = p->outfd;
3825 3815
3826#ifdef ADAPTIVE_READ_BUFFERING 3816#ifdef ADAPTIVE_READ_BUFFERING
3827 if (XINT (p->read_output_delay) > 0) 3817 if (p->read_output_delay > 0)
3828 { 3818 {
3829 if (--process_output_delay_count < 0) 3819 if (--process_output_delay_count < 0)
3830 process_output_delay_count = 0; 3820 process_output_delay_count = 0;
3831 XSETINT (p->read_output_delay, 0); 3821 p->read_output_delay = 0;
3832 p->read_output_skip = Qnil; 3822 p->read_output_skip = 0;
3833 } 3823 }
3834#endif 3824#endif
3835 3825
@@ -3851,8 +3841,8 @@ deactivate_process (proc)
3851 emacs_close (outchannel); 3841 emacs_close (outchannel);
3852#endif 3842#endif
3853 3843
3854 XSETINT (p->infd, -1); 3844 p->infd = -1;
3855 XSETINT (p->outfd, -1); 3845 p->outfd = -1;
3856#ifdef DATAGRAM_SOCKETS 3846#ifdef DATAGRAM_SOCKETS
3857 if (DATAGRAM_CHAN_P (inchannel)) 3847 if (DATAGRAM_CHAN_P (inchannel))
3858 { 3848 {
@@ -3900,8 +3890,8 @@ close_process_descs ()
3900 process = chan_process[i]; 3890 process = chan_process[i];
3901 if (!NILP (process)) 3891 if (!NILP (process))
3902 { 3892 {
3903 int in = XINT (XPROCESS (process)->infd); 3893 int in = XPROCESS (process)->infd;
3904 int out = XINT (XPROCESS (process)->outfd); 3894 int out = XPROCESS (process)->outfd;
3905 if (in >= 0) 3895 if (in >= 0)
3906 emacs_close (in); 3896 emacs_close (in);
3907 if (out >= 0 && in != out) 3897 if (out >= 0 && in != out)
@@ -4145,8 +4135,8 @@ server_accept_connection (server, channel)
4145 p->filter = ps->filter; 4135 p->filter = ps->filter;
4146 p->command = Qnil; 4136 p->command = Qnil;
4147 p->pid = 0; 4137 p->pid = 0;
4148 XSETINT (p->infd, s); 4138 p->infd = s;
4149 XSETINT (p->outfd, s); 4139 p->outfd = s;
4150 p->status = Qrun; 4140 p->status = Qrun;
4151 4141
4152 /* Client processes for accepted connections are not stopped initially. */ 4142 /* Client processes for accepted connections are not stopped initially. */
@@ -4169,12 +4159,11 @@ server_accept_connection (server, channel)
4169 setup_process_coding_systems (proc); 4159 setup_process_coding_systems (proc);
4170 4160
4171 p->decoding_buf = make_uninit_string (0); 4161 p->decoding_buf = make_uninit_string (0);
4172 p->decoding_carryover = make_number (0); 4162 p->decoding_carryover = 0;
4173 p->encoding_buf = make_uninit_string (0); 4163 p->encoding_buf = make_uninit_string (0);
4174 p->encoding_carryover = make_number (0);
4175 4164
4176 p->inherit_coding_system_flag 4165 p->inherit_coding_system_flag
4177 = (NILP (buffer) ? Qnil : ps->inherit_coding_system_flag); 4166 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
4178 4167
4179 if (!NILP (ps->log)) 4168 if (!NILP (ps->log))
4180 call3 (ps->log, server, proc, 4169 call3 (ps->log, server, proc,
@@ -4299,7 +4288,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4299 4288
4300 /* If wait_proc is a process to watch, set wait_channel accordingly. */ 4289 /* If wait_proc is a process to watch, set wait_channel accordingly. */
4301 if (wait_proc != NULL) 4290 if (wait_proc != NULL)
4302 wait_channel = XINT (wait_proc->infd); 4291 wait_channel = wait_proc->infd;
4303 4292
4304 record_unwind_protect (wait_reading_process_output_unwind, 4293 record_unwind_protect (wait_reading_process_output_unwind,
4305 make_number (waiting_for_user_input_p)); 4294 make_number (waiting_for_user_input_p));
@@ -4484,9 +4473,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4484 XSETPROCESS (proc, wait_proc); 4473 XSETPROCESS (proc, wait_proc);
4485 4474
4486 /* Read data from the process, until we exhaust it. */ 4475 /* Read data from the process, until we exhaust it. */
4487 while (XINT (wait_proc->infd) >= 0) 4476 while (wait_proc->infd >= 0)
4488 { 4477 {
4489 nread = read_process_output (proc, XINT (wait_proc->infd)); 4478 nread = read_process_output (proc, wait_proc->infd);
4490 4479
4491 if (nread == 0) 4480 if (nread == 0)
4492 break; 4481 break;
@@ -4516,9 +4505,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4516 4505
4517 if (wait_proc && just_wait_proc) 4506 if (wait_proc && just_wait_proc)
4518 { 4507 {
4519 if (XINT (wait_proc->infd) < 0) /* Terminated */ 4508 if (wait_proc->infd < 0) /* Terminated */
4520 break; 4509 break;
4521 FD_SET (XINT (wait_proc->infd), &Available); 4510 FD_SET (wait_proc->infd, &Available);
4522 check_delay = 0; 4511 check_delay = 0;
4523 IF_NON_BLOCKING_CONNECT (check_connect = 0); 4512 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4524 } 4513 }
@@ -4566,7 +4555,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4566 4555
4567#ifdef ADAPTIVE_READ_BUFFERING 4556#ifdef ADAPTIVE_READ_BUFFERING
4568 /* Set the timeout for adaptive read buffering if any 4557 /* Set the timeout for adaptive read buffering if any
4569 process has non-nil read_output_skip and non-zero 4558 process has non-zero read_output_skip and non-zero
4570 read_output_delay, and we are not reading output for a 4559 read_output_delay, and we are not reading output for a
4571 specific wait_channel. It is not executed if 4560 specific wait_channel. It is not executed if
4572 Vprocess_adaptive_read_buffering is nil. */ 4561 Vprocess_adaptive_read_buffering is nil. */
@@ -4581,16 +4570,16 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4581 if (NILP (proc)) 4570 if (NILP (proc))
4582 continue; 4571 continue;
4583 /* Find minimum non-zero read_output_delay among the 4572 /* Find minimum non-zero read_output_delay among the
4584 processes with non-nil read_output_skip. */ 4573 processes with non-zero read_output_skip. */
4585 if (XINT (XPROCESS (proc)->read_output_delay) > 0) 4574 if (XPROCESS (proc)->read_output_delay > 0)
4586 { 4575 {
4587 check_delay--; 4576 check_delay--;
4588 if (NILP (XPROCESS (proc)->read_output_skip)) 4577 if (!XPROCESS (proc)->read_output_skip)
4589 continue; 4578 continue;
4590 FD_CLR (channel, &Available); 4579 FD_CLR (channel, &Available);
4591 XPROCESS (proc)->read_output_skip = Qnil; 4580 XPROCESS (proc)->read_output_skip = 0;
4592 if (XINT (XPROCESS (proc)->read_output_delay) < usecs) 4581 if (XPROCESS (proc)->read_output_delay < usecs)
4593 usecs = XINT (XPROCESS (proc)->read_output_delay); 4582 usecs = XPROCESS (proc)->read_output_delay;
4594 } 4583 }
4595 } 4584 }
4596 EMACS_SET_SECS_USECS (timeout, 0, usecs); 4585 EMACS_SET_SECS_USECS (timeout, 0, usecs);
@@ -4863,7 +4852,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4863 else 4852 else
4864 { 4853 {
4865 /* Preserve status of processes already terminated. */ 4854 /* Preserve status of processes already terminated. */
4866 XSETINT (XPROCESS (proc)->tick, ++process_tick); 4855 XPROCESS (proc)->tick = ++process_tick;
4867 deactivate_process (proc); 4856 deactivate_process (proc);
4868 if (XPROCESS (proc)->raw_status_new) 4857 if (XPROCESS (proc)->raw_status_new)
4869 update_status (XPROCESS (proc)); 4858 update_status (XPROCESS (proc));
@@ -4915,7 +4904,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4915#endif 4904#endif
4916 if (xerrno) 4905 if (xerrno)
4917 { 4906 {
4918 XSETINT (p->tick, ++process_tick); 4907 p->tick = ++process_tick;
4919 p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)); 4908 p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil));
4920 deactivate_process (proc); 4909 deactivate_process (proc);
4921 } 4910 }
@@ -4928,8 +4917,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4928 exec_sentinel (proc, build_string ("open\n")); 4917 exec_sentinel (proc, build_string ("open\n"));
4929 if (!EQ (p->filter, Qt) && !EQ (p->command, Qt)) 4918 if (!EQ (p->filter, Qt) && !EQ (p->command, Qt))
4930 { 4919 {
4931 FD_SET (XINT (p->infd), &input_wait_mask); 4920 FD_SET (p->infd, &input_wait_mask);
4932 FD_SET (XINT (p->infd), &non_keyboard_wait_mask); 4921 FD_SET (p->infd, &non_keyboard_wait_mask);
4933 } 4922 }
4934 } 4923 }
4935 } 4924 }
@@ -5003,7 +4992,7 @@ read_process_output (proc, channel)
5003 register struct Lisp_Process *p = XPROCESS (proc); 4992 register struct Lisp_Process *p = XPROCESS (proc);
5004 register int opoint; 4993 register int opoint;
5005 struct coding_system *coding = proc_decode_coding_system[channel]; 4994 struct coding_system *coding = proc_decode_coding_system[channel];
5006 int carryover = XINT (p->decoding_carryover); 4995 int carryover = p->decoding_carryover;
5007 int readmax = 4096; 4996 int readmax = 4096;
5008 4997
5009#ifdef VMS 4998#ifdef VMS
@@ -5056,9 +5045,9 @@ read_process_output (proc, channel)
5056 { 5045 {
5057 nbytes = emacs_read (channel, chars + carryover, readmax); 5046 nbytes = emacs_read (channel, chars + carryover, readmax);
5058#ifdef ADAPTIVE_READ_BUFFERING 5047#ifdef ADAPTIVE_READ_BUFFERING
5059 if (nbytes > 0 && !NILP (p->adaptive_read_buffering)) 5048 if (nbytes > 0 && p->adaptive_read_buffering)
5060 { 5049 {
5061 int delay = XINT (p->read_output_delay); 5050 int delay = p->read_output_delay;
5062 if (nbytes < 256) 5051 if (nbytes < 256)
5063 { 5052 {
5064 if (delay < READ_OUTPUT_DELAY_MAX_MAX) 5053 if (delay < READ_OUTPUT_DELAY_MAX_MAX)
@@ -5074,10 +5063,10 @@ read_process_output (proc, channel)
5074 if (delay == 0) 5063 if (delay == 0)
5075 process_output_delay_count--; 5064 process_output_delay_count--;
5076 } 5065 }
5077 XSETINT (p->read_output_delay, delay); 5066 p->read_output_delay = delay;
5078 if (delay) 5067 if (delay)
5079 { 5068 {
5080 p->read_output_skip = Qt; 5069 p->read_output_skip = 1;
5081 process_output_skip = 1; 5070 process_output_skip = 1;
5082 } 5071 }
5083 } 5072 }
@@ -5095,7 +5084,7 @@ read_process_output (proc, channel)
5095 } 5084 }
5096#endif /* not VMS */ 5085#endif /* not VMS */
5097 5086
5098 XSETINT (p->decoding_carryover, 0); 5087 p->decoding_carryover = 0;
5099 5088
5100 /* At this point, NBYTES holds number of bytes just received 5089 /* At this point, NBYTES holds number of bytes just received
5101 (including the one in proc_buffered_char[channel]). */ 5090 (including the one in proc_buffered_char[channel]). */
@@ -5169,12 +5158,12 @@ read_process_output (proc, channel)
5169 valid memory because p->outfd will be changed once EOF is 5158 valid memory because p->outfd will be changed once EOF is
5170 sent to the process. */ 5159 sent to the process. */
5171 if (NILP (p->encode_coding_system) 5160 if (NILP (p->encode_coding_system)
5172 && proc_encode_coding_system[XINT (p->outfd)]) 5161 && proc_encode_coding_system[p->outfd])
5173 { 5162 {
5174 p->encode_coding_system 5163 p->encode_coding_system
5175 = coding_inherit_eol_type (Vlast_coding_system_used, Qnil); 5164 = coding_inherit_eol_type (Vlast_coding_system_used, Qnil);
5176 setup_coding_system (p->encode_coding_system, 5165 setup_coding_system (p->encode_coding_system,
5177 proc_encode_coding_system[XINT (p->outfd)]); 5166 proc_encode_coding_system[p->outfd]);
5178 } 5167 }
5179 } 5168 }
5180 5169
@@ -5184,10 +5173,10 @@ read_process_output (proc, channel)
5184 p->decoding_buf = make_uninit_string (coding->carryover_bytes); 5173 p->decoding_buf = make_uninit_string (coding->carryover_bytes);
5185 bcopy (coding->carryover, SDATA (p->decoding_buf), 5174 bcopy (coding->carryover, SDATA (p->decoding_buf),
5186 coding->carryover_bytes); 5175 coding->carryover_bytes);
5187 XSETINT (p->decoding_carryover, coding->carryover_bytes); 5176 p->decoding_carryover = coding->carryover_bytes;
5188 } 5177 }
5189 /* Adjust the multibyteness of TEXT to that of the filter. */ 5178 /* Adjust the multibyteness of TEXT to that of the filter. */
5190 if (NILP (p->filter_multibyte) != ! STRING_MULTIBYTE (text)) 5179 if (p->filter_multibyte != STRING_MULTIBYTE (text))
5191 text = (STRING_MULTIBYTE (text) 5180 text = (STRING_MULTIBYTE (text)
5192 ? Fstring_as_unibyte (text) 5181 ? Fstring_as_unibyte (text)
5193 : Fstring_to_multibyte (text)); 5182 : Fstring_to_multibyte (text));
@@ -5279,12 +5268,12 @@ read_process_output (proc, channel)
5279 { 5268 {
5280 p->decode_coding_system = Vlast_coding_system_used; 5269 p->decode_coding_system = Vlast_coding_system_used;
5281 if (NILP (p->encode_coding_system) 5270 if (NILP (p->encode_coding_system)
5282 && proc_encode_coding_system[XINT (p->outfd)]) 5271 && proc_encode_coding_system[p->outfd])
5283 { 5272 {
5284 p->encode_coding_system 5273 p->encode_coding_system
5285 = coding_inherit_eol_type (Vlast_coding_system_used, Qnil); 5274 = coding_inherit_eol_type (Vlast_coding_system_used, Qnil);
5286 setup_coding_system (p->encode_coding_system, 5275 setup_coding_system (p->encode_coding_system,
5287 proc_encode_coding_system[XINT (p->outfd)]); 5276 proc_encode_coding_system[p->outfd]);
5288 } 5277 }
5289 } 5278 }
5290 if (coding->carryover_bytes > 0) 5279 if (coding->carryover_bytes > 0)
@@ -5293,7 +5282,7 @@ read_process_output (proc, channel)
5293 p->decoding_buf = make_uninit_string (coding->carryover_bytes); 5282 p->decoding_buf = make_uninit_string (coding->carryover_bytes);
5294 bcopy (coding->carryover, SDATA (p->decoding_buf), 5283 bcopy (coding->carryover, SDATA (p->decoding_buf),
5295 coding->carryover_bytes); 5284 coding->carryover_bytes);
5296 XSETINT (p->decoding_carryover, coding->carryover_bytes); 5285 p->decoding_carryover = coding->carryover_bytes;
5297 } 5286 }
5298 /* Adjust the multibyteness of TEXT to that of the buffer. */ 5287 /* Adjust the multibyteness of TEXT to that of the buffer. */
5299 if (NILP (current_buffer->enable_multibyte_characters) 5288 if (NILP (current_buffer->enable_multibyte_characters)
@@ -5412,10 +5401,10 @@ send_process (proc, buf, len, object)
5412 update_status (p); 5401 update_status (p);
5413 if (! EQ (p->status, Qrun)) 5402 if (! EQ (p->status, Qrun))
5414 error ("Process %s not running", SDATA (p->name)); 5403 error ("Process %s not running", SDATA (p->name));
5415 if (XINT (p->outfd) < 0) 5404 if (p->outfd < 0)
5416 error ("Output file descriptor of %s is closed", SDATA (p->name)); 5405 error ("Output file descriptor of %s is closed", SDATA (p->name));
5417 5406
5418 coding = proc_encode_coding_system[XINT (p->outfd)]; 5407 coding = proc_encode_coding_system[p->outfd];
5419 Vlast_coding_system_used = CODING_ID_NAME (coding->id); 5408 Vlast_coding_system_used = CODING_ID_NAME (coding->id);
5420 5409
5421 if ((STRINGP (object) && STRING_MULTIBYTE (object)) 5410 if ((STRINGP (object) && STRING_MULTIBYTE (object))
@@ -5499,7 +5488,7 @@ send_process (proc, buf, len, object)
5499 if (pty_max_bytes == 0) 5488 if (pty_max_bytes == 0)
5500 { 5489 {
5501#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON) 5490#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON)
5502 pty_max_bytes = fpathconf (XFASTINT (p->outfd), _PC_MAX_CANON); 5491 pty_max_bytes = fpathconf (p->outfd, _PC_MAX_CANON);
5503 if (pty_max_bytes < 0) 5492 if (pty_max_bytes < 0)
5504 pty_max_bytes = 250; 5493 pty_max_bytes = 250;
5505#else 5494#else
@@ -5521,7 +5510,7 @@ send_process (proc, buf, len, object)
5521 5510
5522 /* Decide how much data we can send in one batch. 5511 /* Decide how much data we can send in one batch.
5523 Long lines need to be split into multiple batches. */ 5512 Long lines need to be split into multiple batches. */
5524 if (!NILP (p->pty_flag)) 5513 if (p->pty_flag)
5525 { 5514 {
5526 /* Starting this at zero is always correct when not the first 5515 /* Starting this at zero is always correct when not the first
5527 iteration because the previous iteration ended by sending C-d. 5516 iteration because the previous iteration ended by sending C-d.
@@ -5550,7 +5539,7 @@ send_process (proc, buf, len, object)
5550 /* Send this batch, using one or more write calls. */ 5539 /* Send this batch, using one or more write calls. */
5551 while (this > 0) 5540 while (this > 0)
5552 { 5541 {
5553 int outfd = XINT (p->outfd); 5542 int outfd = p->outfd;
5554 old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); 5543 old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap);
5555#ifdef DATAGRAM_SOCKETS 5544#ifdef DATAGRAM_SOCKETS
5556 if (DATAGRAM_CHAN_P (outfd)) 5545 if (DATAGRAM_CHAN_P (outfd))
@@ -5570,12 +5559,12 @@ send_process (proc, buf, len, object)
5570 { 5559 {
5571 rv = emacs_write (outfd, (char *) buf, this); 5560 rv = emacs_write (outfd, (char *) buf, this);
5572#ifdef ADAPTIVE_READ_BUFFERING 5561#ifdef ADAPTIVE_READ_BUFFERING
5573 if (XINT (p->read_output_delay) > 0 5562 if (p->read_output_delay > 0
5574 && EQ (p->adaptive_read_buffering, Qt)) 5563 && p->adaptive_read_buffering == 1)
5575 { 5564 {
5576 XSETFASTINT (p->read_output_delay, 0); 5565 p->read_output_delay = 0;
5577 process_output_delay_count--; 5566 process_output_delay_count--;
5578 p->read_output_skip = Qnil; 5567 p->read_output_skip = 0;
5579 } 5568 }
5580#endif 5569#endif
5581 } 5570 }
@@ -5618,7 +5607,7 @@ send_process (proc, buf, len, object)
5618 if (errno == EAGAIN) 5607 if (errno == EAGAIN)
5619 { 5608 {
5620 int flags = FWRITE; 5609 int flags = FWRITE;
5621 ioctl (XINT (p->outfd), TIOCFLUSH, &flags); 5610 ioctl (p->outfd, TIOCFLUSH, &flags);
5622 } 5611 }
5623#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ 5612#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
5624 5613
@@ -5667,7 +5656,7 @@ send_process (proc, buf, len, object)
5667#endif 5656#endif
5668 p->raw_status_new = 0; 5657 p->raw_status_new = 0;
5669 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil)); 5658 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil));
5670 XSETINT (p->tick, ++process_tick); 5659 p->tick = ++process_tick;
5671 deactivate_process (proc); 5660 deactivate_process (proc);
5672#ifdef VMS 5661#ifdef VMS
5673 error ("Error writing to process %s; closed it", SDATA (p->name)); 5662 error ("Error writing to process %s; closed it", SDATA (p->name));
@@ -5736,7 +5725,7 @@ emacs_get_tty_pgrp (p)
5736 int gid = -1; 5725 int gid = -1;
5737 5726
5738#ifdef TIOCGPGRP 5727#ifdef TIOCGPGRP
5739 if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) 5728 if (ioctl (p->infd, TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
5740 { 5729 {
5741 int fd; 5730 int fd;
5742 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the 5731 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
@@ -5774,7 +5763,7 @@ return t unconditionally. */)
5774 if (!EQ (p->childp, Qt)) 5763 if (!EQ (p->childp, Qt))
5775 error ("Process %s is not a subprocess", 5764 error ("Process %s is not a subprocess",
5776 SDATA (p->name)); 5765 SDATA (p->name));
5777 if (XINT (p->infd) < 0) 5766 if (p->infd < 0)
5778 error ("Process %s is not active", 5767 error ("Process %s is not active",
5779 SDATA (p->name)); 5768 SDATA (p->name));
5780 5769
@@ -5817,11 +5806,11 @@ process_send_signal (process, signo, current_group, nomsg)
5817 if (!EQ (p->childp, Qt)) 5806 if (!EQ (p->childp, Qt))
5818 error ("Process %s is not a subprocess", 5807 error ("Process %s is not a subprocess",
5819 SDATA (p->name)); 5808 SDATA (p->name));
5820 if (XINT (p->infd) < 0) 5809 if (p->infd < 0)
5821 error ("Process %s is not active", 5810 error ("Process %s is not active",
5822 SDATA (p->name)); 5811 SDATA (p->name));
5823 5812
5824 if (NILP (p->pty_flag)) 5813 if (!p->pty_flag)
5825 current_group = Qnil; 5814 current_group = Qnil;
5826 5815
5827 /* If we are using pgrps, get a pgrp number and make it negative. */ 5816 /* If we are using pgrps, get a pgrp number and make it negative. */
@@ -5840,7 +5829,7 @@ process_send_signal (process, signo, current_group, nomsg)
5840 struct termios t; 5829 struct termios t;
5841 cc_t *sig_char = NULL; 5830 cc_t *sig_char = NULL;
5842 5831
5843 tcgetattr (XINT (p->infd), &t); 5832 tcgetattr (p->infd, &t);
5844 5833
5845 switch (signo) 5834 switch (signo)
5846 { 5835 {
@@ -5880,16 +5869,16 @@ process_send_signal (process, signo, current_group, nomsg)
5880 switch (signo) 5869 switch (signo)
5881 { 5870 {
5882 case SIGINT: 5871 case SIGINT:
5883 ioctl (XINT (p->infd), TIOCGETC, &c); 5872 ioctl (p->infd, TIOCGETC, &c);
5884 send_process (proc, &c.t_intrc, 1, Qnil); 5873 send_process (proc, &c.t_intrc, 1, Qnil);
5885 return; 5874 return;
5886 case SIGQUIT: 5875 case SIGQUIT:
5887 ioctl (XINT (p->infd), TIOCGETC, &c); 5876 ioctl (p->infd, TIOCGETC, &c);
5888 send_process (proc, &c.t_quitc, 1, Qnil); 5877 send_process (proc, &c.t_quitc, 1, Qnil);
5889 return; 5878 return;
5890#ifdef SIGTSTP 5879#ifdef SIGTSTP
5891 case SIGTSTP: 5880 case SIGTSTP:
5892 ioctl (XINT (p->infd), TIOCGLTC, &lc); 5881 ioctl (p->infd, TIOCGLTC, &lc);
5893 send_process (proc, &lc.t_suspc, 1, Qnil); 5882 send_process (proc, &lc.t_suspc, 1, Qnil);
5894 return; 5883 return;
5895#endif /* ! defined (SIGTSTP) */ 5884#endif /* ! defined (SIGTSTP) */
@@ -5904,16 +5893,16 @@ process_send_signal (process, signo, current_group, nomsg)
5904 switch (signo) 5893 switch (signo)
5905 { 5894 {
5906 case SIGINT: 5895 case SIGINT:
5907 ioctl (XINT (p->infd), TCGETA, &t); 5896 ioctl (p->infd, TCGETA, &t);
5908 send_process (proc, &t.c_cc[VINTR], 1, Qnil); 5897 send_process (proc, &t.c_cc[VINTR], 1, Qnil);
5909 return; 5898 return;
5910 case SIGQUIT: 5899 case SIGQUIT:
5911 ioctl (XINT (p->infd), TCGETA, &t); 5900 ioctl (p->infd, TCGETA, &t);
5912 send_process (proc, &t.c_cc[VQUIT], 1, Qnil); 5901 send_process (proc, &t.c_cc[VQUIT], 1, Qnil);
5913 return; 5902 return;
5914#ifdef SIGTSTP 5903#ifdef SIGTSTP
5915 case SIGTSTP: 5904 case SIGTSTP:
5916 ioctl (XINT (p->infd), TCGETA, &t); 5905 ioctl (p->infd, TCGETA, &t);
5917 send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); 5906 send_process (proc, &t.c_cc[VSWTCH], 1, Qnil);
5918 return; 5907 return;
5919#endif /* ! defined (SIGTSTP) */ 5908#endif /* ! defined (SIGTSTP) */
@@ -5971,7 +5960,7 @@ process_send_signal (process, signo, current_group, nomsg)
5971 case SIGCONT: 5960 case SIGCONT:
5972 p->raw_status_new = 0; 5961 p->raw_status_new = 0;
5973 p->status = Qrun; 5962 p->status = Qrun;
5974 XSETINT (p->tick, ++process_tick); 5963 p->tick = ++process_tick;
5975 if (!nomsg) 5964 if (!nomsg)
5976 status_notify (NULL); 5965 status_notify (NULL);
5977 break; 5966 break;
@@ -5991,7 +5980,7 @@ process_send_signal (process, signo, current_group, nomsg)
5991 sys$forcex (&(p->pid), 0, 1); 5980 sys$forcex (&(p->pid), 0, 1);
5992 whoosh: 5981 whoosh:
5993#endif 5982#endif
5994 flush_pending_output (XINT (p->infd)); 5983 flush_pending_output (p->infd);
5995 break; 5984 break;
5996 } 5985 }
5997 5986
@@ -6008,7 +5997,7 @@ process_send_signal (process, signo, current_group, nomsg)
6008#ifdef TIOCSIGSEND 5997#ifdef TIOCSIGSEND
6009 if (!NILP (current_group)) 5998 if (!NILP (current_group))
6010 { 5999 {
6011 if (ioctl (XINT (p->infd), TIOCSIGSEND, signo) == -1) 6000 if (ioctl (p->infd, TIOCSIGSEND, signo) == -1)
6012 EMACS_KILLPG (gid, signo); 6001 EMACS_KILLPG (gid, signo);
6013 } 6002 }
6014 else 6003 else
@@ -6074,10 +6063,10 @@ If PROCESS is a network process, inhibit handling of incoming traffic. */)
6074 6063
6075 p = XPROCESS (process); 6064 p = XPROCESS (process);
6076 if (NILP (p->command) 6065 if (NILP (p->command)
6077 && XINT (p->infd) >= 0) 6066 && p->infd >= 0)
6078 { 6067 {
6079 FD_CLR (XINT (p->infd), &input_wait_mask); 6068 FD_CLR (p->infd, &input_wait_mask);
6080 FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); 6069 FD_CLR (p->infd, &non_keyboard_wait_mask);
6081 } 6070 }
6082 p->command = Qt; 6071 p->command = Qt;
6083 return process; 6072 return process;
@@ -6105,11 +6094,11 @@ If PROCESS is a network process, resume handling of incoming traffic. */)
6105 6094
6106 p = XPROCESS (process); 6095 p = XPROCESS (process);
6107 if (EQ (p->command, Qt) 6096 if (EQ (p->command, Qt)
6108 && XINT (p->infd) >= 0 6097 && p->infd >= 0
6109 && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten))) 6098 && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten)))
6110 { 6099 {
6111 FD_SET (XINT (p->infd), &input_wait_mask); 6100 FD_SET (p->infd, &input_wait_mask);
6112 FD_SET (XINT (p->infd), &non_keyboard_wait_mask); 6101 FD_SET (p->infd, &non_keyboard_wait_mask);
6113 } 6102 }
6114 p->command = Qnil; 6103 p->command = Qnil;
6115 return process; 6104 return process;
@@ -6306,7 +6295,7 @@ text to PROCESS after you call this function. */)
6306 return process; 6295 return process;
6307 6296
6308 proc = get_process (process); 6297 proc = get_process (process);
6309 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; 6298 coding = proc_encode_coding_system[XPROCESS (proc)->outfd];
6310 6299
6311 /* Make sure the process is really alive. */ 6300 /* Make sure the process is really alive. */
6312 if (XPROCESS (proc)->raw_status_new) 6301 if (XPROCESS (proc)->raw_status_new)
@@ -6323,7 +6312,7 @@ text to PROCESS after you call this function. */)
6323#ifdef VMS 6312#ifdef VMS
6324 send_process (proc, "\032", 1, Qnil); /* ^z */ 6313 send_process (proc, "\032", 1, Qnil); /* ^z */
6325#else 6314#else
6326 if (!NILP (XPROCESS (proc)->pty_flag)) 6315 if (XPROCESS (proc)->pty_flag)
6327 send_process (proc, "\004", 1, Qnil); 6316 send_process (proc, "\004", 1, Qnil);
6328 else 6317 else
6329 { 6318 {
@@ -6335,18 +6324,18 @@ text to PROCESS after you call this function. */)
6335 (In some old system, shutdown to socketpair doesn't work. 6324 (In some old system, shutdown to socketpair doesn't work.
6336 Then we just can't win.) */ 6325 Then we just can't win.) */
6337 if (XPROCESS (proc)->pid == 0 6326 if (XPROCESS (proc)->pid == 0
6338 || XINT (XPROCESS (proc)->outfd) == XINT (XPROCESS (proc)->infd)) 6327 || XPROCESS (proc)->outfd == XPROCESS (proc)->infd)
6339 shutdown (XINT (XPROCESS (proc)->outfd), 1); 6328 shutdown (XPROCESS (proc)->outfd, 1);
6340 /* In case of socketpair, outfd == infd, so don't close it. */ 6329 /* In case of socketpair, outfd == infd, so don't close it. */
6341 if (XINT (XPROCESS (proc)->outfd) != XINT (XPROCESS (proc)->infd)) 6330 if (XPROCESS (proc)->outfd != XPROCESS (proc)->infd)
6342 emacs_close (XINT (XPROCESS (proc)->outfd)); 6331 emacs_close (XPROCESS (proc)->outfd);
6343#else /* not HAVE_SHUTDOWN */ 6332#else /* not HAVE_SHUTDOWN */
6344 emacs_close (XINT (XPROCESS (proc)->outfd)); 6333 emacs_close (XPROCESS (proc)->outfd);
6345#endif /* not HAVE_SHUTDOWN */ 6334#endif /* not HAVE_SHUTDOWN */
6346 new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0); 6335 new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0);
6347 if (new_outfd < 0) 6336 if (new_outfd < 0)
6348 abort (); 6337 abort ();
6349 old_outfd = XINT (XPROCESS (proc)->outfd); 6338 old_outfd = XPROCESS (proc)->outfd;
6350 6339
6351 if (!proc_encode_coding_system[new_outfd]) 6340 if (!proc_encode_coding_system[new_outfd])
6352 proc_encode_coding_system[new_outfd] 6341 proc_encode_coding_system[new_outfd]
@@ -6357,7 +6346,7 @@ text to PROCESS after you call this function. */)
6357 bzero (proc_encode_coding_system[old_outfd], 6346 bzero (proc_encode_coding_system[old_outfd],
6358 sizeof (struct coding_system)); 6347 sizeof (struct coding_system));
6359 6348
6360 XSETINT (XPROCESS (proc)->outfd, new_outfd); 6349 XPROCESS (proc)->outfd = new_outfd;
6361 } 6350 }
6362#endif /* VMS */ 6351#endif /* VMS */
6363 return process; 6352 return process;
@@ -6380,7 +6369,7 @@ kill_buffer_processes (buffer)
6380 { 6369 {
6381 if (NETCONN_P (proc)) 6370 if (NETCONN_P (proc))
6382 Fdelete_process (proc); 6371 Fdelete_process (proc);
6383 else if (XINT (XPROCESS (proc)->infd) >= 0) 6372 else if (XPROCESS (proc)->infd >= 0)
6384 process_send_signal (proc, SIGHUP, Qnil, 1); 6373 process_send_signal (proc, SIGHUP, Qnil, 1);
6385 } 6374 }
6386 } 6375 }
@@ -6510,21 +6499,21 @@ sigchld_handler (signo)
6510 union { int i; WAITTYPE wt; } u; 6499 union { int i; WAITTYPE wt; } u;
6511 int clear_desc_flag = 0; 6500 int clear_desc_flag = 0;
6512 6501
6513 XSETINT (p->tick, ++process_tick); 6502 p->tick = ++process_tick;
6514 u.wt = w; 6503 u.wt = w;
6515 p->raw_status = u.i; 6504 p->raw_status = u.i;
6516 p->raw_status_new = 1; 6505 p->raw_status_new = 1;
6517 6506
6518 /* If process has terminated, stop waiting for its output. */ 6507 /* If process has terminated, stop waiting for its output. */
6519 if ((WIFSIGNALED (w) || WIFEXITED (w)) 6508 if ((WIFSIGNALED (w) || WIFEXITED (w))
6520 && XINT (p->infd) >= 0) 6509 && p->infd >= 0)
6521 clear_desc_flag = 1; 6510 clear_desc_flag = 1;
6522 6511
6523 /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */ 6512 /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */
6524 if (clear_desc_flag) 6513 if (clear_desc_flag)
6525 { 6514 {
6526 FD_CLR (XINT (p->infd), &input_wait_mask); 6515 FD_CLR (p->infd, &input_wait_mask);
6527 FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); 6516 FD_CLR (p->infd, &non_keyboard_wait_mask);
6528 } 6517 }
6529 6518
6530 /* Tell wait_reading_process_output that it needs to wake up and 6519 /* Tell wait_reading_process_output that it needs to wake up and
@@ -6701,18 +6690,18 @@ status_notify (deleting_process)
6701 proc = Fcdr (Fcar (tail)); 6690 proc = Fcdr (Fcar (tail));
6702 p = XPROCESS (proc); 6691 p = XPROCESS (proc);
6703 6692
6704 if (XINT (p->tick) != XINT (p->update_tick)) 6693 if (p->tick != p->update_tick)
6705 { 6694 {
6706 XSETINT (p->update_tick, XINT (p->tick)); 6695 p->update_tick = p->tick;
6707 6696
6708 /* If process is still active, read any output that remains. */ 6697 /* If process is still active, read any output that remains. */
6709 while (! EQ (p->filter, Qt) 6698 while (! EQ (p->filter, Qt)
6710 && ! EQ (p->status, Qconnect) 6699 && ! EQ (p->status, Qconnect)
6711 && ! EQ (p->status, Qlisten) 6700 && ! EQ (p->status, Qlisten)
6712 && ! EQ (p->command, Qt) /* Network process not stopped. */ 6701 && ! EQ (p->command, Qt) /* Network process not stopped. */
6713 && XINT (p->infd) >= 0 6702 && p->infd >= 0
6714 && p != deleting_process 6703 && p != deleting_process
6715 && read_process_output (proc, XINT (p->infd)) > 0); 6704 && read_process_output (proc, p->infd) > 0);
6716 6705
6717 buffer = p->buffer; 6706 buffer = p->buffer;
6718 6707
@@ -6739,7 +6728,7 @@ status_notify (deleting_process)
6739 So set p->update_tick again 6728 So set p->update_tick again
6740 so that an error in the sentinel will not cause 6729 so that an error in the sentinel will not cause
6741 this code to be run again. */ 6730 this code to be run again. */
6742 XSETINT (p->update_tick, XINT (p->tick)); 6731 p->update_tick = p->tick;
6743 /* Now output the message suitably. */ 6732 /* Now output the message suitably. */
6744 if (!NILP (p->sentinel)) 6733 if (!NILP (p->sentinel))
6745 exec_sentinel (proc, msg); 6734 exec_sentinel (proc, msg);
@@ -6812,9 +6801,9 @@ encode subprocess input. */)
6812 6801
6813 CHECK_PROCESS (process); 6802 CHECK_PROCESS (process);
6814 p = XPROCESS (process); 6803 p = XPROCESS (process);
6815 if (XINT (p->infd) < 0) 6804 if (p->infd < 0)
6816 error ("Input file descriptor of %s closed", SDATA (p->name)); 6805 error ("Input file descriptor of %s closed", SDATA (p->name));
6817 if (XINT (p->outfd) < 0) 6806 if (p->outfd < 0)
6818 error ("Output file descriptor of %s closed", SDATA (p->name)); 6807 error ("Output file descriptor of %s closed", SDATA (p->name));
6819 Fcheck_coding_system (decoding); 6808 Fcheck_coding_system (decoding);
6820 Fcheck_coding_system (encoding); 6809 Fcheck_coding_system (encoding);
@@ -6851,7 +6840,7 @@ suppressed. */)
6851 6840
6852 CHECK_PROCESS (process); 6841 CHECK_PROCESS (process);
6853 p = XPROCESS (process); 6842 p = XPROCESS (process);
6854 p->filter_multibyte = flag; 6843 p->filter_multibyte = !NILP (flag);
6855 setup_process_coding_systems (process); 6844 setup_process_coding_systems (process);
6856 6845
6857 return Qnil; 6846 return Qnil;
@@ -6868,7 +6857,7 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
6868 CHECK_PROCESS (process); 6857 CHECK_PROCESS (process);
6869 p = XPROCESS (process); 6858 p = XPROCESS (process);
6870 6859
6871 return (NILP (p->filter_multibyte) ? Qnil : Qt); 6860 return (p->filter_multibyte ? Qt : Qnil);
6872} 6861}
6873 6862
6874 6863
diff --git a/src/process.h b/src/process.h
index 718d2a70ea8..fd7847b5e29 100644
--- a/src/process.h
+++ b/src/process.h
@@ -36,10 +36,6 @@ struct Lisp_Process
36 { 36 {
37 EMACS_INT size; 37 EMACS_INT size;
38 struct Lisp_Vector *v_next; 38 struct Lisp_Vector *v_next;
39 /* Descriptor by which we read from this process */
40 Lisp_Object infd;
41 /* Descriptor by which we write to this process */
42 Lisp_Object outfd;
43 /* Name of subprocess terminal. */ 39 /* Name of subprocess terminal. */
44 Lisp_Object tty_name; 40 Lisp_Object tty_name;
45 /* Name of this process */ 41 /* Name of this process */
@@ -64,61 +60,65 @@ struct Lisp_Process
64 Lisp_Object plist; 60 Lisp_Object plist;
65 /* Marker set to end of last buffer-inserted output from this process */ 61 /* Marker set to end of last buffer-inserted output from this process */
66 Lisp_Object mark; 62 Lisp_Object mark;
67 /* Non-nil means kill silently if Emacs is exited.
68 This is the inverse of the `query-on-exit' flag. */
69 Lisp_Object kill_without_query;
70 /* Symbol indicating status of process. 63 /* Symbol indicating status of process.
71 This may be a symbol: run, open, or closed. 64 This may be a symbol: run, open, or closed.
72 Or it may be a list, whose car is stop, exit or signal 65 Or it may be a list, whose car is stop, exit or signal
73 and whose cdr is a pair (EXIT_CODE . COREDUMP_FLAG) 66 and whose cdr is a pair (EXIT_CODE . COREDUMP_FLAG)
74 or (SIGNAL_NUMBER . COREDUMP_FLAG). */ 67 or (SIGNAL_NUMBER . COREDUMP_FLAG). */
75 Lisp_Object status; 68 Lisp_Object status;
76 /* Non-nil if communicating through a pty. */
77 Lisp_Object pty_flag;
78 /* Event-count of last event in which this process changed status. */
79 Lisp_Object tick;
80 /* Event-count of last such event reported. */
81 Lisp_Object update_tick;
82 /* Coding-system for decoding the input from this process. */ 69 /* Coding-system for decoding the input from this process. */
83 Lisp_Object decode_coding_system; 70 Lisp_Object decode_coding_system;
84 /* Working buffer for decoding. */ 71 /* Working buffer for decoding. */
85 Lisp_Object decoding_buf; 72 Lisp_Object decoding_buf;
86 /* Size of carryover in decoding. */
87 Lisp_Object decoding_carryover;
88 /* Coding-system for encoding the output to this process. */ 73 /* Coding-system for encoding the output to this process. */
89 Lisp_Object encode_coding_system; 74 Lisp_Object encode_coding_system;
90 /* Working buffer for encoding. */ 75 /* Working buffer for encoding. */
91 Lisp_Object encoding_buf; 76 Lisp_Object encoding_buf;
92 /* Size of carryover in encoding. */
93 Lisp_Object encoding_carryover;
94 /* Flag to set coding-system of the process buffer from the
95 coding_system used to decode process output. */
96 Lisp_Object inherit_coding_system_flag;
97 /* Flat to decide the multibyteness of a string given to the
98 filter (if any). It is initialized to the value of
99 `default-enable-multibyte-characters' when the process is
100 generated, and can be changed by the function
101 `set-process-fileter-multibyte'. */
102 Lisp_Object filter_multibyte;
103 /* Should we delay reading output from this process.
104 Initialized from `Vprocess_adaptive_read_buffering'. */
105 Lisp_Object adaptive_read_buffering;
106 /* Hysteresis to try to read process output in larger blocks.
107 On some systems, e.g. GNU/Linux, Emacs is seen as
108 an interactive app also when reading process output, meaning
109 that process output can be read in as little as 1 byte at a
110 time. Value is micro-seconds to delay reading output from
111 this process. Range is 0 .. 50000. */
112 Lisp_Object read_output_delay;
113 /* Skip reading this process on next read. */
114 Lisp_Object read_output_skip;
115 77
116 /* After this point, there are no Lisp_Objects any more. */ 78 /* After this point, there are no Lisp_Objects any more. */
79 /* alloc.c assumes that `pid' is the first such non-Lisp slot. */
117 80
118 /* Number of this process. 81 /* Number of this process.
119 allocate_process assumes this is the first non-Lisp_Object field. 82 allocate_process assumes this is the first non-Lisp_Object field.
120 A value 0 is used for pseudo-processes such as network connections. */ 83 A value 0 is used for pseudo-processes such as network connections. */
121 pid_t pid; 84 pid_t pid;
85 /* Descriptor by which we read from this process */
86 int infd;
87 /* Descriptor by which we write to this process */
88 int outfd;
89 /* Event-count of last event in which this process changed status. */
90 int tick;
91 /* Event-count of last such event reported. */
92 int update_tick;
93 /* Size of carryover in decoding. */
94 int decoding_carryover;
95 /* Hysteresis to try to read process output in larger blocks.
96 On some systems, e.g. GNU/Linux, Emacs is seen as
97 an interactive app also when reading process output, meaning
98 that process output can be read in as little as 1 byte at a
99 time. Value is micro-seconds to delay reading output from
100 this process. Range is 0 .. 50000. */
101 int read_output_delay;
102 /* Should we delay reading output from this process.
103 Initialized from `Vprocess_adaptive_read_buffering'.
104 0 = nil, 1 = t, 2 = other. */
105 int adaptive_read_buffering : 2;
106 /* Skip reading this process on next read. */
107 int read_output_skip : 1;
108 /* Non-nil means kill silently if Emacs is exited.
109 This is the inverse of the `query-on-exit' flag. */
110 int kill_without_query : 1;
111 /* Non-nil if communicating through a pty. */
112 int pty_flag : 1;
113 /* Flag to set coding-system of the process buffer from the
114 coding_system used to decode process output. */
115 int inherit_coding_system_flag : 1;
116 /* Flag to decide the multibyteness of a string given to the
117 filter (if any). It is initialized to the value of
118 `default-enable-multibyte-characters' when the process is
119 generated, and can be changed by the function
120 `set-process-filter-multibyte'. */
121 int filter_multibyte : 1;
122 /* Record the process status in the raw form in which it comes from `wait'. 122 /* Record the process status in the raw form in which it comes from `wait'.
123 This is to avoid consing in a signal handler. The `raw_status_new' 123 This is to avoid consing in a signal handler. The `raw_status_new'
124 flag indicates that `raw_status' contains a new status that still 124 flag indicates that `raw_status' contains a new status that still
diff --git a/src/search.c b/src/search.c
index fd7b474e4ab..ae5ae608e4a 100644
--- a/src/search.c
+++ b/src/search.c
@@ -93,6 +93,11 @@ Lisp_Object Qsearch_failed;
93 93
94Lisp_Object Vsearch_spaces_regexp; 94Lisp_Object Vsearch_spaces_regexp;
95 95
96/* If non-nil, the match data will not be changed during call to
97 searching or matching functions. This variable is for internal use
98 only. */
99Lisp_Object Vinhibit_changing_match_data;
100
96static void set_search_regs (); 101static void set_search_regs ();
97static void save_search_regs (); 102static void save_search_regs ();
98static int simple_search (); 103static int simple_search ();
@@ -289,7 +294,9 @@ looking_at_1 (string, posix)
289 = current_buffer->case_eqv_table; 294 = current_buffer->case_eqv_table;
290 295
291 CHECK_STRING (string); 296 CHECK_STRING (string);
292 bufp = compile_pattern (string, &search_regs, 297 bufp = compile_pattern (string,
298 (NILP (Vinhibit_changing_match_data)
299 ? &search_regs : NULL),
293 (!NILP (current_buffer->case_fold_search) 300 (!NILP (current_buffer->case_fold_search)
294 ? current_buffer->case_canon_table : Qnil), 301 ? current_buffer->case_canon_table : Qnil),
295 posix, 302 posix,
@@ -320,7 +327,9 @@ looking_at_1 (string, posix)
320 re_match_object = Qnil; 327 re_match_object = Qnil;
321 328
322 i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2, 329 i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2,
323 PT_BYTE - BEGV_BYTE, &search_regs, 330 PT_BYTE - BEGV_BYTE,
331 (NILP (Vinhibit_changing_match_data)
332 ? &search_regs : NULL),
324 ZV_BYTE - BEGV_BYTE); 333 ZV_BYTE - BEGV_BYTE);
325 immediate_quit = 0; 334 immediate_quit = 0;
326 335
@@ -328,7 +337,7 @@ looking_at_1 (string, posix)
328 matcher_overflow (); 337 matcher_overflow ();
329 338
330 val = (0 <= i ? Qt : Qnil); 339 val = (0 <= i ? Qt : Qnil);
331 if (i >= 0) 340 if (NILP (Vinhibit_changing_match_data) && i >= 0)
332 for (i = 0; i < search_regs.num_regs; i++) 341 for (i = 0; i < search_regs.num_regs; i++)
333 if (search_regs.start[i] >= 0) 342 if (search_regs.start[i] >= 0)
334 { 343 {
@@ -337,7 +346,11 @@ looking_at_1 (string, posix)
337 search_regs.end[i] 346 search_regs.end[i]
338 = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); 347 = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE);
339 } 348 }
340 XSETBUFFER (last_thing_searched, current_buffer); 349
350 /* Set last_thing_searched only when match data is changed. */
351 if (NILP (Vinhibit_changing_match_data))
352 XSETBUFFER (last_thing_searched, current_buffer);
353
341 return val; 354 return val;
342} 355}
343 356
@@ -399,7 +412,9 @@ string_match_1 (regexp, string, start, posix)
399 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] 412 XCHAR_TABLE (current_buffer->case_canon_table)->extras[2]
400 = current_buffer->case_eqv_table; 413 = current_buffer->case_eqv_table;
401 414
402 bufp = compile_pattern (regexp, &search_regs, 415 bufp = compile_pattern (regexp,
416 (NILP (Vinhibit_changing_match_data)
417 ? &search_regs : NULL),
403 (!NILP (current_buffer->case_fold_search) 418 (!NILP (current_buffer->case_fold_search)
404 ? current_buffer->case_canon_table : Qnil), 419 ? current_buffer->case_canon_table : Qnil),
405 posix, 420 posix,
@@ -410,21 +425,27 @@ string_match_1 (regexp, string, start, posix)
410 val = re_search (bufp, (char *) SDATA (string), 425 val = re_search (bufp, (char *) SDATA (string),
411 SBYTES (string), pos_byte, 426 SBYTES (string), pos_byte,
412 SBYTES (string) - pos_byte, 427 SBYTES (string) - pos_byte,
413 &search_regs); 428 (NILP (Vinhibit_changing_match_data)
429 ? &search_regs : NULL));
414 immediate_quit = 0; 430 immediate_quit = 0;
415 last_thing_searched = Qt; 431
432 /* Set last_thing_searched only when match data is changed. */
433 if (NILP (Vinhibit_changing_match_data))
434 last_thing_searched = Qt;
435
416 if (val == -2) 436 if (val == -2)
417 matcher_overflow (); 437 matcher_overflow ();
418 if (val < 0) return Qnil; 438 if (val < 0) return Qnil;
419 439
420 for (i = 0; i < search_regs.num_regs; i++) 440 if (NILP (Vinhibit_changing_match_data))
421 if (search_regs.start[i] >= 0) 441 for (i = 0; i < search_regs.num_regs; i++)
422 { 442 if (search_regs.start[i] >= 0)
423 search_regs.start[i] 443 {
424 = string_byte_to_char (string, search_regs.start[i]); 444 search_regs.start[i]
425 search_regs.end[i] 445 = string_byte_to_char (string, search_regs.start[i]);
426 = string_byte_to_char (string, search_regs.end[i]); 446 search_regs.end[i]
427 } 447 = string_byte_to_char (string, search_regs.end[i]);
448 }
428 449
429 return make_number (string_byte_to_char (string, val)); 450 return make_number (string_byte_to_char (string, val));
430} 451}
@@ -1042,6 +1063,11 @@ do \
1042 } \ 1063 } \
1043while (0) 1064while (0)
1044 1065
1066/* Only used in search_buffer, to record the end position of the match
1067 when searching regexps and SEARCH_REGS should not be changed
1068 (i.e. Vinhibit_changing_match_data is non-nil). */
1069static struct re_registers search_regs_1;
1070
1045static int 1071static int
1046search_buffer (string, pos, pos_byte, lim, lim_byte, n, 1072search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1047 RE, trt, inverse_trt, posix) 1073 RE, trt, inverse_trt, posix)
@@ -1077,7 +1103,10 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1077 int s1, s2; 1103 int s1, s2;
1078 struct re_pattern_buffer *bufp; 1104 struct re_pattern_buffer *bufp;
1079 1105
1080 bufp = compile_pattern (string, &search_regs, trt, posix, 1106 bufp = compile_pattern (string,
1107 (NILP (Vinhibit_changing_match_data)
1108 ? &search_regs : &search_regs_1),
1109 trt, posix,
1081 !NILP (current_buffer->enable_multibyte_characters)); 1110 !NILP (current_buffer->enable_multibyte_characters));
1082 1111
1083 immediate_quit = 1; /* Quit immediately if user types ^G, 1112 immediate_quit = 1; /* Quit immediately if user types ^G,
@@ -1110,7 +1139,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1110 int val; 1139 int val;
1111 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, 1140 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2,
1112 pos_byte - BEGV_BYTE, lim_byte - pos_byte, 1141 pos_byte - BEGV_BYTE, lim_byte - pos_byte,
1113 &search_regs, 1142 (NILP (Vinhibit_changing_match_data)
1143 ? &search_regs : &search_regs_1),
1114 /* Don't allow match past current point */ 1144 /* Don't allow match past current point */
1115 pos_byte - BEGV_BYTE); 1145 pos_byte - BEGV_BYTE);
1116 if (val == -2) 1146 if (val == -2)
@@ -1119,18 +1149,27 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1119 } 1149 }
1120 if (val >= 0) 1150 if (val >= 0)
1121 { 1151 {
1122 pos_byte = search_regs.start[0] + BEGV_BYTE; 1152 if (NILP (Vinhibit_changing_match_data))
1123 for (i = 0; i < search_regs.num_regs; i++) 1153 {
1124 if (search_regs.start[i] >= 0) 1154 pos_byte = search_regs.start[0] + BEGV_BYTE;
1125 { 1155 for (i = 0; i < search_regs.num_regs; i++)
1126 search_regs.start[i] 1156 if (search_regs.start[i] >= 0)
1127 = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE); 1157 {
1128 search_regs.end[i] 1158 search_regs.start[i]
1129 = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); 1159 = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE);
1130 } 1160 search_regs.end[i]
1131 XSETBUFFER (last_thing_searched, current_buffer); 1161 = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE);
1132 /* Set pos to the new position. */ 1162 }
1133 pos = search_regs.start[0]; 1163 XSETBUFFER (last_thing_searched, current_buffer);
1164 /* Set pos to the new position. */
1165 pos = search_regs.start[0];
1166 }
1167 else
1168 {
1169 pos_byte = search_regs_1.start[0] + BEGV_BYTE;
1170 /* Set pos to the new position. */
1171 pos = BYTE_TO_CHAR (search_regs_1.start[0] + BEGV_BYTE);
1172 }
1134 } 1173 }
1135 else 1174 else
1136 { 1175 {
@@ -1144,7 +1183,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1144 int val; 1183 int val;
1145 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, 1184 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2,
1146 pos_byte - BEGV_BYTE, lim_byte - pos_byte, 1185 pos_byte - BEGV_BYTE, lim_byte - pos_byte,
1147 &search_regs, 1186 (NILP (Vinhibit_changing_match_data)
1187 ? &search_regs : &search_regs_1),
1148 lim_byte - BEGV_BYTE); 1188 lim_byte - BEGV_BYTE);
1149 if (val == -2) 1189 if (val == -2)
1150 { 1190 {
@@ -1152,17 +1192,25 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1152 } 1192 }
1153 if (val >= 0) 1193 if (val >= 0)
1154 { 1194 {
1155 pos_byte = search_regs.end[0] + BEGV_BYTE; 1195 if (NILP (Vinhibit_changing_match_data))
1156 for (i = 0; i < search_regs.num_regs; i++) 1196 {
1157 if (search_regs.start[i] >= 0) 1197 pos_byte = search_regs.end[0] + BEGV_BYTE;
1158 { 1198 for (i = 0; i < search_regs.num_regs; i++)
1159 search_regs.start[i] 1199 if (search_regs.start[i] >= 0)
1160 = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE); 1200 {
1161 search_regs.end[i] 1201 search_regs.start[i]
1162 = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE); 1202 = BYTE_TO_CHAR (search_regs.start[i] + BEGV_BYTE);
1163 } 1203 search_regs.end[i]
1164 XSETBUFFER (last_thing_searched, current_buffer); 1204 = BYTE_TO_CHAR (search_regs.end[i] + BEGV_BYTE);
1165 pos = search_regs.end[0]; 1205 }
1206 XSETBUFFER (last_thing_searched, current_buffer);
1207 pos = search_regs.end[0];
1208 }
1209 else
1210 {
1211 pos_byte = search_regs_1.end[0] + BEGV_BYTE;
1212 pos = BYTE_TO_CHAR (search_regs_1.end[0] + BEGV_BYTE);
1213 }
1166 } 1214 }
1167 else 1215 else
1168 { 1216 {
@@ -1907,7 +1955,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
1907 cursor += dirlen - i - direction; /* fix cursor */ 1955 cursor += dirlen - i - direction; /* fix cursor */
1908 if (i + direction == 0) 1956 if (i + direction == 0)
1909 { 1957 {
1910 int position; 1958 int position, start, end;
1911 1959
1912 cursor -= direction; 1960 cursor -= direction;
1913 1961
@@ -1915,11 +1963,24 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
1915 ? 1 - len_byte : 0); 1963 ? 1 - len_byte : 0);
1916 set_search_regs (position, len_byte); 1964 set_search_regs (position, len_byte);
1917 1965
1966 if (NILP (Vinhibit_changing_match_data))
1967 {
1968 start = search_regs.start[0];
1969 end = search_regs.end[0];
1970 }
1971 else
1972 /* If Vinhibit_changing_match_data is non-nil,
1973 search_regs will not be changed. So let's
1974 compute start and end here. */
1975 {
1976 start = BYTE_TO_CHAR (position);
1977 end = BYTE_TO_CHAR (position + len_byte);
1978 }
1979
1918 if ((n -= direction) != 0) 1980 if ((n -= direction) != 0)
1919 cursor += dirlen; /* to resume search */ 1981 cursor += dirlen; /* to resume search */
1920 else 1982 else
1921 return ((direction > 0) 1983 return direction > 0 ? end : start;
1922 ? search_regs.end[0] : search_regs.start[0]);
1923 } 1984 }
1924 else 1985 else
1925 cursor += stride_for_teases; /* <sigh> we lose - */ 1986 cursor += stride_for_teases; /* <sigh> we lose - */
@@ -1984,18 +2045,30 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
1984 pos_byte += dirlen - i- direction; 2045 pos_byte += dirlen - i- direction;
1985 if (i + direction == 0) 2046 if (i + direction == 0)
1986 { 2047 {
1987 int position; 2048 int position, start, end;
1988 pos_byte -= direction; 2049 pos_byte -= direction;
1989 2050
1990 position = pos_byte + ((direction > 0) ? 1 - len_byte : 0); 2051 position = pos_byte + ((direction > 0) ? 1 - len_byte : 0);
1991
1992 set_search_regs (position, len_byte); 2052 set_search_regs (position, len_byte);
1993 2053
2054 if (NILP (Vinhibit_changing_match_data))
2055 {
2056 start = search_regs.start[0];
2057 end = search_regs.end[0];
2058 }
2059 else
2060 /* If Vinhibit_changing_match_data is non-nil,
2061 search_regs will not be changed. So let's
2062 compute start and end here. */
2063 {
2064 start = BYTE_TO_CHAR (position);
2065 end = BYTE_TO_CHAR (position + len_byte);
2066 }
2067
1994 if ((n -= direction) != 0) 2068 if ((n -= direction) != 0)
1995 pos_byte += dirlen; /* to resume search */ 2069 pos_byte += dirlen; /* to resume search */
1996 else 2070 else
1997 return ((direction > 0) 2071 return direction > 0 ? end : start;
1998 ? search_regs.end[0] : search_regs.start[0]);
1999 } 2072 }
2000 else 2073 else
2001 pos_byte += stride_for_teases; 2074 pos_byte += stride_for_teases;
@@ -2018,6 +2091,9 @@ set_search_regs (beg_byte, nbytes)
2018{ 2091{
2019 int i; 2092 int i;
2020 2093
2094 if (!NILP (Vinhibit_changing_match_data))
2095 return;
2096
2021 /* Make sure we have registers in which to store 2097 /* Make sure we have registers in which to store
2022 the match position. */ 2098 the match position. */
2023 if (search_regs.num_regs == 0) 2099 if (search_regs.num_regs == 0)
@@ -3145,6 +3221,13 @@ or other such regexp constructs are not replaced with this.
3145A value of nil (which is the normal value) means treat spaces literally. */); 3221A value of nil (which is the normal value) means treat spaces literally. */);
3146 Vsearch_spaces_regexp = Qnil; 3222 Vsearch_spaces_regexp = Qnil;
3147 3223
3224 DEFVAR_LISP ("inhibit-changing-match-data", &Vinhibit_changing_match_data,
3225 doc: /* Internal use only.
3226If non-nil, the match data will not be changed during call to searching or
3227matching functions, such as `looking-at', `string-match', `re-search-forward'
3228etc. */);
3229 Vinhibit_changing_match_data = Qnil;
3230
3148 defsubr (&Slooking_at); 3231 defsubr (&Slooking_at);
3149 defsubr (&Sposix_looking_at); 3232 defsubr (&Sposix_looking_at);
3150 defsubr (&Sstring_match); 3233 defsubr (&Sstring_match);
diff --git a/src/term.c b/src/term.c
index 0210a66afa9..331d9f20e4c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -25,6 +25,9 @@ Boston, MA 02110-1301, USA. */
25#include <stdio.h> 25#include <stdio.h>
26#include <ctype.h> 26#include <ctype.h>
27#include <string.h> 27#include <string.h>
28#ifdef HAVE_UNISTD_H
29#include <unistd.h>
30#endif
28 31
29#include "termchar.h" 32#include "termchar.h"
30#include "termopts.h" 33#include "termopts.h"
@@ -2493,9 +2496,9 @@ set_tty_color_mode (f, val)
2493void 2496void
2494term_mouse_moveto (int x, int y) 2497term_mouse_moveto (int x, int y)
2495{ 2498{
2499 /* TODO: how to set mouse position?
2496 const char *name; 2500 const char *name;
2497 int fd; 2501 int fd;
2498 /* TODO: how to set mouse position?
2499 name = (const char *) ttyname (0); 2502 name = (const char *) ttyname (0);
2500 fd = open (name, O_WRONLY); 2503 fd = open (name, O_WRONLY);
2501 SOME_FUNCTION (x, y, fd); 2504 SOME_FUNCTION (x, y, fd);
@@ -2509,7 +2512,7 @@ term_show_mouse_face (enum draw_glyphs_face draw)
2509{ 2512{
2510 struct window *w = XWINDOW (Qmouse_face_window); 2513 struct window *w = XWINDOW (Qmouse_face_window);
2511 int save_x, save_y; 2514 int save_x, save_y;
2512 int i, j; 2515 int i;
2513 2516
2514 if (/* If window is in the process of being destroyed, don't bother 2517 if (/* If window is in the process of being destroyed, don't bother
2515 to do anything. */ 2518 to do anything. */
@@ -3029,7 +3032,7 @@ int
3029handle_one_term_event (Gpm_Event *event, struct input_event* hold_quit) 3032handle_one_term_event (Gpm_Event *event, struct input_event* hold_quit)
3030{ 3033{
3031 struct frame *f = SELECTED_FRAME (); 3034 struct frame *f = SELECTED_FRAME ();
3032 int i, j, fd; 3035 int fd;
3033 struct input_event ie; 3036 struct input_event ie;
3034 int do_help = 0; 3037 int do_help = 0;
3035 int count = 0; 3038 int count = 0;
@@ -3053,7 +3056,7 @@ handle_one_term_event (Gpm_Event *event, struct input_event* hold_quit)
3053 arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased; 3056 arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased;
3054 arg[4] = (unsigned short) 3; 3057 arg[4] = (unsigned short) 3;
3055 3058
3056 name = (const char *) ttyname (0); 3059 name = ttyname (0);
3057 fd = open (name, O_WRONLY); 3060 fd = open (name, O_WRONLY);
3058 ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1); 3061 ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1);
3059 close (fd); 3062 close (fd);
diff --git a/src/w32fns.c b/src/w32fns.c
index fbdb11ca922..e0c763aef99 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -53,6 +53,7 @@ Boston, MA 02110-1301, USA. */
53#include <shellapi.h> 53#include <shellapi.h>
54#include <ctype.h> 54#include <ctype.h>
55#include <winspool.h> 55#include <winspool.h>
56#include <objbase.h>
56 57
57#include <dlgs.h> 58#include <dlgs.h>
58#define FILE_NAME_TEXT_FIELD edt1 59#define FILE_NAME_TEXT_FIELD edt1
@@ -2518,6 +2519,13 @@ w32_msg_pump (deferred_msg * msg_buf)
2518 /* Produced by complete_deferred_msg; just ignore. */ 2519 /* Produced by complete_deferred_msg; just ignore. */
2519 break; 2520 break;
2520 case WM_EMACS_CREATEWINDOW: 2521 case WM_EMACS_CREATEWINDOW:
2522 /* Initialize COM for this window. Even though we don't use it,
2523 some third party shell extensions can cause it to be used in
2524 system dialogs, which causes a crash if it is not initialized.
2525 This is a known bug in Windows, which was fixed long ago, but
2526 the patch for XP is not publically available until XP SP3,
2527 and older versions will never be patched. */
2528 CoInitialize (NULL);
2521 w32_createwindow ((struct frame *) msg.wParam); 2529 w32_createwindow ((struct frame *) msg.wParam);
2522 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) 2530 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
2523 abort (); 2531 abort ();
@@ -3664,6 +3672,10 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3664 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 3672 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
3665 goto dflt; 3673 goto dflt;
3666 3674
3675 case WM_DESTROY:
3676 CoUninitialize ();
3677 return 0;
3678
3667 case WM_CLOSE: 3679 case WM_CLOSE:
3668 wmsg.dwModifiers = w32_get_modifiers (); 3680 wmsg.dwModifiers = w32_get_modifiers ();
3669 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 3681 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
diff --git a/src/window.c b/src/window.c
index 61be973e180..42a33828d8d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6643,7 +6643,7 @@ and the value of point and mark for each window.
6643Also restore the choice of selected window. 6643Also restore the choice of selected window.
6644Also restore which buffer is current. 6644Also restore which buffer is current.
6645Does not restore the value of point in current buffer. 6645Does not restore the value of point in current buffer.
6646usage: (save-window-excursion BODY ...) */) 6646usage: (save-window-excursion BODY...) */)
6647 (args) 6647 (args)
6648 Lisp_Object args; 6648 Lisp_Object args;
6649{ 6649{