summaryrefslogtreecommitdiff
path: root/lisp/filenotify.el
Commit message (Collapse)AuthorAgeFilesLines
* Fix filenotify-tests.el for cygwinMichael Albinus2017-05-011-2/+2
| | | | | | | * test/lisp/filenotify-tests.el (file-notify--test-read-event): Add an additional `sit-for'. (file-notify-test02-rm-watch): Add an additional `file-notify--test-read-event' call.
* Avoid unnecessary loading of subr-x at run-timeGlenn Morris2017-04-181-1/+1
| | | | | | | | | | * lisp/doc-view.el, lisp/filenotify.el, lisp/info-look.el: * lisp/svg.el, lisp/emacs-lisp/byte-opt.el, lisp/net/shr.el: * lisp/textmodes/sgml-mode.el, test/lisp/dom-tests.el: No need to load subr-x at run-time. * lisp/gnus/nnheader.el: No need to load subr-x. ; * lisp/emacs-lisp/subr-x.el, lisp/gnus/message.el, lisp/net/nsm.el: ; Comments.
* ; Spelling fixesPaul Eggert2017-04-011-1/+1
|
* Minor filenotify.el fixesAndreas Politz2017-03-301-3/+4
| | | | | * lisp/filenotify.el: Require subr-x. (file-notify-callback): Use equal, not eq.
* Minor fixes for inotify.c and filenotify.elAndreas Politz2017-03-261-4/+2
| | | | | | | | * lisp/filenotify.el (file-notify--watch-absolute-filename): Add docstring. (file-notify-callback): Simplify. * src/inotify.c (Finotify_add_watch): Adapt docstring.
* ; Format files from last commitMichael Albinus2017-03-261-15/+15
|
* Fix issues regarding inotify file-notificationAndreas Politz2017-03-261-234/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove special code handling the inotify back-end. * lisp/filenotify.el (file-notify--watch): New struct representing a file-watch. (file-notify-descriptors): Use the new struct as hash-value. (file-notify-handle-event): Check that event is a cons. (file-notify--rm-descriptor, file-notify--event-watched-file) (file-notify--event-file-name, file-notify--event-file1-name) (file-notify-callback, file-notify-add-watch) (file-notify-rm-watch, file-notify-valid-p): Use new struct. Remove special code handling inotify descriptors. Remove code handling multiple clients per descriptor. (file-notify--descriptor): Remove unused function. Let inotify-add-watch return a unique descriptor on every call, like every other back-end does (Bug#26126). Prevent multiple clients from interfering with each other, when watching a shared descriptor. * src/inotify.c (watch_list): Extend the format by including a id and the provided mask. (INOTIFY_DEFAULT_MASK): Default mask used for all clients. (make_watch_descriptor): Removed. (make_lispy_mask, lispy_mask_match_p): New functions. (inotifyevent_to_event): Match event against the mask provided by the client. (add_watch, remove_descriptor, remove_watch): New functions for managing the watch_list. (inotify_callback): Use the new functions. (Finotify_add_watch, Finotify_rm_watch): Remove deprecated flags from documentation. Add check for validity of provided descriptor. Use the new functions. Use the default mask. (INOTIFY_DEBUG): Add new debug conditional. (inotify-watch-list, inotify-allocated-p): New debug functions. (symbol_to_inotifymask, syms_of_inotify): Remove deprecated symbols. * test/lisp/filenotify-tests.el: (file-notify-test02-rm-watch): Remove expected failure for inotify.
* Fix filenotify.el issue for kqueueMichael Albinus2017-03-221-7/+3
| | | | | | | | | * lisp/filenotify.el (file-notify-add-watch): Use directory for remote file name handlers. * test/lisp/filenotify-tests.el (file-notify-test01-add-watch): Create/delete temporary file only for "kqueue". (file-notify-test02-rm-watch): Create/delete temporary files.
* Fix Bug#26127Michael Albinus2017-03-171-3/+4
| | | | | | | | | | | | | | | | * lisp/filenotify.el (file-notify--rm-descriptor): Check, that there is a function which could be called. (Bug#26127) * test/lisp/filenotify-tests.el (file-notify--test-cleanup): Clear also `file-notify-descriptors'. (file-notify--test-make-temp-name): Move up. (file-notify-test02-rm-watch): New test. (file-notify-test03-events, file-notify-test04-autorevert) (file-notify-test05-file-validity) (file-notify-test06-dir-validity) (file-notify-test07-many-events, file-notify-test08-backup) (file-notify-test09-watched-file-in-watched-dir) (file-notify-test10-sufficient-resources): Rename.
* Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | Run admin/update-copyright.
* Fix Bug#22859Michael Albinus2016-03-021-2/+4
| | | | | * lisp/filenotify.el (file-notify-callback): Return a `deleted' event in case of kqueue and file1 is nil. (Bug#22859)
* Minor fixes in filenotify.elMichael Albinus2016-02-221-9/+10
| | | | | | | * lisp/filenotify.el (top): Require 'cl-lib. (file-notify--rm-descriptor) (file-notify--event-watched-file): Use cl-caadr. (file-notify-callback): Handle also `ignore' events from inotify.
* Additional fixes for file notificationMichael Albinus2016-02-221-32/+25
| | | | | | | | | | | | | | | | * lisp/filenotify.el (top): Require 'cl when compiling. (file-notify--event-watched-file): New defun. (file-notify--rm-descriptor, file-notify-callback): Handle case of several monitors running in parallel. * test/automated/file-notify-tests.el (file-notify--test-event-test): Simplify test. (file-notify--test-with-events): Get rid of outer definition. Check also results of tests performed in callbacks. (file-notify-test02-events): No wrapping when calling `file-notify-rm-watch'. No special checking for callback tests. (file-notify-test07-backup): Adapt expected events for gfilenotify. (file-notify-test08-watched-file-in-watched-dir): Improve.
* Fix Bug#22736Michael Albinus2016-02-211-3/+5
| | | | | | | | | | * lisp/filenotify.el (file-notify-callback): Use the proper descriptor when calling the callback. (Bug#22736) * test/automated/file-notify-tests.el (file-notify--test-event-handler): Deactivate trace. (file-notify-test08-watched-file-in-watched-dir): Bind `file-notify--test-tmpfile' temporarily in `dir-callback'.
* Fix Bug#22557Michael Albinus2016-02-071-0/+4
| | | | | | | | | | | | | | | | | | * lisp/filenotify.el (file-notify-callback): Do not send a `stopped' event in case of backup by renaming. (Bug#22557) * test/automated/Makefile.in: Use $(SELECTOR_EXPENSIVE) for all targets but check and check-maybe. * test/automated/file-notify-tests.el (file-notify--test-read-event-timeout): New defconst. (file-notify--deftest-remote, file-notify--wait-for-events) (file-notify-test02-events) (file-notify-test04-file-validity) (file-notify-test06-many-events): Use it. (file-notify--test-cleanup): Make it more robust. Delete also backup file. (file-notify-test07-backup): New test.
* Backport kqueue integration from masterMichael Albinus2016-01-221-42/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (--with-file-notification): Add kqueue. (top): Remove special test for "${HAVE_NS}" and ${with_file_notification}, this is handled inside gfilenotify tests. Add kqueue tests. Use NOTIFY_CFLAGS and NOTIFY_LIBS instead of library specific variables. Add error message for gfile on Nextstep. * doc/lispref/os.texi (File Notifications): Add kqueue as backend. Fix some glitches in the example. * etc/NEWS: Mention kqueue. * lisp/filenotify.el (file-notify--library) (file-notify-descriptors, file-notify-callback) (file-notify-add-watch, file-notify-rm-watch) (file-notify-valid-p): Add kqueue support. (file-notify--rm-descriptor): Remove WHAT arg. * src/Makefile.in: Use NOTIFY_CFLAGS and NOTIFY_LIBS. * src/emacs.c (main): Call globals_of_kqueue and syms_of_kqueue. * src/inotify.c (inotifyevent_to_event): Extract file name from watch_object if the event doesn't provide it. (Finotify_add_watch): Add file name to watch_object. * src/keyboard.c (make_lispy_event): Check also for HAVE_KQUEUE. * src/kqueue.c: New file. * src/lisp.h: Declare extern globals_of_kqueue and syms_of_kqueue. * test/automated/file-notify-tests.el (file-notify--test-expected-events): Remove. (file-notify--test-cleanup): Do not set that variable. (file-notify--test-timeout) Use different timeouts for different libraries. (file-notify--test-library): New defun. (file-notify--test-event-test): Make stronger checks. (file-notify--test-with-events): EVENTS can also be a list of lists. Flush outstanding events before running the body. Make timeout heuristically depend on the number of events. (file-notify-test01-add-watch, file-notify-test02-events) (file-notify-test04-file-validity, file-notify-test05-dir-validity): Rewrite in order to call file monitors but directory monitors. (file-notify-test02-events, file-notify-test04-file-validity): Do not skip cygwin tests. Add additional test for file creation. Adapt expected result for different backends. (file-notify-test03-autorevert): Some of the tests don't work for w32notify. (file-notify-test06-many-events): New test.
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* Fix Bug#21841Michael Albinus2015-11-081-14/+24
| | | | | | | | * lisp/filenotify.el (file-notify--rm-descriptor): Use `descriptor' instead of computing its value. (file-notify--descriptor): Additional argument FILE. Adapt all callees. (file-notify-rm-watch): Use `descriptor' when calling file name handler. (Bug#21841)
* Minor fix in filenotify.elMichael Albinus2015-10-311-5/+7
| | | | | | * lisp/filenotify.el (file-notify--event-file-name) (file-notify--event-file1-name): Normalize result with `directory-file-name'.
* Further work on `stopped' events in filenotify.elMichael Albinus2015-10-261-19/+25
| | | | | | | | | | | | | | | | | | | | * doc/lispref/os.texi (File Notifications): Rework examples. * lisp/filenotify.el (file-notify--rm-descriptor): Optional parameter. (file-notify--rm-descriptor, file-notify-callback): Improve check for sending `stopped' event. (file-notify-add-watch): Check for more events for `inotify'. * test/automated/file-notify-tests.el (file-notify--test-expected-events): New defvar. (file-notify--test-with-events): Use it. (file-notify--test-cleanup): Make it more robust when deleting directories. (file-notify--test-event-test): Check also for watched directories. (file-notify--test-event-handler): Suppress temporary .#files. (file-notify-test02-events, file-notify-test04-file-validity): Rework `stopped' events. (file-notify-test05-dir-validity): Wait for events when appropriate.
* Introduce `stopped' event in file notificationMichael Albinus2015-10-251-16/+57
| | | | | | | | | | | | | * lisp/filenotify.el (file-notify--rm-descriptor): New defun. (file-notify-rm-watch): Use it. (file-notify-callback): Implement `stopped' event. (file-notify-add-watch): Mention `stopped' in the docstring. Check, that upper directory exists. * test/automated/file-notify-tests.el (file-notify-test01-add-watch): Add two test cases. (file-notify-test02-events): Handle also `stopped' event. (file-notify-test04-file-validity): Add another test case.
* Fix Bug#21669Michael Albinus2015-10-231-1/+3
| | | | | | | | | | | | | * lisp/filenotify.el (file-notify-rm-watch): Improve check for calling low-level functions. * test/automated/file-notify-tests.el (file-notify--test-timeout): Decrase to 6 seconds for remote directories. (file-notify-test02-events): Expect different number of `attribute-changed' events for the local and remote cases. Apply short delays between the operations, in order to receive all events in the remote case. Combine `attribute-change' tests. (Bug#21669)
* ; Fix thinko in last commit of filenotify.elMichael Albinus2015-09-231-16/+17
|
* Continue gfilenotify.c implementation of missing partsMichael Albinus2015-09-231-18/+16
| | | | | | | | | | | | | * lisp/filenotify.el (file-notify-add-watch): Append `flags' to `gfile-add-watch' call. (file-notify-rm-watch): Modify `file-notify-descriptors' only after calling the low level functions. * src/gfilenotify.c (dir_monitor_callback): Check, whether event_type is expected. (Fgfile_add_watch): Allow also `change'and `attribute-change' for FLAGS. (Fgfile_rm_watch): Fix typo. (syms_of_gfilenotify): Declare Qchange and Qattribute_change.
* Implement gfile-valid-pMichael Albinus2015-09-221-4/+1
| | | | | | | | | | | | * lisp/filenotify.el (file-notify-callback): Fix typo. (gfile-valid-p): Remove defalias. * src/gfilenotify.c (dir_monitor_callback): Cancel the monitor if the file or directory to be watched is deleted. (Fgfile_add_watch): Make watch_object a triple. (Fgfile_rm_watch): Check, whether watch is cancelled already. (Fgfile_valid_p): New defun. (syms_of_gfilenotify): Declare Sgfile_valid_p.
* Backslash cleanup in Elisp source filesPaul Eggert2015-09-171-2/+2
| | | | | | | | | | | This patch should not change behavior. It typically omits backslashes where they are redundant (e.g., in the string literal "^\$"). In a few places, insert backslashes where they make regular expressions clearer: e.g., replace "^\*" (equivalent to "^*") with "^\\*", which has the same effect as a regular expression. Also, use ‘\ %’ instead of ‘\%’ when avoiding confusion with SCCS IDs, and similarly use ‘\ $’ instead of ‘\$’ when avoiding confusion with RCS IDs, as that makes it clearer that the backslash is intended.
* Adaot file-notify-tests.el test casesMichael Albinus2015-09-141-11/+13
| | | | | | | | | | | | | | | | | | * lisp/filenotify.el (file-notify-rm-watch): Ignore `file-notify-error'. * src/inotify.c (Finotify_valid_p): Adapt docstring. * test/automated/file-notify-tests.el () (file-notify-test03-autorevert) (file-notify-test04-file-validity) (file-notify-test04-file-validity-remote) (file-notify-test05-dir-validity) (file-notify-test05-dir-validity-remote): Adapt docstring. (file-notify-test04-file-validity): Let events arrive before calling final `file-notify-valid-p'. Do not ignore errors. (file-notify-test05-dir-validity): Do not manipulate `temporary-file-directory', it isn't necessary. Let events arrive before calling final `file-notify-valid-p'. Do not ignore errors.
* Implement w32notify-valid-pEli Zaretskii2015-09-141-1/+0
| | | | | | | * src/w32notify.c (Fw32notify_valid_p): New function. (Bug#21432) * lisp/filenotify.el (w32notify-valid-p): No longer an alias for 'identity'.
* Introduce `file-notify-valid-p'Michael Albinus2015-09-131-0/+32
| | | | | | | | | | | | | | | | | | * lisp/filenotify.el (file-notify-valid-p): New defun. (gfile-valid-p, w32notify-valid-p): Make them an alias to `identity'. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist) * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist) * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist) * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist) <file-notify-valid-p>: Add handler. * lisp/net/tramp.el (tramp-file-name-for-operation): Add `file-notify-valid-p'. (tramp-handle-file-notify-valid-p): New defun. * src/inotify.c (Finotify_valid_p): New defun. (syms_of_inotify): Declare Sinotify_valid_p.
* * lisp/filenotify.el: Use lexical-bindingStefan Monnier2015-09-091-6/+5
| | | | (file-notify-add-watch): Avoid add-to-list.
* Fix double-reporting of rename events with inotifyTassilo Horn2015-09-081-3/+3
| | | | | * lisp/filenotify.el (file-notify-callback): Fix double-reporting of rename events with inotify (bug#21435).
* File notifications: Support renaming over directory boundariesMichael Albinus2015-09-061-60/+54
| | | | | | | | | | | * lisp/filenotify.el (file-notify-handle-event): (file-notify--pending-event): Adapt docstring. (file-notify--descriptor, file-notify-callback): Reimplement in order to support renaming over directory boundaries. (file-notify-add-watch): Adapt `file-notify--descriptor' call. * doc/lispref/os.texi (File Notifications): Remove limitation of file renaming to the same directory.
* * filenotify.el (file-notify--descriptor): Do not cons for remote files.Michael Albinus2015-01-131-1/+1
|
* Handle watching of several files in the same directory for inotify.Michael Albinus2015-01-131-168/+215
| | | | | | | | | | | | | | Fixes: debbugs:18880 * filenotify.el (file-notify-descriptors, file-notify-handle-event): Adapt docstring. (file-notify--descriptor): New defun. (file-notify-callback, file-notify-add-watch, file-notify-rm-watch): Adapt docstring. Handle multiple values for `file-notify-descriptors' entries. * net/tramp.el (tramp-handle-file-notify-rm-watch): Do not check `file-notify-descriptors', the implementation has been changed.
* Update copyright year to 2015Paul Eggert2015-01-011-1/+1
| | | | Run admin/update-copyright.
* Update copyright year to 2014 by running admin/update-copyright.Paul Eggert2014-01-011-1/+1
|
* Fix watching directories using w32notify.c.Eli Zaretskii2013-11-271-2/+1
| | | | | | | | | src/w32notify.c (Fw32notify_add_watch): If the argument FILE is a directory, watch it and not its parent. (add_watch): Allow empty string in FILE. lisp/filenotify.el (file-notify-add-watch): Don't special-case w32notify when computing the directory to watch.
* Doc fixes.Xue Fuqiao2013-11-191-1/+1
| | | | | | | | * lisp/filenotify.el (file-notify-add-watch): Refine doc string. * doc/lispref/os.texi (File Notifications): Add an index. * doc/lispref/loading.texi (Loading): Add an cross-reference.
* lisp/*.el: Remove lexical-binding warnings; additional small cleanups.Juanma Barranquero2013-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * calculator.el (calculator): Mark unused argument. (calculator-paste, calculator-quit, calculator-integer-p): Use ignore-errors. (calculator-string-to-number, calculator-decimal, calculator-exp) (calculator-op-or-exp): Use string-match-p. * dired-aux.el (dired-compress): Use ignore-errors. (dired-do-chxxx, dired-do-chmod, dired-trample-file-versions) (dired-do-async-shell-command, dired-do-shell-command) (dired-shell-stuff-it, dired-compress-file, dired-insert-subdir) (dired-insert-subdir-validate): Use string-match-p. (dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p. (dired-add-entry): Use string-match-p, looking-at-p. (dired-insert-subdir-newpos): Remove unused local variable. * dired.el (dired-buffer-more-recently-used-p): Declare. (dired-insert-set-properties, dired-insert-old-subdirs): Use ignore-errors. * filenotify.el (file-notify-callback): Remove unused local variable. * filesets.el (filesets-error): Mark unused argument. (filesets-which-command-p, filesets-filter-dir-names) (filesets-directory-files, filesets-get-external-viewer) (filesets-ingroup-get-data): Use string-match-p. * find-file.el (ff-other-file-name, ff-other-file-name) (ff-find-the-other-file, ff-cc-hh-converter): Remove unused local variables. (ff-get-file-name): Use string-match-p. (ff-all-dirs-under): Use ignore-errors. * follow.el (follow-comint-scroll-to-bottom): Mark unused argument. (follow-select-if-visible): Remove unused local variable. * forms.el (read-file-filter): Move declaration. (forms--make-format, forms--make-parser, forms-insert-record): Quote function with #'. (forms--update): Use string-match-p. Quote function with #'. * help-mode.el (help-dir-local-var-def): Mark unused argument. (help-make-xrefs): Use looking-at-p. (help-xref-on-pp): Use looking-at-p, ignore-errors. * ibuffer.el (ibuffer-ext-visible-p): Declare. (ibuffer-confirm-operation-on): Use string-match-p. * msb.el (msb-item-handler, msb-dired-item-handler): Mark unused arguments. * ses.el (ses-decode-cell-symbol) (ses-kill-override): Remove unused local variable. (ses-create-cell-variable, ses-relocate-formula): Use string-match-p. (ses-load): Use ignore-errors, looking-at-p. (ses-jump-safe): Use ignore-errors. (ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments. * tabify.el (untabify, tabify): Mark unused arguments. * thingatpt.el (thing-at-point--bounds-of-well-formed-url): Mark unused argument. (bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point) (thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
* * filenotify.el (file-notify-supported-p):Michael Albinus2013-07-241-15/+5
| | | | | | | | | | | | | | * net/tramp-sh.el (tramp-sh-handle-file-notify-supported-p): Remove functions. * autorevert.el (auto-revert-use-notify): (auto-revert-notify-add-watch): * net/tramp.el (tramp-file-name-for-operation): * net/tramp-adb.el (tramp-adb-file-name-handler-alist): * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * net/tramp-sh.el (tramp-sh-file-name-handler-alist): * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Remove `file-notify-supported-p' entry.
* * filenotify.el (file-notify--library): Renamed fromMichael Albinus2013-07-181-15/+25
| | | | | | | | | | | | | | | | | | | | | | | `file-notify-support'. Do not autoload. Adapt all uses. (file-notify-supported-p): New defun. * autorevert.el (auto-revert-use-notify): Use `file-notify-supported-p' instead of `file-notify-support'. Adapt docstring. (auto-revert-notify-add-watch): Use `file-notify-supported-p'. * net/tramp.el (tramp-file-name-for-operation): Add `file-notify-supported-p'. * net/tramp-sh.el (tramp-sh-handle-file-notify-supported-p): New defun. (tramp-sh-file-name-handler-alist): Add it as handler for `file-notify-supported-p '. * net/tramp-adb.el (tramp-adb-file-name-handler-alist): * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add `ignore' as handler for `file-notify-*' functions.
* * filenotify.el: New package.Michael Albinus2013-07-041-0/+324
* autorevert.el (top): Require filenotify.el. (auto-revert-notify-enabled): Remove. Use `file-notify-support' instead. (auto-revert-notify-rm-watch, auto-revert-notify-add-watch) (auto-revert-notify-handler): Use `file-notify-*' functions. * subr.el (file-notify-handle-event): Move function to filenotify.el. * net/tramp.el (tramp-file-name-for-operation): Handle `file-notify-add-watch' and `file-notify-rm-watch'. * net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add handler for `file-notify-add-watch' and `file-notify-rm-watch'. (tramp-process-sentinel): Improve trace. (tramp-sh-handle-file-notify-add-watch) (tramp-sh-file-notify-process-filter) (tramp-sh-handle-file-notify-rm-watch) (tramp-get-remote-inotifywait): New defuns.