TL;DR
Hey all! I made a bit of progress working around https://gitlab.com/emacs-geiser/mit/-/issues/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):
### TL;DR
Hey all! I made a bit of progress working around https://gitlab.com/emacs-geiser/mit/-/issues/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`:
```lisp
;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:
```lisp
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):
```lisp
Error: retort-syntax
#[%record 32]
;Unspecified return value
```
### Debugging
I did some _casual_ `debug` sessions in the [MIT Scheme debugger](https://www.gnu.org/software/mit-scheme/documentation/stable/mit-scheme-user.html#Command_002dLine-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](https://melpa.org/#/geiser) and [emacs-geiser/mit](https://melpa.org/#/geiser-mit) from MELPA (via the Spacemacs [Scheme layer](https://github.com/syl20bnr/spacemacs/blob/develop/layers/%2Blang/scheme/README.org)) on Emacs 29.1 with [MIT Scheme 12.1](https://ftp.gnu.org/gnu/mit-scheme/stable.pkg/12.1/mit-scheme-12.1-x86-64.tar.gz) compiled on MacOS (via `arch -x86_64` to ensure compilation uses the x86_64 instruction set instead of the M1's arm64):
- geiser: https://gitlab.com/emacs-geiser/geiser/-/commit/49d12a14482ce9a193c049a5ccdd2fed90b0bdbe
- geiser-mit: https://gitlab.com/emacs-geiser/mit/-/commit/4e90e9ae815e89f3540fb9644e6016c663ef5765
- [mit-scheme-12.1-x86-64](https://ftp.gnu.org/gnu/mit-scheme/stable.pkg/12.1/mit-scheme-12.1-x86-64.tar.gz)
- GNU Emacs 29.1 with Spacemacs 0.999.0
- macOS 14.1 (23B74), M1