我想在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)添加到上面的代码行中,但这并没有帮助。我该怎么做呢?
发布于 2013-05-30 22:27:56
嗯,我找到了以下解决方案,不使用emacs-for-python,而是在加载Python文件时使用‘find-file-hook’激活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-06-04 12:03:21
只需注释掉epy-python.el中所有与ropemacs相关的部分就可以了。;-)
https://stackoverflow.com/questions/16821731
复制相似问题