Created
August 5, 2013 15:31
-
-
Save gonz/6156840 to your computer and use it in GitHub Desktop.
python/js flymake syntax check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(when (load "flymake" t) | |
;; python syntax check | |
(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))) | |
(pycheck-bin (concat my-emacs-bin-directory | |
"pycheckers"))) | |
(list pycheck-bin (list local-file)))) | |
(add-to-list 'flymake-allowed-file-name-masks | |
'("\\.py\\'" flymake-pyflakes-init)) | |
;; javascript jslint | |
(defun flymake-jslint-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 "jschecker" (list local-file)))) | |
(setq flymake-err-line-patterns | |
(cons '("^\\(.*\\)(\\([[:digit:]]+\\)):\\(.*\\)$" | |
1 2 nil 3) | |
flymake-err-line-patterns)) | |
(add-to-list 'flymake-allowed-file-name-masks | |
'("\\.js\\'" flymake-jslint-init)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment