Skip to content

Instantly share code, notes, and snippets.

@sabof
Last active December 21, 2015 15:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sabof/6329267 to your computer and use it in GitHub Desktop.
Save sabof/6329267 to your computer and use it in GitHub Desktop.
Customizing flymake output
(defadvice flymake-post-syntax-check (before coffee-no-spaces activate)
"Warn about space indentation when in coffee-mode."
(when (eq major-mode 'coffee-mode)
(let (bad-spaces)
(save-excursion
(goto-char (point-min))
(while (re-search-forward
"^[[:blank:]]*\\(?1: \\)[[:blank:]]*[^[:blank:]\n]"
nil t)
(let (( ppss (syntax-ppss (match-beginning 1))))
(unless (or (nth 4 ppss) (nth 3 ppss))
(push (match-beginning 1) bad-spaces)))))
(mapc (lambda (space)
(let* (( linum (line-number-at-pos space))
( ler (flymake-ler-make-ler
buffer-file-name
linum
"w"
"Line contains space indentation.")))
(if (assoc linum flymake-new-err-info)
(push ler (cadr (assoc linum flymake-new-err-info)))
(push (list linum (list ler)) flymake-new-err-info))))
bad-spaces)
(setq flymake-new-err-info
(sort flymake-new-err-info
(lambda (a b) (< (car a) (car b)))))
)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment