From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrey Tykhonov Newsgroups: gmane.emacs.help Subject: Re: help-gnu-emacs Digest, Vol 133, Issue 16 Date: Sun, 08 Dec 2013 05:58:29 +0200 Message-ID: <87eh5oyowq.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1386475515 17472 80.91.229.3 (8 Dec 2013 04:05:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Dec 2013 04:05:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 08 05:05:21 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 1VpVcN-0006ux-5O for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Dec 2013 05:05:19 +0100 Original-Received: from localhost ([::1]:38102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpVcM-0000wW-MW for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Dec 2013 23:05:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpVc9-0000t7-5k for help-gnu-emacs@gnu.org; Sat, 07 Dec 2013 23:05:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpVc4-0007N0-P7 for help-gnu-emacs@gnu.org; Sat, 07 Dec 2013 23:05:05 -0500 Original-Received: from mail-bk0-x22e.google.com ([2a00:1450:4008:c01::22e]:48310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpVc4-0007Mu-H4 for help-gnu-emacs@gnu.org; Sat, 07 Dec 2013 23:05:00 -0500 Original-Received: by mail-bk0-f46.google.com with SMTP id u15so863320bkz.5 for ; Sat, 07 Dec 2013 20:04:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:user-agent:in-reply-to:date:message-id :mime-version:content-type; bh=KYJKJsCCG3RuMJOD/okquMNGeMShSTk0nbZUivJw7tU=; b=B6SFOsTTcuHCSgwz1eTEQsgBbpIAvTteyp5VOumAbUf0dDWq4EH66lk2FPxKWH63D+ Ou9e3f8+Sy5OdQTYX/qwt6E0AUPTX+YIgXMTWGt6o2hZhgBkYE3hR3g7ubwR+lDhZ9Ge 7rKU2WsmFvlpJzpeb2LDkyjYHVoz1UI4nuTMWrhk4QbU7Ye94s7Uudng77J7KhRPNT0N WSybgjY+mq1spdktM5VZ4TbmXxF3JYtiwTKZ5H42ZfxfTyoqHsFL+5dMmHvIiMwRZx0j 0WBp/SmBi1E9zLmK5Ur7stzFKIjjvQpuYDK/+Rp8sVQ7x1Cby7O87kR/8y5A0I7765ey /Whg== X-Received: by 10.205.65.81 with SMTP id xl17mr130042bkb.66.1386475499205; Sat, 07 Dec 2013 20:04:59 -0800 (PST) Original-Received: from demi.gmail ([193.84.22.38]) by mx.google.com with ESMTPSA id qe6sm4013779bkb.5.2013.12.07.20.04.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 07 Dec 2013 20:04:57 -0800 (PST) User-agent: mu4e 0.9.9; emacs 24.3.1 In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4008:c01::22e 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:94873 Archived-At: > Date: Sat, 07 Dec 2013 09:06:50 +0100 > From: "Sebastien Vauban" > To: help-gnu-emacs@gnu.org > Subject: Rename Shell buffer with current directory > Message-ID: <86ppp92ig5.fsf@somewhere.org> > Content-Type: text/plain > > Hello, Hello, I don't see any reason why your code doesn't work. I'm new in emacs and many things are new for me.... But I would like to suggest you using the following code: (defun add-mode-line-dirtrack () (add-to-list 'mode-line-buffer-identification '(:propertize (" " default-directory " ") face dired-directory) ) ) (add-hook 'shell-mode-hook 'add-mode-line-dirtrack) This code displays current directory in the shell's modeline. If this code is not suitable for you then I would like to suggest to bind RET to the your function `my-rename-to-curdir`. Then your function could has (rename-buffer <...>) call as it has and also (comint-send-input) (`commint-send-input` is currently binded to RET in mine emacs): (defun my-rename-to-curdir () (interactive) (comint-send-input) (rename-buffer (concat "*shell " default-directory "*")) ) (define-key shell-mode-map [remap comint-send-input] 'my-rename-to-curdir) Best regards, Andrey > > 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