@@ -596,7 +596,7 @@ If you are using REPL types, it will pickup the most approapriate
596
596
597
597
(define-obsolete-variable-alias 'inf-clojure-var-source-command 'inf-clojure-var-source-form " 2.0.0" )
598
598
599
- (defcustom inf-clojure-arglist -form
599
+ (defcustom inf-clojure-arglists -form
600
600
" (try
601
601
(:arglists
602
602
(clojure.core/meta
@@ -607,7 +607,21 @@ If you are using REPL types, it will pickup the most approapriate
607
607
:type 'string
608
608
:package-version '(inf-clojure . " 2.0.0" ))
609
609
610
- (define-obsolete-variable-alias 'inf-clojure-arglist-command 'inf-clojure-arglist-form " 2.0.0" )
610
+ (define-obsolete-variable-alias 'inf-clojure-arglist-command 'inf-clojure-arglists-form " 2.0.0" )
611
+
612
+ (defcustom inf-clojure-arglists-form-lumo
613
+ " (lumo.repl/get-arglists \" %s\" )"
614
+ " Lumo form to query inferior Clojure for a function's arglist."
615
+ :type 'string
616
+ :package-version '(inf-clojure . " 2.0.0" ))
617
+
618
+ (defun inf-clojure-arglists-form ()
619
+ " Return the form to query inferior Clojure for arglists of a var.
620
+ If you are using REPL types, it will pickup the most approapriate
621
+ `inf-clojure-arglist-form` variant."
622
+ (pcase (inf-clojure--set-repl-type (inf-clojure-proc))
623
+ (`lumo inf-clojure-arglists-form-lumo)
624
+ (_ inf-clojure-arglists-form)))
611
625
612
626
(defcustom inf-clojure-completion-form
613
627
" (complete.core/completions \" %s\" )\n "
@@ -725,6 +739,16 @@ prefix argument PROMPT-FOR-SYMBOL, it prompts for a symbol name."
725
739
(inf-clojure-symbol-at-point))))
726
740
(comint-proc-query (inf-clojure-proc) (format inf-clojure-var-source-form var))))
727
741
742
+ (defun inf-clojure-match-arglists (input-form string )
743
+ " Return the arglists match from INPUT-FORM and STRING.
744
+ The output depends on the correct REPL type. We assume the
745
+ `inf-clojure-repl-type` var is already set, therefore this is
746
+ safe to call only from inside `inf-clojure-arglist`."
747
+ (pcase inf-clojure-repl-type
748
+ (`lumo (let ((input-end (and (string-match input-form string) (match-end 0 ))))
749
+ (and (string-match " (.+)" string input-end) (match-string 0 string))))
750
+ (_ (and (string-match " (.+)" string) (match-string 0 string)))))
751
+
728
752
(defun inf-clojure-arglist (fn )
729
753
" Send a query to the inferior Clojure for the arglist for function FN.
730
754
See variable `inf-clojure-arglist-form' ."
@@ -734,11 +758,11 @@ See variable `inf-clojure-arglist-form'."
734
758
eldoc)
735
759
(set-process-filter proc (lambda (_proc string ) (setq kept (concat kept string))))
736
760
(unwind-protect
737
- (let ((eldoc-snippet (format inf-clojure-arglist -form fn)))
738
- (process -send-string proc eldoc-snippet)
761
+ (let ((eldoc-snippet (format ( inf-clojure-arglists -form) fn)))
762
+ (inf-clojure- -send-string proc eldoc-snippet)
739
763
(while (and (not (string-match inf-clojure-prompt kept))
740
764
(accept-process-output proc 2 )))
741
- (setq eldoc (and ( string- match " (.+) " kept) ( match-string 0 kept) )))
765
+ (setq eldoc (inf-clojure- match-arglists eldoc-snippet kept)))
742
766
(set-process-filter proc comint-filt))
743
767
eldoc))
744
768
0 commit comments