/
jslint-epe.el
28 lines (24 loc) · 1.08 KB
/
jslint-epe.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; from https://gist.github.com/769416
;; TODO
;; - "C-x `" binding is shadowed by js2-next-error
;;; C-x c calls jslint and outputs to the *compilation* buffer.
(setq jslint-wrapper "java -jar ~/3rdparty/jslint4java/jslint4java-1.4.6.jar --maxlen 160")
(require 'compile)
(add-hook 'js2-mode-hook
(lambda ()
(set (make-local-variable 'compilation-read-command) nil)
(set (make-local-variable 'compile-command)
(concat jslint-wrapper " " buffer-file-name))
(local-set-key (kbd "C-x c") 'compile)))
(defun notify-compilation-result(buffer msg)
"Notify that the compilation is finished,
close the *compilation* buffer if the compilation is successful,
and set the focus back to Emacs frame"
(if (string-match "^finished" msg)
(progn
(delete-windows-on buffer)
(tooltip-show "\n Compilation Successful :-) \n "))
(tooltip-show "\n Compilation Failed :-( \n "))
(setq current-frame (car (car (cdr (current-frame-configuration)))))
(select-frame-set-input-focus current-frame))
(add-to-list 'compilation-finish-functions 'notify-compilation-result)