[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/slime 6594b80f14 1/2: Insert inferior-lisp output into the
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/slime 6594b80f14 1/2: Insert inferior-lisp output into the repl. |
Date: |
Sat, 28 Sep 2024 07:00:43 -0400 (EDT) |
branch: elpa/slime
commit 6594b80f14b87af416838f274a1942a27999f6e8
Author: Stas Boukarev <stassats@gmail.com>
Commit: Stas Boukarev <stassats@gmail.com>
Insert inferior-lisp output into the repl.
---
contrib/slime-repl.el | 1 +
slime.el | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/contrib/slime-repl.el b/contrib/slime-repl.el
index c4c7db90bd..a77759c164 100644
--- a/contrib/slime-repl.el
+++ b/contrib/slime-repl.el
@@ -894,6 +894,7 @@ used with a prefix argument (C-u), doesn't switch back
afterwards."
(defvar slime-repl-clear-buffer-hook)
(add-hook 'slime-repl-clear-buffer-hook 'slime-clear-repl-variables)
+(setq slime-terminal-output-function 'slime-write-string)
(defun slime-repl-clear-buffer ()
"Delete the output generated by the Lisp process."
diff --git a/slime.el b/slime.el
index d6653b0d6c..47d1b07122 100644
--- a/slime.el
+++ b/slime.el
@@ -1202,6 +1202,16 @@ Return true if we have been given permission to
continue."
(defvar slime-inferior-process-start-hook nil
"Hook called whenever a new process gets started.")
+
+(defvar slime-inferior-lisp-connected nil)
+(defvar slime-terminal-output-function nil)
+
+(defun slime-insert-inferior-lisp-output (string)
+ (when slime-inferior-lisp-connected
+ (let ((slime-dispatching-connection slime-inferior-lisp-connected))
+ (funcall slime-terminal-output-function string)))
+ string)
+
(defun slime-start-lisp (program program-args env directory buffer)
"Does the same as `inferior-lisp' but less ugly.
Return the created process."
@@ -1209,6 +1219,8 @@ Return the created process."
(when directory
(cd (expand-file-name directory)))
(comint-mode)
+ (set (make-local-variable 'slime-inferior-lisp-connected) nil)
+ (add-hook 'comint-preoutput-filter-functions
'slime-insert-inferior-lisp-output 0 t)
(let ((process-environment (append env process-environment))
(process-connection-type nil))
(comint-exec (current-buffer) "inferior-lisp" program nil program-args))
@@ -1888,6 +1900,8 @@ This is automatically synchronized from Lisp.")
(slime-generate-connection-name (symbol-name name))))))
(slime-load-contribs)
(run-hooks 'slime-connected-hook)
+ (with-current-buffer (process-buffer (slime-inferior-process))
+ (setq slime-inferior-lisp-connected connection))
(let ((fun (plist-get args ':init-function)))
(when fun (funcall fun))))
(message "Connected. %s" (slime-random-words-of-encouragement))))