@@ -358,12 +358,12 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
358
358
(defun inf-clojure--modeline-info ()
359
359
" Return modeline info for `inf-clojure-minor-mode' .
360
360
Either \" no process\" or \" buffer-name(repl-type)\" "
361
- (let ((inf-buffer (inf-clojure--get-buffer))))
362
- (if (and (bufferp inf-buffer)
363
- (buffer-live-p inf-buffer))
364
- (with-current-buffer inf-buffer
365
- (format " %s (%s )" (buffer-name (current-buffer )) inf-clojure-repl-type))
366
- " no process" ))
361
+ (let ((inf-buffer (inf-clojure--get-buffer)))
362
+ (if (and (bufferp inf-buffer)
363
+ (buffer-live-p inf-buffer))
364
+ (with-current-buffer inf-buffer
365
+ (format " %s (%s )" (buffer-name (current-buffer )) inf-clojure-repl-type))
366
+ " no process" ) ))
367
367
368
368
(defvar inf-clojure-mode-map
369
369
(let ((map (make-sparse-keymap )))
@@ -867,10 +867,19 @@ HOST is the host the process is running on, PORT is where it's listening."
867
867
(inf-clojure (cons host port)))
868
868
869
869
(defvar-local inf-clojure-socket-callback nil
870
- " Used to transfer state between the socket process and the inf-clojure-connect process/bufffer." )
870
+ " Used to transfer state between the socket process and the
871
+ inf-clojure-connect process/buffer." )
871
872
872
873
(defcustom inf-clojure-cli-args nil
873
- " Arguments to be supplied when the clojure repl type is used e.g -Mdev." )
874
+ " Arguments to be supplied when the clojure repl type is used e.g -Mdev."
875
+ :type 'string
876
+ :safe #'stringp )
877
+
878
+ (defcustom inf-clojure-cljs-cli-args " -m cljs.main"
879
+ " Arguments to be supplied when the cljs repl type is used e.g \" -Mdev:client -e (start-cljs)\" ."
880
+ :type 'string
881
+ :safe #'stringp )
882
+
874
883
875
884
(defun inf-clojure-socket-filter (process output )
876
885
" A filter that gets triggered each time the socket receives new OUTPUT.
@@ -895,6 +904,25 @@ OUTPUT is the latest data received from the process"
895
904
(when inf-clojure-socket-callback
896
905
(funcall inf-clojure-socket-callback)))))))
897
906
907
+ (defvar inf-clojure-socket-forms
908
+ `((lein . (concat " JVM_OPTS='-Dclojure.server.repl="
909
+ " {:port %s :accept clojure.core.server/repl}' lein repl" ))
910
+ (boot . (concat " export BOOT_JVM_OPTIONS='-Dclojure.server.repl="
911
+ " \" {:port %s :accept clojure.core.server/repl}\" ' boot repl" ))
912
+ (clojure . ,(concat
913
+ " clojure"
914
+ " -J-Dclojure.server.repl="
915
+ " \" {:port %s :accept clojure.core.server/repl}\" " ))
916
+ (cljs . ,(concat
917
+ " clojure"
918
+ " -J-Dclojure.server.repl="
919
+ " \" {:port %s :accept clojure.core.server/repl}\" " ))
920
+ (lein-clr . ,(concat " JVM_OPTS='-Dclojure.server.repl="
921
+ " {:port %s :accept clojure.core.server/repl}' lein clr repl" ))
922
+ (planck . " planck -n %s" )
923
+ (babashka . " bb socket-repl %s" )))
924
+
925
+
898
926
;;;### autoload
899
927
(defun inf-clojure-socket (&optional &rest args )
900
928
" Starts a socket REPL server and connects to it via `inf-clojure' .
@@ -916,7 +944,7 @@ VALUE must be a number specifying the port for the socket to listen.
916
944
917
945
`:repl-type'
918
946
919
- VALUE must be a valid repl type, given as a string e.g clojure/cljs/lein/babashka.
947
+ VALUE must be a valid repl type, given as a string e.g clojure/cljs/lein/babashka. Note that `joker' and `lumo' are not supported.
920
948
921
949
`:project-name'
922
950
@@ -934,13 +962,14 @@ VALUE can be any string, by default this is either derived from your current dir
934
962
(socket-buffer-name (format " *%s -%s -socket* " project-name repl-type))
935
963
(socket-buffer (get-buffer-create socket-buffer-name))
936
964
(repl-buffer-name (format " %s -%s -repl" project-name repl-type))
965
+ (socket-form (cdr (assoc (intern repl-type) inf-clojure-socket-forms)))
966
+ (socket-cmd (concat (format socket-form (number-to-string port))
967
+ (cond ((string= repl-type " clojure" ) inf-clojure-cli-args)
968
+ ((string= repl-type " cljs" ) inf-clojure-cljs-cli-args)
969
+ (t nil ))))
937
970
(sock (start-file-process-shell-command
938
971
socket-process-name socket-buffer
939
- (concat " clojure"
940
- " -J-Dclojure.server.repl=\" {:port "
941
- (number-to-string port)
942
- " :accept clojure.core.server/repl}\" "
943
- inf-clojure-cli-args))))
972
+ socket-cmd)))
944
973
(with-current-buffer socket-buffer
945
974
(setq-local
946
975
inf-clojure-socket-callback
@@ -952,7 +981,7 @@ VALUE can be any string, by default this is either derived from your current dir
952
981
repl-buffer-name)
953
982
(inf-clojure-connect host port))))
954
983
(set-process-filter sock #'inf-clojure-socket-filter )
955
- (message " Starting socket server at %s :%s " host port)))
984
+ (message " Starting socket server at %s :%s with ' %s ' " host port socket-cmd )))
956
985
957
986
958
987
(defun inf-clojure--forms-without-newlines (str )
0 commit comments