[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to prefix tramp buffers with method prefix?
From: |
Tassilo Horn |
Subject: |
Re: How to prefix tramp buffers with method prefix? |
Date: |
Fri, 26 Sep 2008 18:53:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Michael Albinus <address@hidden> writes:
Hi Michael,
>> I'd like to have tramp buffers prefixed with the current method. For
>> example if I open /ets/hosts with the sudo method, the buffer should
>> be named "sudo:hosts" instead of only "hosts" so that I can easily
>> use the usual buffer completion to distinguish between normal and
>> tramp buffers.
>>
>> How can I achieve that?
>
> (add-hook 'find-file-hook
> '(lambda ()
> (when (file-remote-p (buffer-file-name))
> (rename-buffer
> (format "%s:%s"
> (file-remote-p (buffer-file-name) 'method)
> (buffer-name))
> 'unique))))
Thanks, that works like a charm.
Bye,
Tassilo
--
No person, no idea, and no religion deserves to be illegal to insult,
not even the Church of Emacs. (Richard M. Stallman)