[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rename Shell buffer with current directory
From: |
Michael Heerdegen |
Subject: |
Re: Rename Shell buffer with current directory |
Date: |
Sat, 07 Dec 2013 21:58:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
"Sebastien Vauban" <sva-news@mygooglest.com>
writes:
> Hello,
>
> In order to rename the Shell buffer with the information of the current
> directory, I've come up with the following:
>
> (defun my-rename-to-curdir ()
> (message "%s" default-directory) ; does work
> (rename-buffer (concat "*shell " default-directory "*")) ; DOESN'T WORK
> )
>
> (add-hook 'shell-mode-hook 'my-rename-to-curdir)
>
> (add-hook 'comint-output-filter-functions 'my-rename-to-curdir nil t)
>
> Depending on where you first launch Shell, the name is correctly
> created, so it
> mostly works.
>
> But, when changing of directory, in the shell session, does not update
> the name
> of the buffer -- while the variable `default-directory' is correctly
> updated...
Without knowing if renaming the buffer all the time breaks anything:
`comint-output-filter-functions' is an abnormal hook (that's why it is
called ""...-functions"" and not "...-hook""). In contrast to normal
hooks, functions in abnormal hooks take arguments. The doc of the hook
says how many and what they mean. `comint-output-filter-functions'
functions need to accept one argument. Just don't use it in the
function body if you don't need it.
Regards,
Michael.
- Rename Shell buffer with current directory, Sebastien Vauban, 2013/12/07
- Re: Rename Shell buffer with current directory,
Michael Heerdegen <=
- 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, 2013/12/09
- Re: Rename Shell buffer with current directory, Michael Heerdegen, 2013/12/09