On Dec 26, 2008, at 8:39 PM, kub wrote:
I asked for help because vim error format settings are somewhat
tricky and my hope was that somebody already has this done.
Parsing error messages and compiler output is tricky and no one
likes to do it. So, please accept the following solution from
within Ikarus itself (revision 1729). The following program
takes an R6RS script as input and tries to compile it (without
running it or serializing any of the libraries it depends on),
and if there is an error with a source position, it runs vim on
the offending file and positions the cursor accordingly. It's
probably easy to modify for emacs, but emacs is probably too
heavy to fire up for every error message. You can also modify
it so that it attempts to recompile the script after you exit
vim (successfully).
Script follows. Let me know if you have any suggestions.
Aziz,,,
$ cat ikarus-quickfix
#!/usr/bin/env scheme-script
(import (ikarus))
(define (compile script-name)
(call/cc
(lambda (break)
(with-exception-handler
(lambda (con)
(print-condition con (current-output-port))
(when (source-position-condition? con)
(system
(format "vim ~s -c \"goto ~a\""
(source-position-file-name con)
(source-position-character con))))
(break))
(lambda ()
(load-r6rs-script script-name #f #f))))))
(apply
(case-lambda
[(script script-name) (compile script-name)]
[(script . args) (error #f "usage: ~a <script-name>" script)])
(command-line))