Function: tramp-cleanup-some-buffers

tramp-cleanup-some-buffers is an autoloaded, interactive and byte-compiled function defined in tramp-cmds.el.gz.

Signature

(tramp-cleanup-some-buffers)

Documentation

Kill some remote buffers.

A buffer is killed when it has a remote default-directory, and one of the functions in tramp-cleanup-some-buffers-hook returns non-nil.

Probably introduced at or before Emacs version 30.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-cmds.el.gz
;;;###tramp-autoload
(defun tramp-cleanup-some-buffers ()
  "Kill some remote buffers.
A buffer is killed when it has a remote `default-directory', and
one of the functions in `tramp-cleanup-some-buffers-hook' returns
non-nil."
  (declare (completion tramp-active-command-completion-p))
  (interactive)

  ;; Remove all Tramp related connections.
  (tramp-cleanup-all-connections)

  ;; Remove all buffers with a remote default-directory which fit the hook.
  (dolist (name (tramp-list-remote-buffers))
    (and (buffer-live-p (get-buffer name))
	 (with-current-buffer name
	   (run-hook-with-args-until-success 'tramp-cleanup-some-buffers-hook))
	 (kill-buffer name))))