[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tramp (2.2.5-pre); Lingering default-directory causing damage
From: |
Dave Abrahams |
Subject: |
Re: tramp (2.2.5-pre); Lingering default-directory causing damage |
Date: |
Thu, 14 Jun 2012 10:51:24 -0400 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.0.94 (darwin) |
on Thu Jun 14 2012, Michael Albinus <michael.albinus-AT-gmx.de> wrote:
> Dave Abrahams <address@hidden> 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 (2.2.5-pre); Lingering default-directory causing damage, Dave Abrahams, 2012/06/13
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Michael Albinus, 2012/06/14
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage,
Dave Abrahams <=
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Michael Albinus, 2012/06/14
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Dave Abrahams, 2012/06/16
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Michael Albinus, 2012/06/16
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Michael Albinus, 2012/06/16
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Dave Abrahams, 2012/06/17
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Michael Albinus, 2012/06/17
- Re: tramp (2.2.5-pre); Lingering default-directory causing damage, Dave Abrahams, 2012/06/17