From 7b56eb4c6951f157448ab5029203828b27126d92 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Mon, 31 Oct 2022 00:11:15 -0400 Subject: [PATCH] repl: Add ,q command and move exit outside run-prompt I've been toying around with emacs and one of the really cool things is being able to send updates to chicken REPL. Sometimes I want to exit the run-prompt loop without ending the scheme process though! So this patch allows exiting (run-prompt) with ,q (since C-d seems to be finnicky). --- fisl.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fisl.scm b/fisl.scm index f2bb007..d0a547a 100755 --- a/fisl.scm +++ b/fisl.scm @@ -23,12 +23,11 @@ (define (run-prompt) (display "> ") (let ((l (read-line))) - (if (not (eof-object? l)) + (if (not (or (eof-object? l) (equal? l ",q"))) (begin (run l "repl") (clear-err!) - (run-prompt)) - (exit 0)))) + (run-prompt))))) (define (run-file fname) (call-with-input-file fname (lambda (p) @@ -38,6 +37,6 @@ (define (main args) (let ((argc (length args))) (cond - ((eq? argc 0) (run-prompt)) + ((eq? argc 0) (run-prompt) (exit 0)) ((eq? argc 1) (run-file (car args))) (else (die "Too many arguments. Usage: fisl [FILE]"))))) -- libgit2 1.1.1