aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2013-01-30 08:37:12 +0100
committerMichael Albinus2013-01-30 08:37:12 +0100
commit9e4ce6976d594b65c7b925fdff12a1adadb3b688 (patch)
tree10c802f2364604a33a80300d694d03b8a3650643
parent953e5b8cb2326f1b153ad29c2af7c5b488865162 (diff)
downloademacs-9e4ce6976d594b65c7b925fdff12a1adadb3b688.tar.gz
emacs-9e4ce6976d594b65c7b925fdff12a1adadb3b688.zip
Revert changes, which were committed with 2013-01-29T16:03:40Z!michael.albinus@gmx.de by accident.
-rw-r--r--lisp/net/tramp-sh.el66
1 files changed, 1 insertions, 65 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 65a514c8e36..63e966b91b2 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -988,8 +988,7 @@ This is used to map a mode number to a permission string.")
988 (set-file-selinux-context . tramp-sh-handle-set-file-selinux-context) 988 (set-file-selinux-context . tramp-sh-handle-set-file-selinux-context)
989 (file-acl . tramp-sh-handle-file-acl) 989 (file-acl . tramp-sh-handle-file-acl)
990 (set-file-acl . tramp-sh-handle-set-file-acl) 990 (set-file-acl . tramp-sh-handle-set-file-acl)
991 (vc-registered . tramp-sh-handle-vc-registered) 991 (vc-registered . tramp-sh-handle-vc-registered))
992 (inotify-add-watch . tramp-sh-handle-inotify-add-watch))
993 "Alist of handler functions. 992 "Alist of handler functions.
994Operations not mentioned here will be handled by the normal Emacs functions.") 993Operations not mentioned here will be handled by the normal Emacs functions.")
995 994
@@ -3488,64 +3487,6 @@ Fall back to normal file name handler if no Tramp handler exists."
3488 ;; Default file name handlers, we don't care. 3487 ;; Default file name handlers, we don't care.
3489 (t (tramp-run-real-handler operation args))))))) 3488 (t (tramp-run-real-handler operation args)))))))
3490 3489
3491(defun tramp-sh-handle-inotify-add-watch (file-name aspect callback)
3492 "Like `inotify-add-watch' for Tramp files."
3493 (setq file-name (expand-file-name file-name))
3494 (unless (consp aspect) (setq aspect (cons aspect nil)))
3495 (with-parsed-tramp-file-name file-name nil
3496 (let* ((default-directory (file-name-directory file-name))
3497 (command (tramp-get-remote-inotifywait v))
3498 (aspect (mapconcat
3499 (lambda (x)
3500 (replace-regexp-in-string "-" "_" (symbol-name x)))
3501 aspect ","))
3502 (p (and command
3503 (start-file-process
3504 "inotifywait" nil command "-mq" "-e" aspect localname))))
3505 (when (processp p)
3506 (tramp-compat-set-process-query-on-exit-flag p nil)
3507 (set-process-filter p 'tramp-sh-inotify-process-filter)
3508 (tramp-set-connection-property p "inotify-callback" callback)
3509 ;; Return the file-name vector as watch-descriptor.
3510 (tramp-set-connection-property p "inotify-watch-descriptor" v)))))
3511
3512(defun tramp-sh-inotify-process-filter (proc string)
3513 "Read output from \"inotifywait\" and add corresponding inotify events."
3514 (tramp-message
3515 (tramp-get-connection-property proc "vector" nil) 6
3516 (format "%s\n%s" proc string))
3517 (dolist (line (split-string string "[\n\r]+" 'omit-nulls))
3518 ;; Check, whether there is a problem.
3519 (unless
3520 (string-match
3521 "^[^[:blank:]]+[[:blank:]]+\\([^[:blank:]]+\\)+\\([[:blank:]]+\\([^[:blank:]]+\\)\\)?[[:blank:]]*$" line)
3522 (tramp-error proc 'filewatch-error "%s" line))
3523
3524 (let* ((object
3525 (list
3526 (tramp-get-connection-property
3527 proc "inotify-watch-descriptor" nil)
3528 ;; Aspect symbols. We filter out MOVE and CLOSE, which
3529 ;; are convenience macros. See INOTIFY(7).
3530 (mapcar
3531 (lambda (x)
3532 (intern-soft (replace-regexp-in-string "_" "-" (downcase x))))
3533 (delete "MOVE" (delete "CLOSE"
3534 (split-string (match-string 1 line) "," 'omit-nulls))))
3535 ;; We cannot gather any cookie value. So we return 0 as
3536 ;; "don't know".
3537 0 (match-string 3 line)))
3538 (callback
3539 (tramp-get-connection-property proc "inotify-callback" nil))
3540 (event `(file-inotify ,object ,callback)))
3541
3542 ;; Usually, we would add an Emacs event now. Unfortunately,
3543 ;; `unread-command-events' does not accept several events at
3544 ;; once. Therefore, we apply the callback directly.
3545 ;(setq unread-command-events (cons event unread-command-events)))))
3546 (let ((last-input-event event))
3547 (funcall callback object)))))
3548
3549;;; Internal Functions: 3490;;; Internal Functions:
3550 3491
3551(defun tramp-maybe-send-script (vec script name) 3492(defun tramp-maybe-send-script (vec script name)
@@ -5105,11 +5046,6 @@ This is used internally by `tramp-file-mode-from-int'."
5105 (tramp-message vec 5 "Finding a suitable `trash' command") 5046 (tramp-message vec 5 "Finding a suitable `trash' command")
5106 (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))) 5047 (tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
5107 5048
5108(defun tramp-get-remote-inotifywait (vec)
5109 (with-tramp-connection-property vec "inotifywait"
5110 (tramp-message vec 5 "Finding a suitable `inotifywait' command")
5111 (tramp-find-executable vec "inotifywait" (tramp-get-remote-path vec) t t)))
5112
5113(defun tramp-get-remote-id (vec) 5049(defun tramp-get-remote-id (vec)
5114 (with-tramp-connection-property vec "id" 5050 (with-tramp-connection-property vec "id"
5115 (tramp-message vec 5 "Finding POSIX `id' command") 5051 (tramp-message vec 5 "Finding POSIX `id' command")