Skip to content

Instantly share code, notes, and snippets.

@gonz
Created August 5, 2013 15:31
Show Gist options
  • Save gonz/6156840 to your computer and use it in GitHub Desktop.
Save gonz/6156840 to your computer and use it in GitHub Desktop.
python/js flymake syntax check
(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