[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Executing init script after launching eshell
From: |
Tom Willemsen |
Subject: |
Re: Executing init script after launching eshell |
Date: |
Tue, 27 Mar 2012 13:21:47 +0200 |
User-agent: |
mu4e 0.9.8.2; emacs 24.0.94.1 |
Hey Kashyap,
On Tue 27 Mar 2012 12:26:37 PM CEST, C K Kashyap wrote:
> Thanks Tom
>
> Maybe the following could work, it seems to do what you want when I try
> > it here.
> >
> > (progn
> > (let ((default-directory "path1"))
> > (eshell t)
> > (rename-buffer "b1"))
> > (let ((default-directory "path2"))
> > (eshell t)
> > (rename-buffer "b2")))
> >
> >
> This is a working solution for me.
Excellent!
> > (progn
> > (eshell t)
> > (eshell/cd "path1")
> > (eshell-send-input)
> > (eshell t)
> > (eshell/cd "path2")
> > (eshell-send-input))
> >
> >
> The above snippet does not seem to work for me. Could you please explain
> the below lines ?
>
> (eshell t) -> This opens up a new eshell
> (eshell/cd "path1") - ?????
> (eshell-send-input) - I am guessing the command in the previous step gets
> passed on using this command.
The `eshell/cd' function is what is executed when you type 'cd' into
eshell, unless you have changed this. It doesn't change what you see in
eshell though, so the `eshell-send-input' should send an empty command,
which resets the eshell prompt and should show you that it's actually in
the right directory. Perhaps I got it wrong here, I use `eshell-reset'
in one of my keybindings, but I though send-input was perhaps clearer to
use here, sorry.
It also doesn't rename the buffers, so it was wrong anyway, I only know
that just sending a `\n' character to an eshell buffer doesn't execute
the command, but `eshell-send-input' does, or should. At least that's
what I noticed when messing around with sending commands
programmatically.
> > Hope it helps in some small way.
> >
>
> Absolutely helps!!!
Awesome!
Regards,
Tom