Commit 9e4ce697 authored by Michael Albinus's avatar Michael Albinus
Browse files

Revert changes, which were committed with 2013-01-29T16:03:40Z! by accident.

parent 953e5b8c
......@@ -988,8 +988,7 @@ This is used to map a mode number to a permission string.")
(set-file-selinux-context . tramp-sh-handle-set-file-selinux-context)
(file-acl . tramp-sh-handle-file-acl)
(set-file-acl . tramp-sh-handle-set-file-acl)
(vc-registered . tramp-sh-handle-vc-registered)
(inotify-add-watch . tramp-sh-handle-inotify-add-watch))
(vc-registered . tramp-sh-handle-vc-registered))
"Alist of handler functions.
Operations not mentioned here will be handled by the normal Emacs functions.")
......@@ -3488,64 +3487,6 @@ Fall back to normal file name handler if no Tramp handler exists."
;; Default file name handlers, we don't care.
(t (tramp-run-real-handler operation args)))))))
(defun tramp-sh-handle-inotify-add-watch (file-name aspect callback)
"Like `inotify-add-watch' for Tramp files."
(setq file-name (expand-file-name file-name))
(unless (consp aspect) (setq aspect (cons aspect nil)))
(with-parsed-tramp-file-name file-name nil
(let* ((default-directory (file-name-directory file-name))
(command (tramp-get-remote-inotifywait v))
(aspect (mapconcat
(lambda (x)
(replace-regexp-in-string "-" "_" (symbol-name x)))
aspect ","))
(p (and command
"inotifywait" nil command "-mq" "-e" aspect localname))))
(when (processp p)
(tramp-compat-set-process-query-on-exit-flag p nil)
(set-process-filter p 'tramp-sh-inotify-process-filter)
(tramp-set-connection-property p "inotify-callback" callback)
;; Return the file-name vector as watch-descriptor.
(tramp-set-connection-property p "inotify-watch-descriptor" v)))))
(defun tramp-sh-inotify-process-filter (proc string)
"Read output from \"inotifywait\" and add corresponding inotify events."
(tramp-get-connection-property proc "vector" nil) 6
(format "%s\n%s" proc string))
(dolist (line (split-string string "[\n\r]+" 'omit-nulls))
;; Check, whether there is a problem.
"^[^[:blank:]]+[[:blank:]]+\\([^[:blank:]]+\\)+\\([[:blank:]]+\\([^[:blank:]]+\\)\\)?[[:blank:]]*$" line)
(tramp-error proc 'filewatch-error "%s" line))
(let* ((object
proc "inotify-watch-descriptor" nil)
;; Aspect symbols. We filter out MOVE and CLOSE, which
;; are convenience macros. See INOTIFY(7).
(lambda (x)
(intern-soft (replace-regexp-in-string "_" "-" (downcase x))))
(delete "MOVE" (delete "CLOSE"
(split-string (match-string 1 line) "," 'omit-nulls))))
;; We cannot gather any cookie value. So we return 0 as
;; "don't know".
0 (match-string 3 line)))
(tramp-get-connection-property proc "inotify-callback" nil))
(event `(file-inotify ,object ,callback)))
;; Usually, we would add an Emacs event now. Unfortunately,
;; `unread-command-events' does not accept several events at
;; once. Therefore, we apply the callback directly.
;(setq unread-command-events (cons event unread-command-events)))))
(let ((last-input-event event))
(funcall callback object)))))
;;; Internal Functions:
(defun tramp-maybe-send-script (vec script name)
......@@ -5105,11 +5046,6 @@ This is used internally by `tramp-file-mode-from-int'."
(tramp-message vec 5 "Finding a suitable `trash' command")
(tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
(defun tramp-get-remote-inotifywait (vec)
(with-tramp-connection-property vec "inotifywait"
(tramp-message vec 5 "Finding a suitable `inotifywait' command")
(tramp-find-executable vec "inotifywait" (tramp-get-remote-path vec) t t)))
(defun tramp-get-remote-id (vec)
(with-tramp-connection-property vec "id"
(tramp-message vec 5 "Finding POSIX `id' command")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment