aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog20
-rw-r--r--src/emacs.c4
-rw-r--r--src/w32inevt.c4
-rw-r--r--src/w32notify.c7
-rw-r--r--src/w32proc.c34
-rw-r--r--src/w32term.h1
6 files changed, 63 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 78dd2362018..f3cbf4e1f14 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
12013-11-28 Eli Zaretskii <eliz@gnu.org>
2
3 Support w32 file notifications in batch mode.
4 * w32proc.c (sys_select): Don't wait on interrupt_handle if it is
5 invalid (which happens in batch mode). If non-interactive, call
6 handle_file_notifications to store file notification events in the
7 input queue. (Bug#15933)
8
9 * w32notify.c (send_notifications): Handle FRAME_INITIAL frames as
10 well.
11
12 * w32inevt.c (handle_file_notifications): Now external, not
13 static.
14
15 * w32term.h (handle_file_notifications): Provide prototype.
16
17 * emacs.c (main) [HAVE_W32NOTIFY]: When non-interactive, call
18 init_crit, since init_display, which does that otherwise, is not
19 called.
20
12013-11-27 Glenn Morris <rgm@gnu.org> 212013-11-27 Glenn Morris <rgm@gnu.org>
2 22
3 * Makefile.in ($(lispsource)/international/charprop.el): New. 23 * Makefile.in ($(lispsource)/international/charprop.el): New.
diff --git a/src/emacs.c b/src/emacs.c
index 75082ecef7d..159b0d5040d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1517,6 +1517,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1517 init_keyboard (); /* This too must precede init_sys_modes. */ 1517 init_keyboard (); /* This too must precede init_sys_modes. */
1518 if (!noninteractive) 1518 if (!noninteractive)
1519 init_display (); /* Determine terminal type. Calls init_sys_modes. */ 1519 init_display (); /* Determine terminal type. Calls init_sys_modes. */
1520#if HAVE_W32NOTIFY
1521 else
1522 init_crit (); /* w32notify.c needs this in batch mode. */
1523#endif /* HAVE_W32NOTIFY */
1520 init_xdisp (); 1524 init_xdisp ();
1521#ifdef HAVE_WINDOW_SYSTEM 1525#ifdef HAVE_WINDOW_SYSTEM
1522 init_fringe (); 1526 init_fringe ();
diff --git a/src/w32inevt.c b/src/w32inevt.c
index dc587de1183..a157cb5c1df 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -608,7 +608,7 @@ maybe_generate_resize_event (void)
608} 608}
609 609
610#if HAVE_W32NOTIFY 610#if HAVE_W32NOTIFY
611static int 611int
612handle_file_notifications (struct input_event *hold_quit) 612handle_file_notifications (struct input_event *hold_quit)
613{ 613{
614 BYTE *p = file_notifications; 614 BYTE *p = file_notifications;
@@ -676,7 +676,7 @@ handle_file_notifications (struct input_event *hold_quit)
676 return nevents; 676 return nevents;
677} 677}
678#else /* !HAVE_W32NOTIFY */ 678#else /* !HAVE_W32NOTIFY */
679static int 679int
680handle_file_notifications (struct input_event *hold_quit) 680handle_file_notifications (struct input_event *hold_quit)
681{ 681{
682 return 0; 682 return 0;
diff --git a/src/w32notify.c b/src/w32notify.c
index 1f2ef83b2fd..373e20e8e92 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -163,7 +163,12 @@ send_notifications (BYTE *info, DWORD info_size, void *desc,
163 && PostThreadMessage (dwMainThreadId, WM_EMACS_FILENOTIFY, 0, 0)) 163 && PostThreadMessage (dwMainThreadId, WM_EMACS_FILENOTIFY, 0, 0))
164 || (FRAME_W32_P (f) 164 || (FRAME_W32_P (f)
165 && PostMessage (FRAME_W32_WINDOW (f), 165 && PostMessage (FRAME_W32_WINDOW (f),
166 WM_EMACS_FILENOTIFY, 0, 0))) 166 WM_EMACS_FILENOTIFY, 0, 0))
167 /* When we are running in batch mode, there's no one to
168 send a message, so we just signal the data is
169 available and hope sys_select will be called soon and
170 will read the data. */
171 || (FRAME_INITIAL_P (f) && noninteractive))
167 notification_buffer_in_use = 1; 172 notification_buffer_in_use = 1;
168 done = 1; 173 done = 1;
169 } 174 }
diff --git a/src/w32proc.c b/src/w32proc.c
index ea16f26a0ee..3e0081cd802 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1960,12 +1960,17 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1960 FD_ZERO (rfds); 1960 FD_ZERO (rfds);
1961 nr = 0; 1961 nr = 0;
1962 1962
1963 /* Always wait on interrupt_handle, to detect C-g (quit). */ 1963 /* If interrupt_handle is available and valid, always wait on it, to
1964 wait_hnd[0] = interrupt_handle; 1964 detect C-g (quit). */
1965 fdindex[0] = -1; 1965 nh = 0;
1966 if (interrupt_handle && interrupt_handle != INVALID_HANDLE_VALUE)
1967 {
1968 wait_hnd[0] = interrupt_handle;
1969 fdindex[0] = -1;
1970 nh++;
1971 }
1966 1972
1967 /* Build a list of pipe handles to wait on. */ 1973 /* Build a list of pipe handles to wait on. */
1968 nh = 1;
1969 for (i = 0; i < nfds; i++) 1974 for (i = 0; i < nfds; i++)
1970 if (FD_ISSET (i, &orfds)) 1975 if (FD_ISSET (i, &orfds))
1971 { 1976 {
@@ -1986,6 +1991,11 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1986 FD_SET (i, rfds); 1991 FD_SET (i, rfds);
1987 return 1; 1992 return 1;
1988 } 1993 }
1994 else if (noninteractive)
1995 {
1996 if (handle_file_notifications (NULL))
1997 return 1;
1998 }
1989 } 1999 }
1990 else 2000 else
1991 { 2001 {
@@ -2086,6 +2096,11 @@ count_children:
2086 { 2096 {
2087 if (timeout) 2097 if (timeout)
2088 Sleep (timeout_ms); 2098 Sleep (timeout_ms);
2099 if (noninteractive)
2100 {
2101 if (handle_file_notifications (NULL))
2102 return 1;
2103 }
2089 return 0; 2104 return 0;
2090 } 2105 }
2091 2106
@@ -2112,6 +2127,11 @@ count_children:
2112 } 2127 }
2113 else if (active == WAIT_TIMEOUT) 2128 else if (active == WAIT_TIMEOUT)
2114 { 2129 {
2130 if (noninteractive)
2131 {
2132 if (handle_file_notifications (NULL))
2133 return 1;
2134 }
2115 return 0; 2135 return 0;
2116 } 2136 }
2117 else if (active >= WAIT_OBJECT_0 2137 else if (active >= WAIT_OBJECT_0
@@ -2218,6 +2238,12 @@ count_children:
2218 break; 2238 break;
2219 } while (active < nh + nc); 2239 } while (active < nh + nc);
2220 2240
2241 if (noninteractive)
2242 {
2243 if (handle_file_notifications (NULL))
2244 nr++;
2245 }
2246
2221 /* If no input has arrived and timeout hasn't expired, wait again. */ 2247 /* If no input has arrived and timeout hasn't expired, wait again. */
2222 if (nr == 0) 2248 if (nr == 0)
2223 { 2249 {
diff --git a/src/w32term.h b/src/w32term.h
index b3c0cf56c7b..6825e3cd546 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -680,6 +680,7 @@ extern DWORD notifications_size;
680extern void *notifications_desc; 680extern void *notifications_desc;
681extern Lisp_Object w32_get_watch_object (void *); 681extern Lisp_Object w32_get_watch_object (void *);
682extern Lisp_Object lispy_file_action (DWORD); 682extern Lisp_Object lispy_file_action (DWORD);
683extern int handle_file_notifications (struct input_event *);
683 684
684extern void w32_initialize_display_info (Lisp_Object); 685extern void w32_initialize_display_info (Lisp_Object);
685extern void initialize_w32_display (struct terminal *, int *, int *); 686extern void initialize_w32_display (struct terminal *, int *, int *);