emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/helm 6b95028425: Remove all remote watchers and entries in


From: ELPA Syncer
Subject: [nongnu] elpa/helm 6b95028425: Remove all remote watchers and entries in helm-ff-* caches
Date: Tue, 21 Jun 2022 16:58:41 -0400 (EDT)

branch: elpa/helm
commit 6b95028425b5ac7567a046e762d2df2b6c443132
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Remove all remote watchers and entries in helm-ff-* caches
    
    when tramp-cleanup-connection run manually or after timeout.
---
 helm-files.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/helm-files.el b/helm-files.el
index d61ccce5e4..4c49892bef 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3626,6 +3626,22 @@ in cache."
         (file-notify-rm-watch (gethash directory 
helm-ff--file-notify-watchers))
         (remhash directory helm-ff--file-notify-watchers)))))
 
+(defun helm-ff-tramp-cleanup-hook (vec)
+  "Remove remote directories related to VEC in helm-ff* caches.
+Remove as well all related file-notify watchers.
+
+This is meant to run in `tramp-cleanup-connection-hook'."
+  (cl-loop for key being the hash-keys in helm-ff--list-directory-cache
+           when (equal (file-remote-p key 'method) (cadr vec)) 
+           do (remhash key helm-ff--list-directory-cache))
+  (cl-loop for key being the hash-keys in helm-ff--file-notify-watchers
+           when (equal (file-remote-p key 'method) (cadr vec))
+           do (progn
+                (file-notify-rm-watch
+                 (gethash key helm-ff--file-notify-watchers))
+                (remhash key helm-ff--file-notify-watchers))))
+(add-hook 'tramp-cleanup-connection-hook #'helm-ff-tramp-cleanup-hook)
+
 (defun helm-ff-handle-backslash (fname)
   ;; Allow creation of filenames containing a backslash.
   (cl-loop with bad = '((92 . ""))



reply via email to

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