diff options
| author | Michael Albinus | 2019-05-04 22:29:27 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-05-04 22:29:27 +0200 |
| commit | 2e0947abbc384a55411880c6d49020b43fe8b5f5 (patch) | |
| tree | 5f4dcac10251c4890035a2fc6082644196f9694a | |
| parent | ebecafbd19e2ba55ba90bfc9f7de88f4742479ad (diff) | |
| download | emacs-2e0947abbc384a55411880c6d49020b43fe8b5f5.tar.gz emacs-2e0947abbc384a55411880c6d49020b43fe8b5f5.zip | |
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.
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 1 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 7 |
3 files changed, 11 insertions, 0 deletions
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." | |||
| 1187 | (process-put p 'adjust-window-size-function #'ignore) | 1187 | (process-put p 'adjust-window-size-function #'ignore) |
| 1188 | (set-process-query-on-exit-flag p nil) | 1188 | (set-process-query-on-exit-flag p nil) |
| 1189 | (set-process-filter p #'tramp-gvfs-monitor-process-filter) | 1189 | (set-process-filter p #'tramp-gvfs-monitor-process-filter) |
| 1190 | (set-process-sentinel p #'tramp-file-notify-process-sentinel) | ||
| 1190 | ;; There might be an error if the monitor is not supported. | 1191 | ;; There might be an error if the monitor is not supported. |
| 1191 | ;; Give the filter a chance to read the output. | 1192 | ;; Give the filter a chance to read the output. |
| 1192 | (while (tramp-accept-process-output p 0)) | 1193 | (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." | |||
| 3645 | (process-put p 'watch-name localname) | 3645 | (process-put p 'watch-name localname) |
| 3646 | (set-process-query-on-exit-flag p nil) | 3646 | (set-process-query-on-exit-flag p nil) |
| 3647 | (set-process-filter p filter) | 3647 | (set-process-filter p filter) |
| 3648 | (set-process-sentinel p #'tramp-file-notify-process-sentinel) | ||
| 3648 | ;; There might be an error if the monitor is not supported. | 3649 | ;; There might be an error if the monitor is not supported. |
| 3649 | ;; Give the filter a chance to read the output. | 3650 | ;; Give the filter a chance to read the output. |
| 3650 | (while (tramp-accept-process-output p 0)) | 3651 | (while (tramp-accept-process-output p 0)) |
| @@ -5957,5 +5958,7 @@ function cell is returned to be applied on a buffer." | |||
| 5957 | ;; * Implement detaching/re-attaching remote sessions. By this, a | 5958 | ;; * Implement detaching/re-attaching remote sessions. By this, a |
| 5958 | ;; session could be reused after a connection loss. Use dtach, or | 5959 | ;; session could be reused after a connection loss. Use dtach, or |
| 5959 | ;; screen, or tmux, or mosh. | 5960 | ;; screen, or tmux, or mosh. |
| 5961 | ;; | ||
| 5962 | ;; * Implement `:stderr' of `make-process' as pipe process. | ||
| 5960 | 5963 | ||
| 5961 | ;;; tramp-sh.el ends here | 5964 | ;;; 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 @@ | |||
| 9 | ;; Package: tramp | 9 | ;; Package: tramp |
| 10 | ;; Version: 2.4.2-pre | 10 | ;; Version: 2.4.2-pre |
| 11 | ;; Package-Requires: ((emacs "24.1")) | 11 | ;; Package-Requires: ((emacs "24.1")) |
| 12 | ;; URL: https://savannah.gnu.org/projects/tramp | ||
| 12 | 13 | ||
| 13 | ;; This file is part of GNU Emacs. | 14 | ;; This file is part of GNU Emacs. |
| 14 | 15 | ||
| @@ -3854,6 +3855,12 @@ of." | |||
| 3854 | (concat (file-remote-p default-directory) | 3855 | (concat (file-remote-p default-directory) |
| 3855 | (process-get proc 'watch-name)))))) | 3856 | (process-get proc 'watch-name)))))) |
| 3856 | 3857 | ||
| 3858 | (defun tramp-file-notify-process-sentinel (proc event) | ||
| 3859 | "Call `file-notify-rm-watch'." | ||
| 3860 | (unless (process-live-p proc) | ||
| 3861 | (tramp-message proc 5 "Sentinel called: `%S' `%s'" proc event) | ||
| 3862 | (file-notify-rm-watch proc))) | ||
| 3863 | |||
| 3857 | ;;; Functions for establishing connection: | 3864 | ;;; Functions for establishing connection: |
| 3858 | 3865 | ||
| 3859 | ;; The following functions are actions to be taken when seeing certain | 3866 | ;; The following functions are actions to be taken when seeing certain |