Skip to content
Newer
Older
100644 47 lines (39 sloc) 1.4 KB
6524d2e @purcell Note scss support in header line
authored Dec 18, 2012
1 ;;; flymake-sass.el --- Flymake handler for sass and scss files
a7fef5c @purcell Initial check-in
authored Oct 14, 2011
2 ;;
3 ;;; Author: Steve Purcell <steve@sanityinc.com>
4 ;;; URL: https://github.com/purcell/flymake-sass
5 ;;; Version: DEV
8643055 @purcell Update to use flymake-easy
authored Nov 4, 2012
6 ;;; Package-Requires: ((flymake-easy "0.1"))
a7fef5c @purcell Initial check-in
authored Oct 14, 2011
7 ;;
8 ;;; Commentary:
9 ;;
10 ;; Usage:
11 ;; (require 'flymake-sass)
12 ;; (add-hook 'sass-mode-hook 'flymake-sass-load)
1c76648 @purcell Support scss-mode too
authored Dec 17, 2012
13 ;; (add-hook 'scss-mode-hook 'flymake-sass-load)
8643055 @purcell Update to use flymake-easy
authored Nov 4, 2012
14 ;;
15 ;; Uses flymake-easy, from https://github.com/purcell/flymake-easy
a7fef5c @purcell Initial check-in
authored Oct 14, 2011
16
2024244 @purcell Checkdoc compliance
authored Oct 23, 2011
17 ;;; Code:
500c63d @purcell Handle multiline error output, as produced by recent sass versions
authored Oct 16, 2011
18
8643055 @purcell Update to use flymake-easy
authored Nov 4, 2012
19 (require 'flymake-easy)
20
500c63d @purcell Handle multiline error output, as produced by recent sass versions
authored Oct 16, 2011
21 (defconst flymake-sass-err-line-patterns
22 '(("^Syntax error on line \\([0-9]+\\): \\(.*\\)$" nil 1 nil 2)
23 ("^WARNING on line \\([0-9]+\\) of .*?:\r?\n\\(.*\\)$" nil 1 nil 2)
24 ("^Syntax error: \\(.*\\)\r?\n on line \\([0-9]+\\) of .*?$" nil 2 nil 1) ;; Older sass versions
25 ))
a7fef5c @purcell Initial check-in
authored Oct 14, 2011
26
27 ;; Invoke utilities with '-c' to get syntax checking
8643055 @purcell Update to use flymake-easy
authored Nov 4, 2012
28 (defun flymake-sass-command (filename)
2024244 @purcell Checkdoc compliance
authored Oct 23, 2011
29 "Construct a command that flymake can use to check sass source."
1c76648 @purcell Support scss-mode too
authored Dec 17, 2012
30 (append '("sass" "-c")
31 (when (eq 'scss-mode major-mode)
7de9381 @purcell Use scss-sass-options when running scss
authored Mar 8, 2014
32 (cons "--scss" scss-sass-options))
1c76648 @purcell Support scss-mode too
authored Dec 17, 2012
33 (list filename)))
500c63d @purcell Handle multiline error output, as produced by recent sass versions
authored Oct 16, 2011
34
a7fef5c @purcell Initial check-in
authored Oct 14, 2011
35 ;;;###autoload
36 (defun flymake-sass-load ()
8643055 @purcell Update to use flymake-easy
authored Nov 4, 2012
37 "Configure flymake mode to check the current buffer's sass syntax."
a7fef5c @purcell Initial check-in
authored Oct 14, 2011
38 (interactive)
8643055 @purcell Update to use flymake-easy
authored Nov 4, 2012
39 (flymake-easy-load 'flymake-sass-command
40 flymake-sass-err-line-patterns
41 'tempdir
42 "rb"))
e99dfd3 @purcell Make it look like flymake got interrupted, thus avoiding an exception.
authored Mar 19, 2012
43
44
a7fef5c @purcell Initial check-in
authored Oct 14, 2011
45 (provide 'flymake-sass)
46 ;;; flymake-sass.el ends here
Something went wrong with that request. Please try again.