Created
September 4, 2013 18:02
-
-
Save starstuck/6440501 to your computer and use it in GitHub Desktop.
Add compilation-error-regexp to make Emacs recognize jstestdriver and jslint output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Define various js test/linting compilation errrors matchers. You can say, | |
;; which you want to consider on matching output from compilation, by | |
;; customizing compilation-error-regexp-alist variable. | |
;; | |
;; (setq compilation-error-regexp-alist (list 'jstestdriver 'jslint-file 'jslint-line)) | |
;; | |
;; If you are using desktop.el, you may want to keep compilation customizations | |
;; in your project deskto file | |
;; | |
;; (add-to-list 'desktop-globals-to-save 'compilation-search-path) | |
;; (add-to-list 'desktop-globals-to-save 'compilation-error-regexp-alist) | |
;; | |
(require 'compile) | |
(dolist (item | |
'( | |
;; Match errors in JS Test Driver output like (Regexp based on java error matcher): | |
;; at http://localhost:4224/test/src/test/libs/bdd.js:373:16 | |
;; at assertable.is (http://localhost:4224/test/src/test/libs/bdd.js:143:28) | |
(jstestdriver | |
"^\\(?:[ ]+at \\|==[0-9]+== +\\(?:at\\|b\\(y\\)\\)\\).+(http://[[:alpha:][:digit:]:.]+/test/\\([^()\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\))$" 2 3 4 2) | |
;; Match errors in jslint output: | |
;;testfile.js | |
;; #1 Missing 'use strict' statement. | |
;; TestCase('model test', { // Line 3, Pos 4 | |
(jslint-file "^\\(.+.js\\)$" 1 nil nil 2) | |
(jslint-line "\\/\\/ Line \\([[:digit:]]+\\), Pos \\([[:digit:]]+\\)$" nil 1 2 0) | |
)) | |
(add-to-list 'compilation-error-regexp-alist-alist item)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment