summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-cmds.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-cmds.el
parent6a3b1aaa066dac28355ca5d09550947250108950 (diff)
downloademacs-cedc3410d4feab7b4beeef3eab474fbabad4035c.tar.gz
emacs-cedc3410d4feab7b4beeef3eab474fbabad4035c.tar.bz2
emacs-cedc3410d4feab7b4beeef3eab474fbabad4035c.zip
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-cmds.el')
-rw-r--r--lisp/net/tramp-cmds.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 38e440e0930..cf4f7417475 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -69,6 +69,11 @@ SYNTAX can be one of the symbols `default' (default),
(buffer-list))))
;;;###tramp-autoload
+(defvar tramp-cleanup-connection-hook nil
+ "List of functions to be called after Tramp connection is cleaned up.
+Each function is called with the current vector as argument.")
+
+;;;###tramp-autoload
(defun tramp-cleanup-connection (vec &optional keep-debug keep-password)
"Flush all connection related objects.
This includes password cache, file cache, connection cache,
@@ -99,9 +104,8 @@ When called interactively, a Tramp connection has to be selected."
(unless keep-password (tramp-clear-passwd vec))
;; Cleanup `tramp-current-connection'. Otherwise, we would be
- ;; suppressed in the test suite. We use `keep-password' as
- ;; indicator; it is not worth to add a new argument.
- (when keep-password (setq tramp-current-connection nil))
+ ;; suppressed.
+ (setq tramp-current-connection nil)
;; Flush file cache.
(tramp-flush-directory-properties vec "")
@@ -120,8 +124,8 @@ When called interactively, a Tramp connection has to be selected."
(tramp-get-connection-property vec "process-buffer" nil)))
(when (bufferp buf) (kill-buffer buf)))
- ;; Remove recentf files.
- (tramp-recentf-cleanup vec)))
+ ;; The end.
+ (run-hook-with-args 'tramp-cleanup-connection-hook vec)))
;;;###tramp-autoload
(defun tramp-cleanup-this-connection ()
@@ -132,6 +136,10 @@ When called interactively, a Tramp connection has to be selected."
(tramp-dissect-file-name default-directory 'noexpand))))
;;;###tramp-autoload
+(defvar tramp-cleanup-all-connections-hook nil
+ "List of functions to be called after all Tramp connections are cleaned up.")
+
+;;;###tramp-autoload
(defun tramp-cleanup-all-connections ()
"Flush all Tramp internal objects.
This includes password cache, file cache, connection cache, buffers."
@@ -146,10 +154,6 @@ This includes password cache, file cache, connection cache, buffers."
;; Flush file and connection cache.
(clrhash tramp-cache-data)
- ;; Cleanup local copies of archives.
- (when (bound-and-true-p tramp-archive-enabled)
- (tramp-archive-cleanup-hash))
-
;; Remove ad-hoc proxies.
(let ((proxies tramp-default-proxies-alist))
(while proxies
@@ -167,9 +171,8 @@ This includes password cache, file cache, connection cache, buffers."
(dolist (name (tramp-list-tramp-buffers))
(when (bufferp (get-buffer name)) (kill-buffer name)))
- ;; Remove recentf files.
- (dolist (v (tramp-list-connections))
- (tramp-recentf-cleanup v)))
+ ;; The end.
+ (run-hooks 'tramp-cleanup-all-connections-hook))
;;;###tramp-autoload
(defun tramp-cleanup-all-buffers ()