all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Rename Shell buffer with current directory
@ 2013-12-07  8:06 Sebastien Vauban
  2013-12-07 20:58 ` Michael Heerdegen
       [not found] ` <mailman.8479.1386449940.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Sebastien Vauban @ 2013-12-07  8:06 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-12-09 19:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07  8:06 Rename Shell buffer with current directory Sebastien Vauban
2013-12-07 20:58 ` Michael Heerdegen
     [not found] ` <mailman.8479.1386449940.10748.help-gnu-emacs@gnu.org>
2013-12-08 20:36   ` Sebastien Vauban
2013-12-08 21:32     ` Michael Heerdegen
     [not found]     ` <mailman.8618.1386538352.10748.help-gnu-emacs@gnu.org>
2013-12-09  8:36       ` Sebastien Vauban
2013-12-09  9:36         ` Rainer M Krug
     [not found]           ` <52A58F09.1010409-vfylz/Ys1k4@public.gmane.org>
2013-12-09 12:22             ` Sebastien Vauban
2013-12-09 12:56               ` Rainer M Krug
2013-12-09 18:16               ` Michael Heerdegen
     [not found]               ` <mailman.8695.1386613044.10748.help-gnu-emacs@gnu.org>
2013-12-09 18:44                 ` Sebastien Vauban
2013-12-09 19:31                   ` Michael Heerdegen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.