Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial check-in

  • Loading branch information...
commit d631942e98160318aff8cb65d661d31d6f10743a 0 parents
@purcell authored
Showing with 36 additions and 0 deletions.
  1. +36 −0 flymake-coffee.el
36 flymake-coffee.el
@@ -0,0 +1,36 @@
+;; Flymake support for coffee script
+;;
+;; Author: Steve Purcell <steve at sanityinc dot com>
+;;
+;; Homepage: https://github.com/purcell/flymake-coffee
+;;
+;; Based in part on http://d.hatena.ne.jp/antipop/20110508/1304838383
+;;
+;; Usage: (add-hook 'coffee-mode-hook '(lambda () (flymake-coffee-load)))
+
+(defconst flymake-allowed-coffee-file-name-masks '(("\\.coffee$" flymake-coffee-init)))
+
+(defvar flymake-coffee-err-line-patterns
+ '(("\\(Error: In \\([^,]+\\), .+ on line \\([0-9]+\\).*\\)" 2 3 nil 1)))
+
+(defun flymake-coffee-create-temp-in-system-tempdir (filename prefix)
+ (make-temp-file (or prefix "flymake-coffee")))
+
+(defun flymake-coffee-init ()
+ (list "coffee" (list (flymake-init-create-temp-buffer-copy
+ 'flymake-coffee-create-temp-in-system-tempdir))))
+
+(defun flymake-coffee-load ()
+ (interactive)
+ (require 'flymake)
+ (defadvice flymake-post-syntax-check (before flymake-force-check-was-interrupted)
+ (setq flymake-check-was-interrupted t))
+ (ad-activate 'flymake-post-syntax-check)
+ (setq flymake-allowed-file-name-masks (append flymake-allowed-file-name-masks flymake-allowed-coffee-file-name-masks))
+ (setq flymake-err-line-patterns flymake-coffee-err-line-patterns)
+ (if (executable-find "coffee")
+ (flymake-mode t)
+ (message "Not enabling flymake: coffee command not found")))
+
+
+(provide 'flymake-coffee)
Please sign in to comment.
Something went wrong with that request. Please try again.