diff options
| author | RĂ¼diger Sonderfeld | 2012-12-10 06:17:21 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2012-12-10 06:17:21 -0500 |
| commit | 81606b10501169a5671061b8461bbc32dcec8705 (patch) | |
| tree | 6dadb650dc1950fbb1e5d4cf6f0c8d18588e6787 /lisp | |
| parent | 265c2fbf11cb8bf9b805df63ecb9508631f08e35 (diff) | |
| download | emacs-81606b10501169a5671061b8461bbc32dcec8705.tar.gz emacs-81606b10501169a5671061b8461bbc32dcec8705.zip | |
Support filesystem notification through inotify on GNU/Linux.
configure.ac (inotify): New option.
(HAVE_INOTIFY): Test for inotify.
src/termhooks.h (enum event_kind) [HAVE_INOTIFY]: Add
FILE_NOTIFY_EVENT.
src/lisp.h (syms_of_inotify) [HAVE_INOTIFY]: Add prototype.
src/keyboard.c (Qfile_inotify) [HAVE_INOTIFY]: New variable.
(syms_of_keyboard): DEFSYM it.
(kbd_buffer_get_event) [HAVE_INOTIFY]: Generate FILE_NOTIFY_EVENT.
(make_lispy_event): Support FILE_NOTIFY_EVENT by generating
Qfile_inotify events.
(keys_of_keyboard) [HAVE_INOTIFY]: Bind file-inotify events in
special-event-map to inotify-handle-event.
src/emacs.c (main) [HAVE_INOTIFY]: Call syms_of_inotify.
src/Makefile.in (base_obj): Add inotify.o.
src/inotify.c: New file.
lisp/subr.el (inotify-event-p, inotify-handle-event): New functions.
test/automated/inotify-test.el: New test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/subr.el | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 787bfb7563b..1e65aa3a089 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-12-10 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de> | ||
| 2 | |||
| 3 | * subr.el (inotify-event-p, inotify-handle-event): New functions. | ||
| 4 | |||
| 1 | 2012-12-10 Dani Moncayo <dmoncayo@gmail.com> | 5 | 2012-12-10 Dani Moncayo <dmoncayo@gmail.com> |
| 2 | 6 | ||
| 3 | * simple.el (just-one-space): Doc fix. | 7 | * simple.el (just-one-space): Doc fix. |
diff --git a/lisp/subr.el b/lisp/subr.el index e08277370a9..4f2e8f22bfe 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -4323,6 +4323,26 @@ convenience wrapper around `make-progress-reporter' and friends. | |||
| 4323 | nil ,@(cdr (cdr spec))))) | 4323 | nil ,@(cdr (cdr spec))))) |
| 4324 | 4324 | ||
| 4325 | 4325 | ||
| 4326 | ;;;; Support for watching filesystem events. | ||
| 4327 | |||
| 4328 | (defun inotify-event-p (event) | ||
| 4329 | "Check if EVENT is an inotify event." | ||
| 4330 | (and (listp event) | ||
| 4331 | (>= (length event) 3) | ||
| 4332 | (eq (car event) 'file-inotify))) | ||
| 4333 | |||
| 4334 | ;;;###autoload | ||
| 4335 | (defun inotify-handle-event (event) | ||
| 4336 | "Handle file system monitoring event. | ||
| 4337 | If EVENT is a filewatch event then the callback is called. If EVENT is | ||
| 4338 | not a filewatch event then a `filewatch-error' is signaled." | ||
| 4339 | (interactive "e") | ||
| 4340 | (unless (inotify-event-p event) | ||
| 4341 | (signal 'filewatch-error (cons "Not a valid inotify event" event))) | ||
| 4342 | |||
| 4343 | (funcall (nth 2 event) (nth 1 event))) | ||
| 4344 | |||
| 4345 | |||
| 4326 | ;;;; Comparing version strings. | 4346 | ;;;; Comparing version strings. |
| 4327 | 4347 | ||
| 4328 | (defconst version-separator "." | 4348 | (defconst version-separator "." |