This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to make cygwin/bash shell work in emacs


One other thing- after reading cgf's comments 
in the "~/name when home is c:/user/foo" thread, 
I tried setting my HOME variable to /home/pbuckley, 
a unix path. When I start emacs from "runemacs.exe" 
it can't find my .emacs file in my home directory, 
and ~/name and "cd" and "cd ~" don't work. But when 
I start a bash shell, and then run "runemacs.exe", 
emacs can find my .emacs file in my home directory 
and ~/name and "cd" and "cd ~" work fine. Now, I 
don't expect it to work, but I still have one problem- 
(maybe my answer is "submit a patch") but when I do 
"cd /cygdrive/c" in emacs, it cd's to /cygdrive/c, 
but path completion doesn't follow me. So I can't 
Ctrl-x-f and open the file /cygdrive/c/foo.c, because 
Ctrl-x-f is still looking at "~/". So I am still 
cd-ing to "c:/" so path completion follows me.

Is this expected behavior (I think so) or is there 
something I can do to workaround it other than check 
the source and then submit a patch. Even then, would 
patching cygwin to deal with this even be doable/accepted, 
or would I really have to patch emacs to get it to work?

TIA,
Peter

Peter Buckley wrote:
> 
> This is what I have in my .emacs file,
> I don't have to do anything other than this
> to get emacs to use bash as my shell. I just
> have a shortcut to "runemacs.exe" and it
> works.
> 
> Now, I can't use /cygdrive/x paths, but
> that is okay. I can at least use path completion
> by doing "cd Y:/path1/path2/etc" and it uses
> forward slashes and works great.
> 
> ;; This assumes that Cygwin is installed in C:\cygwin (the
> ;; default) and that C:\cygwin\bin is not already in your
> ;; Windows Path (it generally should not be).
> ;;
> (setq exec-path (cons "C:/cygwin/bin" exec-path))
> (setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH")))
> ;;
> ;; NT-emacs assumes a Windows command shell, which you change
> ;; here.
> ;;
> (setq process-coding-system-alist '(("bash" . undecided-unix)))
> (setq w32-quote-process-args ?\")
> (setq shell-file-name "bash")
> (setenv "SHELL" shell-file-name)
> (setq explicit-shell-file-name shell-file-name)
> ;;
> ;; This removes unsightly ^M characters that would otherwise
> ;; appear in the output of java applications.
> ;;
> (add-hook 'comint-output-filter-functions
>           'comint-strip-ctrl-m)
> 
> Roman Adar wrote:
> >
> > Ehud
> >
> > Thanks for your help and your patience.
> >
> > 1. I've set the 1st line in my /etc/profile to "set -x"
> > 2. When I invoke the cygwin shell now I see what happens.
> > 3. M-x, "getenv RET BASH_ENV RET" does not do anything, as this function can
> > not be called from command line. I can do "setenv" and tried to set it to
> > /etc/profile again.
> > 4. I run the ./runemacs.exe from cygwin prompt.
> > 5. I can see that there is error when emacs starts, at the bottom:
> >
> > Error in init file: Symbol's value as variable is void: BASH_ENV.
> >
> > Is there another place that I've to set this env variable ?
> >
> > 6. Attached please find my "profile" and ".emacs" files if you would like to
> > have a look at them.
> >
> > I'll appreciate if you could point what could be wrong ?
> >
> > Thanks again
> >
> > Roman
> >
> > -----Original Message-----
> > From: Ehud Karni [mailto:ehud@unix.simonwiesel.co.il]
> > Sent: Tuesday, October 02, 2001 4:18 AM
> > To: Roman Adar
> > Cc: cygwin@cygwin.com
> > Subject: Re: How to make cygwin/bash shell work in emacs
> >
> > On Mon, 1 Oct 2001 21:20:27 -0700, Roman Adar <radar@cacheware.com> wrote:
> > >
> > > Adding the: (setenv "BASH_ENV" "/etc/profile") to my .emacs file did not
> > > solve the problem of the path, where the "perl" is picked from. It still
> > > stays /usr/bin.
> >
> > Debug it. Check that you really set the Emacs env by M-x getenv RET
> > BASH_ENV RET. Also check the values of the Emacs variables:
> > `sh-shell-file' and `shell-file-name' (they should be "bash" NOT "sh").
> > Add set -x as the 1st line of your /etc/profile and check if it is
> > called or any later command changes the PATH.
> >
> > Just to give you hope, I can tell you that it works fine for me and
> > other users.
> >
> > 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@unix.simonwiesel.co.il    http://www.simonwiesel.co.il
> >
> >   ------------------------------------------------------------------------
> >               Name: profile
> >    profile    Type: unspecified type (application/octet-stream)
> >           Encoding: quoted-printable
> >
> >              Name: .emacs
> >    .emacs    Type: unspecified type (application/octet-stream)
> >          Encoding: quoted-printable
> >
> >   ------------------------------------------------------------------------
> > --
> > 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/
> 
> --
> Your mouse has moved.
> Windows NT must be restarted for the change to take effect.
> Reboot now?  [OK]
> 
> --
> 
> --
> 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/

-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]

--

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]