From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sebastien Vauban" Newsgroups: gmane.emacs.help Subject: Re: Rename Shell buffer with current directory Date: Mon, 09 Dec 2013 09:36:51 +0100 Organization: Sebastien Vauban Message-ID: <86d2l6mndo.fsf@somewhere.org> References: <86ppp92ig5.fsf@somewhere.org> <86siu3f5bd.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1386578413 13151 80.91.229.3 (9 Dec 2013 08:40:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Dec 2013 08:40:13 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Mon Dec 09 09:40:19 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 1VpwO2-0000S4-NV for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Dec 2013 09:40:18 +0100 Original-Received: from localhost ([::1]:42527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpwO2-0000Bi-Aq for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Dec 2013 03:40:18 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Injection-Info: mx05.eternal-september.org; posting-host="6f05eaee171434c896d44feeaf7179f0"; logging-data="24402"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX18fKGfJ6b5RHuKPUTKceNFA" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:strqrMXd5/1jkpVj1dBZOQkLhsQ= sha1:Fk2RptHnBWPMS0CP6fPLkOj6WhI= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:202625 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.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-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:94894 Archived-At: 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