Emacs Cygwin setup in Vista help

View: New views
5 Messages — Rating Filter:   Alert me  

Emacs Cygwin setup in Vista help

by rpd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I guess this question has been asked before but I want to open cygwin bash shell in Emacs (Vista O/S).

I have Cygwin installed but cannot yet open it from Emacs. From my internet search I have added Cygwin-mount.el.

This is what I have in my .emacs (v22.3):
;;;;===EMACS CYGWIN (GCC) & Vista======
;;;
;;To use shell/cmd prompt use M-x shell but
;;To use BASH (cygwin) shell use M-x cygwin-shell
;;xxxxx EMACS & CYGWIN==========
;;
(load "C:\\Users\\Dad\\Emacs\\emacsaddons\\cygwin-mount.el")
(setenv "PATH" (concat "c:\\cygwin\\bin;" (getenv "PATH")))
(setq exec-path (cons "c:\\cygwin\\bin" exec-path))
(require 'cygwin-mount)
(cygwin-mount-activate)
;;http://xahlee.blogspot.com/2009/06/cygwin-tutorial-and-notes.html
;;Cygwin and EmacsW32
;;If you are using emacsW32, then you can go to the cygwin shell by calling the command cygwin-shell.
;;First, you need to set the cygwin-shell path. This you can do by pulling the menu
;; under “Options‣Customize emacsW32”. Or, you can put the following line in your .emacs:
;;“(setq w32shell-cygwin-bin "C:\\cygwin\\bin")”.
;;Once you have the w32shell-cygwin-bin set, the command “shell” will also invoke cygwin-shell.
;;If you want run plain Windows's “cmd.exe” shell, you can call cmd-shell. EmacsW32 also has msys-shell,
;; which is for those who are using MinGW.
;;Note, when using cygwin shell in emacsW32, if the $PATH env var is not set correctly, it can cause
;; Window to mistakingly popup a dialogue saying some program crashed.
;; For a example, see: http://xah-forum.blogspot.com/2009/06/cygwinimagemagickemacsw32-causes-vista.html.
(setq exec-path (cons "C:\\cygwin\\bin" exec-path))
(setq w32shell-cygwin-bin "C:\\cygwin\\bin")
;;
;;http://www.emacswiki.org/emacs/CygWin
;;
;===

Using M-x shell -I get Windows command shell
Using M-x cygwin-shell ret I get 'no match'

I am most grateful if someone could advise on what I need to do to open cygwin shell.
I look forward to helpful replies so I can do this, many thanks

Re: Emacs Cygwin setup in Vista help

by Lennart Borgman (gmail) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 12, 2009 at 7:23 PM, rpd
<richard@...> wrote:

>
> Hi
>
> I guess this question has been asked before but I want to open cygwin bash
> shell in Emacs (Vista O/S).
>
> I have Cygwin installed but cannot yet open it from Emacs. From my internet
> search I have added Cygwin-mount.el.
>
> This is what I have in my .emacs (v22.3):
> ;;;;===EMACS CYGWIN (GCC) & Vista======
> ;;;
> ;;To use shell/cmd prompt use M-x shell but
> ;;To use BASH (cygwin) shell use M-x cygwin-shell
> ;;xxxxx EMACS & CYGWIN==========
> ;;
> (load "C:\\Users\\Dad\\Emacs\\emacsaddons\\cygwin-mount.el")
> (setenv "PATH" (concat "c:\\cygwin\\bin;" (getenv "PATH")))
> (setq exec-path (cons "c:\\cygwin\\bin" exec-path))
> (require 'cygwin-mount)
> (cygwin-mount-activate)
> ;;http://xahlee.blogspot.com/2009/06/cygwin-tutorial-and-notes.html
> ;;Cygwin and EmacsW32
> ;;If you are using emacsW32, then you can go to the cygwin shell by calling
> the command cygwin-shell.
> ;;First, you need to set the cygwin-shell path. This you can do by pulling
> the menu
> ;; under “Options‣Customize emacsW32”. Or, you can put the following line in
> your .emacs:
> ;;“(setq w32shell-cygwin-bin "C:\\cygwin\\bin")”.
> ;;Once you have the w32shell-cygwin-bin set, the command “shell” will also
> invoke cygwin-shell.
> ;;If you want run plain Windows's “cmd.exe” shell, you can call cmd-shell.
> EmacsW32 also has msys-shell,
> ;; which is for those who are using MinGW.
> ;;Note, when using cygwin shell in emacsW32, if the $PATH env var is not set
> correctly, it can cause
> ;; Window to mistakingly popup a dialogue saying some program crashed.
> ;; For a example, see:
> http://xah-forum.blogspot.com/2009/06/cygwinimagemagickemacsw32-causes-vista.html.
> (setq exec-path (cons "C:\\cygwin\\bin" exec-path))
> (setq w32shell-cygwin-bin "C:\\cygwin\\bin")
> ;;
> ;;http://www.emacswiki.org/emacs/CygWin
> ;;
> ;===
>
> Using M-x shell -I get Windows command shell
> Using M-x cygwin-shell ret I get 'no match'
>
> I am most grateful if someone could advise on what I need to do to open
> cygwin shell.
> I look forward to helpful replies so I can do this, many thanks


cygwin-shell etc comes with Emacs+EmacsW32, see

  http://ourcomments.org/Emacs/EmacsW32.html



Re: Emacs Cygwin setup in Vista help

by John A Pershing Jr-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

rpd wrote:
> Hi
>
> I guess this question has been asked before but I want to open cygwin bash
> shell in Emacs (Vista O/S).
>
>  
I'm probably missing something fundamental -- however, I have
C:\cygwin\bin in my (Windoze) PATH, right after the various C:\WINDOWS
directories, and I have the line:

    (setq explicit-shell-file-name "C:/cygwin/bin/bash.exe")

in my .emacs file, and it just works.  I also have a file
.emacs_bash.exe containing the single line:

    . .bash_profile

since the Emacs 'shell' command does not pass the --login option to the
shell.

  -jp




Re: Emacs Cygwin setup in Vista help

by rpd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lennart (& John P jr)

Thanks for your helpful replies.

I added the path to cygwin bin to Vista path & dl & added w32shell.el to my .emacs.
This somehow seems to have worked & I can now open cygwin shell & window shell (with either M-x cygwin-shell or m-x shell accordingly).

Perhaps the docs for this Cygwin on EmacsW32 could be a bit more expansive and clearer (but setting up Emacs on Windows isn't so straightforward). However many thanks Lennart for all your efforts to make it easier to integrate Emacs& Windows.

Btw I used gcc to compile c code in cygwin and I noticed emacs c menu compile gives 'make -k' command which I need to investigate! The joys of computing!

Thanks & regards

 

Lennart Borgman (gmail) wrote:
On Sat, Sep 12, 2009 at 7:23 PM, rpd
<richard@dickinson350.freeserve.co.uk> wrote:
>
> Hi
>
> I guess this question has been asked before but I want to open cygwin bash
> shell in Emacs (Vista O/S).
>
> I have Cygwin installed but cannot yet open it from Emacs. From my internet
> search I have added Cygwin-mount.el.
>
> This is what I have in my .emacs (v22.3):
> ;;;;===EMACS CYGWIN (GCC) & Vista======
> ;;;
> ;;To use shell/cmd prompt use M-x shell but
> ;;To use BASH (cygwin) shell use M-x cygwin-shell
> ;;xxxxx EMACS & CYGWIN==========
> ;;
> (load "C:\\Users\\Dad\\Emacs\\emacsaddons\\cygwin-mount.el")
> (setenv "PATH" (concat "c:\\cygwin\\bin;" (getenv "PATH")))
> (setq exec-path (cons "c:\\cygwin\\bin" exec-path))
> (require 'cygwin-mount)
> (cygwin-mount-activate)
> ;;http://xahlee.blogspot.com/2009/06/cygwin-tutorial-and-notes.html
> ;;Cygwin and EmacsW32
> ;;If you are using emacsW32, then you can go to the cygwin shell by calling
> the command cygwin-shell.
> ;;First, you need to set the cygwin-shell path. This you can do by pulling
> the menu
> ;; under “Options‣Customize emacsW32”. Or, you can put the following line in
> your .emacs:
> ;;“(setq w32shell-cygwin-bin "C:\\cygwin\\bin")”.
> ;;Once you have the w32shell-cygwin-bin set, the command “shell” will also
> invoke cygwin-shell.
> ;;If you want run plain Windows's “cmd.exe” shell, you can call cmd-shell.
> EmacsW32 also has msys-shell,
> ;; which is for those who are using MinGW.
> ;;Note, when using cygwin shell in emacsW32, if the $PATH env var is not set
> correctly, it can cause
> ;; Window to mistakingly popup a dialogue saying some program crashed.
> ;; For a example, see:
> http://xah-forum.blogspot.com/2009/06/cygwinimagemagickemacsw32-causes-vista.html.
> (setq exec-path (cons "C:\\cygwin\\bin" exec-path))
> (setq w32shell-cygwin-bin "C:\\cygwin\\bin")
> ;;
> ;;http://www.emacswiki.org/emacs/CygWin
> ;;
> ;===
>
> Using M-x shell -I get Windows command shell
> Using M-x cygwin-shell ret I get 'no match'
>
> I am most grateful if someone could advise on what I need to do to open
> cygwin shell.
> I look forward to helpful replies so I can do this, many thanks


cygwin-shell etc comes with Emacs+EmacsW32, see

  http://ourcomments.org/Emacs/EmacsW32.html


Re: Emacs Cygwin setup in Vista help

by Lennart Borgman (gmail) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 12, 2009 at 8:22 PM, John A Pershing Jr
<pershng@...> wrote:

> rpd wrote:
>>
>> Hi
>>
>> I guess this question has been asked before but I want to open cygwin bash
>> shell in Emacs (Vista O/S).
>>
>>
>
> I'm probably missing something fundamental -- however, I have C:\cygwin\bin
> in my (Windoze) PATH, right after the various C:\WINDOWS directories, and I
> have the line:
>
>   (setq explicit-shell-file-name "C:/cygwin/bin/bash.exe")
>
> in my .emacs file, and it just works.  I also have a file .emacs_bash.exe
> containing the single line:
>
>   . .bash_profile
>
> since the Emacs 'shell' command does not pass the --login option to the
> shell.


Yes, that it is more problematic if you want to change between different shells.