* Re: help-gnu-emacs Digest, Vol 133, Issue 16
[not found] <mailman.155.1386435649.1853.help-gnu-emacs@gnu.org>
@ 2013-12-08 3:58 ` Andrey Tykhonov
0 siblings, 0 replies; only message in thread
From: Andrey Tykhonov @ 2013-12-08 3:58 UTC (permalink / raw
To: help-gnu-emacs
> Date: Sat, 07 Dec 2013 09:06:50 +0100
> From: "Sebastien Vauban" <sva-news@mygooglest.com>
> 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-12-08 3:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.155.1386435649.1853.help-gnu-emacs@gnu.org>
2013-12-08 3:58 ` help-gnu-emacs Digest, Vol 133, Issue 16 Andrey Tykhonov
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.