Skip to content

Commit e10ac48

Browse files
arichiardibbatsov
authored andcommitted
Improve string sanitation and arglists response parsing
The function `inf-clojure--sanitize-command` now also makes sure that form sent to the process is not multiline. Weird stuff happens instead.
1 parent 896edd1 commit e10ac48

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

inf-clojure.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,16 @@ It requires a REPL PROC for inspecting the correct type."
215215
(setq inf-clojure-repl-type (inf-clojure--detect-repl-type proc))
216216
inf-clojure-repl-type))
217217

218+
(defun inf-clojure--single-linify (string)
219+
"Convert a multi-line STRING in a single-line STRING."
220+
(replace-regexp-in-string "[[:space:]\\|\n]+" " " string))
221+
218222
(defun inf-clojure--sanitize-command (command)
219223
"Sanitize COMMAND for sending it to a process.
220224
An example of things that this function does is to add a final
221225
newline at the end of the form."
222-
(concat (string-trim-right command) "\n"))
226+
(concat (string-trim-right (inf-clojure--single-linify command))
227+
"\n"))
223228

224229
(defun inf-clojure--send-string (proc string)
225230
"A custom `comint-input-sender` / `comint-send-string`.

0 commit comments

Comments
 (0)