0

How do I exit the debugger in a SublimeREPL repl? I'm not very good at guessing keystrokes, and I didn't see anything in the documentation. As an example invoked by sending the current file to the repl:

debugger invoked on a SB-INT:SIMPLE-READER-PACKAGE-ERROR in thread
#<THREAD "main thread" RUNNING {1001834103}>:
  Package PPCRE does not exist.

    Stream: #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {100001B513}>

Easy to fix, but not while stuck in the debugger! The error is not, I say again, not the problem. What is the problem is that I know of no way to exit the debugger and return to the top level of the repl. Of course, this applies to any error in the repl. For instance, the following code in the file window will suffice:

(count-matches "\\w*" "foo bar baz")

This code submitted to the reply with the keystroke(s) of C-,f will, of course, enter the debugger either because you have not Quickloaded the cl-ppcre library or you have, and it's failing because you forgot to prefix your usage with ppcre: As I said, any error will do, trapping you in a repl state that is useless without a way out.

hsmyers
  • 665
  • 7
  • 10
  • 1
    What language are you using? How *exactly* did you invoke the debugger? Please [edit] your question and add a [mre]. It's not clear at all what you're asking. – MattDMo Apr 16 '23 at 19:54
  • The language is in the title "sbcl," a common abbreviation for Steel Bank Common Lisp – hsmyers Apr 16 '23 at 20:29
  • 1
    I had to look it up, and I added the tag (please do that next time). The abbreviation may be common in the Lisp world, but I've been working with computers for over 30 years and I'd never heard of it before, so please don't assume. At any rate, again, *please* edit your question and post a [mre]. Create a sample file that reproduces the problem. Tell how you configured SublimeREPL, if at all, and tell us *exactly* what menu options or key combos you used to run it. Just guessing by looking at the error, you seem to be missing a package - have you tried (re)installing it? Help us help you. – MattDMo Apr 16 '23 at 22:36
  • Thanks for the tag. You are right. My Lisp-eye view of things gave me an unforced assumption error! OBTW, I'm 72 and have only been programming since 1975—this is hardly the first time I've displayed my ignorance in public… – hsmyers Apr 17 '23 at 02:46
  • 1
    For my part, I sometimes forget that SO rep != experience. No worries, glad we're all on the same page. Have you tried opening a REPL first (`Tools->SublimeREPL->Common Lisp->SBCL`), switching back to your file, then executing Transfer to REPL (`C-S-,f`) instead of Eval in REPL? Unfortunately I don't know the key commands for navigating around the SBCL debugger, but it's possible with Transfer to an already running REPL you might have some greater degree of control. From [this](https://www.sbcl.org/manual/#Debugger), it looks like you might just be able to enter `0` to get back to the REPL? – MattDMo Apr 17 '23 at 16:27
  • What you describe is, in fact, what I did; I forgot to mention which window I used. Hadn't thought to try 0. Just noticed that the missing display is sent to stdout. Not where I would have put it, but usable nonetheless. – hsmyers Apr 17 '23 at 20:41

1 Answers1

1

I installed the sbcl v2.3.3 MacPorts port on my Mac (OSX 10.15.7) for the purposes of this answer.

First, I created a file test.lisp with the contents:

(count-matches "\\w*" "foo bar baz")

as suggested in the question. Next, I started a REPL by selecting Tools → SublimeREPL → Common Lisp → SBCL. This appeared in a new tab:

This is SBCL 2.3.3, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* 

Switching back to test.lisp, I selected Tools → SublimeREPL → Eval in REPL → File and got this:

* (count-matches "\\w*" "foo bar baz")

; in: COUNT-MATCHES "\\w*"
;     (COUNT-MATCHES "\\w*" "foo bar baz")
; 
; caught STYLE-WARNING:
;   undefined function: COMMON-LISP-USER::COUNT-MATCHES
; 
; compilation unit finished
;   Undefined function:
;     COUNT-MATCHES
;   caught 1 STYLE-WARNING condition

debugger invoked on a UNDEFINED-FUNCTION @52A00904 in thread
#<THREAD "main thread" RUNNING {10013B0003}>:
  The function COMMON-LISP-USER::COUNT-MATCHES is undefined.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE      ] Retry calling COUNT-MATCHES.
  1: [USE-VALUE     ] Call specified function.
  2: [RETURN-VALUE  ] Return specified values.
  3: [RETURN-NOTHING] Return zero values.
  4: [ABORT         ] Exit debugger, returning to top level.

("undefined function" "\\w*" "foo bar baz")
0] 

I then typed in 4 and the prompt changed back to * .

If I started a fresh SBCL REPL and instead chose Tools → SublimeREPL → Transfer to REPL → File, it copied the contents of the file to the * prompt, and I had to hit Enter for it to evaluate. The same debugger message as above came up, and entering 4 successfully brought me back to the * prompt.


While searching for lisp on Package Control, I came across Slyblime, a port of Sly to Sublime Text 4 (make sure you are using build number 4000 or greater - Sublime Text → About Sublime Text on Mac, Preferences → About Sublime Text on Windows/Linux). Slyblime is built on top of SublimeREPL and adds additional features. I don't know enough about Lisp to make use of it or judge its utility, I just thought I'd mention it here.

MattDMo
  • 100,794
  • 21
  • 241
  • 231