greghendershott / racket-mode

Emacs major and minor modes for Racket: edit, REPL, check-syntax, debug, profile, packages, and more.
https://www.racket-mode.com/
GNU General Public License v3.0
683 stars 93 forks source link

`racket-repl-goto-error-location` chokes every *even* number of error locations #691

Closed usaoc closed 11 months ago

usaoc commented 11 months ago

This is a weird one, but racket-repl-goto-error-location chokes when there are multiple error locations, and in particular every even number of error locations. For example,

#lang racket/base
(raise-syntax-error
 'test "message" #f #f
 (list #'foo))

here, RET on the first (only) error location goes to foo as expected, but

#lang racket/base
(raise-syntax-error
 'test "message" #f #f
 (list #'foo #'bar))

here, RET on the second error location triggers “Wrong type argument: integer-or-marker-p” (and further racket-run-module-at-point is borked). Even worse,

#lang racket/base
(raise-syntax-error
 'test "message" #f #f
 (list #'foo #'bar #'baz))

here, RET on the second error location triggers “Lisp nesting exceeds max-lisp-eval-depth”! You can try adding more error locations, which ends up cycling the pattern.

greghendershott commented 11 months ago

Thanks for the report!

I had mostly tested with error messages and locations from context ("stack trace") and rackunit.

I should have tested more the sort of thing you reported -- a single error that supplies multiple srclocs.

I'll merge a commit to fix, soon...

greghendershott commented 11 months ago

p.s. I believe I arose in commit 7f60acc last week for #493. Although I did a lot of testing, then, I overlooked testing with errors that supply multiple srclocs.