Function: python-flymake
python-flymake is a byte-compiled function defined in python.el.gz.
Signature
(python-flymake REPORT-FN &rest ARGS)
Documentation
Flymake backend for Python.
This backend uses python-flymake-command (which see) to launch a process
that is passed the current buffer's content via stdin.
REPORT-FN is Flymake's callback function.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-flymake (report-fn &rest _args)
"Flymake backend for Python.
This backend uses `python-flymake-command' (which see) to launch a process
that is passed the current buffer's content via stdin.
REPORT-FN is Flymake's callback function."
(unless (executable-find (car python-flymake-command))
(error "Cannot find a suitable checker"))
(when (process-live-p python--flymake-proc)
(kill-process python--flymake-proc))
(let ((source (current-buffer)))
(save-restriction
(widen)
(setq python--flymake-proc
(make-process
:name "python-flymake"
:noquery t
:connection-type 'pipe
:buffer (generate-new-buffer " *python-flymake*")
:command python-flymake-command
:sentinel
(lambda (proc _event)
(when (eq 'exit (process-status proc))
(unwind-protect
(when (with-current-buffer source
(eq proc python--flymake-proc))
(python--flymake-parse-output source proc report-fn))
(kill-buffer (process-buffer proc)))))))
(process-send-region python--flymake-proc (point-min) (point-max))
(process-send-eof python--flymake-proc))))