help-gnu-emacs
[Top][All Lists]
Advanced

[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 09:36:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)

Hi Michael,

Michael Heerdegen wrote:
>>   (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 'my-rename-buffer-to-curdir)
>>
>>   (add-hook 'comint-output-filter-functions 'my-rename-buffer-to-curdir nil 
>> t)
>                                                                               
> ^
>> However, that does not change the end result: the name of the buffer is
>> unchanged.
>
> Why do you use a non-nil LOCAL parameter for `add-hook'? Without it, your
> code works for me.

So does it for me -- thanks for your help!

Though, I still don't understand why making the `my-rename-buffer-to-curdir'
function buffer-local makes the above fail... Remember that that function gets
called (see the message displayed in the echo area), only the function
`rename-buffer' fails...

Best regards,
  Seb

-- 
Sebastien Vauban


reply via email to

[Prev in Thread] Current Thread [Next in Thread]