From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rainer M Krug Newsgroups: gmane.emacs.help Subject: Re: Rename Shell buffer with current directory Date: Mon, 09 Dec 2013 10:36:09 +0100 Message-ID: <52A58F09.1010409@krugs.de> References: <86ppp92ig5.fsf@somewhere.org> <86siu3f5bd.fsf@somewhere.org> <86d2l6mndo.fsf@somewhere.org> Reply-To: Rainer@krugs.de NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1386599854 3639 80.91.229.3 (9 Dec 2013 14:37:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Dec 2013 14:37:34 +0000 (UTC) To: Sebastien Vauban , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 09 15:37:41 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vq1xr-0004pe-LY for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Dec 2013 15:37:39 +0100 Original-Received: from localhost ([::1]:44182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq1xr-0008UY-6n for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Dec 2013 09:37:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpxGD-0003Cg-96 for help-gnu-emacs@gnu.org; Mon, 09 Dec 2013 04:36:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpxG8-0005n8-P3 for help-gnu-emacs@gnu.org; Mon, 09 Dec 2013 04:36:17 -0500 Original-Received: from mail-wi0-f172.google.com ([209.85.212.172]:63801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpxG8-0005n2-IZ for help-gnu-emacs@gnu.org; Mon, 09 Dec 2013 04:36:12 -0500 Original-Received: by mail-wi0-f172.google.com with SMTP id en1so3447330wid.5 for ; Mon, 09 Dec 2013 01:36:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=cpNZPAyMjjZ9k0Su4uLuW66MrkVkfDNDgP5GUki6eko=; b=OXrePz6aFxnP/Jnh63EN6ECaNG4quRTrFtz2RCtAIqRuU6Qb6wA31+xtlwzrmyzumr nJmB1/j57dPjVat/f3RQfaOgR7VKtoAvIDyQgsVPaCxJ5CS1ojb899imJCRzhOnpQWnf tVJ3YDkV9ZaJbdnTzfhS293CAeNqTv2TLt3dNcTET7OvVPCuxqkSQBgu8LdYTqXdJJjU Jv58QUByjVzC339PIuPoK6hapLMDOgbOtgL+ypJBKwDwcEbPdkU0g9aUzlmlMiTfE41Q RhkKQiychN4TmUZAWQNa7kTGWCaHpkOThWZYp34QgkZOH6an4vz2/+sh+sHh8MpglhId qo/A== X-Received: by 10.180.208.79 with SMTP id mc15mr13354780wic.40.1386581771709; Mon, 09 Dec 2013 01:36:11 -0800 (PST) Original-Received: from Rainers-MacBook-Pro-2.local ([2a01:e35:8baa:b070:b1da:7a2c:c390:a3b0]) by mx.google.com with ESMTPSA id x4sm23189286wif.0.2013.12.09.01.36.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Dec 2013 01:36:10 -0800 (PST) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 In-Reply-To: <86d2l6mndo.fsf@somewhere.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.172 X-Mailman-Approved-At: Mon, 09 Dec 2013 09:37:17 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94904 Archived-At: -----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-----