From: Michael Albinus Date: Sat, 4 May 2019 20:29:27 +0000 (+0200) Subject: Notify broken file notification from Tramp X-Git-Tag: emacs-27.0.90~2991 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2e0947abbc384a55411880c6d49020b43fe8b5f5;p=emacs.git 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. --- diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 8fea82d97c4..52eaf686eaa 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 37ff14a5eb2..c4c439885c6 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 427b3c41e3a..c1fe413e368 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