PEP8 and pyflakes for emacs

flymake+pep8 for emacs
Emacs flymake-mode and python code styles PEP8 script enables you to
have realtime checking for python coding style.
In addition, you can check common errors with pyflakes.

Combine PEP8 and pylakes to one command.

/Users/k01/mypy/bin/mypychechers
#!/bin/bash
/Users/k01/mypy/bin/pyflakes "$1"
/Users/k01/mypy/bin/pep8 --repeat "$1"
true

.emacs

(add-hook 'python-mode-hook
          '(lambda ()
             (flymake-mode t)))
(load-library "flymake-cursor.el")
(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 "/Users/k01/mypy/bin/mypycheckers" (list local-file))))
  (add-to-list 'flymake-allowed-file-name-masks
               '("\\.py\\'" flymake-pylint-init)))
Posted: May 1st, 2010 | Author: | Filed under: 技術 | Tags: , , , , | No Comments »