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/keyboard.c | |
| 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/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 54 |
1 files changed, 21 insertions, 33 deletions
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 | ||