[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Emacs flymake syntax checking for XQL

Klotz, Leigh Leigh.Klotz at xerox.com
Mon Feb 22 16:44:28 PST 2010


  Emacs flymake syntax checking for XQL
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.