@@ -319,7 +319,8 @@ fully initialized."
319
319
((pred identity) (pop-to-buffer buffer)))
320
320
(with-current-buffer buffer
321
321
(cider-repl--insert-banner)
322
- (cider-repl--insert-startup-commands)
322
+ (cider-repl--insert-param-values `((:cljs-repl-type " cljs repl type:" ,#'symbol-name )
323
+ (:repl-init-form " cljs repl startup command:" )))
323
324
(when-let* ((window (get-buffer-window buffer t )))
324
325
(with-selected-window window
325
326
(recenter (- -1 scroll-margin))))
@@ -334,27 +335,25 @@ fully initialized."
334
335
(insert-before-markers
335
336
(propertize (cider-repl--help-banner) 'font-lock-face 'font-lock-comment-face ))))
336
337
337
- (defun cider-repl--insert-startup-commands ()
338
- " Insert the commands used to create the repl."
339
- (let ((params cider-saved-params))
340
- (cl-labels
341
- ((emit-comment
342
- (string )
343
- (insert-before-markers
344
- (propertize string 'font-lock-face 'font-lock-comment-face )))
345
- (emit-command
346
- (desc prop &optional transform)
347
- (let ((transform (or transform #'identity )))
348
- (when-let ((command (plist-get params prop)))
349
- (emit-comment
350
- (concat " ;; " desc " \n ;; " (funcall transform command) " \n " ))))))
351
- (emit-comment " ;;\n " )
352
- (emit-command " repl startup command:" :jack-in-cmd )
353
- (when (plist-get params :repl-init-form )
354
- (emit-comment " ;;\n " )
355
- (emit-command " repl type:" :cljs-repl-type #'symbol-name )
356
- (emit-command " cljs startup command:" :repl-init-form ))
357
- (emit-comment " \n " ))))
338
+ (defun cider-repl--insert-param-values (param-tuples )
339
+ " Insert the values from params specified in PARAM-TUPLES.
340
+ PARAM-TUPLES are tuples of (param-key description) or (param-key
341
+ description transform) where transform is called with the param-value if
342
+ present."
343
+ (cl-labels
344
+ ((emit-comment
345
+ (string )
346
+ (insert-before-markers
347
+ (propertize
348
+ (if (string-blank-p string) " ;;\n " (concat " ;; " string " \n " ))
349
+ 'font-lock-face 'font-lock-comment-face ))))
350
+ (mapc (lambda (param-tuple )
351
+ (cl-destructuring-bind (param-key desc &optional transform) param-tuple
352
+ (when-let ((value (plist-get cider-saved-params param-key)))
353
+ (emit-comment " " )
354
+ (emit-comment (concat desc " : " (funcall (or transform #'identity ) value))))))
355
+ param-tuples)
356
+ (emit-comment " " )))
358
357
359
358
(defun cider-repl--banner ()
360
359
" Generate the welcome REPL buffer banner."
@@ -367,13 +366,15 @@ fully initialized."
367
366
;; Javadoc: (javadoc java-object-or-class)
368
367
;; Exit: <C-c C-q>
369
368
;; Results: Stored in vars *1, *2, *3, an exception in *e;
369
+ ;; Startup: %s
370
370
"
371
371
(plist-get nrepl-endpoint :host )
372
372
(plist-get nrepl-endpoint :port )
373
373
(cider--version)
374
374
(cider--nrepl-version)
375
375
(cider--clojure-version)
376
- (cider--java-version)))
376
+ (cider--java-version)
377
+ (plist-get cider-saved-params :jack-in-cmd )))
377
378
378
379
(defun cider-repl--help-banner ()
379
380
" Generate the help banner."
0 commit comments