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

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

[nongnu] elpa/inf-clojure 339093c 056/313: Replace multiple newlines by


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure 339093c 056/313: Replace multiple newlines by single one or add one
Date: Wed, 11 Aug 2021 09:59:46 -0400 (EDT)

branch: elpa/inf-clojure
commit 339093c05c19e1ac8b1735709905726a3628852a
Author: Okke Tijhuis <o.tijhuis@gmail.com>
Commit: Okke Tijhuis <o.tijhuis@gmail.com>

    Replace multiple newlines by single one or add one
---
 inf-clojure.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/inf-clojure.el b/inf-clojure.el
index 733074b..95484de 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -323,8 +323,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]