How can I use Emacs Flymake mode for python with pyflakes and pylint checking code?

后端 未结 4 1557
闹比i
闹比i 2020-12-12 17:53

For checking code in python mode I use flymake with pyflakes

Also I want check code style (pep8) with pylint (description on the same page with pyflakes)

Thi

4条回答
  •  情话喂你
    2020-12-12 18:40

    Usually one can enable flymake mode in the python-mode-hook. Unfortunately that causes issues with things like py-execute-buffer which create temporary buffers which invoke the hook and then cause flymake mode to hiccup because of the lack of "real file". The solution is to modify the conditions where you add the hook:- e.g mine is:

    (add-hook 'python-mode-hook 
          (lambda () 
            (unless (eq buffer-file-name nil) (flymake-mode 1)) ;dont invoke flymake on temporary buffers for the interpreter
            (local-set-key [f2] 'flymake-goto-prev-error)
            (local-set-key [f3] 'flymake-goto-next-error)
            ))
    

提交回复
热议问题