help-emacs-windows
[Top][All Lists]

## Re: [h-e-w] Unix utilities for Emacs on MS Windows

 From: Lennart Borgman Subject: Re: [h-e-w] Unix utilities for Emacs on MS Windows Date: Wed, 23 Nov 2005 18:05:43 +0100 User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Hi Ismael,

It works lovely apart from a few unimportant glitches. Feel free to
suggest this snippet from my .emacs which suits perfectly my environment.

(when (file-directory-p "C:/cygwin/bin")

;; Make NT Emacs use Cygwin bash, copied verbatim from Cygwin FAQ
;; at http://www.cygwin.com/faq/

;; 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 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.
;;
'comint-strip-ctrl-m)

;; Make NT Emacs understand Cygwin paths
(when (locate-library "cygwin-mount")
(require 'cygwin-mount)
(cygwin-mount-activate)))
In w32shell.el (mentioned on the web page I sent) there is a little bit more generalized version of the above code that hopefully could suite most users without modifications. The idea of optionally loading cygwin-mount I will however steal from you, thanks ;-)

One thing that I at the moment have commented out is setting of process-coding-system-alist, because I do not understand when it is needed. I myself is using CVS Emacs (the developers version) and that might be the reason, but I do not know. Can you maybe explain why and when it is needed?

Also in .bashrc is useful to have something like this:

[ -e "`which gnuclientw`" ] && alias emacs='gnuclientw'

So when running emacs from a shell, an existing Emacs process is reused
instead of opening a new one. It's a lot faster, but requires Guy
Gascoigne's Gnuserv to be installed. Can be found here:

http://www.wyrdrune.com/index.html?gnuserv.html~main
Apart from that it is faster it also avoids trouble you can run into if you open the same file in multiple instances of an editor. With gnuclient/gnuserv you only open it once.

Gnuserv/gnuclient is included in EmacsW32 at my site. If you use the setup in EmacsW32 you do not need to start Emacs or gnuserv, that is done automatically when you try to edit a file.

Best wishes,
Lennart