diff options
| author | Michael Albinus | 2013-06-03 15:03:05 +0200 |
|---|---|---|
| committer | Michael Albinus | 2013-06-03 15:03:05 +0200 |
| commit | c9628c79bba5ec1e55c31512b5c32371ff034b1f (patch) | |
| tree | 9da42ec29de5da50cbe76bd73ccc382c265aa1af /src | |
| parent | 2041ae1fa791f61bf9f4a154de29a7bc167481d6 (diff) | |
| download | emacs-c9628c79bba5ec1e55c31512b5c32371ff034b1f.tar.gz emacs-c9628c79bba5ec1e55c31512b5c32371ff034b1f.zip | |
* configure.ac (file-notification): New option, replaces inotify option.
(HAVE_W32): Remove w32notify.o.
(with_file_notification): Add checks for glib and w32. Adapt check
for inotify.
(Summary): Add entry for file notification.
* autogen/config.in: Add entries for HAVE_GFILENOTIFY,
HAVE_W32NOTIFY and USE_FILE_NOTIFY.
* lisp/autorevert.el (auto-revert-notify-enabled)
(auto-revert-notify-rm-watch, auto-revert-notify-add-watch)
(auto-revert-notify-event-p, auto-revert-notify-event-file-name)
(auto-revert-notify-handler): Handle also gfilenotify.
* lisp/subr.el: (file-notify-handle-event): New defun. Replacing ...
(inotify-event-p, inotify-handle-event, w32notify-handle-event):
Removed.
* src/Makefile.in (NOTIFY_OBJ): New variable.
(base_obj): Replace inotify.o by $(NOTIFY_OBJ).
* src/emacs.c (main): Use HAVE_W32NOTIFY to wrap respective code.
Call syms_of_gfilenotify.
* src/gfilenotify.c: New file.
* src/keyboard.c (Qfile_notify): New variable. Replaces Qfile_inotify
and Qfile_w32notify.
(top): Wrap respective code by HAVE_GFILENOTIFY, HAVE_INOTIFY,
HAVE_W32NOTIFY and USE_FILE_NOTIFY.
* src/lisp.h: Declare syms_of_gfilenotify.
* src/termhooks.h (e): Wrap enum by USE_FILE_NOTIFY.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 19 | ||||
| -rw-r--r-- | src/Makefile.in | 7 | ||||
| -rw-r--r-- | src/emacs.c | 8 | ||||
| -rw-r--r-- | src/gfilenotify.c | 266 | ||||
| -rw-r--r-- | src/keyboard.c | 54 | ||||
| -rw-r--r-- | src/lisp.h | 11 | ||||
| -rw-r--r-- | src/termhooks.h | 2 |
7 files changed, 329 insertions, 38 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 41687e07593..fce07f9db1a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2013-06-03 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * Makefile.in (NOTIFY_OBJ): New variable. | ||
| 4 | (base_obj): Replace inotify.o by $(NOTIFY_OBJ). | ||
| 5 | |||
| 6 | * emacs.c (main): Use HAVE_W32NOTIFY to wrap respective code. | ||
| 7 | Call syms_of_gfilenotify. | ||
| 8 | |||
| 9 | * gfilenotify.c: New file. | ||
| 10 | |||
| 11 | * keyboard.c (Qfile_notify): New variable. Replaces Qfile_inotify | ||
| 12 | and Qfile_w32notify. | ||
| 13 | (top): Wrap respective code by HAVE_GFILENOTIFY, HAVE_INOTIFY, | ||
| 14 | HAVE_W32NOTIFY and USE_FILE_NOTIFY. | ||
| 15 | |||
| 16 | * lisp.h: Declare syms_of_gfilenotify. | ||
| 17 | |||
| 18 | * termhooks.h (e): Wrap enum by USE_FILE_NOTIFY. | ||
| 19 | |||
| 1 | 2013-06-03 Stefan Monnier <monnier@iro.umontreal.ca> | 20 | 2013-06-03 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 21 | ||
| 3 | Merge the specpdl and backtrace stacks. Make the structure of the | 22 | Merge the specpdl and backtrace stacks. Make the structure of the |
diff --git a/src/Makefile.in b/src/Makefile.in index 2fa7fb37348..0556bae1ecd 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -156,6 +156,11 @@ SETTINGS_LIBS = @SETTINGS_LIBS@ | |||
| 156 | ## gtkutil.o if USE_GTK, else empty. | 156 | ## gtkutil.o if USE_GTK, else empty. |
| 157 | GTK_OBJ=@GTK_OBJ@ | 157 | GTK_OBJ=@GTK_OBJ@ |
| 158 | 158 | ||
| 159 | ## gfilenotify.o if HAVE_GFILENOTIFY. | ||
| 160 | ## inotify.o if HAVE_INOTIFY. | ||
| 161 | ## w32notify.o if HAVE_W32NOTIFY. | ||
| 162 | NOTIFY_OBJ = @NOTIFY_OBJ@ | ||
| 163 | |||
| 159 | ## -ltermcap, or -lncurses, or -lcurses, or "". | 164 | ## -ltermcap, or -lncurses, or -lcurses, or "". |
| 160 | LIBS_TERMCAP=@LIBS_TERMCAP@ | 165 | LIBS_TERMCAP=@LIBS_TERMCAP@ |
| 161 | ## terminfo.o if TERMINFO, else tparam.o. | 166 | ## terminfo.o if TERMINFO, else tparam.o. |
| @@ -363,7 +368,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ | |||
| 363 | syntax.o $(UNEXEC_OBJ) bytecode.o \ | 368 | syntax.o $(UNEXEC_OBJ) bytecode.o \ |
| 364 | process.o gnutls.o callproc.o \ | 369 | process.o gnutls.o callproc.o \ |
| 365 | region-cache.o sound.o atimer.o \ | 370 | region-cache.o sound.o atimer.o \ |
| 366 | doprnt.o intervals.o textprop.o composite.o xml.o inotify.o \ | 371 | doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \ |
| 367 | profiler.o \ | 372 | profiler.o \ |
| 368 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ | 373 | $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ |
| 369 | $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) | 374 | $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) |
diff --git a/src/emacs.c b/src/emacs.c index 5115126577b..4e439a601b1 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1252,7 +1252,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1252 | 1252 | ||
| 1253 | #ifdef WINDOWSNT | 1253 | #ifdef WINDOWSNT |
| 1254 | globals_of_w32 (); | 1254 | globals_of_w32 (); |
| 1255 | #ifdef HAVE_W32NOTIFY | ||
| 1255 | globals_of_w32notify (); | 1256 | globals_of_w32notify (); |
| 1257 | #endif | ||
| 1256 | /* Initialize environment from registry settings. */ | 1258 | /* Initialize environment from registry settings. */ |
| 1257 | init_environment (argv); | 1259 | init_environment (argv); |
| 1258 | init_ntproc (dumping); /* must precede init_editfns. */ | 1260 | init_ntproc (dumping); /* must precede init_editfns. */ |
| @@ -1409,6 +1411,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1409 | syms_of_gnutls (); | 1411 | syms_of_gnutls (); |
| 1410 | #endif | 1412 | #endif |
| 1411 | 1413 | ||
| 1414 | #ifdef HAVE_GFILENOTIFY | ||
| 1415 | syms_of_gfilenotify (); | ||
| 1416 | #endif /* HAVE_GFILENOTIFY */ | ||
| 1417 | |||
| 1412 | #ifdef HAVE_INOTIFY | 1418 | #ifdef HAVE_INOTIFY |
| 1413 | syms_of_inotify (); | 1419 | syms_of_inotify (); |
| 1414 | #endif /* HAVE_INOTIFY */ | 1420 | #endif /* HAVE_INOTIFY */ |
| @@ -1419,7 +1425,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1419 | 1425 | ||
| 1420 | #ifdef WINDOWSNT | 1426 | #ifdef WINDOWSNT |
| 1421 | syms_of_ntterm (); | 1427 | syms_of_ntterm (); |
| 1428 | #ifdef HAVE_W32NOTIFY | ||
| 1422 | syms_of_w32notify (); | 1429 | syms_of_w32notify (); |
| 1430 | #endif /* HAVE_W32NOTIFY */ | ||
| 1423 | #endif /* WINDOWSNT */ | 1431 | #endif /* WINDOWSNT */ |
| 1424 | 1432 | ||
| 1425 | syms_of_profiler (); | 1433 | syms_of_profiler (); |
diff --git a/src/gfilenotify.c b/src/gfilenotify.c new file mode 100644 index 00000000000..4ccc430d815 --- /dev/null +++ b/src/gfilenotify.c | |||
| @@ -0,0 +1,266 @@ | |||
| 1 | /* Filesystem notifications support with glib API. | ||
| 2 | Copyright (C) 2013 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation, either version 3 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 18 | |||
| 19 | #include <config.h> | ||
| 20 | |||
| 21 | #ifdef HAVE_GFILENOTIFY | ||
| 22 | #include <stdio.h> | ||
| 23 | #include <gio/gio.h> | ||
| 24 | #include "lisp.h" | ||
| 25 | #include "coding.h" | ||
| 26 | #include "frame.h" | ||
| 27 | #include "termhooks.h" | ||
| 28 | #include "keyboard.h" | ||
| 29 | #include "process.h" | ||
| 30 | |||
| 31 | |||
| 32 | /* Subroutines. */ | ||
| 33 | static Lisp_Object Qgfile_add_watch; | ||
| 34 | static Lisp_Object Qgfile_rm_watch; | ||
| 35 | |||
| 36 | /* Filter objects. */ | ||
| 37 | static Lisp_Object Qwatch_mounts; /* G_FILE_MONITOR_WATCH_MOUNTS */ | ||
| 38 | static Lisp_Object Qsend_moved; /* G_FILE_MONITOR_SEND_MOVED */ | ||
| 39 | |||
| 40 | /* Event types. */ | ||
| 41 | static Lisp_Object Qchanged; /* G_FILE_MONITOR_EVENT_CHANGED */ | ||
| 42 | static Lisp_Object Qchanges_done_hint; /* G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT */ | ||
| 43 | static Lisp_Object Qdeleted; /* G_FILE_MONITOR_EVENT_DELETED */ | ||
| 44 | static Lisp_Object Qcreated; /* G_FILE_MONITOR_EVENT_CREATED */ | ||
| 45 | static Lisp_Object Qattribute_changed; /* G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED */ | ||
| 46 | static Lisp_Object Qpre_unmount; /* G_FILE_MONITOR_EVENT_PRE_UNMOUNT */ | ||
| 47 | static Lisp_Object Qunmounted; /* G_FILE_MONITOR_EVENT_UNMOUNTED */ | ||
| 48 | static Lisp_Object Qmoved; /* G_FILE_MONITOR_EVENT_MOVED */ | ||
| 49 | |||
| 50 | static Lisp_Object watch_list; | ||
| 51 | |||
| 52 | /* This is the callback function for arriving signals from | ||
| 53 | g_file_monitor. It shall create a Lisp event, and put it into | ||
| 54 | Emacs input queue. */ | ||
| 55 | static gboolean | ||
| 56 | dir_monitor_callback (GFileMonitor* monitor, | ||
| 57 | GFile* file, | ||
| 58 | GFile* other_file, | ||
| 59 | GFileMonitorEvent event_type, | ||
| 60 | gpointer user_data) | ||
| 61 | { | ||
| 62 | Lisp_Object symbol, watch_object; | ||
| 63 | char *name = g_file_get_parse_name (file); | ||
| 64 | char *oname = other_file ? g_file_get_parse_name (other_file) : NULL; | ||
| 65 | |||
| 66 | /* Determine event symbol. */ | ||
| 67 | switch (event_type) | ||
| 68 | { | ||
| 69 | case G_FILE_MONITOR_EVENT_CHANGED: | ||
| 70 | symbol = Qchanged; | ||
| 71 | break; | ||
| 72 | case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: | ||
| 73 | symbol = Qchanges_done_hint; | ||
| 74 | break; | ||
| 75 | case G_FILE_MONITOR_EVENT_DELETED: | ||
| 76 | symbol = Qdeleted; | ||
| 77 | break; | ||
| 78 | case G_FILE_MONITOR_EVENT_CREATED: | ||
| 79 | symbol = Qcreated; | ||
| 80 | break; | ||
| 81 | case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: | ||
| 82 | symbol = Qattribute_changed; | ||
| 83 | break; | ||
| 84 | case G_FILE_MONITOR_EVENT_PRE_UNMOUNT: | ||
| 85 | symbol = Qpre_unmount; | ||
| 86 | break; | ||
| 87 | case G_FILE_MONITOR_EVENT_UNMOUNTED: | ||
| 88 | symbol = Qunmounted; | ||
| 89 | break; | ||
| 90 | case G_FILE_MONITOR_EVENT_MOVED: | ||
| 91 | symbol = Qmoved; | ||
| 92 | break; | ||
| 93 | default: | ||
| 94 | goto cleanup; | ||
| 95 | } | ||
| 96 | |||
| 97 | /* Determine callback function. */ | ||
| 98 | watch_object = Fassoc (XIL ((EMACS_INT) monitor), watch_list); | ||
| 99 | |||
| 100 | if (FUNCTIONP (CDR_SAFE (watch_object))) | ||
| 101 | { | ||
| 102 | /* Construct an event. */ | ||
| 103 | struct input_event event; | ||
| 104 | EVENT_INIT (event); | ||
| 105 | event.kind = FILE_NOTIFY_EVENT; | ||
| 106 | event.frame_or_window = Qnil; | ||
| 107 | event.arg = oname | ||
| 108 | ? list2 (list4 (XIL ((EMACS_INT) monitor), symbol, | ||
| 109 | build_string (name), build_string (oname)), | ||
| 110 | CDR_SAFE (watch_object)) | ||
| 111 | : list2 (list3 (XIL ((EMACS_INT) monitor), symbol, build_string (name)), | ||
| 112 | CDR_SAFE (watch_object)); | ||
| 113 | |||
| 114 | /* Store it into the input event queue. */ | ||
| 115 | kbd_buffer_store_event (&event); | ||
| 116 | } | ||
| 117 | |||
| 118 | /* Cleanup. */ | ||
| 119 | cleanup: | ||
| 120 | g_free (name); | ||
| 121 | g_free (oname); | ||
| 122 | |||
| 123 | return TRUE; | ||
| 124 | } | ||
| 125 | |||
| 126 | DEFUN ("gfile-add-watch", Fgfile_add_watch, Sgfile_add_watch, 3, 3, 0, | ||
| 127 | doc: /* Add a watch for filesystem events pertaining to FILE. | ||
| 128 | |||
| 129 | This arranges for filesystem events pertaining to FILE to be reported | ||
| 130 | to Emacs. Use `gfile-rm-watch' to cancel the watch. | ||
| 131 | |||
| 132 | Value is a descriptor for the added watch. If the file cannot be | ||
| 133 | watched for some reason, this function signals a `file-error' error. | ||
| 134 | |||
| 135 | FLAGS is a list of conditions to set what will be watched for. It can | ||
| 136 | include the following symbols: | ||
| 137 | |||
| 138 | 'watch-mounts' -- watch for mount events | ||
| 139 | 'send-moved' -- pair 'deleted' and 'created' events caused by file | ||
| 140 | renames (moves) and send a single 'event-moved' | ||
| 141 | event instead | ||
| 142 | |||
| 143 | When any event happens, Emacs will call the CALLBACK function passing | ||
| 144 | it a single argument EVENT, which is of the form | ||
| 145 | |||
| 146 | (DESCRIPTOR ACTION FILE [FILE1]) | ||
| 147 | |||
| 148 | DESCRIPTOR is the same object as the one returned by this function. | ||
| 149 | ACTION is the description of the event. It could be any one of the | ||
| 150 | following: | ||
| 151 | |||
| 152 | 'changed' -- FILE has changed | ||
| 153 | 'changes-done-hint' -- a hint that this was probably the last change | ||
| 154 | in a set of changes | ||
| 155 | 'deleted' -- FILE was deleted | ||
| 156 | 'created' -- FILE was created | ||
| 157 | 'attribute-changed' -- a FILE attribute was changed | ||
| 158 | 'pre-unmount' -- the FILE location will soon be unmounted | ||
| 159 | 'unmounted' -- the FILE location was unmounted | ||
| 160 | 'moved' -- FILE was moved to FILE1 | ||
| 161 | |||
| 162 | FILE is the name of the file whose event is being reported. FILE1 | ||
| 163 | will be reported only in case of the 'moved' event. */) | ||
| 164 | (Lisp_Object file, Lisp_Object flags, Lisp_Object callback) | ||
| 165 | { | ||
| 166 | Lisp_Object watch_descriptor, watch_object; | ||
| 167 | GFile *gfile; | ||
| 168 | GFileMonitor* monitor; | ||
| 169 | GFileMonitorFlags gflags = G_FILE_MONITOR_NONE; | ||
| 170 | |||
| 171 | /* Check parameters. */ | ||
| 172 | CHECK_STRING (file); | ||
| 173 | file = Fdirectory_file_name (Fexpand_file_name (file, Qnil)); | ||
| 174 | if (NILP (Ffile_exists_p (file))) | ||
| 175 | report_file_error ("File does not exists", Fcons (file, Qnil)); | ||
| 176 | |||
| 177 | CHECK_LIST (flags); | ||
| 178 | |||
| 179 | if (!FUNCTIONP (callback)) | ||
| 180 | wrong_type_argument (Qinvalid_function, callback); | ||
| 181 | |||
| 182 | /* Create GFile name. */ | ||
| 183 | gfile = g_file_new_for_path (SSDATA (ENCODE_FILE (file))); | ||
| 184 | |||
| 185 | /* Assemble flags. */ | ||
| 186 | if (!NILP (Fmember (Qwatch_mounts, flags))) | ||
| 187 | gflags |= G_FILE_MONITOR_WATCH_MOUNTS; | ||
| 188 | if (!NILP (Fmember (Qsend_moved, flags))) | ||
| 189 | gflags |= G_FILE_MONITOR_SEND_MOVED; | ||
| 190 | |||
| 191 | /* Enable watch. */ | ||
| 192 | monitor = g_file_monitor (gfile, gflags, NULL, NULL); | ||
| 193 | if (monitor != NULL) | ||
| 194 | g_signal_connect (monitor, "changed", | ||
| 195 | (GCallback) dir_monitor_callback, NULL); | ||
| 196 | else | ||
| 197 | report_file_error ("Cannot watch file", Fcons (file, Qnil)); | ||
| 198 | |||
| 199 | /* Store watch object in watch list. */ | ||
| 200 | watch_descriptor = XIL ((EMACS_INT) monitor); | ||
| 201 | watch_object = Fcons (watch_descriptor, callback); | ||
| 202 | watch_list = Fcons (watch_object, watch_list); | ||
| 203 | |||
| 204 | return watch_descriptor; | ||
| 205 | } | ||
| 206 | |||
| 207 | DEFUN ("gfile-rm-watch", Fgfile_rm_watch, Sgfile_rm_watch, 1, 1, 0, | ||
| 208 | doc: /* Remove an existing WATCH-DESCRIPTOR. | ||
| 209 | |||
| 210 | WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) | ||
| 211 | (Lisp_Object watch_descriptor) | ||
| 212 | { | ||
| 213 | Lisp_Object watch_object; | ||
| 214 | GFileMonitor *monitor = (GFileMonitor *) XLI (watch_descriptor); | ||
| 215 | |||
| 216 | watch_object = Fassoc (watch_descriptor, watch_list); | ||
| 217 | if (NILP (watch_object)) | ||
| 218 | report_file_error ("Not a watch descriptor", | ||
| 219 | Fcons (watch_descriptor, Qnil)); | ||
| 220 | |||
| 221 | if (!g_file_monitor_cancel (monitor)) | ||
| 222 | report_file_error ("Could not rm watch", | ||
| 223 | Fcons (watch_descriptor, Qnil)); | ||
| 224 | |||
| 225 | /* Remove watch descriptor from watch list. */ | ||
| 226 | watch_list = Fdelete (watch_object, watch_list); | ||
| 227 | |||
| 228 | /* Cleanup. */ | ||
| 229 | g_object_unref (monitor); | ||
| 230 | |||
| 231 | return Qt; | ||
| 232 | } | ||
| 233 | |||
| 234 | |||
| 235 | void | ||
| 236 | syms_of_gfilenotify (void) | ||
| 237 | { | ||
| 238 | |||
| 239 | g_type_init (); | ||
| 240 | |||
| 241 | DEFSYM (Qgfile_add_watch, "gfile-add-watch"); | ||
| 242 | defsubr (&Sgfile_add_watch); | ||
| 243 | |||
| 244 | DEFSYM (Qgfile_rm_watch, "gfile-rm-watch"); | ||
| 245 | defsubr (&Sgfile_rm_watch); | ||
| 246 | |||
| 247 | DEFSYM (Qwatch_mounts, "watch-mounts"); | ||
| 248 | DEFSYM (Qsend_moved, "send-moved"); | ||
| 249 | DEFSYM (Qchanged, "changed"); | ||
| 250 | DEFSYM (Qchanges_done_hint, "changes-done-hint"); | ||
| 251 | DEFSYM (Qdeleted, "deleted"); | ||
| 252 | DEFSYM (Qcreated, "created"); | ||
| 253 | DEFSYM (Qattribute_changed, "attribute-changed"); | ||
| 254 | DEFSYM (Qpre_unmount, "pre-unmount"); | ||
| 255 | DEFSYM (Qunmounted, "unmounted"); | ||
| 256 | DEFSYM (Qmoved, "moved"); | ||
| 257 | |||
| 258 | /* Initialize internal objects. */ | ||
| 259 | watch_list = Qnil; | ||
| 260 | staticpro (&watch_list); | ||
| 261 | |||
| 262 | Fprovide (intern_c_string ("gfilenotify"), Qnil); | ||
| 263 | |||
| 264 | } | ||
| 265 | |||
| 266 | #endif /* HAVE_GFILENOTIFY */ | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 0a7577b859e..a243b95470a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -308,18 +308,15 @@ static Lisp_Object Qfunction_key; | |||
| 308 | Lisp_Object Qmouse_click; | 308 | Lisp_Object Qmouse_click; |
| 309 | #ifdef HAVE_NTGUI | 309 | #ifdef HAVE_NTGUI |
| 310 | Lisp_Object Qlanguage_change; | 310 | Lisp_Object Qlanguage_change; |
| 311 | #ifdef WINDOWSNT | ||
| 312 | Lisp_Object Qfile_w32notify; | ||
| 313 | #endif | ||
| 314 | #endif | 311 | #endif |
| 315 | static Lisp_Object Qdrag_n_drop; | 312 | static Lisp_Object Qdrag_n_drop; |
| 316 | static Lisp_Object Qsave_session; | 313 | static Lisp_Object Qsave_session; |
| 317 | #ifdef HAVE_DBUS | 314 | #ifdef HAVE_DBUS |
| 318 | static Lisp_Object Qdbus_event; | 315 | static Lisp_Object Qdbus_event; |
| 319 | #endif | 316 | #endif |
| 320 | #ifdef HAVE_INOTIFY | 317 | #ifdef USE_FILE_NOTIFY |
| 321 | static Lisp_Object Qfile_inotify; | 318 | static Lisp_Object Qfile_notify; |
| 322 | #endif /* HAVE_INOTIFY */ | 319 | #endif /* USE_FILE_NOTIFY */ |
| 323 | static Lisp_Object Qconfig_changed_event; | 320 | static Lisp_Object Qconfig_changed_event; |
| 324 | 321 | ||
| 325 | /* Lisp_Object Qmouse_movement; - also an event header */ | 322 | /* Lisp_Object Qmouse_movement; - also an event header */ |
| @@ -4013,18 +4010,22 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4013 | kbd_fetch_ptr = event + 1; | 4010 | kbd_fetch_ptr = event + 1; |
| 4014 | } | 4011 | } |
| 4015 | #endif | 4012 | #endif |
| 4016 | #ifdef WINDOWSNT | 4013 | #ifdef USE_FILE_NOTIFY |
| 4017 | else if (event->kind == FILE_NOTIFY_EVENT) | 4014 | else if (event->kind == FILE_NOTIFY_EVENT) |
| 4018 | { | 4015 | { |
| 4016 | #ifdef HAVE_W32NOTIFY | ||
| 4019 | /* Make an event (file-notify (DESCRIPTOR ACTION FILE) CALLBACK). */ | 4017 | /* Make an event (file-notify (DESCRIPTOR ACTION FILE) CALLBACK). */ |
| 4020 | obj = Fcons (Qfile_w32notify, | 4018 | obj = Fcons (Qfile_notify, |
| 4021 | list2 (list3 (make_number (event->code), | 4019 | list2 (list3 (make_number (event->code), |
| 4022 | XCAR (event->arg), | 4020 | XCAR (event->arg), |
| 4023 | XCDR (event->arg)), | 4021 | XCDR (event->arg)), |
| 4024 | event->frame_or_window)); | 4022 | event->frame_or_window)); |
| 4023 | #else | ||
| 4024 | obj = make_lispy_event (event); | ||
| 4025 | #endif | ||
| 4025 | kbd_fetch_ptr = event + 1; | 4026 | kbd_fetch_ptr = event + 1; |
| 4026 | } | 4027 | } |
| 4027 | #endif | 4028 | #endif /* USE_FILE_NOTIFY */ |
| 4028 | else if (event->kind == SAVE_SESSION_EVENT) | 4029 | else if (event->kind == SAVE_SESSION_EVENT) |
| 4029 | { | 4030 | { |
| 4030 | obj = Fcons (Qsave_session, Fcons (event->arg, Qnil)); | 4031 | obj = Fcons (Qsave_session, Fcons (event->arg, Qnil)); |
| @@ -4082,13 +4083,6 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4082 | kbd_fetch_ptr = event + 1; | 4083 | kbd_fetch_ptr = event + 1; |
| 4083 | } | 4084 | } |
| 4084 | #endif | 4085 | #endif |
| 4085 | #ifdef HAVE_INOTIFY | ||
| 4086 | else if (event->kind == FILE_NOTIFY_EVENT) | ||
| 4087 | { | ||
| 4088 | obj = make_lispy_event (event); | ||
| 4089 | kbd_fetch_ptr = event + 1; | ||
| 4090 | } | ||
| 4091 | #endif | ||
| 4092 | else if (event->kind == CONFIG_CHANGED_EVENT) | 4086 | else if (event->kind == CONFIG_CHANGED_EVENT) |
| 4093 | { | 4087 | { |
| 4094 | obj = make_lispy_event (event); | 4088 | obj = make_lispy_event (event); |
| @@ -5991,12 +5985,12 @@ make_lispy_event (struct input_event *event) | |||
| 5991 | } | 5985 | } |
| 5992 | #endif /* HAVE_DBUS */ | 5986 | #endif /* HAVE_DBUS */ |
| 5993 | 5987 | ||
| 5994 | #ifdef HAVE_INOTIFY | 5988 | #if defined HAVE_GFILENOTIFY || defined HAVE_INOTIFY |
| 5995 | case FILE_NOTIFY_EVENT: | 5989 | case FILE_NOTIFY_EVENT: |
| 5996 | { | 5990 | { |
| 5997 | return Fcons (Qfile_inotify, event->arg); | 5991 | return Fcons (Qfile_notify, event->arg); |
| 5998 | } | 5992 | } |
| 5999 | #endif /* HAVE_INOTIFY */ | 5993 | #endif /* defined HAVE_GFILENOTIFY || defined HAVE_INOTIFY */ |
| 6000 | 5994 | ||
| 6001 | case CONFIG_CHANGED_EVENT: | 5995 | case CONFIG_CHANGED_EVENT: |
| 6002 | return Fcons (Qconfig_changed_event, | 5996 | return Fcons (Qconfig_changed_event, |
| @@ -11006,17 +11000,13 @@ syms_of_keyboard (void) | |||
| 11006 | DEFSYM (Qlanguage_change, "language-change"); | 11000 | DEFSYM (Qlanguage_change, "language-change"); |
| 11007 | #endif | 11001 | #endif |
| 11008 | 11002 | ||
| 11009 | #ifdef WINDOWSNT | ||
| 11010 | DEFSYM (Qfile_w32notify, "file-w32notify"); | ||
| 11011 | #endif | ||
| 11012 | |||
| 11013 | #ifdef HAVE_DBUS | 11003 | #ifdef HAVE_DBUS |
| 11014 | DEFSYM (Qdbus_event, "dbus-event"); | 11004 | DEFSYM (Qdbus_event, "dbus-event"); |
| 11015 | #endif | 11005 | #endif |
| 11016 | 11006 | ||
| 11017 | #ifdef HAVE_INOTIFY | 11007 | #ifdef USE_FILE_NOTIFY |
| 11018 | DEFSYM (Qfile_inotify, "file-inotify"); | 11008 | DEFSYM (Qfile_notify, "file-notify"); |
| 11019 | #endif /* HAVE_INOTIFY */ | 11009 | #endif /* USE_FILE_NOTIFY */ |
| 11020 | 11010 | ||
| 11021 | DEFSYM (QCenable, ":enable"); | 11011 | DEFSYM (QCenable, ":enable"); |
| 11022 | DEFSYM (QCvisible, ":visible"); | 11012 | DEFSYM (QCvisible, ":visible"); |
| @@ -11762,20 +11752,18 @@ keys_of_keyboard (void) | |||
| 11762 | "dbus-handle-event"); | 11752 | "dbus-handle-event"); |
| 11763 | #endif | 11753 | #endif |
| 11764 | 11754 | ||
| 11765 | #ifdef HAVE_INOTIFY | 11755 | #ifdef USE_FILE_NOTIFY |
| 11766 | /* Define a special event which is raised for inotify callback | 11756 | /* Define a special event which is raised for notification callback |
| 11767 | functions. */ | 11757 | functions. */ |
| 11768 | initial_define_lispy_key (Vspecial_event_map, "file-inotify", | 11758 | initial_define_lispy_key (Vspecial_event_map, "file-notify", |
| 11769 | "inotify-handle-event"); | 11759 | "file-notify-handle-event"); |
| 11770 | #endif /* HAVE_INOTIFY */ | 11760 | #endif /* USE_FILE_NOTIFY */ |
| 11771 | 11761 | ||
| 11772 | initial_define_lispy_key (Vspecial_event_map, "config-changed-event", | 11762 | initial_define_lispy_key (Vspecial_event_map, "config-changed-event", |
| 11773 | "ignore"); | 11763 | "ignore"); |
| 11774 | #if defined (WINDOWSNT) | 11764 | #if defined (WINDOWSNT) |
| 11775 | initial_define_lispy_key (Vspecial_event_map, "language-change", | 11765 | initial_define_lispy_key (Vspecial_event_map, "language-change", |
| 11776 | "ignore"); | 11766 | "ignore"); |
| 11777 | initial_define_lispy_key (Vspecial_event_map, "file-w32notify", | ||
| 11778 | "w32notify-handle-event"); | ||
| 11779 | #endif | 11767 | #endif |
| 11780 | } | 11768 | } |
| 11781 | 11769 | ||
diff --git a/src/lisp.h b/src/lisp.h index bd2f55f7cf4..517d0abbb61 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3784,9 +3784,9 @@ extern void syms_of_fontset (void); | |||
| 3784 | extern Lisp_Object Qfont_param; | 3784 | extern Lisp_Object Qfont_param; |
| 3785 | #endif | 3785 | #endif |
| 3786 | 3786 | ||
| 3787 | #ifdef WINDOWSNT | 3787 | /* Defined in gfilenotify.c */ |
| 3788 | /* Defined on w32notify.c. */ | 3788 | #ifdef HAVE_GFILENOTIFY |
| 3789 | extern void syms_of_w32notify (void); | 3789 | extern void syms_of_gfilenotify (void); |
| 3790 | #endif | 3790 | #endif |
| 3791 | 3791 | ||
| 3792 | /* Defined in inotify.c */ | 3792 | /* Defined in inotify.c */ |
| @@ -3794,6 +3794,11 @@ extern void syms_of_w32notify (void); | |||
| 3794 | extern void syms_of_inotify (void); | 3794 | extern void syms_of_inotify (void); |
| 3795 | #endif | 3795 | #endif |
| 3796 | 3796 | ||
| 3797 | #ifdef HAVE_W32NOTIFY | ||
| 3798 | /* Defined on w32notify.c. */ | ||
| 3799 | extern void syms_of_w32notify (void); | ||
| 3800 | #endif | ||
| 3801 | |||
| 3797 | /* Defined in xfaces.c. */ | 3802 | /* Defined in xfaces.c. */ |
| 3798 | extern Lisp_Object Qdefault, Qtool_bar, Qfringe; | 3803 | extern Lisp_Object Qdefault, Qtool_bar, Qfringe; |
| 3799 | extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; | 3804 | extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; |
diff --git a/src/termhooks.h b/src/termhooks.h index 252dbabb6f9..4f3fa9cb47f 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -212,7 +212,7 @@ enum event_kind | |||
| 212 | , NS_NONKEY_EVENT | 212 | , NS_NONKEY_EVENT |
| 213 | #endif | 213 | #endif |
| 214 | 214 | ||
| 215 | #if defined (HAVE_INOTIFY) || defined (HAVE_NTGUI) | 215 | #ifdef USE_FILE_NOTIFY |
| 216 | /* File or directory was changed. */ | 216 | /* File or directory was changed. */ |
| 217 | , FILE_NOTIFY_EVENT | 217 | , FILE_NOTIFY_EVENT |
| 218 | #endif | 218 | #endif |