[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rename Shell buffer with current directory
From: |
Sebastien Vauban |
Subject: |
Re: Rename Shell buffer with current directory |
Date: |
Mon, 09 Dec 2013 19:44:01 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) |
Hello Michael,
Michael Heerdegen wrote:
> "Sebastien Vauban" <sva-news@mygooglest.com> writes:
>
>> >>> Why do you use a non-nil LOCAL parameter for `add-hook'? Without
>> >>> it, your code works for me.
>
>> Though, I just realized it also renames R buffers (as it is bound to comint
>> mode). I'll have to make some exceptions there.
>
> Oh, that's clear, silly me. So, you must indeed use the local
> parameter.
Did you understand why `rename-buffer' wasn't working in the local version,
then?
> I think something like this should DTRT:
> (defun my-rename-buffer-to-curdir (&optional _string)
> "Change Shell buffer's name to current directory."
> (message "%s" default-directory)
> (rename-buffer (concat "*shell " default-directory "*")))
>
> (add-hook 'shell-mode-hook
> (lambda ()
> (my-rename-buffer-to-curdir)
> (add-hook 'comint-output-filter-functions
> #'my-rename-buffer-to-curdir nil t)))
I'll try it, and come back to you... Thanks for your help.
>> As well, it does not handle (yet) the problem of two Shell buffers in
>> the same directory, as the name won't be unique. Not sure what's the
>> most straightforward approach for this one. Maybe looking at
>> `uniquify' or so.
>
> How do you want it to behave?
I guess the best option would be to work like the default Shell buffer naming;
so, for example:
*shell ~/Public/Repositories/org-mode/lisp*
*shell ~/Public/Repositories/org-mode/lisp <2>*
or something similar.
Best regards,
Seb
--
Sebastien Vauban
- Rename Shell buffer with current directory, Sebastien Vauban, 2013/12/07
- Re: Rename Shell buffer with current directory, Michael Heerdegen, 2013/12/07
- Message not available
- Re: Rename Shell buffer with current directory, Sebastien Vauban, 2013/12/08
- Re: Rename Shell buffer with current directory, Michael Heerdegen, 2013/12/08
- Message not available
- Re: Rename Shell buffer with current directory, Sebastien Vauban, 2013/12/09
- Re: Rename Shell buffer with current directory, Rainer M Krug, 2013/12/09
- Re: Rename Shell buffer with current directory, Sebastien Vauban, 2013/12/09
- Re: Rename Shell buffer with current directory, Rainer M Krug, 2013/12/09
- Re: Rename Shell buffer with current directory, Michael Heerdegen, 2013/12/09
- Message not available
- Re: Rename Shell buffer with current directory,
Sebastien Vauban <=
- Re: Rename Shell buffer with current directory, Michael Heerdegen, 2013/12/09