From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Re: Rename Shell buffer with current directory
Date: Mon, 09 Dec 2013 19:44:01 +0100 [thread overview]
Message-ID: <868uvt50ge.fsf@somewhere.org> (raw)
In-Reply-To: mailman.8695.1386613044.10748.help-gnu-emacs@gnu.org
Hello Michael,
Michael Heerdegen wrote:
> "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> writes:
>
>> >>> Why do you use a non-nil LOCAL parameter for `add-hook'? Without
>> >>> it, your code works for me.
>
>> Though, I just realized it also renames R buffers (as it is bound to comint
>> mode). I'll have to make some exceptions there.
>
> Oh, that's clear, silly me. So, you must indeed use the local
> parameter.
Did you understand why `rename-buffer' wasn't working in the local version,
then?
> I think something like this should DTRT:
> (defun my-rename-buffer-to-curdir (&optional _string)
> "Change Shell buffer's name to current directory."
> (message "%s" default-directory)
> (rename-buffer (concat "*shell " default-directory "*")))
>
> (add-hook 'shell-mode-hook
> (lambda ()
> (my-rename-buffer-to-curdir)
> (add-hook 'comint-output-filter-functions
> #'my-rename-buffer-to-curdir nil t)))
I'll try it, and come back to you... Thanks for your help.
>> As well, it does not handle (yet) the problem of two Shell buffers in
>> the same directory, as the name won't be unique. Not sure what's the
>> most straightforward approach for this one. Maybe looking at
>> `uniquify' or so.
>
> How do you want it to behave?
I guess the best option would be to work like the default Shell buffer naming;
so, for example:
*shell ~/Public/Repositories/org-mode/lisp*
*shell ~/Public/Repositories/org-mode/lisp <2>*
or something similar.
Best regards,
Seb
--
Sebastien Vauban
next prev parent reply other threads:[~2013-12-09 18:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2013-12-09 19:31 ` Michael Heerdegen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=868uvt50ge.fsf@somewhere.org \
--to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
--cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.