Emacs flymake syntax checking for XQLKlotz, Leigh Leigh.Klotz at xerox.com
Mon Feb 22 16:44:28 PST 2010
I've whipped up an Emacs flymake integration for XQL. It gives on-the-fly syntax checking with highlighted errors and mouseover explanations of error messages. It works well with Suraj Acharya's xquery-mode for Emacs. There are two parts: - a small Java command-line program which invokes the Saxon9 XQuery compiler and prints out errors and warnings - a few lines of Emacs Lisp to glue it in to flymake The command-line program uses Saxon9, but it could probably also be made to work with xqsharp with --static --explain as well. It would be nice if vendors (Saxon, XQSharp?) would take the code as an example and write their own command-line options for easy syntax checking. (For an example of this approach, see the "-emacs" flag in Ant, which formats one-per-line error messages easily parsed by Emacs users.) Save this as XQLSyntaxCheck.java in a directory you will use permanently: http://pastie.org/837838 Save this as xquery-flymake.el in your emacs directory. http://pastie.org/837869 Save the Emacs XQuery mode by Suraj Acharya file to your emacs directory. http://www.emacswiki.org/cgi-bin/wiki/xquery-mode.el To use, 1. Save the files as described above 2. Compile XQLSyntaxCheck.java. 3. Edit the xquery-flymake.el file to point to your Saxon9 installation and your XQLSyntaxCheck directory. 4. Compile xquery-flymake.el and xquery-mode.el (See note, below.) 5. Put these lines in your .emacs file: (require 'xquery-mode) (require 'flymake-xquery) Note: I found that in order to get xquery-mode automatically set for .xql files I needed to edit xquery-mode.el line 62 and change apostrope to "l". Otherwise, these features didn't take effect until I explicitly typed m-x xquery-mode. Leigh.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format