1

我想在 emacs 中获得 pep8 格式,所以我添加到我的 .emacs 文件中:

(when (load "flymake" t)
 (defun flymake-pylint-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 "pep8" (list "--repeat" local-file))))
 (add-to-list 'flymake-allowed-file-name-masks
              '("\\.py\\'" flymake-pylint-init)))

(if (file-exists-p "~/ml/.emacs.d/emacs-for-python/epy-init.el")
    (load "emacs-for-python/epy-init"))

现在的问题是,ropemacs 做了很多东西,让我无法打字。我想禁用它,以便我可以得到 pep8 格式。我怎样才能做到这一点。我试图添加

(ropemacs-mode nil)

到上述几行,但它没有帮助。我该怎么做?

4

2 回答 2

0

好吧,我找到了以下解决方案,不使用 emacs-for-python 并使用“find-file-hook”在加载 Python 文件时激活 flymake:

(when (load "flymake" t)
 (defun flymake-pylint-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 "pep8" (list "--repeat" local-file))))
 (add-to-list 'flymake-allowed-file-name-masks
              '(".py$" flymake-pylint-init)))

(add-hook 'find-file-hook 'flymake-find-file-hook)
于 2013-05-30T14:27:55.533 回答
0

只需从 epy-python.el 中注释掉所有与ropemacs 相关的位就可以了。;-)

于 2013-06-04T04:03:21.103 回答