After leaving Emacs open overnight, the SSH connection expires. However, the buffers that I left open, are still useful, and I want to continue working with them.
However, many actions I do with Emacs in the expired TRAMP buffer lead to an attempt to reconnect to SSH. This is very annoying since it requires entering a password or may even be impossible since remote machines often have downtime, scheduled or unscheduled. I am looking to be able to work on such buffers for a day or two without workflow constantly being interrupted by TRAMP trying, and failing, to connect.
Is there a way to stop Emacs from trying to reconnect on every action that does not require a fresh version of a file explicitly?
This is my TRAMP config:
(use-package tramp
:straight nil
:init
(setq tramp-terminal-type "tramp")
(setq server-port "1492")
(setq server-use-tcp t)
(setq auth-source-save-behavior nil)
:config
(add-to-list 'tramp-connection-properties
(list nil "remote-shell" "/bin/zsh"))
(setq tramp-completion-reread-directory-timeout nil)
(setq tramp-default-method "sshx")
(setq tramp-use-ssh-controlmaster-options nil)
(setq vc-ignore-dir-regexp
(format "\\(%s\\)\\|\\(%s\\)"
vc-ignore-dir-regexp
tramp-file-name-regexp))
(setq tramp-verbose 5)
(setq remote-file-name-inhibit-cache nil)
(setq tramp-auto-save-directory "~/.emacs.d/tramp-autosave")
)