Emacs Interface to Pylint
Emacs Interface to Pylint
Created: Fang lungang 02-27-2007
Modified: Fang lungang 07/09/2007 14:53>
Get pylint.el
Pylint distribution package already contains an elisp file "pylint.el"
(at least, it's true for pylint-0.12.2). It is in "pylint/elisp".
Patch Pylint
There is a small bug in it: it uses "compile-internal" from "compile"
without require compile. Thus it may sometimes failed to run. You'd
patch it using following diff output (save it as pylint.patch then run
cmd "patch pylint.el pylint.patch"):
2a3
> (require 'compile)
Load Pylint in .emacs
Just copy pylint.el to wherever you like and load it in '.emacs' as
following:
;; I place all emacs lisp scripts including pylint.el in following
;; directory
(setq my-extension-path
(file-name-as-directory "c:/path/tolgfang/programs/emacs-lisp"))
;; for pylint
(load-file (concat my-extension-path "pylint.el"))
However, that doesn't work for me in Windows.The reason is that the el
file calls pylint.bat which is not in search path. It is in the
sub-directory "Scripts" of python installation path. eg. it's
"C:\Python25\Scripts" in my machine.
There are two solutions:
1. Add the path mentioned above to environment variable "Path".
2. Or modify "pylint.el" if you don't want to mess up the "Path".
;; change
(command (concat "pylint --output-format=parseable \"" file "\"")))
;; to
(command (concat
"c:/Python25/Scripts/pylint.bat --output-format=parseable \""
file "\"")))
Restart emacs. Then, you can call pylint within Emacs using M-x pylint
to check file associated with current buffer.