@@ -216,13 +216,16 @@ It requires a REPL PROC for inspecting the correct type."
216216
217217(defun inf-clojure--send-string (proc string )
218218 " A custom `comint-input-sender` / `comint-send-string`.
219- Perform the required side effects on every send for PROC and
219+ It performs the required side effects on every send for PROC and
220220STRING (for example set the buffer local REPL type). It should
221- be used instead of `comint-send-string`."
221+ always be preferred over `comint-send-string`. It delegates to
222+ `comint-simple-send` so it always appends a newline at the end of
223+ the string for evaluation. Refer to `comint-simple-send` for
224+ customizations. "
222225 (inf-clojure--set-repl-type proc)
223226 (comint-simple-send proc string))
224227
225- (defcustom inf-clojure-load-form " (clojure.core/load-file \" %s\" )\n "
228+ (defcustom inf-clojure-load-form " (clojure.core/load-file \" %s\" )"
226229 " Format-string for building a Clojure expression to load a file.
227230This format string should use `%s' to substitute a file name and
228231should result in a Clojure form that will be sent to the inferior
@@ -458,17 +461,16 @@ of `inf-clojure-*-cmd'). Runs the hooks from
458461 " Send the current region to the inferior Clojure process.
459462Prefix argument AND-GO means switch to the Clojure buffer afterwards."
460463 (interactive " r\n P" )
461- ; ; replace multiple newlines at the end of the region by a single one
462- ; ; or add one if there was no newline
464+ ; ; drops newlines at the end of the region
463465 (let ((str (replace-regexp-in-string
464- " [\n ]* \\ '" " \n "
466+ " [\n ]+ \\ '" " "
465467 (buffer-substring-no-properties start end))))
466468 (inf-clojure--send-string (inf-clojure-proc) str))
467- (if and-go (inf-clojure-switch-to-repl t )))
469+ (when and-go (inf-clojure-switch-to-repl t )))
468470
469471(defun inf-clojure-eval-string (code )
470472 " Send the string CODE to the inferior Clojure process to be executed."
471- (inf-clojure--send-string (inf-clojure-proc) ( concat code " \n " ) ))
473+ (inf-clojure--send-string (inf-clojure-proc) code))
472474
473475(defun inf-clojure-eval-defun (&optional and-go )
474476 " Send the current defun to the inferior Clojure process.
0 commit comments