aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2013-07-05 17:17:16 +0200
committerMichael Albinus2013-07-05 17:17:16 +0200
commitc0747758896a1d0ca4fd9649277ff5adbdf757d7 (patch)
tree486802eb2b63f3bf86746d4ba808333ff46d12c2 /lisp
parent84b6d3df1ad4f84faaf2bdf511f184ae1716762e (diff)
downloademacs-c0747758896a1d0ca4fd9649277ff5adbdf757d7.tar.gz
emacs-c0747758896a1d0ca4fd9649277ff5adbdf757d7.zip
Fix previous patch.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/tramp-sh.el59
1 files changed, 31 insertions, 28 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index f0423cbfa68..1557acb7894 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3418,37 +3418,40 @@ Fall back to normal file name handler if no Tramp handler exists."
3418 3418
3419(defun tramp-sh-file-gvfs-monitor-dir-process-filter (proc string) 3419(defun tramp-sh-file-gvfs-monitor-dir-process-filter (proc string)
3420 "Read output from \"gvfs-monitor-dir\" and add corresponding file-notify events." 3420 "Read output from \"gvfs-monitor-dir\" and add corresponding file-notify events."
3421 (tramp-message proc 6 (format "%S\n%s" proc string)) 3421 (let ((remote-prefix
3422 (with-current-buffer (process-buffer proc) 3422 (with-current-buffer (process-buffer proc)
3423 (dolist 3423 (file-remote-p default-directory)))
3424 (line 3424 (previous-string (tramp-compat-process-get proc 'previous-string)))
3425 (split-string string "Directory Monitor Event:[\n\r]+" 'omit-nulls)) 3425 (when previous-string
3426 ;; Attribute change is returned in unused wording. 3426 (tramp-message proc 10 (format "Previous string:\n%s" previous-string)))
3427 (setq line 3427 (tramp-message proc 6 (format "%S\n%s" proc string))
3428 (replace-regexp-in-string 3428 (setq string (concat previous-string string)
3429 "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" line)) 3429 ;; Attribute change is returned in unused wording.
3430 ;; Check, whether there is a problem. 3430 string (replace-regexp-in-string
3431 (unless 3431 "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
3432 (string-match 3432
3433 "^Child = \\([^[:blank:]]+\\)[\n\r]+\\(Other = \\([^[:blank:]]+\\)[\n\r]+\\)?Event = \\([^[:blank:]]+\\)[\n\r]+$" line) 3433 (while (string-match
3434 (tramp-error proc 'file-notify-error "%s" line)) 3434 "^Directory Monitor Event:[\n\r]+Child = \\([^[:blank:]]+\\)[\n\r]+\\(Other = \\([^[:blank:]]+\\)[\n\r]+\\)?Event = \\([^[:blank:]]+\\)[\n\r]+$" string)
3435 3435 (let ((object
3436 (let* ((remote-prefix (file-remote-p default-directory)) 3436 (list
3437 (object 3437 proc
3438 (list 3438 (intern-soft
3439 proc 3439 (replace-regexp-in-string
3440 (intern-soft 3440 "_" "-" (downcase (match-string 4 string))))
3441 (replace-regexp-in-string 3441 ;; File names are returned as absolute paths. We must
3442 "_" "-" (downcase (match-string 4 line)))) 3442 ;; add the remote prefix.
3443 ;; File names are returned as absolute paths. We must 3443 (concat remote-prefix (match-string 1 string))
3444 ;; add the remote prefix. 3444 (when (match-string 3 string)
3445 (concat remote-prefix (match-string 1 line)) 3445 (concat remote-prefix (match-string 3 string))))))
3446 (when (match-string 3 line)
3447 (concat remote-prefix (match-string 3 line))))))
3448 ;; Usually, we would add an Emacs event now. Unfortunately, 3446 ;; Usually, we would add an Emacs event now. Unfortunately,
3449 ;; `unread-command-events' does not accept several events at 3447 ;; `unread-command-events' does not accept several events at
3450 ;; once. Therefore, we apply the callback directly. 3448 ;; once. Therefore, we apply the callback directly.
3451 (tramp-compat-funcall 'file-notify-callback object))))) 3449 (tramp-compat-funcall 'file-notify-callback object)
3450 (setq string (replace-match "" nil nil string)))))
3451
3452 ;; Save rest of the string.
3453 (when string (tramp-message proc 10 (format "Rest string:\n%s" string)))
3454 (tramp-compat-process-put proc 'previous-string string))
3452 3455
3453(defun tramp-sh-file-inotifywait-process-filter (proc string) 3456(defun tramp-sh-file-inotifywait-process-filter (proc string)
3454 "Read output from \"inotifywait\" and add corresponding file-notify events." 3457 "Read output from \"inotifywait\" and add corresponding file-notify events."