Skip to content

Commit 7441d3b

Browse files
arichiardibbatsov
authored andcommitted
Fix REPL type detection
The problem was occurring when the first operation was not an `inf-clojure--send-string`. Now `inf-clojure--set-repl-type` is explicitely called in the form getters.
1 parent 1507faa commit 7441d3b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

inf-clojure.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,11 @@ either `setq-local` or an entry in `.dir-locals.el`." )
202202
(t 'clojure)))
203203

204204
(defun inf-clojure--set-repl-type (proc)
205-
"Set the REPL type if has not already been set."
206-
(when (not inf-clojure-repl-type)
207-
(setq inf-clojure-repl-type (inf-clojure--detect-type proc))))
205+
"Set the REPL type if has not already been set.
206+
It requires a REPL PROC for inspecting the correct type."
207+
(if (not inf-clojure-repl-type)
208+
(setq inf-clojure-repl-type (inf-clojure--detect-type proc))
209+
inf-clojure-repl-type))
208210

209211
(defun inf-clojure--send-string (proc string)
210212
"A custom `comint-input-sender` / `comint-send-string`.
@@ -584,7 +586,7 @@ The prefix argument SWITCH-TO-REPL controls whether to switch to REPL after the
584586
"Return the form to query inferior Clojure for a var's documentation.
585587
If you are using REPL types, it will pickup the most approapriate
586588
`inf-clojure-var-doc-form` variant."
587-
(pcase inf-clojure-repl-type
589+
(pcase (inf-clojure--set-repl-type (inf-clojure-proc))
588590
(`lumo inf-clojure-var-doc-form-lumo)
589591
(_ inf-clojure-var-doc-form)))
590592

@@ -641,7 +643,7 @@ If you are using REPL types, it will pickup the most approapriate
641643
"Return the form to query inferior Clojure for a var's documentation.
642644
If you are using REPL types, it will pickup the most approapriate
643645
`inf-clojure-completion-form` variant."
644-
(pcase inf-clojure-repl-type
646+
(pcase (inf-clojure--set-repl-type (inf-clojure-proc))
645647
(`lumo inf-clojure-completion-form-lumo)
646648
(_ inf-clojure-completion-form)))
647649

0 commit comments

Comments
 (0)