Re: Behavior of Scheme REPL

"Jakub T. Jankiewicz" <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <20260818194913.1a2c8ce0@jcubic>

On Tue, 18 Aug 2026 12:40:47 +0100
Sean Whitton <[email protected]> wrote:

> Jakub T. Jankiewicz [17/Aug  8:34pm +02] wrote:
> > I've noticed that that cmuscheme that is shipped with Emacs prints
> > multiple prompts when you evaluate Scheme code with C-x C-e
> >
> > ...
> >
> > IMHO it would be better if the code is echoed back into the scheme shell,
> > or at least a newline is added between the prompts. so the output from the
> > process appear between the prompts like it appear when running it from
> > normal terminal emulator.  
> 
> I think if someone wants to fix this we would take the patch.
> 

Here is the patch:

diff --git i/lisp/cmuscheme.el w/lisp/cmuscheme.el
index 6c714f2f80a..be0a4c50c5f 100644
--- i/lisp/cmuscheme.el
+++ w/lisp/cmuscheme.el
@@ -256,8 +256,15 @@ scheme-start-file
 (defun scheme-send-region (start end)
   "Send the current region to the inferior Scheme process."
   (interactive "r")
-  (comint-send-region (scheme-proc) start end)
-  (comint-send-string (scheme-proc) "\n"))
+  (let ((proc (scheme-proc)))
+    (with-current-buffer (process-buffer proc)
+      (save-excursion
+        (goto-char (process-mark proc))
+        (unless (bolp)
+          (let ((inhibit-read-only t))
+            (insert-before-markers "\n")))))
+    (comint-send-region proc start end)
+    (comint-send-string proc "\n")))
 
 (defun scheme-send-definition ()
   "Send the current definition to the inferior Scheme process."


-- 
Jakub T. Jankiewicz, Open-source Developer & Wikipedia Editor
Official Website: https://jakub.jankiewicz.org
Educational Project:  https://wikizeit.edu.pl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.