在更新到Yosemite之前,emacs中的Flymake可以正常工作。但现在它在抱怨:
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>是当前活动的虚拟环境。
如果从外壳运行,pychecker将正常工作。
我在shell中通过输入emacsgui (alias emacsgui='open -a emacs')启动emacs,通常是在venv被激活的情况下。我也尝试在没有任何venv激活的情况下打开emacs,但问题仍然存在。有什么问题吗?
发布于 2014-10-27 00:11:42
我通过将以下内容添加到我的.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))https://stackoverflow.com/questions/26574885
复制相似问题