我想在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)
以上几行,但没有帮助。我该怎么办?
答案 0 :(得分: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)
答案 1 :(得分:0)
只需注释掉epy-python.el中所有与ropemacs相关的位就可以了。 ; - )