@@ -216,13 +216,16 @@ It requires a REPL PROC for inspecting the correct type."
216
216
217
217
(defun inf-clojure--send-string (proc string )
218
218
" 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
220
220
STRING (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. "
222
225
(inf-clojure--set-repl-type proc)
223
226
(comint-simple-send proc string))
224
227
225
- (defcustom inf-clojure-load-form " (clojure.core/load-file \" %s\" )\n "
228
+ (defcustom inf-clojure-load-form " (clojure.core/load-file \" %s\" )"
226
229
" Format-string for building a Clojure expression to load a file.
227
230
This format string should use `%s' to substitute a file name and
228
231
should result in a Clojure form that will be sent to the inferior
@@ -458,17 +461,16 @@ of `inf-clojure-*-cmd'). Runs the hooks from
458
461
" Send the current region to the inferior Clojure process.
459
462
Prefix argument AND-GO means switch to the Clojure buffer afterwards."
460
463
(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
463
465
(let ((str (replace-regexp-in-string
464
- " [\n ]* \\ '" " \n "
466
+ " [\n ]+ \\ '" " "
465
467
(buffer-substring-no-properties start end))))
466
468
(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 )))
468
470
469
471
(defun inf-clojure-eval-string (code )
470
472
" 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))
472
474
473
475
(defun inf-clojure-eval-defun (&optional and-go )
474
476
" Send the current defun to the inferior Clojure process.
0 commit comments