From 0acd49d606daf5cb4f1c3629ec451f0956920fa3 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Sun, 11 Aug 2024 22:26:55 +0900 Subject: [PATCH] fix --- extensions/lisp-mode/lisp-mode.lisp | 19 ++++++++++--------- extensions/lisp-mode/repl.lisp | 26 ++++++++++++++------------ 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/extensions/lisp-mode/lisp-mode.lisp b/extensions/lisp-mode/lisp-mode.lisp index 62cfaab45..9719e8a49 100644 --- a/extensions/lisp-mode/lisp-mode.lisp +++ b/extensions/lisp-mode/lisp-mode.lisp @@ -190,15 +190,16 @@ (abort-all (current-connection) "change connection") (notify-change-connection-to-wait-message-thread)) (setf (current-connection) connection) - (write-string-to-repl - (if (self-connection-p connection) - (format nil - "~%; changed connection (self connection)") - (format nil - "~%; changed connection (~A ~A)" - (connection-implementation-name connection) - (connection-implementation-version connection))) - :attribute 'syntax-comment-attribute)) + (when (repl-buffer) + (write-string-to-repl + (if (self-connection-p connection) + (format nil + "~%; changed connection (self connection)") + (format nil + "~%; changed connection (~A ~A)" + (connection-implementation-name connection) + (connection-implementation-version connection))) + :attribute 'syntax-comment-attribute))) (defmethod switch-connection ((connection connection)) (change-current-connection connection)) diff --git a/extensions/lisp-mode/repl.lisp b/extensions/lisp-mode/repl.lisp index deb152166..53400785e 100644 --- a/extensions/lisp-mode/repl.lisp +++ b/extensions/lisp-mode/repl.lisp @@ -283,7 +283,8 @@ (defun insert-repl-header (buffer self-connection) (when self-connection (insert-string (buffer-point buffer) - *welcome-text*) + *welcome-text* + :sticky-attribute 'syntax-comment-attribute) (update-repl-buffer-write-point (buffer-end-point buffer)))) (defun make-repl-buffer (self-connection) @@ -347,17 +348,18 @@ (defun call-with-repl-point (function) (let* ((buffer (ensure-repl-buffer-exist)) (point (repl-buffer-write-point buffer))) - (cond (*repl-evaluating* - (buffer-end point)) - (t - (when (point<= (lem/listener-mode:input-start-point buffer) point) - (move-point point (lem/listener-mode:input-start-point buffer)) - (previous-single-property-change point :field)))) - (unless (eq (current-buffer) buffer) - (see-repl-writing buffer)) - (with-buffer-read-only buffer nil - (let ((*inhibit-read-only* t)) - (funcall function point))))) + (when (lem/listener-mode:input-start-point buffer) + (cond (*repl-evaluating* + (buffer-end point)) + (t + (when (point<= (lem/listener-mode:input-start-point buffer) point) + (move-point point (lem/listener-mode:input-start-point buffer)) + (previous-single-property-change point :field)))) + (unless (eq (current-buffer) buffer) + (see-repl-writing buffer)) + (with-buffer-read-only buffer nil + (let ((*inhibit-read-only* t)) + (funcall function point)))))) (defmacro with-repl-point ((point) &body body) `(call-with-repl-point (lambda (,point) ,@body)))