on Thu Jun 14 2012, Michael Albinus <michael.albinus-AT-gmx.de> wrote:
> Dave Abrahams <[email protected]> writes: > >> Hi Michael, > > Hi Dave, > >> It's fairly common that even after tramp-cleanup-all-connections, I am >> left with lots of buffers (especially Gnus buffers!) whose buffer-local >> default-directory is set to a tramp path. This causes all kinds of >> problems, especially if I've disconnected from the network where those >> paths could be reached. I was thinking it might be a good idea to add >> something like this to tramp-cleanup-all-connections: >> >> --8<---------------cut here---------------start------------->8--- >> (dolist (b (buffer-list)) >> (with-current-buffer b >> (when (tramp-tramp-file-p default-directory) >> (setq default-directory user-emacs-directory) >> ))) >> --8<---------------cut here---------------end--------------->8--- > > But this would also alter other buffers, which are still useful (like > dired buffers etc). For those buffers, it would be fatal if > `default-directory' would have been faked. > > That's why there is another command `tramp-cleanup-all-buffers'. Oh, I thought this stanza in tramp-cleanup-all-connections did that: ;; Remove buffers. (dolist (name (tramp-list-tramp-buffers)) (when (bufferp (get-buffer name)) (kill-buffer name)))) > This command deletes all buffers which have a remote buffer name. We > could also delete buffers with a remote `default-directory'. > > WDYT? Deleting them would be bad in many circumstances, e.g. if they are Gnus buffers. This is my current setup, after modification --8<---------------cut here---------------start------------->8--- (require 'tramp-cmds) (defadvice tramp-cleanup-all-buffers (after tramp-reset-default-directories activate) (dolist (b (buffer-list)) (with-current-buffer b (when (tramp-tramp-file-p default-directory) (setq default-directory user-emacs-directory) )))) --8<---------------cut here---------------end--------------->8--- -- Dave Abrahams BoostPro Computing http://www.boostpro.com _______________________________________________ Tramp-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/tramp-devel
