Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have question regarding when running emacs with cygwin. I have installed emacs which comes with cygwin. How can I get cygwin to run emacs in its own window instead from the cygwin's console window.

I like how it is in ubuntu when I run emacs from the terminal it will open emacs's GUI.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer

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)])
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                  <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2015 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2015.4.24.2525\r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Super User works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\r\n    </noscrip"], "copyright__copyright__copyright": ["4)])\n(define-key function-key-map \"\\e[1;5u\" [(control ?5)])\n(define-key function-key-map \"\\e[1;5w\" [(control ?7)])\n(define-key function-key-map \"\\e[1;5x\" [(control ?8)])\n(define-key function-key-map \"\\e[1;5y\" [(control ?9)])\n(define-key function-key-map \"\\e[1;5p\" [(control ?0)])\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}