This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/init-extension/init-flymake.el

42 lines
1.3 KiB
EmacsLisp
Raw Normal View History

2012-12-27 20:50:48 +00:00
(defun flymake-create-copy-file ()
"Create a copy local file"
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace)))
(file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(defun flymake-command-parse (cmdline)
"Parses the command line CMDLINE in a format compatible
with flymake, as:(list cmd-name arg-list)
The CMDLINE should be something like:
flymake %f python custom.py %f
%f will be substituted with a temporary copy of the file that is
currently being checked.
"
(let ((cmdline-subst (replace-regexp-in-string "%f" (flymake-create-copy-file) cmdline)))
(setq cmdline-subst (split-string-and-unquote cmdline-subst))
(list (first cmdline-subst) (rest cmdline-subst))
))
(when (load-file (concat user-extensions-directory "flymake/flymake-patch.el"))
2012-12-27 20:50:48 +00:00
(setq flymake-info-line-regex
(append flymake-info-line-regex '("unused$" "^redefinition" "used$")))
(load-library "flymake-cursor"))
(defun epy-setup-checker (cmdline)
(add-to-list 'flymake-allowed-file-name-masks
(list "\\.py\\'" (apply-partially 'flymake-command-parse cmdline)))
)
(epy-setup-checker "pyflakes %f")
(eval-after-load 'python
'(progn
(add-hook 'python-mode-hook (lambda () (if (buffer-file-name)
(flymake-mode))))
)
)