emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2e0947a: Notify broken file notification from Tramp


From: Michael Albinus
Subject: [Emacs-diffs] master 2e0947a: Notify broken file notification from Tramp
Date: Sat, 4 May 2019 16:29:37 -0400 (EDT)

branch: master
commit 2e0947abbc384a55411880c6d49020b43fe8b5f5
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Notify broken file notification from Tramp
    
    * lisp/net/tramp.el (tramp-file-notify-process-sentinel): New defun.
    
    * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
    * lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
    Set process sentinel.
---
 lisp/net/tramp-gvfs.el | 1 +
 lisp/net/tramp-sh.el   | 3 +++
 lisp/net/tramp.el      | 7 +++++++
 3 files changed, 11 insertions(+)

diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 8fea82d..52eaf68 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1187,6 +1187,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
        (process-put p 'adjust-window-size-function #'ignore)
        (set-process-query-on-exit-flag p nil)
        (set-process-filter p #'tramp-gvfs-monitor-process-filter)
+       (set-process-sentinel p #'tramp-file-notify-process-sentinel)
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
        (while (tramp-accept-process-output p 0))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 37ff14a..c4c4398 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3645,6 +3645,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
        (process-put p 'watch-name localname)
        (set-process-query-on-exit-flag p nil)
        (set-process-filter p filter)
+       (set-process-sentinel p #'tramp-file-notify-process-sentinel)
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
        (while (tramp-accept-process-output p 0))
@@ -5957,5 +5958,7 @@ function cell is returned to be applied on a buffer."
 ;; * Implement detaching/re-attaching remote sessions.  By this, a
 ;;   session could be reused after a connection loss.  Use dtach, or
 ;;   screen, or tmux, or mosh.
+;;
+;; * Implement `:stderr' of `make-process' as pipe process.
 
 ;;; tramp-sh.el ends here
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 427b3c4..c1fe413 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -9,6 +9,7 @@
 ;; Package: tramp
 ;; Version: 2.4.2-pre
 ;; Package-Requires: ((emacs "24.1"))
+;; URL: https://savannah.gnu.org/projects/tramp
 
 ;; This file is part of GNU Emacs.
 
@@ -3854,6 +3855,12 @@ of."
          (concat (file-remote-p default-directory)
                  (process-get proc 'watch-name))))))
 
+(defun tramp-file-notify-process-sentinel (proc event)
+  "Call `file-notify-rm-watch'."
+  (unless (process-live-p proc)
+    (tramp-message proc 5 "Sentinel called: `%S' `%s'" proc event)
+    (file-notify-rm-watch proc)))
+
 ;;; Functions for establishing connection:
 
 ;; The following functions are actions to be taken when seeing certain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]