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: Rainer M Krug
Subject: Re: Rename Shell buffer with current directory
Date: Mon, 09 Dec 2013 10:36:09 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/09/13, 09:36 , Sebastien Vauban wrote:
> 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...

Thanks - I am using your code, and it works very nicely - very useful.

Cheers,

Rainer

> 
> Best regards, Seb
> 

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSpY8JAAoJENvXNx4PUvmCcyMH/iuQ6Bi5o1jfeKBx+2fvs/3y
7MvwdaaUIPD56J5U0/vfQ4J74nmZgceIm7nGf3KkG4iSorOaRHye+IEeQJonwkKo
ozogmFncLw9v7cK8ToUcAawCfFr6iCZo72EPneuOrwdcMI4zvNI+Cyk2iUhHA/nv
L509GMYy36X538yPzbtES0Y1TkSjvCBoUQukj7ZkllTdSzwVFUmQJ0DE22NlQn0W
IM7KFQCe1xTyj5T2oAoZ9C6gIScHQ3NX18lPnFusjpoTzMgyIRfsM4rQlGpeeQh0
0EBufnZvJA5a9O1P8dS8Q9ohgTOWVUNIMAzMixPLKqGCgJm9ee9uIV3uucRCUy0=
=qcQf
-----END PGP SIGNATURE-----



reply via email to

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