[racket] flymake for Emacs

From: Eli Barzilay (eli at barzilay.org)
Date: Mon May 21 09:51:36 EDT 2012

There was a question on SO on flymake -- an Emacs thing that runs your
file through a "syntax checker" and highlights errors.  The syntax
checker usually means compile the file, which in racket's case is
simple: I got it working using "racket -qf <file>" which will show
syntax errors without actually running the code.  The only caveat is
that this true only for module files.  It could easily be improved by
some naive check that there's a "#lang" in the file.

If anyone wants to play with it, here's how to use it:

1. Load flymake as usual (get from the website and add as an
   autoloaded function or just load directly).

2. Add this code somewhere:

     (defun flymake-racket-init ()
       (let* ((temp-file (flymake-init-create-temp-buffer-copy
                          'flymake-create-temp-inplace))
              (local-file (file-relative-name
                           temp-file
                           (file-name-directory buffer-file-name))))
         (list "racket" (list "-qf" local-file))))
     (push '("\\.rkt\\'" flymake-racket-init)
           flymake-allowed-file-name-masks)

3. Open some "*.rkt" file.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.