[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to start shell and rename the buffer
From: |
Pascal J. Bourguignon |
Subject: |
Re: How to start shell and rename the buffer |
Date: |
Thu, 15 Jan 2009 16:34:51 +0100 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux) |
Decebal <CLDWesterhof@gmail.com> writes:
> I sometimes want to start emacs with a shell, but I also want to
> rename the default name '*shell*'.
http://darcs.informatimago.com/emacs/pjb-shell.el
> I have:
> emacs -title ${TITLE} --eval '(shell) (rename-buffer "shell")'
>
> But the buffername is not renamed.
> In *Messages* I see:
> (emacs --eval (shell) (rename-buffer "shell"))
>
> And not an error or a warning.
> If I do 'M-:' and then '(rename-buffer "shell")' the buffer is
> renamed.
>
> What am I doing wrong?
You're assuming that --eval will loop. If that had been the case, it
would have been called --eval-loop. Instead it is called --eval, and
therefore it only does that.
When you want to group several expressionsions in a sequence, you must
use prog1, prog2 or in general, progn:
emacs --eval '(progn (shell) (rename-buffer "shell"))'
But since you don't pass -q, emacs will read your ~/.emacs, so you
can as well put there a function such as:
(defun shell-and-rename (name)
(interactive "sName: ")
(shell)
(rename-buffer name))
and then:
emacs --eval '(shell-and-rename "shell")'
--
__Pascal Bourguignon__