branch: elpa/inf-clojure commit 339093c05c19e1ac8b1735709905726a3628852a Author: Okke Tijhuis <o.tijh...@gmail.com> Commit: Okke Tijhuis <o.tijh...@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)