branch: elpa/inf-clojure commit e10ac489e015515aaa7f49d397c08a26063cf777 Author: Andrea Richiardi <a.richiardi.w...@gmail.com> Commit: Bozhidar Batsov <bozhidar.bat...@gmail.com>
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. --- inf-clojure.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inf-clojure.el b/inf-clojure.el index f16a92f..b5b6623 100644 --- a/inf-clojure.el +++ b/inf-clojure.el @@ -215,11 +215,16 @@ It requires a REPL PROC for inspecting the correct type." (setq inf-clojure-repl-type (inf-clojure--detect-repl-type proc)) inf-clojure-repl-type)) +(defun inf-clojure--single-linify (string) + "Convert a multi-line STRING in a single-line STRING." + (replace-regexp-in-string "[[:space:]\\|\n]+" " " string)) + (defun inf-clojure--sanitize-command (command) "Sanitize COMMAND for sending it to a process. An example of things that this function does is to add a final newline at the end of the form." - (concat (string-trim-right command) "\n")) + (concat (string-trim-right (inf-clojure--single-linify command)) + "\n")) (defun inf-clojure--send-string (proc string) "A custom `comint-input-sender` / `comint-send-string`.