unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tom Willemsen <tom@ryuslash.org>
To: C K Kashyap <ckkashyap@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Executing init script after launching eshell
Date: Tue, 27 Mar 2012 13:21:47 +0200	[thread overview]
Message-ID: <m31uoegugk.fsf@ryuslash.org> (raw)
In-Reply-To: <CAGdT1gqa53AvXA8y6B1UxcYnqHhSfny9dhVauj12rkhtjFrxaw@mail.gmail.com>

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



  reply	other threads:[~2012-03-27 11:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27  7:58 Executing init script after launching eshell C K Kashyap
2012-03-27  8:53 ` Tom Willemsen
2012-03-27 10:26   ` C K Kashyap
2012-03-27 11:21     ` Tom Willemsen [this message]
2012-03-27 13:13       ` C K Kashyap

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m31uoegugk.fsf@ryuslash.org \
    --to=tom@ryuslash.org \
    --cc=ckkashyap@gmail.com \
    --cc=help-gnu-emacs@gnu.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).