From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Willemsen Newsgroups: gmane.emacs.help Subject: Re: Executing init script after launching eshell Date: Tue, 27 Mar 2012 13:21:47 +0200 Message-ID: References: , , NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1332865069 18202 80.91.229.3 (27 Mar 2012 16:17:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Mar 2012 16:17:49 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: C K Kashyap Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 27 18:17:48 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SCZ5f-0002P1-Mz for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Mar 2012 18:17:47 +0200 Original-Received: from localhost ([::1]:54900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCZ5e-0002qD-RU for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Mar 2012 12:17:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCUTP-0006gJ-AS for help-gnu-emacs@gnu.org; Tue, 27 Mar 2012 07:22:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCUTJ-0007MD-3g for help-gnu-emacs@gnu.org; Tue, 27 Mar 2012 07:21:58 -0400 Original-Received: from r3.smtp1.alwaysdata.com ([176.31.58.10]:50062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCUTI-0007Lw-Tc for help-gnu-emacs@gnu.org; Tue, 27 Mar 2012 07:21:53 -0400 Original-Received: from 78-21-105-160.access.telenet.be ([78.21.105.160] helo=localhost) by smtp1.alwaysdata.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1SCUTE-0004um-AZ; Tue, 27 Mar 2012 13:21:48 +0200 User-agent: mu4e 0.9.8.2; emacs 24.0.94.1 In-reply-to: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 176.31.58.10 X-Mailman-Approved-At: Tue, 27 Mar 2012 12:17:41 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84116 Archived-At: 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