2014-10-26 42 views
1

emacs中的Flymake正在正常工作,直到更新到Yosemite。但現在它的抱怨:Mac上的Emacs flymake Yosemite

Flymake: Failed to launch syntax check process 'pychecker' with args (<filename>_flymake.py): Searching for program: no such file or directory, pychecker. Flymake will be switched OFF. 

其中<filename>處於打開緩衝區中的文件的名稱。 這裏是我的flymake配置:

(add-to-list 'load-path "~/.emacs.d/") 
;; Setup for Flymake code checking. 
(require 'flymake) 
(load-library "flymake-cursor") 

;; Script that flymake uses to check code. This script must be 
;; present in the system path. 
(setq pycodechecker "pychecker") 

(when (load "flymake" t) 
    (defun flymake-pycodecheck-init() 
    (let* ((temp-file (flymake-init-create-temp-buffer-copy 
         'flymake-create-temp-inplace)) 
      (local-file (file-relative-name 
         temp-file 
         (file-name-directory buffer-file-name)))) 
     (list pycodechecker (list local-file)))) 
    (add-to-list 'flymake-allowed-file-name-masks 
       '("\\.py\\'" flymake-pycodecheck-init))) 

(add-hook 'python-mode-hook 'flymake-mode) 

這裏的/usr/local/bin/pychecker

#! /bin/sh 

pyflakes "$1" 
pep8 --repeat "$1" --max-line-length=80 --ignore=E123,E133,E226,E501 
true 

這裏的$PATH

/Users/<user>/Envs/<venv>/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin 

其中<user>我的用戶名和<venv>是在當前虛擬-ENV。

pychecker如果從shell運行正常工作。

我通過輸入emacsguialias emacsgui='open -a emacs')從外殼啓動emacs,通常啓動venv。我也嘗試打開emacs沒有任何Venv激活,但問題仍然存在。問題是什麼?

回答

1

我解決了通過添加這對我.emacs文件:

(defun set-exec-path-from-shell-PATH() 
    (let ((path-from-shell (replace-regexp-in-string 
          "[ \t\n]*$" 
          "" 
          (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'")))) 
    (setenv "PATH" path-from-shell) 
    (setq exec-path (split-string path-from-shell path-separator)))) 

(when (and window-system (eq system-type 'darwin)) 
    ;; When started from Emacs.app or similar, ensure $PATH 
    ;; is the same the user would see in Terminal.app 
    (set-exec-path-from-shell-PATH)) 
+0

怎麼樣'M-X包安裝RET EXEC路徑 - 從殼RET'? – aculich 2014-10-27 11:30:51