branch: elpa/inf-clojure commit 98d324b144c5db682c09b6347026516767cb0a78 Merge: 19605ac 339093c Author: Bozhidar Batsov <bozhidar.bat...@gmail.com> Commit: Bozhidar Batsov <bozhidar.bat...@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)