Flymake and XML on Debian

March 21, 2009

Flymake is an emacs minor mode that runs a syntax check tool over source files as you write them, on the fly. Essentially it calls the compiler for the relevant language and then parses the warnings.

Because this is so obviously useful, I have it turned on by default in .emacs:

; Highlight syntax errors
(require 'flymake)
(add-hook 'find-file-hook 'flymake-find-file-hook)

Recall also that I use emacs to view page source in Epiphany. Unfortunately, this produced a nasty dialog box warning about not being able to find an 'xml' command.

The solution comes in two parts:

  • Install the 'xmlstarlet' package.
  • If you are using the emacs-snapshot package rather than emacs22, the fix to Bug #447378 is not yet applied. (I've mailed the maintainer.) Until then, it is simple to redefine flymake-xml-init in .emacs:
    ;;;; xml-specific init-cleanup routines
    (defun flymake-xml-init ()
      (list "xmlstarlet" (list "val" (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))))
    

I suppose both emacs packages should really Suggest xmlstarlet - I wonder how many other external programs might fall into that category.

Nifty tech tag lists fromĀ Wouter Beeftink