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: Rename Shell buffer with current directory Date: Sat, 07 Dec 2013 09:06:50 +0100 Organization: Sebastien Vauban Message-ID: <86ppp92ig5.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1386403811 15507 80.91.229.3 (7 Dec 2013 08:10:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Dec 2013 08:10:11 +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 Sat Dec 07 09:10:17 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 1VpCxt-00058w-Ca for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Dec 2013 09:10:17 +0100 Original-Received: from localhost ([::1]:34929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpCxs-0000GK-Ml for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Dec 2013 03:10:16 -0500 Original-Path: usenet.stanford.edu!newsfeed.news.ucla.edu!news.snarked.org!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 Injection-Info: mx05.eternal-september.org; posting-host="6f05eaee171434c896d44feeaf7179f0"; logging-data="14502"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX1+v1HAWAB8f4Ms+ygD+tYV0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-Url: Under construction... X-Archive: encrypt Cancel-Lock: sha1:CtrhDIElgpD+LSg/F9d3l2Gy18o= sha1:e3DDUpYIZbvMGr5pWbgDTOXCXEw= Original-Xref: usenet.stanford.edu gnu.emacs.help:202598 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:94867 Archived-At: Hello, In order to rename the Shell buffer with the information of the current directory, I've come up with the following: --8<---------------cut here---------------start------------->8--- (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) --8<---------------cut here---------------end--------------->8--- 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... It's like if `rename-buffer' would fail. But I see no reason for that. Do you? Best regards, Seb -- Sebastien Vauban