all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: aundro@gmail.com
To: help-gnu-emacs@gnu.org
Subject: JSLint integration: Question
Date: 4 Apr 2007 08:40:18 -0700	[thread overview]
Message-ID: <1175701218.073536.281300@q75g2000hsh.googlegroups.com> (raw)


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))

             reply	other threads:[~2007-04-04 15:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 15:40 aundro [this message]
2007-04-05  9:53 ` JSLint integration: Question Kai Grossjohann
     [not found] ` <mailman.1783.1175767033.7795.help-gnu-emacs@gnu.org>
2007-04-05 12:18   ` Arnaud Diederen (aundro)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1175701218.073536.281300@q75g2000hsh.googlegroups.com \
    --to=aundro@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.