Created
August 7, 2024 09:11
-
-
Save epichub/670be484291a037c3f82d9c24cec82fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun epicemacs/save-and-kill-tramp-buffers () | |
(interactive) | |
(let* ( | |
(filter "\*") ;; not any meta buffers such as #<buffer *tramp/ssh rootepicvps*> - let them be | |
(ssh-buffers (seq-filter (lambda (buf) | |
(not (string-match-p filter (buffer-name buf)))) | |
(tramp-list-remote-buffers))) | |
(ssh-buffer-names (mapcar #'buffer-name ssh-buffers)) | |
(prettylist (mapconcat 'identity ssh-buffer-names " ")) | |
) | |
(message "killing tramp buffers: %s" prettylist) | |
(mapcar #'save-buffer ssh-buffers) | |
(mapcar #'kill-buffer ssh-buffers) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment