@@ -205,6 +205,7 @@ See http://blog.jorgenschaefer.de/2014/05/race-conditions-in-emacs-process-filte
205
205
(let ((inf-clojure--repl-type-lock t ))
206
206
(cond
207
207
((inf-clojure--lumo-p proc) 'lumo )
208
+ ((inf-clojure--planck-p proc) 'planck )
208
209
(t 'clojure )))))
209
210
210
211
(defun inf-clojure--set-repl-type (proc )
@@ -221,7 +222,7 @@ STRING (for example set the buffer local REPL type). It should
221
222
always be preferred over `comint-send-string`. It delegates to
222
223
`comint-simple-send` so it always appends a newline at the end of
223
224
the string for evaluation. Refer to `comint-simple-send` for
224
- customizations. "
225
+ customizations."
225
226
(inf-clojure--set-repl-type proc)
226
227
(comint-simple-send proc string))
227
228
@@ -236,7 +237,15 @@ Clojure to load that file."
236
237
(define-obsolete-variable-alias 'inf-clojure-load-command 'inf-clojure-load-form " 2.0.0" )
237
238
238
239
(defcustom inf-clojure-load-form-lumo " (clojure.core/load-file \" %s\" )"
239
- " Format-string for building a Clojure expression to load a file.
240
+ " Lumo format-string for building a Clojure expression to load a file.
241
+ This format string should use `%s' to substitute a file name and
242
+ should result in a Clojure form that will be sent to the inferior
243
+ Clojure to load that file."
244
+ :type 'string
245
+ :package-version '(inf-clojure . " 2.0.0" ))
246
+
247
+ (defcustom inf-clojure-load-form-planck " (load-file \" %s\" )"
248
+ " Planck format-string for building a Clojure expression to load a file.
240
249
This format string should use `%s' to substitute a file name and
241
250
should result in a Clojure form that will be sent to the inferior
242
251
Clojure to load that file."
@@ -249,6 +258,7 @@ If you are using REPL types, it will pickup the most approapriate
249
258
`inf-clojure-var-doc-form` variant."
250
259
(pcase (inf-clojure--set-repl-type (inf-clojure-proc))
251
260
(`lumo inf-clojure-load-form-lumo)
261
+ (`planck inf-clojure-load-form-planck)
252
262
(_ inf-clojure-load-form)))
253
263
254
264
(defcustom inf-clojure-prompt " ^[^=> \n ]+=> *"
@@ -592,12 +602,19 @@ The prefix argument SWITCH-TO-REPL controls whether to switch to REPL after the
592
602
:type 'string
593
603
:package-version '(inf-clojure . " 2.0.0" ))
594
604
605
+ (defcustom inf-clojure-var-doc-form-planck
606
+ " (planck.repl/doc %s)\n "
607
+ " Planck form to query inferior Clojure for a var's documentation."
608
+ :type 'string
609
+ :package-version '(inf-clojure . " 2.0.0" ))
610
+
595
611
(defun inf-clojure-var-doc-form ()
596
612
" Return the form to query inferior Clojure for a var's documentation.
597
613
If you are using REPL types, it will pickup the most approapriate
598
614
`inf-clojure-var-doc-form` variant."
599
615
(pcase (inf-clojure--set-repl-type (inf-clojure-proc))
600
616
(`lumo inf-clojure-var-doc-form-lumo)
617
+ (`planck inf-clojure-var-doc-form-planck)
601
618
(_ inf-clojure-var-doc-form)))
602
619
603
620
(defcustom inf-clojure-var-source-form
@@ -606,6 +623,20 @@ If you are using REPL types, it will pickup the most approapriate
606
623
:type 'string
607
624
:package-version '(inf-clojure . " 2.0.0" ))
608
625
626
+ (defcustom inf-clojure-var-source-form-planck
627
+ " (planck.repl/source %s)\n "
628
+ " Planck form to query inferior Clojure for a var's source."
629
+ :type 'string
630
+ :package-version '(inf-clojure . " 2.0.0" ))
631
+
632
+ (defun inf-clojure-var-source-form ()
633
+ " Return the form to query inferior Clojure for a var's source.
634
+ If you are using REPL types, it will pickup the most approapriate
635
+ `inf-clojure-var-source-form` variant."
636
+ (pcase (inf-clojure--set-repl-type (inf-clojure-proc))
637
+ (`planck inf-clojure-var-source-form-planck)
638
+ (_ inf-clojure-var-source-form)))
639
+
609
640
(define-obsolete-variable-alias 'inf-clojure-var-source-command 'inf-clojure-var-source-form " 2.0.0" )
610
641
611
642
(defcustom inf-clojure-arglists-form
@@ -649,12 +680,19 @@ If you are using REPL types, it will pickup the most approapriate
649
680
:type 'string
650
681
:package-version '(inf-clojure . " 2.0.0" ))
651
682
683
+ (defcustom inf-clojure-completion-form-planck
684
+ " (planck.repl/get-completions \" %s\" )\n "
685
+ " Planck form to query inferior Clojure for completion candidates."
686
+ :type 'string
687
+ :package-version '(inf-clojure . " 2.0.0" ))
688
+
652
689
(defun inf-clojure-completion-form ()
653
690
" Return the form to query inferior Clojure for a var's documentation.
654
691
If you are using REPL types, it will pickup the most approapriate
655
692
`inf-clojure-completion-form` variant."
656
693
(pcase (inf-clojure--set-repl-type (inf-clojure-proc))
657
694
(`lumo inf-clojure-completion-form-lumo)
695
+ (`planck inf-clojure-completion-form-planck)
658
696
(_ inf-clojure-completion-form)))
659
697
660
698
(defcustom inf-clojure-ns-vars-form
@@ -669,12 +707,19 @@ If you are using REPL types, it will pickup the most approapriate
669
707
:type 'string
670
708
:package-version '(inf-clojure . " 2.0.0" ))
671
709
710
+ (defcustom inf-clojure-ns-vars-form-planck
711
+ " (planck.repl/dir %s)\n "
712
+ " Planck form to show the public vars in a namespace."
713
+ :type 'string
714
+ :package-version '(inf-clojure . " 2.0.0" ))
715
+
672
716
(defun inf-clojure-ns-vars-form ()
673
717
" Return the form to query inferior Clojure for public vars in a namespace.
674
718
If you are using REPL types, it will pickup the most approapriate
675
719
`inf-clojure-ns-vars-form` variant."
676
720
(pcase (inf-clojure--set-repl-type (inf-clojure-proc))
677
721
(`lumo inf-clojure-ns-vars-form-lumo)
722
+ (`planck inf-clojure-ns-vars-form-lumo)
678
723
(_ inf-clojure-ns-vars-form)))
679
724
680
725
(define-obsolete-variable-alias 'inf-clojure-ns-vars-command 'inf-clojure-ns-vars-form " 2.0.0" )
@@ -685,6 +730,20 @@ If you are using REPL types, it will pickup the most approapriate
685
730
:type 'string
686
731
:package-version '(inf-clojure . " 2.0.0" ))
687
732
733
+ (defcustom inf-clojure-set-ns-form-planck
734
+ " (in-ns '%s)\n "
735
+ " Planck form to set the namespace of the inferior Clojure process."
736
+ :type 'string
737
+ :package-version '(inf-clojure . " 2.0.0" ))
738
+
739
+ (defun inf-clojure-set-ns-form ()
740
+ " Return the form to set the ns of the inferior Clojure process.
741
+ If you are using REPL types, it will pickup the most approapriate
742
+ `inf-clojure-set-ns-form` variant."
743
+ (pcase (inf-clojure--set-repl-type (inf-clojure-proc))
744
+ (`planck inf-clojure-set-ns-form-planck)
745
+ (_ inf-clojure-ns-form)))
746
+
688
747
(define-obsolete-variable-alias 'inf-clojure-set-ns-command 'inf-clojure-set-ns-form " 2.0.0" )
689
748
690
749
(defcustom inf-clojure-apropos-form
@@ -694,6 +753,21 @@ If you are using REPL types, it will pickup the most approapriate
694
753
:type 'string
695
754
:package-version '(inf-clojure . " 2.0.0" ))
696
755
756
+ (defcustom inf-clojure-apropos-form-planck
757
+ " (doseq [var (sort (planck.repl/apropos \" %s\" ))]
758
+ (println (str var)))\n "
759
+ " Planck form to invoke apropos."
760
+ :type 'string
761
+ :package-version '(inf-clojure . " 2.0.0" ))
762
+
763
+ (defun inf-clojure-apropos-form ()
764
+ " Return the form to query inferior Clojure for public vars in a namespace.
765
+ If you are using REPL types, it will pickup the most approapriate
766
+ `inf-clojure-ns-vars-form` variant."
767
+ (pcase (inf-clojure--set-repl-type (inf-clojure-proc))
768
+ (`planck inf-clojure-apropos-form-planck)
769
+ (_ inf-clojure-apropos-form)))
770
+
697
771
(define-obsolete-variable-alias 'inf-clojure-apropos-command 'inf-clojure-apropos-form " 2.0.0" )
698
772
699
773
(defcustom inf-clojure-macroexpand-form
@@ -702,6 +776,20 @@ If you are using REPL types, it will pickup the most approapriate
702
776
:type 'string
703
777
:package-version '(inf-clojure . " 2.0.0" ))
704
778
779
+ (defcustom inf-clojure-macroexpand-form-planck
780
+ " (macroexpand '%s)\n "
781
+ " Planck form to invoke macroexpand."
782
+ :type 'string
783
+ :package-version '(inf-clojure . " 2.0.0" ))
784
+
785
+ (defun inf-clojure-macroexpand-form ()
786
+ " Return the form for macroexpansion in the inferior Clojure process.
787
+ If you are using REPL types, it will pickup the most approapriate
788
+ `inf-clojure-macroexpand-form` variant."
789
+ (pcase (inf-clojure--set-repl-type (inf-clojure-proc))
790
+ (`planck inf-clojure-macroexpand-form-planck)
791
+ (_ inf-clojure-macroexpand-form)))
792
+
705
793
(define-obsolete-variable-alias 'inf-clojure-macroexpand-command 'inf-clojure-macroexpand-form " 2.0.0" )
706
794
707
795
(defcustom inf-clojure-macroexpand-1-form
@@ -710,6 +798,20 @@ If you are using REPL types, it will pickup the most approapriate
710
798
:type 'string
711
799
:package-version '(inf-clojure . " 2.0.0" ))
712
800
801
+ (defcustom inf-clojure-macroexpand-1-form-planck
802
+ " (macroexpand-1 '%s)\n "
803
+ " Planck form to invoke macroexpand-1."
804
+ :type 'string
805
+ :package-version '(inf-clojure . " 2.0.0" ))
806
+
807
+ (defun inf-clojure-macroexpand-1-form ()
808
+ " Return the form for macroexpand-1 in the inferior Clojure process.
809
+ If you are using REPL types, it will pickup the most approapriate
810
+ `inf-clojure-macroexpand-1-form` variant."
811
+ (pcase (inf-clojure--set-repl-type (inf-clojure-proc))
812
+ (`planck inf-clojure-macroexpand-1-planck)
813
+ (_ inf-clojure-macroexpand-1-form)))
814
+
713
815
(define-obsolete-variable-alias 'inf-clojure-macroexpand-1-command 'inf-clojure-macroexpand-1-form " 2.0.0" )
714
816
715
817
; ;; Ancillary functions
@@ -763,7 +865,7 @@ prefix argument PROMPT-FOR-SYMBOL, it prompts for a symbol name."
763
865
(let ((var (if prompt-for-symbol
764
866
(car (inf-clojure-symprompt " Var source" (inf-clojure-symbol-at-point)))
765
867
(inf-clojure-symbol-at-point))))
766
- (comint-proc-query (inf-clojure-proc) (format inf-clojure-var-source-form var))))
868
+ (comint-proc-query (inf-clojure-proc) (format ( inf-clojure-var-source-form) var))))
767
869
768
870
(defun inf-clojure-match-arglists (input-form string )
769
871
" Return the arglists match from INPUT-FORM and STRING.
@@ -825,13 +927,13 @@ PROMPT-FOR-NS, it prompts for a namespace name."
825
927
(clojure-find-ns))))
826
928
(when (or (not ns) (equal ns " " ))
827
929
(user-error " No namespace selected" ))
828
- (comint-proc-query (inf-clojure-proc) (format inf-clojure-set-ns-form ns))))
930
+ (comint-proc-query (inf-clojure-proc) (format ( inf-clojure-set-ns-form) ns))))
829
931
830
932
(defun inf-clojure-apropos (var )
831
933
" Send a form to the inferior Clojure to give apropos for VAR.
832
934
See variable `inf-clojure-apropos-form' ."
833
935
(interactive (inf-clojure-symprompt " Var apropos" (inf-clojure-symbol-at-point)))
834
- (comint-proc-query (inf-clojure-proc) (format inf-clojure-apropos-form var)))
936
+ (comint-proc-query (inf-clojure-proc) (format ( inf-clojure-apropos-form) var)))
835
937
836
938
(defun inf-clojure-macroexpand (&optional macro-1 )
837
939
" Send a form to the inferior Clojure to give apropos for VAR.
@@ -842,8 +944,8 @@ With a prefix arg MACRO-1 uses `inf-clojure-macroexpand-1-form'."
842
944
(inf-clojure--send-string
843
945
(inf-clojure-proc)
844
946
(format (if macro-1
845
- inf-clojure-macroexpand-1-form
846
- inf-clojure-macroexpand-form)
947
+ ( inf-clojure-macroexpand-1-form)
948
+ ( inf-clojure-macroexpand-form) )
847
949
last-sexp))))
848
950
849
951
@@ -1067,5 +1169,22 @@ for evaluation, therefore FORM should not include it."
1067
1169
(string-match-p " \\ Ca*true\\ Ca*" string)))
1068
1170
" Ascertain that PROC is a Lumo REPL." )
1069
1171
1172
+
1173
+ ; ;;; Planck
1174
+ ; ;;; ====
1175
+
1176
+ (defcustom inf-clojure--planck-repl-form
1177
+ " (js/global.hasOwnProperty \" PLANCK_VERSION\" )"
1178
+ " Form to invoke in order to verify that we launched a Planck REPL."
1179
+ :type 'string
1180
+ :package-version '(inf-clojure . " 2.0.0" ))
1181
+
1182
+ (defalias 'inf-clojure--planck-p
1183
+ (apply-partially 'inf-clojure--response-match-p
1184
+ inf-clojure--planck-repl-form
1185
+ (lambda (string )
1186
+ (string-match-p " \\ Ca*true\\ Ca*" string)))
1187
+ " Ascertain that PROC is a Planck REPL." )
1188
+
1070
1189
(provide 'inf-clojure )
1071
1190
; ;; inf-clojure.el ends here
0 commit comments