Illusory stillness

mumble mumble techblog

Racket and Flycheck-mode

From earlier, I had the following complaints about flycheck:

As I edit code I’m getting this annoyingly big message in the minibuffer:

“` Checker racket returned non-zero exit code 1, but no errors from output: r5rs:body: no expression in body in: (r5rs:body (define (new-record data) attach-tag data) (define (get-record name) (new-record data)) (define (get-salary record) (quote salary))) context…: /Applications/Racket v6.1/share/pkgs/r5rs-lib/r5rs/main.rkt:335:2

Checker definition probably flawed. “`

In other words, one kind of syntax error (no expression on body) is not getting interpreted as an “error”.

To fix this, I need to fix the error patterns that Racket checker uses, to make it catch a certain error as an error.

Now, what is some example output from the racket compiler? I ran M-! racket -f chap3.1.rkt and went to the *Shell Command Output* buffer.

I will play with regexp-builder on that, but how do I add error patterns to the existing thing?

Additionally, I find that the error highlighting is one character off. Racket reporting zero-based colukmn numbers or something. Also the entire following sexp should be underlined (as opposed to underlining a single paren.)

more advanced syntax checking?

Well, Racket actually has a syntax checker module, while this is just reporting the errors on trying to load a file. So how to make emacs talk to drracket/check-syntax package? Apparently one must write a Racket script. I don’t know what it is saying about syntax objects. (make-traversal ...) apparently makes a Visitor type thing, but where do I get the visited?

Syntax objects

On the other hand, I don’t see the “Check Syntax” button in DrRacket giving any more information about those pesky “no expression in body” errors (like a line number would be helpful!)

Okay, put this down for now.

> (make-traversal (make-base-namespace) "chap3.1.rkt")

Actually this particular syntax error (at least when writing code in the #lang planet neil/sicp module) is annoying because it won’t point you to the line on which error occurs despite it being mostly syntax. Usually turns out to be an ‘if’ with no clauses, a duplicated paren, or something.

Additionally, the red underline that flycheck puts is misplaced and tiny (it is frequently on an open paren, when it should really be on all of the first sexp inside that paren).