Emacs code validation
I am having a hard time finding code validation solutions for emacs, something/s to check that my javascript / css / ruby etc is valid code, where is all th开发者_如何学Pythonis stuff at?
I assume that you're referring to basic syntactic correctness, in which case you should look at flymake, which is included with Emacs, and which runs a validation program in the background, parses its output, and marks up the buffer with errors and warnings.
And, to get you started, here is a small module for using flymake with Ruby, and a similar one for flymake with javascript using jslint as the validation program.
that's why you test ruby mate. Even js has test suites now too.
As for the css, you can always use things like autopair, or textmate.el to ensure you close your hashes, and maybe even add the semi-colon to your css as well (I should see if that exists actually, thanks).
for js - there is an emacs wiki page but it seems to be quite out of date: http://emacswiki.org/emacs/FlymakeJavaScript
Here's what I did instead. First I installed jslint
on node.js
sudo apt-get install nodejs npm
npm install jslint
ln -s ~/.npm/jslint/0.1.8/package/bin/jslint.js ~/.local/bin/
For emacs integration I then tried installing the package flymake-jslint
in emacs (I'm using emacs24 with included package manager) and pointing it at jslint
but it just wouldn't work.
I then followed the instructions here http://www.thoughtspark.org/node/59 - I created a bash wrapper script for jslint.js
and pointed the .el snippet at it and it works fine.
精彩评论