[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help-gnu-emacs Digest, Vol 133, Issue 16
From: |
Andrey Tykhonov |
Subject: |
Re: help-gnu-emacs Digest, Vol 133, Issue 16 |
Date: |
Sun, 08 Dec 2013 05:58:29 +0200 |
User-agent: |
mu4e 0.9.9; emacs 24.3.1 |
> 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: help-gnu-emacs Digest, Vol 133, Issue 16,
Andrey Tykhonov <=