Running emacs in cygwin
Need to have an X-server running and install the x-version of emacs, cygwin includes both (if you select the correct packages during installation).
The X-server is probably started with the command startx
once it's installed.
A non-X solution is emacs-w32 package under Editors in the cygwin setup. It runs emacs as a native Windows application but is still pure Cygwin. If you launch it directly from a shortcut, you'll maybe like these settings in ~/.emacs:
Add cygwin to path and exec path if cygwin isn't in your PATH by default:
(setenv "PATH" (concat "/bin:/usr/bin:/usr/local/bin:" (getenv "PATH"))) (nconc exec-path '("/bin" "/usr/bin" "/usr/local/bin"))
If you compile java or other things that generate filenames like C:\whatever, you may first like to edit /etc/fstab and add a mount from C:\ to /c such as:
C: /c ntfs binary,user 1 1
And then treat files beginning with C: as "magic filenames" that get translated to Cygwin style filenames with this in ~/.emacs. Here I'm simply doing two regex replacements on the first argument and ignoring the rest. Someone probably should create an .el for this, make it more robust and post it to http://www.emacswiki.org/emacs/ElispArea :
; When in cygwin, allow C:\whatever to turn into /c/whatever (defun cygwin-name-hook (operation &rest args) "Turn Windows filenames into Cygwin filenames." ;; Handle all operations the same (let ((first (car args)) (inhibit-file-name-handlers (cons 'cygwin-name-hook (and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers))) (inhibit-file-name-operation operation)) (setq first (replace-regexp-in-string "^C:" "/c" first t)) (setq first (replace-regexp-in-string "\\\\" "/" first t)) (apply operation (cons first (cdr args))))) (add-to-list 'file-name-handler-alist '("^[Cc]:" . cygwin-name-hook))
Then if you run emacs -nw inside mintty, you may like it to recognize more keys, place into ~/.emacs:
;***** For mintty (define-key function-key-map "\e[1;5m" [(control ?-)]) (define-key function-key-map "\e[1;5k" [(control ?=)]) (define-key function-key-map "\e[1;5q" [(control ?1)]) (define-key function-key-map "\e[1;5s" [(control ?3)]) (define-key function-key-map "\e[1;5t" [(control ?4)]) (define-key function-key-map "\e[1;5u" [(control ?5)]) (define-key function-key-map "\e[1;5w" [(control ?7)]) (define-key function-key-map "\e[1;5x" [(control ?8)]) (define-key function-key-map "\e[1;5y" [(control ?9)]) (define-key function-key-map "\e[1;5p" [(control ?0)])