Recently I have started dabbling in the sml-mode Emacs package for running SML code. The problem I’m facing is when I try to send across a region of my SML code/file to the REPL (which I think is the only logical way of writing multi-line functions in SML without getting troubled by the primitive REPL). Here is my workflow:
- Open up an SML file (the SML mode shows in the bottom part of the window)
- Open up the REPL if it isn’t already running (
C-c C-s) - Again get back to the SML file and write a function
- Select the entire function and then press
C-C C-r. I get an error “Not a `sml-prog-proc` buffer” - Now instead of selecting a region, just try to send the entire file to the REPL using
C-C C-l; again the same error in the mini-buffer
Can someone please help me out in understand why this occurs and how to actually send across code from a script/file to the REPL when using SML? If it matters, I’m using SML/NJ.
TIA,
sasuke
This was bugging me as well, as it worked on some occasions but not on others.
If the sml process is killed with
C-d(as recommended when issuing ‘use’ commands) and immediately restarted from the same buffer (C-c C-s), the error will occur whenever any of the ‘send-to-repl’ operations are performed.The correct way (after killing the repl) is to switch back to the buffer containing the .sml file that is being edited and restart the repl from there (
C-c C-s) or by either of (C-c C-r) or (C-c C-l).HTH.