-
Notifications
You must be signed in to change notification settings - Fork 479
Description
csslint works with emacs flymake mode if you strip the newlines from the output. Here's a sample configuration with the relevant matches:
(defun flymake-css-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))))
;; "ecsslint.sh" is a shell script, see below
(list "ecsslint.sh" (list temp-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.css$" flymake-css-init))
;; The regexp for matching errors in the lint output
(add-to-list 'flymake-err-line-patterns
'("^\\(\.+\.css\\): line \\([0-9]+\\), col \\([0-9]+\\), \\(.*\\)"
1 2 3 4))
ecsslint.sh just contains:
#!/bin/sh
csslint --format=compact $1 | grep .
(grep . will return any line that has some characters, removing the empty lines)
I don't know enough emacs lisp to come up with a clever way to do this without the shell script, but perhaps this will also affect other editors.
I did have a look at the code (only 0.5.0, I couldn't figure out how to run the code from HEAD, does it require some kind of build tool?). I can see that startFormat and endFormat are both "", and they are printed. This produces one newline before and after the output. I couldn't figure out why there is also an additional newline at the very end.
There is one other tiny problem when providing full paths as the filename argument, I'll open a different ticket for that.