How to best integrate Emacs and Cygwin?

后端 未结 12 1116
予麋鹿
予麋鹿 2020-12-22 18:22

There are a ton of ways to integrate Cygwin with Emacs on Windows. EmacsWiki shows a few ideas. Here are the options that I\'ve found:

  1. Use the Emacs that com
12条回答
  •  攒了一身酷
    2020-12-22 18:43

    I installed cygwin on the root. It explicitly warns you against it, but I saw no ill effects. (I found that piece of advice from Steve Yegge).

    I also installed cygwin-mount, which helps a bunch. Also, I had to switch from ispell to aspell. Finally, a little bit of .emacs tweaking, and I was good to go:

    ;;;;;;;;;;;;;;;;;;;;;;
    ;;CygForTheWin
    ;;*cygwin
    (when (equal system-type 'windows-nt) 
    (message "Setting up Cygwin...")
    (let* ((cygwin-root "c:")
           (cygwin-bin (concat cygwin-root "/bin"))
           (gambit-bin "/usr/local/Gambit-C/4.0b22/bin/")
           (snow-bin "/usr/local/snow/current/bin")
           (mysql-bin "/wamp/bin/mysql/mysql5.0.51a/bin/"))
       (setenv "PATH" (concat cygwin-bin ";" ;
                              snow-bin ";" 
                              gambit-bin ";"
                              mysql-bin ";"
                              "c:/usr/local/jdk1.60_03/bin/"
                              ".;")  
               (getenv "PATH"))
       (setq exec-path (cons cygwin-bin exec-path)))
    
    (require 'cygwin-mount)
    (cygwin-mount-activate)
    
    (setq shell-file-name "bash")
    (setq explicit-shell-file-name "bash")
    
    (defun jonnay-cygwin-shell ()
      "Wrapper around cygwin-shell so that it doesn't throw an error"
      (interactive)
      (condition-case e
       (cygwin-shell)
       (message "There was an error trying to launch the shell: %s" e)))
    
    (message "Setting up Cygwin...Done")
    
    
    ;; found from the manual, check, use and make go?
     (defun my-shell-setup ()
       "For Cygwin bash under Emacs 20"
       (setq comint-scroll-show-maximum-output 'this)
       (setq comint-completion-addsuffix t)
       (setq comint-eol-on-send t)
       (setq w32-quote-process-args ?\")
       (make-variable-buffer-local 'comint-completion-addsuffix))
    
    (setq shell-mode-hook 'my-shell-setup)
    (add-hook 'emacs-startup-hook 'jonnay-cygwin-shell)
    )
    

提交回复
热议问题