summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-integration.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2019-02-25 11:59:52 +0100
committerMichael Albinus <michael.albinus@gmx.de>2019-02-25 11:59:52 +0100
commitcedc3410d4feab7b4beeef3eab474fbabad4035c (patch)
tree7402bf4ff8d2b6d3f7b3ff897a6bcfa0077c0a07 /lisp/net/tramp-integration.el
parent6a3b1aaa066dac28355ca5d09550947250108950 (diff)
downloademacs-cedc3410d4feab7b4beeef3eab474fbabad4035c.tar.gz
Adapt hooks in Tramp
* lisp/net/tramp-archive.el (tramp-archive-cleanup-hash): Remove autoload cookie. (tramp-cleanup-all-connections-hook): Add `tramp-archive-cleanup-hash'. * lisp/net/tramp-cmds.el (tramp-cleanup-connection-hook) (tramp-cleanup-all-connections-hook): New hook variables. (tramp-cleanup-connection): Set `tramp-current-connection' always to nil. (tramp-cleanup-connection): Do not call `tramp-recentf-cleanup'. Run ´tramp-cleanup-connection-hook`. (tramp-cleanup-all-connections): Do not call `tramp-archive-cleanup-hash' and ´tramp-recentf-cleanup'. Run `tramp-cleanup-all-connections-hook'. * lisp/net/tramp-ftp.el (top): Simply call `tramp-disable-ange-ftp'. * lisp/net/tramp-integration.el (tramp-recentf-cleanup-all): New defun. (top): Adapt `tramp-integration-unload-hook', `tramp-cleanup-connection-hook' and `tramp-cleanup-all-connections-hook'.
Diffstat (limited to 'lisp/net/tramp-integration.el')
-rw-r--r--lisp/net/tramp-integration.el21
1 files changed, 20 insertions, 1 deletions
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index f3f95f1b69c..e2a0d6b206f 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -128,7 +128,7 @@ been set up by `rfn-eshadow-setup-minibuffer'."
'tramp-eshell-directory-change)
(add-hook 'eshell-directory-change-hook
'tramp-eshell-directory-change)
- (add-hook 'tramp-unload-hook
+ (add-hook 'tramp-integration-unload-hook
(lambda ()
(remove-hook 'eshell-mode-hook
'tramp-eshell-directory-change)
@@ -151,6 +151,25 @@ NAME must be equal to `tramp-current-connection'."
(recentf-exclude '(tramp-recentf-exclude-predicate)))
(recentf-cleanup))))
+(defun tramp-recentf-cleanup-all ()
+ "Remove all remote file names from recentf."
+ (when (bound-and-true-p recentf-list)
+ (let ((recentf-exclude '(file-remote-p)))
+ (recentf-cleanup))))
+
+(eval-after-load "recentf"
+ '(progn
+ (add-hook 'tramp-cleanup-connection-hook
+ 'tramp-recentf-cleanup)
+ (add-hook 'tramp-cleanup-all-connections-hook
+ 'tramp-recentf-cleanup-all)
+ (add-hook 'tramp-integration-unload-hook
+ (lambda ()
+ (remove-hook 'tramp-cleanup-connection-hook
+ 'tramp-recentf-cleanup)
+ (remove-hook 'tramp-cleanup-all-connections-hook
+ 'tramp-recentf-cleanup-all)))))
+
(add-hook 'tramp-unload-hook
(lambda () (unload-feature 'tramp-integration 'force)))