aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2013-06-03 15:03:05 +0200
committerMichael Albinus2013-06-03 15:03:05 +0200
commitc9628c79bba5ec1e55c31512b5c32371ff034b1f (patch)
tree9da42ec29de5da50cbe76bd73ccc382c265aa1af
parent2041ae1fa791f61bf9f4a154de29a7bc167481d6 (diff)
downloademacs-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.
-rw-r--r--ChangeLog11
-rw-r--r--autogen/config.in12
-rw-r--r--configure.ac70
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/autorevert.el53
-rw-r--r--lisp/subr.el28
-rw-r--r--src/ChangeLog19
-rw-r--r--src/Makefile.in7
-rw-r--r--src/emacs.c8
-rw-r--r--src/gfilenotify.c266
-rw-r--r--src/keyboard.c54
-rw-r--r--src/lisp.h11
-rw-r--r--src/termhooks.h2
13 files changed, 466 insertions, 86 deletions
diff --git a/ChangeLog b/ChangeLog
index 072e37fef46..22607d59529 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
12013-06-03 Michael Albinus <michael.albinus@gmx.de>
2
3 * configure.ac (file-notification): New option, replaces inotify option.
4 (HAVE_W32): Remove w32notify.o.
5 (with_file_notification): Add checks for glib and w32. Adapt check
6 for inotify.
7 (Summary): Add entry for file notification.
8
9 * autogen/config.in: Add entries for HAVE_GFILENOTIFY,
10 HAVE_W32NOTIFY and USE_FILE_NOTIFY.
11
12013-06-02 Juanma Barranquero <lekktu@gmail.com> 122013-06-02 Juanma Barranquero <lekktu@gmail.com>
2 13
3 * .bzrignore: Ignore dirs libexec/, share/ and var/. 14 * .bzrignore: Ignore dirs libexec/, share/ and var/.
diff --git a/autogen/config.in b/autogen/config.in
index 63abe8c9e16..a25d43cc4cb 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -132,7 +132,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
132 #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ 132 #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
133 # define _FORTIFY_SOURCE 2 133 # define _FORTIFY_SOURCE 2
134 #endif 134 #endif
135 135
136 136
137/* Define to 1 if futimesat mishandles a NULL file name. */ 137/* Define to 1 if futimesat mishandles a NULL file name. */
138#undef FUTIMESAT_NULL_BUG 138#undef FUTIMESAT_NULL_BUG
@@ -547,6 +547,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
547/* Define to 1 if you have the `get_current_dir_name' function. */ 547/* Define to 1 if you have the `get_current_dir_name' function. */
548#undef HAVE_GET_CURRENT_DIR_NAME 548#undef HAVE_GET_CURRENT_DIR_NAME
549 549
550/* Define to 1 to use glib's notify. */
551#undef HAVE_GFILENOTIFY
552
550/* Define to 1 if you have a gif (or ungif) library. */ 553/* Define to 1 if you have a gif (or ungif) library. */
551#undef HAVE_GIF 554#undef HAVE_GIF
552 555
@@ -1140,6 +1143,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1140/* Define to 1 if you have the <vfork.h> header file. */ 1143/* Define to 1 if you have the <vfork.h> header file. */
1141#undef HAVE_VFORK_H 1144#undef HAVE_VFORK_H
1142 1145
1146/* Define to 1 to use w32notify. */
1147#undef HAVE_W32NOTIFY
1148
1143/* Define to 1 if you have the <wchar.h> header file. */ 1149/* Define to 1 if you have the <wchar.h> header file. */
1144#undef HAVE_WCHAR_H 1150#undef HAVE_WCHAR_H
1145 1151
@@ -1496,6 +1502,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1496/* Define to nonzero if you want access control list support. */ 1502/* Define to nonzero if you want access control list support. */
1497#undef USE_ACL 1503#undef USE_ACL
1498 1504
1505/* Define to 1 if if using file notifications. */
1506#undef USE_FILE_NOTIFY
1507
1499/* Define to 1 if using GTK. */ 1508/* Define to 1 if using GTK. */
1500#undef USE_GTK 1509#undef USE_GTK
1501 1510
@@ -1836,4 +1845,3 @@ Local Variables:
1836mode: c 1845mode: c
1837End: 1846End:
1838*/ 1847*/
1839
diff --git a/configure.ac b/configure.ac
index c0aa8e78715..b0859ca8dec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,7 +200,23 @@ OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
200OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support]) 200OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
201OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support]) 201OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
202OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support]) 202OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
203OPTION_DEFAULT_ON([inotify],[don't compile with inotify (file-watch) support]) 203
204AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
205 [use a file notification library (LIB one of: yes, gfile, inotify, w32, no)])],
206 [ case "${withval}" in
207 y | ye | yes ) val=yes ;;
208 n | no ) val=no ;;
209 g | gf | gfi | gfil | gfile ) val=gfile ;;
210 i | in | ino | inot | inoti | inotif | inotify ) val=inotify ;;
211 w | w3 | w32 ) val=w32 ;;
212 * ) AC_MSG_ERROR([`--with-file-notification=$withval' is invalid;
213this option's value should be `yes', `no', `gfile', `inotify' or `w32'.
214`yes' is a synonym for `w32' on MS-Windows, and for `gfile' otherwise.])
215 ;;
216 esac
217 with_file_notification=$val
218 ],
219 [with_file_notification=yes])
204 220
205## For the times when you want to build Emacs but don't have 221## For the times when you want to build Emacs but don't have
206## a suitable makeinfo, and can live without the manuals. 222## a suitable makeinfo, and can live without the manuals.
@@ -1668,7 +1684,6 @@ if test "${HAVE_W32}" = "yes"; then
1668 W32_RES_LINK="-Wl,emacs.res" 1684 W32_RES_LINK="-Wl,emacs.res"
1669 else 1685 else
1670 W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o" 1686 W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
1671 W32_OBJ="$W32_OBJ w32notify.o"
1672 W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32" 1687 W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
1673 W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10" 1688 W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10"
1674 W32_RES_LINK="\$(EMACSRES)" 1689 W32_RES_LINK="\$(EMACSRES)"
@@ -2294,16 +2309,56 @@ fi
2294AC_SUBST(LIBGNUTLS_LIBS) 2309AC_SUBST(LIBGNUTLS_LIBS)
2295AC_SUBST(LIBGNUTLS_CFLAGS) 2310AC_SUBST(LIBGNUTLS_CFLAGS)
2296 2311
2312NOTIFY_OBJ=
2313NOTIFY_SUMMARY=no
2314
2315dnl Set defaults of $with_file_notification.
2316if test "${with_file_notification}" = "yes"; then
2317 if test "${opsys}" = "mingw32"; then
2318 with_file_notification=w32
2319 else
2320 with_file_notification=gfile
2321 fi
2322fi
2323
2324dnl g_file_monitor exists since glib 2.18. It has been tested under
2325dnl GNU/Linux only. We take precedence over inotify, but this makes
2326dnl only sense when glib has been compiled with inotify support. How
2327dnl to check?
2328if test "${with_file_notification}" = "gfile"; then
2329 PKG_CHECK_MODULES(GFILENOTIFY, gio-2.0 >= 2.18, HAVE_GFILENOTIFY=yes, HAVE_GFILENOTIFY=no)
2330 if test "$HAVE_GFILENOTIFY" = "yes"; then
2331 AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
2332 LIBS="$LIBS $GFILENOTIFY_LIBS"
2333 NOTIFY_OBJ=gfilenotify.o
2334 NOTIFY_SUMMARY="yes -lgio (gfile)"
2335 fi
2336fi
2297dnl inotify is only available on GNU/Linux. 2337dnl inotify is only available on GNU/Linux.
2298if test "${with_inotify}" = "yes"; then 2338if test "${with_file_notification}" = "inotify"; then
2299 AC_CHECK_HEADERS(sys/inotify.h) 2339 AC_CHECK_HEADER(sys/inotify.h)
2300 if test "$ac_cv_header_sys_inotify_h" = yes ; then 2340 if test "$ac_cv_header_sys_inotify_h" = yes ; then
2301 AC_CHECK_FUNC(inotify_init1) 2341 AC_CHECK_FUNC(inotify_init1)
2342 if test "$ac_cv_func_inotify_init1" = yes; then
2343 AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.])
2344 NOTIFY_OBJ=inotify.o
2345 NOTIFY_SUMMARY="yes -lglibc (inotify)"
2346 fi
2347 fi
2348fi
2349dnl MS Windows native file monitor is available for mingw32 only.
2350if test "${with_file_notification}" = "w32"; then
2351 AC_CHECK_HEADER(windows.h)
2352 if test "$ac_cv_header_windows_h" = yes ; then
2353 AC_DEFINE(HAVE_W32NOTIFY, 1, [Define to 1 to use w32notify.])
2354 NOTIFY_OBJ=w32notify.o
2355 NOTIFY_SUMMARY="yes (w32)"
2302 fi 2356 fi
2303fi 2357fi
2304if test "$ac_cv_func_inotify_init1" = yes; then 2358if test -n "$NOTIFY_OBJ"; then
2305 AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.]) 2359 AC_DEFINE(USE_FILE_NOTIFY, 1, [Define to 1 if using file notifications.])
2306fi 2360fi
2361AC_SUBST(NOTIFY_OBJ)
2307 2362
2308dnl Do not put whitespace before the #include statements below. 2363dnl Do not put whitespace before the #include statements below.
2309dnl Older compilers (eg sunos4 cc) choke on it. 2364dnl Older compilers (eg sunos4 cc) choke on it.
@@ -4682,6 +4737,7 @@ echo " Does Emacs use -lgpm? ${HAVE_GPM}"
4682echo " Does Emacs use -ldbus? ${HAVE_DBUS}" 4737echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
4683echo " Does Emacs use -lgconf? ${HAVE_GCONF}" 4738echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
4684echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}" 4739echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
4740echo " Does Emacs use a file notification library? ${NOTIFY_SUMMARY}"
4685echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" 4741echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
4686echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}" 4742echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
4687echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}" 4743echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 35ea3231c93..d33cec3ab05 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12013-06-03 Michael Albinus <michael.albinus@gmx.de>
2
3 * autorevert.el (auto-revert-notify-enabled)
4 (auto-revert-notify-rm-watch, auto-revert-notify-add-watch)
5 (auto-revert-notify-event-p, auto-revert-notify-event-file-name)
6 (auto-revert-notify-handler): Handle also gfilenotify.
7
8 * subr.el: (file-notify-handle-event): New defun. Replacing ...
9 (inotify-event-p, inotify-handle-event, w32notify-handle-event):
10 Removed.
11
12013-06-03 Juri Linkov <juri@jurta.org> 122013-06-03 Juri Linkov <juri@jurta.org>
2 13
3 * bindings.el (search-map): Bind `highlight-symbol-at-point' to 14 * bindings.el (search-map): Bind `highlight-symbol-at-point' to
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index a2ce6017b21..90dda93a166 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -271,7 +271,7 @@ This variable becomes buffer local when set in any fashion.")
271 :version "24.4") 271 :version "24.4")
272 272
273(defconst auto-revert-notify-enabled 273(defconst auto-revert-notify-enabled
274 (or (featurep 'inotify) (featurep 'w32notify)) 274 (or (featurep 'gfilenotify) (featurep 'inotify) (featurep 'w32notify))
275 "Non-nil when Emacs has been compiled with file notification support.") 275 "Non-nil when Emacs has been compiled with file notification support.")
276 276
277(defcustom auto-revert-use-notify auto-revert-notify-enabled 277(defcustom auto-revert-use-notify auto-revert-notify-enabled
@@ -502,9 +502,12 @@ will use an up-to-date value of `auto-revert-interval'"
502 (puthash key value auto-revert-notify-watch-descriptor-hash-list) 502 (puthash key value auto-revert-notify-watch-descriptor-hash-list)
503 (remhash key auto-revert-notify-watch-descriptor-hash-list) 503 (remhash key auto-revert-notify-watch-descriptor-hash-list)
504 (ignore-errors 504 (ignore-errors
505 (funcall (if (fboundp 'inotify-rm-watch) 505 (funcall
506 'inotify-rm-watch 'w32notify-rm-watch) 506 (cond
507 auto-revert-notify-watch-descriptor))))) 507 ((fboundp 'gfile-rm-watch) 'gfile-rm-watch)
508 ((fboundp 'inotify-rm-watch) 'inotify-rm-watch)
509 ((fboundp 'w32notify-rm-watch) 'w32notify-rm-watch))
510 auto-revert-notify-watch-descriptor)))))
508 auto-revert-notify-watch-descriptor-hash-list) 511 auto-revert-notify-watch-descriptor-hash-list)
509 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)) 512 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch))
510 (setq auto-revert-notify-watch-descriptor nil 513 (setq auto-revert-notify-watch-descriptor nil
@@ -519,12 +522,18 @@ will use an up-to-date value of `auto-revert-interval'"
519 522
520 (when (and buffer-file-name auto-revert-use-notify 523 (when (and buffer-file-name auto-revert-use-notify
521 (not auto-revert-notify-watch-descriptor)) 524 (not auto-revert-notify-watch-descriptor))
522 (let ((func (if (fboundp 'inotify-add-watch) 525 (let ((func
523 'inotify-add-watch 'w32notify-add-watch)) 526 (cond
524 ;; `attrib' is needed for file modification time. 527 ((fboundp 'gfile-add-watch) 'gfile-add-watch)
525 (aspect (if (fboundp 'inotify-add-watch) 528 ((fboundp 'inotify-add-watch) 'inotify-add-watch)
526 '(attrib create modify moved-to) '(size last-write-time))) 529 ((fboundp 'w32notify-add-watch) 'w32notify-add-watch)))
527 (file (if (fboundp 'inotify-add-watch) 530 (aspect
531 (cond
532 ((fboundp 'gfile-add-watch) '(watch-mounts))
533 ;; `attrib' is needed for file modification time.
534 ((fboundp 'inotify-add-watch) '(attrib create modify moved-to))
535 ((fboundp 'w32notify-add-watch) '(size last-write-time))))
536 (file (if (or (fboundp 'gfile-add-watch) (fboundp 'inotify-add-watch))
528 (directory-file-name (expand-file-name default-directory)) 537 (directory-file-name (expand-file-name default-directory))
529 (buffer-file-name)))) 538 (buffer-file-name))))
530 (setq auto-revert-notify-watch-descriptor 539 (setq auto-revert-notify-watch-descriptor
@@ -545,10 +554,13 @@ will use an up-to-date value of `auto-revert-interval'"
545 554
546(defun auto-revert-notify-event-p (event) 555(defun auto-revert-notify-event-p (event)
547 "Check that event is a file notification event." 556 "Check that event is a file notification event."
548 (cond ((featurep 'inotify) 557 (and (listp event)
549 (and (listp event) (= (length event) 4))) 558 (cond ((featurep 'gfilenotify)
550 ((featurep 'w32notify) 559 (and (>= (length event) 3) (stringp (nth 2 event))))
551 (and (listp event) (= (length event) 3) (stringp (nth 2 event)))))) 560 ((featurep 'inotify)
561 (= (length event) 4))
562 ((featurep 'w32notify)
563 (and (= (length event) 3) (stringp (nth 2 event)))))))
552 564
553(defun auto-revert-notify-event-descriptor (event) 565(defun auto-revert-notify-event-descriptor (event)
554 "Return watch descriptor of file notification event, or nil." 566 "Return watch descriptor of file notification event, or nil."
@@ -561,7 +573,8 @@ will use an up-to-date value of `auto-revert-interval'"
561(defun auto-revert-notify-event-file-name (event) 573(defun auto-revert-notify-event-file-name (event)
562 "Return file name of file notification event, or nil." 574 "Return file name of file notification event, or nil."
563 (and (auto-revert-notify-event-p event) 575 (and (auto-revert-notify-event-p event)
564 (cond ((featurep 'inotify) (nth 3 event)) 576 (cond ((featurep 'gfilenotify) (nth 2 event))
577 ((featurep 'inotify) (nth 3 event))
565 ((featurep 'w32notify) (nth 2 event))))) 578 ((featurep 'w32notify) (nth 2 event)))))
566 579
567(defun auto-revert-notify-handler (event) 580(defun auto-revert-notify-handler (event)
@@ -576,12 +589,18 @@ will use an up-to-date value of `auto-revert-interval'"
576 ;; Check, that event is meant for us. 589 ;; Check, that event is meant for us.
577 ;; TODO: Filter events which stop watching, like `move' or `removed'. 590 ;; TODO: Filter events which stop watching, like `move' or `removed'.
578 (cl-assert descriptor) 591 (cl-assert descriptor)
579 (when (featurep 'inotify) 592 (cond
593 ((featurep 'gfilenotify)
594 (cl-assert (or (eq 'attribute-changed action)
595 (eq 'changed action)
596 (eq 'created action)
597 (eq 'deleted action))))
598 ((featurep 'inotify)
580 (cl-assert (or (memq 'attrib action) 599 (cl-assert (or (memq 'attrib action)
581 (memq 'create action) 600 (memq 'create action)
582 (memq 'modify action) 601 (memq 'modify action)
583 (memq 'moved-to action)))) 602 (memq 'moved-to action))))
584 (when (featurep 'w32notify) (cl-assert (eq 'modified action))) 603 ((featurep 'w32notify) (cl-assert (eq 'modified action))))
585 ;; Since we watch a directory, a file name must be returned. 604 ;; Since we watch a directory, a file name must be returned.
586 (cl-assert (stringp file)) 605 (cl-assert (stringp file))
587 (dolist (buffer buffers) 606 (dolist (buffer buffers)
diff --git a/lisp/subr.el b/lisp/subr.el
index 6b1dd48258e..f30e6db3a1f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4440,32 +4440,16 @@ convenience wrapper around `make-progress-reporter' and friends.
4440 4440
4441;;;; Support for watching filesystem events. 4441;;;; Support for watching filesystem events.
4442 4442
4443(defun inotify-event-p (event) 4443(defun file-notify-handle-event (event)
4444 "Check if EVENT is an inotify event." 4444 "Handle file system monitoring event.
4445 (and (listp event) 4445If EVENT is a filewatch event, call its callback.
4446 (>= (length event) 3)
4447 (eq (car event) 'file-inotify)))
4448
4449;;;###autoload
4450(defun inotify-handle-event (event)
4451 "Handle inotify file system monitoring event.
4452If EVENT is an inotify filewatch event, call its callback.
4453Otherwise, signal a `filewatch-error'." 4446Otherwise, signal a `filewatch-error'."
4454 (interactive "e") 4447 (interactive "e")
4455 (unless (inotify-event-p event) 4448 (if (and (eq (car event) 'file-notify)
4456 (signal 'filewatch-error (cons "Not a valid inotify event" event))) 4449 (>= (length event) 3))
4457 (funcall (nth 2 event) (nth 1 event)))
4458
4459(defun w32notify-handle-event (event)
4460 "Handle MS-Windows file system monitoring event.
4461If EVENT is an MS-Windows filewatch event, call its callback.
4462Otherwise, signal a `filewatch-error'."
4463 (interactive "e")
4464 (if (and (eq (car event) 'file-w32notify)
4465 (= (length event) 3))
4466 (funcall (nth 2 event) (nth 1 event)) 4450 (funcall (nth 2 event) (nth 1 event))
4467 (signal 'filewatch-error 4451 (signal 'filewatch-error
4468 (cons "Not a valid MS-Windows file-notify event" event)))) 4452 (cons "Not a valid file-notify event" event))))
4469 4453
4470 4454
4471;;;; Comparing version strings. 4455;;;; Comparing version strings.
diff --git a/src/ChangeLog b/src/ChangeLog
index 41687e07593..fce07f9db1a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
12013-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
12013-06-03 Stefan Monnier <monnier@iro.umontreal.ca> 202013-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.
157GTK_OBJ=@GTK_OBJ@ 157GTK_OBJ=@GTK_OBJ@
158 158
159## gfilenotify.o if HAVE_GFILENOTIFY.
160## inotify.o if HAVE_INOTIFY.
161## w32notify.o if HAVE_W32NOTIFY.
162NOTIFY_OBJ = @NOTIFY_OBJ@
163
159## -ltermcap, or -lncurses, or -lcurses, or "". 164## -ltermcap, or -lncurses, or -lcurses, or "".
160LIBS_TERMCAP=@LIBS_TERMCAP@ 165LIBS_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
4This file is part of GNU Emacs.
5
6GNU Emacs is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along 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. */
33static Lisp_Object Qgfile_add_watch;
34static Lisp_Object Qgfile_rm_watch;
35
36/* Filter objects. */
37static Lisp_Object Qwatch_mounts; /* G_FILE_MONITOR_WATCH_MOUNTS */
38static Lisp_Object Qsend_moved; /* G_FILE_MONITOR_SEND_MOVED */
39
40/* Event types. */
41static Lisp_Object Qchanged; /* G_FILE_MONITOR_EVENT_CHANGED */
42static Lisp_Object Qchanges_done_hint; /* G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT */
43static Lisp_Object Qdeleted; /* G_FILE_MONITOR_EVENT_DELETED */
44static Lisp_Object Qcreated; /* G_FILE_MONITOR_EVENT_CREATED */
45static Lisp_Object Qattribute_changed; /* G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED */
46static Lisp_Object Qpre_unmount; /* G_FILE_MONITOR_EVENT_PRE_UNMOUNT */
47static Lisp_Object Qunmounted; /* G_FILE_MONITOR_EVENT_UNMOUNTED */
48static Lisp_Object Qmoved; /* G_FILE_MONITOR_EVENT_MOVED */
49
50static 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. */
55static gboolean
56dir_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
126DEFUN ("gfile-add-watch", Fgfile_add_watch, Sgfile_add_watch, 3, 3, 0,
127 doc: /* Add a watch for filesystem events pertaining to FILE.
128
129This arranges for filesystem events pertaining to FILE to be reported
130to Emacs. Use `gfile-rm-watch' to cancel the watch.
131
132Value is a descriptor for the added watch. If the file cannot be
133watched for some reason, this function signals a `file-error' error.
134
135FLAGS is a list of conditions to set what will be watched for. It can
136include 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
143When any event happens, Emacs will call the CALLBACK function passing
144it a single argument EVENT, which is of the form
145
146 (DESCRIPTOR ACTION FILE [FILE1])
147
148DESCRIPTOR is the same object as the one returned by this function.
149ACTION is the description of the event. It could be any one of the
150following:
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
162FILE is the name of the file whose event is being reported. FILE1
163will 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
207DEFUN ("gfile-rm-watch", Fgfile_rm_watch, Sgfile_rm_watch, 1, 1, 0,
208 doc: /* Remove an existing WATCH-DESCRIPTOR.
209
210WATCH-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
235void
236syms_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;
308Lisp_Object Qmouse_click; 308Lisp_Object Qmouse_click;
309#ifdef HAVE_NTGUI 309#ifdef HAVE_NTGUI
310Lisp_Object Qlanguage_change; 310Lisp_Object Qlanguage_change;
311#ifdef WINDOWSNT
312Lisp_Object Qfile_w32notify;
313#endif
314#endif 311#endif
315static Lisp_Object Qdrag_n_drop; 312static Lisp_Object Qdrag_n_drop;
316static Lisp_Object Qsave_session; 313static Lisp_Object Qsave_session;
317#ifdef HAVE_DBUS 314#ifdef HAVE_DBUS
318static Lisp_Object Qdbus_event; 315static Lisp_Object Qdbus_event;
319#endif 316#endif
320#ifdef HAVE_INOTIFY 317#ifdef USE_FILE_NOTIFY
321static Lisp_Object Qfile_inotify; 318static Lisp_Object Qfile_notify;
322#endif /* HAVE_INOTIFY */ 319#endif /* USE_FILE_NOTIFY */
323static Lisp_Object Qconfig_changed_event; 320static 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);
3784extern Lisp_Object Qfont_param; 3784extern 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
3789extern void syms_of_w32notify (void); 3789extern 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);
3794extern void syms_of_inotify (void); 3794extern void syms_of_inotify (void);
3795#endif 3795#endif
3796 3796
3797#ifdef HAVE_W32NOTIFY
3798/* Defined on w32notify.c. */
3799extern void syms_of_w32notify (void);
3800#endif
3801
3797/* Defined in xfaces.c. */ 3802/* Defined in xfaces.c. */
3798extern Lisp_Object Qdefault, Qtool_bar, Qfringe; 3803extern Lisp_Object Qdefault, Qtool_bar, Qfringe;
3799extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; 3804extern 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