From d5d3c58aac3fa748bd6b81c79b0c435bbf1c4cbc Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 24 Jul 2013 15:29:15 +0200 Subject: [PATCH] * filenotify.el (file-notify-supported-p): * 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. --- lisp/ChangeLog | 15 +++++++++++++++ lisp/autorevert.el | 7 ++----- lisp/filenotify.el | 20 +++++--------------- lisp/net/tramp-adb.el | 1 - lisp/net/tramp-gvfs.el | 1 - lisp/net/tramp-sh.el | 10 +--------- lisp/net/tramp-smb.el | 1 - lisp/net/tramp.el | 7 ++++--- 8 files changed, 27 insertions(+), 35 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 886c307565..bd7c43983f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2013-07-24 Michael Albinus + + * filenotify.el (file-notify-supported-p): + * 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. + 2013-07-24 Glenn Morris * printing.el: Replace all uses of deleted ps-windows-system, diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 5c593e2ef7..1617a31cd8 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -271,9 +271,7 @@ This variable becomes buffer local when set in any fashion.") :type 'boolean :version "24.4") -(defcustom auto-revert-use-notify - ;; We use the support of the local filesystem as default. - (file-notify-supported-p temporary-file-directory) +(defcustom auto-revert-use-notify t "If non-nil Auto Revert Mode uses file notification functions. You should set this variable through Custom." :group 'auto-revert @@ -512,8 +510,7 @@ will use an up-to-date value of `auto-revert-interval'" (set (make-local-variable 'auto-revert-use-notify) nil)) (when (and buffer-file-name auto-revert-use-notify - (not auto-revert-notify-watch-descriptor) - (file-notify-supported-p buffer-file-name)) + (not auto-revert-notify-watch-descriptor)) (setq auto-revert-notify-watch-descriptor (ignore-errors (file-notify-add-watch diff --git a/lisp/filenotify.el b/lisp/filenotify.el index c9a7e106fa..d2f37b9910 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -190,17 +190,6 @@ car of that event, which is the symbol `file-notify'." (funcall callback (list desc action file file1)) (funcall callback (list desc action file))))))) -(defun file-notify-supported-p (file) - "Returns non-nil if filesystem pertaining to FILE could be watched." - (unless (stringp file) - (signal 'wrong-type-argument (list file))) - (setq file (expand-file-name file)) - - (let ((handler (find-file-name-handler file 'file-notify-supported-p))) - (if handler - (funcall handler 'file-notify-supported-p file) - (and file-notify--library t)))) - (defun file-notify-add-watch (file flags callback) "Add a watch for filesystem events pertaining to FILE. This arranges for filesystem events pertaining to FILE to be reported @@ -274,10 +263,11 @@ FILE is the name of the file whose event is being reported." '("No file notification package available"))) ;; Determine low-level function to be called. - (setq func (cond - ((eq file-notify--library 'gfilenotify) 'gfile-add-watch) - ((eq file-notify--library 'inotify) 'inotify-add-watch) - ((eq file-notify--library 'w32notify) 'w32notify-add-watch))) + (setq func + (cond + ((eq file-notify--library 'gfilenotify) 'gfile-add-watch) + ((eq file-notify--library 'inotify) 'inotify-add-watch) + ((eq file-notify--library 'w32notify) 'w32notify-add-watch))) ;; Determine respective flags. (if (eq file-notify--library 'gfilenotify) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index d2acea0b1b..82b017fa23 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -110,7 +110,6 @@ (file-modes . tramp-handle-file-modes) (file-notify-add-watch . tramp-handle-file-notify-add-watch) (file-notify-rm-watch . ignore) - (file-notify-supported-p . ignore) (expand-file-name . tramp-adb-handle-expand-file-name) (find-backup-file-name . tramp-handle-find-backup-file-name) (directory-files . tramp-handle-directory-files) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index c6c5a9543c..e25c9bd4ca 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -437,7 +437,6 @@ Every entry is a list (NAME ADDRESS).") (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) (file-notify-add-watch . tramp-handle-file-notify-add-watch) (file-notify-rm-watch . ignore) - (file-notify-supported-p . ignore) (file-ownership-preserved-p . ignore) (file-readable-p . tramp-gvfs-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index d2fc1b9979..c92eacd447 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -867,8 +867,7 @@ of command line.") (set-file-acl . tramp-sh-handle-set-file-acl) (vc-registered . tramp-sh-handle-vc-registered) (file-notify-add-watch . tramp-sh-handle-file-notify-add-watch) - (file-notify-rm-watch . tramp-sh-handle-file-notify-rm-watch) - (file-notify-supported-p . tramp-sh-handle-file-notify-supported-p)) + (file-notify-rm-watch . tramp-sh-handle-file-notify-rm-watch)) "Alist of handler functions. Operations not mentioned here will be handled by the normal Emacs functions.") @@ -3499,13 +3498,6 @@ Fall back to normal file name handler if no Tramp handler exists." (tramp-message proc 6 (format "Kill %S" proc)) (kill-process proc)) -(defun tramp-sh-handle-file-notify-supported-p (file-name) - "Like `file-notify-supported-p' for Tramp files." - (with-parsed-tramp-file-name (expand-file-name file-name) nil - (and (or (tramp-get-remote-gvfs-monitor-dir v) - (tramp-get-remote-inotifywait v)) - t))) - ;;; Internal Functions: (defun tramp-maybe-send-script (vec script name) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index ad22ab98e4..fee34f856d 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -211,7 +211,6 @@ See `tramp-actions-before-shell' for more info.") (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) (file-notify-add-watch . tramp-handle-file-notify-add-watch) (file-notify-rm-watch . ignore) - (file-notify-supported-p . ignore) (file-ownership-preserved-p . ignore) (file-readable-p . tramp-handle-file-exists-p) (file-regular-p . tramp-handle-file-regular-p) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9c19a160a0..db6a1e381a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1980,7 +1980,7 @@ ARGS are the arguments OPERATION has been called with." ;; Emacs 22+ only. 'set-file-times ;; Emacs 24+ only. - 'file-acl 'file-notify-add-watch 'file-notify-supported-p + 'file-acl 'file-notify-add-watch 'file-selinux-context 'set-file-acl 'set-file-selinux-context ;; XEmacs only. 'abbreviate-file-name 'create-file-buffer @@ -2036,8 +2036,9 @@ ARGS are the arguments OPERATION has been called with." default-directory) ;; PROC. ((eq operation 'file-notify-rm-watch) - (with-current-buffer (process-buffer (nth 0 args)) - default-directory)) + (when (processp (nth 0 args)) + (with-current-buffer (process-buffer (nth 0 args)) + default-directory))) ;; Unknown file primitive. (t (error "unknown file I/O primitive: %s" operation)))) -- 2.20.1