Permalink
Browse files

Make jsl the default checker if the executable is found at load-time

  • Loading branch information...
1 parent d886fbb commit 82e86d7d95bf809210ea1f9fe431b2e3235940a3 @purcell committed Jan 7, 2013
Showing with 16 additions and 8 deletions.
  1. +7 −2 README.md
  2. +9 −6 flymake-jslint.el
View
@@ -2,7 +2,7 @@ flymake-jslint.el
=================
An Emacs flymake handler for syntax-checking Javascript source code
-using [`jslint`](http://jslint.com/).
+using [`jslint`](http://jslint.com/) or [`jsl`](http://javascriptlint.com/).
Installation
=============
@@ -18,9 +18,14 @@ Usage
Add the following to your emacs init file:
- (require 'flymake-jslint)
+ (require 'flymake-jslint) ;; Not necessary if using ELPA package
(add-hook 'js-mode-hook 'flymake-jslint-load)
+The default checker is `jsl`, if that executable is
+found at load-time. Otherwise, `jslint` is the default. If you want
+to use the non-default checker, you can customize the values of
+`flymake-jslint-command` and `flymake-jslint-args` accordingly.
+
[marmalade]: http://marmalade-repo.org
[melpa]: http://melpa.milkbox.net
View
@@ -12,8 +12,9 @@
;; http://d.hatena.ne.jp/kazu-yamamoto/mobile?date=20071029
;;
;; Works with either "jslint" from jslint.com, or "jsl" from
-;; javascriptlint.com. The default is "jslint", but if you want to use
-;; "jsl" instead, you can customize the values of
+;; javascriptlint.com. The default is "jsl", if that executable is
+;; found at load-time. Otherwise, "jslint" is the default. If you want
+;; to use the non-default checker, you can customize the values of
;; `flymake-jslint-command' and `flymake-jslint-args' accordingly.
;;
;; Usage:
@@ -37,15 +38,17 @@
:type 'boolean :group :flymake-jslint)
;;;###autoload
-(defcustom flymake-jslint-command "jslint"
+(defcustom flymake-jslint-command
+ (if (executable-find "jsl") "jsl" "jslint")
"Name (and optionally full path) of jslint executable."
:type 'string :group 'flymake-jslint)
;;;###autoload
(defcustom flymake-jslint-args
- (mapcar
- 'symbol-name
- '(--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars --eqeq))
+ (unless (string-equal "jsl" flymake-jslint-command)
+ (mapcar
+ 'symbol-name
+ '(--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars --eqeq)))
"Command-line args for jslint executable."
:type '(repeat string) :group 'flymake-jslint)

0 comments on commit 82e86d7

Please sign in to comment.