emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-clojure 59a9f0695f: Ensure repl scrolls on insert (#20


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure 59a9f0695f: Ensure repl scrolls on insert (#204)
Date: Sun, 7 Aug 2022 17:58:44 -0400 (EDT)

branch: elpa/inf-clojure
commit 59a9f0695f3d97a593f8d5ea04b51ea5dcb2718a
Author: dpsutton <dan@dpsutton.com>
Commit: GitHub <noreply@github.com>

    Ensure repl scrolls on insert (#204)
    
    When inserting forms into the repl, the buffer doesn't always scroll to
    show the new input and result. This has been fixed in CIDER in a similar
    way, so now I'm bringing the same trick here.
    
    See https://github.com/clojure-emacs/cider/pull/2590 for more details.
---
 CHANGELOG.md   |  2 ++
 inf-clojure.el | 25 +++++++++++++++----------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0fa722917..6bf9e4ce36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
 
 ## master (unreleased)
 * [#202](https://github.com/clojure-emacs/inf-clojure/issues/202): Add 
ClojureCLR support.
+* [#204](https://github.com/clojure-emacs/inf-clojure/issues/204): Scroll repl 
buffer on insert commands
+
 
 ## 3.2.1 (2022-07-22)
 
diff --git a/inf-clojure.el b/inf-clojure.el
index a213a55af1..3b7f8dcef4 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -920,16 +920,21 @@ Prefix argument AND-GO means switch to the Clojure buffer 
afterwards."
   "Insert FORM into process and evaluate.
 Indent FORM.  FORM is expected to have been trimmed."
   (let ((clojure-process (inf-clojure-proc)))
-    (with-current-buffer (process-buffer clojure-process)
-      (comint-goto-process-mark)
-      (let ((beginning (point)))
-        (insert (format "%s" form))
-        (let ((end (point)))
-          (goto-char beginning)
-          (indent-sexp end)
-          ;; font-lock the inserted code
-          (font-lock-ensure beginning end)))
-      (comint-send-input t t))))
+    ;; ensure the repl buffer scrolls. See similar fix in CIDER:
+    ;; https://github.com/clojure-emacs/cider/pull/2590
+    (with-selected-window (or (get-buffer-window inf-clojure-buffer)
+                              (selected-window))
+      (with-current-buffer (process-buffer clojure-process)
+        (comint-goto-process-mark)
+        (let ((beginning (point)))
+          (insert form)
+          (let ((end (point)))
+            (goto-char beginning)
+            (indent-sexp end)
+            ;; font-lock the inserted code
+            (font-lock-ensure beginning end)
+            (goto-char end)))
+        (comint-send-input t t)))))
 
 (defun inf-clojure-insert-defun ()
   "Send current defun to process."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]