Geiser with MIT (12.1): Hitting a snag compiling emacs.el
TL;DR
Hey all! I made a bit of progress working around #9. I'm signal boosting here for visibility in case folks have more context and can shed some light. :)
Overview
With geiser and geiser-mit installed on Emacs, I open a .scm
file. The MIT Scheme REPL fires up but hits a snag compiling geiser-mit/src/geiser/emacs.el
:
;Loading "/Users/ads/.config/spacemacs/elpa/29.1/develop/geiser-mit-20211204.1935/src/geiser/load.scm"...
; Loading "compile.scm"...
; Loading "make.com"...
; Loading "cref-unx.pkd"... done
; Loading "mset.com"... done
; Loading "object.com"... done
; Loading "toplev.com"... done
; Loading "anfile.com"... done
; Loading "conpkg.com"... done
; Loading "forpkg.com"... done
; Loading "redpkg.com"... done
; ... done
; Generating SCode for file: "emacs.scm" => "emacs.bin"... done
; Compiling file: "emacs.bin" => "emacs.com"...
;Warning: Procedure called with wrong number of arguments #[primitive-procedure 14 %record-ref] 1
2 error>
The workaround is to (load "emacs")
in the REPL. From there, everything seems to work as expected:
error> (load "emacs")
; Loading "emacs.bin"...
; Loading "format.com"... done
; ... done
;Value: #[environment 15]
2 (user) =>
Good to go! Evaluating code in the source buffer works now—but—an error gets surfaced to the Geiser Debug buffer on each eval (I'm just ignoring these guys for now):
Error: retort-syntax
#[%record 32]
;Unspecified return value
Debugging
I did some casual debug
sessions in the MIT Scheme debugger to investigate the initial compilation issue with emacs.scm
.
After traversing the 80+ subproblems (and the subsequent reductions and environments), I was able to get a reference to the %record-ref
procedure. Then, via (pa %record-ref)
I could see that it takes two formal parameters (a1
and a2
).
So it seems like %record-ref
is getting applied with 1 argument instead of 2 (which isn't new information—the initial warning already told us that!). All to say, as a newbie it was fun to poke around but ultimately I wasn't able to uncover anything useful. :)
Environment
I'm running the latest emacs-geiser/geiser and emacs-geiser/mit from MELPA (via the Spacemacs Scheme layer) on Emacs 29.1 with MIT Scheme 12.1 compiled on MacOS (via arch -x86_64
to ensure compilation uses the x86_64 instruction set instead of the M1's arm64):
- geiser: geiser@49d12a14
- geiser-mit: 4e90e9ae
- mit-scheme-12.1-x86-64
- GNU Emacs 29.1 with Spacemacs 0.999.0
- macOS 14.1 (23B74), M1