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

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

[nongnu] elpa/inf-clojure 98d324b 058/313: Merge pull request #19 from o


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure 98d324b 058/313: Merge pull request #19 from otijhuis/too-many-newlines
Date: Wed, 11 Aug 2021 09:59:46 -0400 (EDT)

branch: elpa/inf-clojure
commit 98d324b144c5db682c09b6347026516767cb0a78
Merge: 19605ac 339093c
Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Merge pull request #19 from otijhuis/too-many-newlines
    
    Too many newlines
---
 inf-clojure.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/inf-clojure.el b/inf-clojure.el
index f041642..591a822 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -332,8 +332,12 @@ of `inf-clojure-program').  Runs the hooks from
   "Send the current region to the inferior Clojure process.
 Prefix argument AND-GO means switch to the Clojure buffer afterwards."
   (interactive "r\nP")
-  (comint-send-region (inf-clojure-proc) start end)
-  (comint-send-string (inf-clojure-proc) "\n")
+  ;; replace multiple newlines at the end of the region by a single one
+  ;; or add one if there was no newline
+  (let ((str (replace-regexp-in-string
+              "[\n]*\\'" "\n"
+              (buffer-substring-no-properties start end))))
+    (comint-send-string (inf-clojure-proc) str))
   (if and-go (inf-clojure-switch-to-repl t)))
 
 (defun inf-clojure-eval-string (code)



reply via email to

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