Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (55 sloc) 2.26 KB
;;; flymake-python-pyflakes.el --- A flymake handler for python-mode files using pyflakes (or flake8)
;; Copyright (C) 2012 Steve Purcell
;; Author: Steve Purcell <>
;; URL:
;; Version: DEV
;; Package-Requires: ((flymake-easy "0.4"))
;;; Commentary:
;; Usage:
;; (require 'flymake-python-pyflakes)
;; (add-hook 'python-mode-hook 'flymake-python-pyflakes-load)
;; To use "flake8" instead of "pyflakes", add this line:
;; (setq flymake-python-pyflakes-executable "flake8")
;; You can pass extra arguments to the checker program by customizing
;; the variable `flymake-python-pyflakes-extra-arguments', or setting it
;; directly, e.g.
;; (setq flymake-python-pyflakes-extra-arguments '("--ignore=W806"))
;; Uses flymake-easy, from
;;; Code:
(require 'flymake-easy)
;; TODO: handle any file name
(defconst flymake-python-pyflakes-err-line-patterns
'(("^\\(.*?\\.pyw?\\):\\([0-9]+\\): \\(.*\\)$" 1 2 nil 3)
;; flake8
("^\\(.*?\\.pyw?\\):\\([0-9]+\\):\\([0-9]+\\): \\(.*\\)$" 1 2 3 4)))
(defgroup flymake-python-pyflakes nil
"Flymake support for Python via pyflakes or flake8"
:group 'flymake
:prefix "flymake-python-pyflakes-")
(defcustom flymake-python-pyflakes-executable "pyflakes"
"Pyflakes executable to use for syntax checking."
:type 'string
:group 'flymake-python-pyflakes)
(defcustom flymake-python-pyflakes-extra-arguments nil
"Pyflakes executable to use for syntax checking."
:type '(repeat string)
:group 'flymake-python-pyflakes)
(defun flymake-python-pyflakes-command (filename)
"Construct a command that flymake can use to syntax-check FILENAME."
(append (list flymake-python-pyflakes-executable)
(list filename)))
(defun flymake-python-pyflakes-load ()
"Configure flymake mode to check the current buffer's python syntax using pyflakes."
(flymake-easy-load 'flymake-python-pyflakes-command
(provide 'flymake-python-pyflakes)
;;; flymake-python-pyflakes.el ends here
Jump to Line
Something went wrong with that request. Please try again.