Why is there an extra newline in Emac's scheme-mode?
Question
I'm running ypsilon scheme using Emacs 23's scheme-mode. When I enter an expression in the interpreter, it adds an extra newline (see below). I've never seen this happen for any other interpreter. I know ypsilon isn't doing it, because it looks fine in shell-mode a shell (though shell-mode exhibits the same incorrect behavior). What function in scheme or comint mode might be adding this extra newline?
Looks like this:
> (+ 1 2)
3
> ;; extra newline above
Should be this:
> (+ 1 2)
3
> ;; no extra newline above
Solution
I figured it out. comint-send-input has an optional no-newline parameter. I set this to true (don't insert another newline) by rebinding the Return key to a new function that wraps comint-send-input. Those extra newlines disappear. I don't know why they appear in the first place, though.
(defun comint-send-input-no-newline ()
(interactive)
(comint-send-input t nil))
OTHER TIPS
This is more of a workaround than anything else, but give SLIME a try. I've found that it handles input/output really nicely. You can find SLIME backends that support Scheme.