all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* JSLint integration: Question
@ 2007-04-04 15:40 aundro
  2007-04-05  9:53 ` Kai Grossjohann
       [not found] ` <mailman.1783.1175767033.7795.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: aundro @ 2007-04-04 15:40 UTC (permalink / raw)
  To: help-gnu-emacs


Hello all,

[I've been searching on the internet and reading the lisp reference
for quite some time now, but there was no real luck..]

First of all, the context: I have been using emacs for quite some
time, without customizing it that much, really.

Now, the problem:
 * I've been coding quite a fair amount of JavaScript for work, lately
 * There's no 'syntactic checking' in emacs, for the JavaScript
language/mode at least
 * I thought I'd integrate the JSLint (http://www.jslint.com/
lint.html) verifier into emacs. To do that, I have added a "write-
contents-hooks" that calls an external program that calls jslint with
the contents of the buffer.
 * The results of JSLint are "collected" by myself, and output to
stdout. That means I have the control on what's output.
 * That output is then collected by emacs, and displayed in a buffer
called *jslint output*

All that works very nicely. The reference and tutorials on the web
have been a great help.

However, I'd like to go a little bit further, and make those lines
that appear in the *jslint output* clickable (pretty much like the
grep output in the *grep* buffer)

That's where I'm stuck; I couldn't find how to 'parse' such lines and
make them "activable" (i.e., clickable, or even <enter>-able).

Could you give me pointers on how to implement that?

Best regards,

          Arnaud.

PS: Here's the code that runs the "jslint" verifier. If anyone wants
to comment it, he's of course welcome, since this is my very first bit
of "real" emacs configuring:

PPS: The 'wraplint.js' file basically builds a string from stdin
(thus, those characters provided by emacs; the contents of the
buffer), passes that string to JSLint, and outputs the errors.

PPPS: Here's a typical error message, the way I format them:
"Error (6,9): Assignment in control part.; while (l = rdr.performSthg
()) {"


------------------------

(add-hook 'javascript-mode-hook 'add-jslint-check)


(defun add-jslint-check ()
  (add-hook 'write-contents-hooks 'jslint-check))


;; JavaScript JSLint hook
(defun jslint-check ()
  (interactive)
  (do-exec-jslint)
  ;; nil from a function in `write-contents-hooks' means
  ;; to continue and write the file as normal
  nil)

(global-set-key "\C-c\C-l" 'jslint-check)


(defun do-exec-jslint ()
  (interactive)
  (shell-command-on-region
   (point-min)
   (point-max)
   "/opt/LINKS/bin/java -jar ~/src/jslint/rhino-1.6R5.jar -f ~/src/
jslint/jslint.js  -f ~/src/jslint/wraplint.js"
   "*jslint output*")
  (display-buffer "*jslint output*" t))

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-05 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-04 15:40 JSLint integration: Question aundro
2007-04-05  9:53 ` Kai Grossjohann
     [not found] ` <mailman.1783.1175767033.7795.help-gnu-emacs@gnu.org>
2007-04-05 12:18   ` Arnaud Diederen (aundro)

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.