delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/10/03/22:14:54

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: "Roman Adar" <radar AT cacheware DOT com>
To: <ehud AT unix DOT simonwiesel DOT co DOT il>
Cc: <chet AT po DOT CWRU DOT Edu>, <cygwin AT cygwin DOT com>
Subject: RE: How to make cygwin/bash shell work in emacs
Date: Wed, 3 Oct 2001 19:13:46 -0700
Message-ID: <NMEHIGJBPAKOAODKKENBKEHACDAA.radar@cacheware.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
Importance: Normal
In-Reply-To: <200110030928.LAA12291@linux.>
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700

Ehud

I greatly appreciate your help. I've tried the suggestion you've made but
still was not able to get it to work the way I want.

For example using method #3. Put the relevant code there: Not sure what to
put there.
But I've tried the "annex" and it (possible due to missing quote or spacing)
does not work. I've traced with the "set -x".

However I've found possible an interim solution, based on the info that the
".bashrc" is used by the sub-shell from within emacs. I put into the .bashrc
file the:

alias perl=c:/'Program\ Files'/bin/Perl.exe

line.

Now the sub-shell runs the perl I want like in the command line cygwin
shell.

Thanks again for your help and I've learnt some new stuff, regarding the
start-up file.

Regards

Roman

-----Original Message-----
From: Ehud Karni [mailto:ehud AT unix DOT simonwiesel DOT co DOT il]
Sent: Wednesday, October 03, 2001 2:28 AM
To: radar AT cacheware DOT com
Cc: chet AT po DOT CWRU DOT Edu; cygwin AT cygwin DOT com
Subject: Re: How to make cygwin/bash shell work in emacs


On Tue, 2 Oct 2001 18:17:41 -0700, Roman Adar <radar AT cacheware DOT com> wrote:
>
> I've tried the approach with the ".bashrc" file, but it creates other
> problems. When I've the "set -x" still set for tracing I can see that it
> loads the "shell" FOREVER, repeatedly. It never exits the load...
statement.

That is because of the last lines in your /etc/profile:
    cd "$HOME"
    test -f ./.bashrc && . ./.bashrc
which just runs your ~/.bashrc again.

There are several ways to overcome this.
  1. You can put the relevant code in ~/.bashrc and not /etc/profile
     I don't recommend this solution.
  2. You can set a local (not env) variable that indicate /etc/profile
     has been processed (full example below).
  3. The recommended solution - put the common code in a separate file
     and source it whenever it is needed.

>
> It looks like the ".bashrc" file is the solution, but I also probably,
need
> to make some changes in my ".emacs" and the "/etc/profile" files. However
> I'm not sure where and what.

You don't need to change ".emacs" as for "/etc/profile" - please
do (3) above.

> I believe that at this point I'll invoke the perl explicitly with the full
> path when I use it in the emacs sub-shell.

You can do that, but it is not convenient, and you are just few lines
from a really GOOD solution.


Annex: how to call /etc/profile from ~/.bashrc and ~/.bashrc from
       /etc/profile without a loop.

1. Add to /etc/profile (near its beginning) ETC_PROFILE=ON
   DO NOT export it !  The reason for not exporting is that you
   to run /etc/profile + ~/.bashrc for sub processes.
2. Build the ~/.bashrc like this:

   if [ "$ETC_PROFILE" != ON ] ; then
       source /etc/profile
   else
       <real bashrc code>
   fi

I added the annex because SOMETIMES it is useful, but please use option
(3) above whenever possible.

Ehud.


--
 Ehud Karni     Mivtach - Simon  Insurance   /"\
 Tel: +972-3-7966-561 Fax: +972-3-7966-667   \ /  ASCII Ribbon Campaign
 (USA) Fax and  voice  mail: 1-815-5509341    X   Against  HTML  Mail
     Better     Safe     Than     Sorry      / \
     mailto:ehud AT unix DOT simonwiesel DOT co DOT il    http://www.simonwiesel.co.il


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019