cd ~/elisp wget http://cvs.savannah.gnu.org/viewvc/*checkout*/emacs/emacs/lisp/progmodes/flymake.el?revision=1.2.4.41 mv flymake.el\?revision\=1.2.4.41 flymake.el easy_install pyflakes add the following to .emacs: (when (load "flymake" t) (defun flymake-pyflakes-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 "pyflakes" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pyflakes-init))) (add-hook 'find-file-hook 'flymake-find-file-hook)
Thursday, April 7, 2011
flymake & pyflakes
I am writing Python using flymake in Emacs with
pyflakes as described in chrism's blog entry on Flymake Mode for Emacs / Python.
Subscribe to:
Post Comments (Atom)
1 comment:
This has really helped my Python coding. Not only does it catch syntax errors, but it also alerts me to unused imports and variables, so my code is cleaner and my programs are more efficient.
One note, though. The add-hook wound up causing error messages when opening other file types (like .tex), so I replaced it with this:
(add-hook 'python-mode-hook
(lambda ()
; Don't invoke flymake on temporary buffers for the interpreter
(unless (eq buffer-file-name nil) (flymake-mode 1))
(local-set-key [f2] 'flymake-goto-prev-error)
(local-set-key [f3] 'flymake-goto-next-error)))
Post a Comment