@@ -753,22 +753,24 @@ process buffer for a list of commands.)"
753753 (repl-buffer-name (if project-dir
754754 (format " *inf-clojure %s * " (inf-clojure--project-name project-dir))
755755 " *inf-clojure*" )))
756- (if (not (comint-check-proc repl-buffer-name))
757- ; ; run the new process in the project's root when in a project folder
758- (let ((default-directory (or project-dir default-directory))
759- (cmdlist (if (consp cmd)
760- (list cmd)
761- (split-string cmd)))
762- (repl-type (or (unless prefix-arg
763- inf-clojure-custom-repl-type)
764- (car (rassoc cmd inf-clojure-startup-forms))
765- (inf-clojure--prompt-repl-type))))
766- (message " Starting Clojure REPL via `%s' ... " cmd)
767- (with-current-buffer (apply #'make-comint
768- " inf-clojure" (car cmdlist) nil (cdr cmdlist))
769- (inf-clojure-mode)
770- (setq-local inf-clojure-repl-type repl-type)
771- (hack-dir-local-variables-non-file-buffer ))))
756+ ; ; Create a new comint buffer if needed
757+ (unless (comint-check-proc repl-buffer-name)
758+ ; ; run the new process in the project's root when in a project folder
759+ (let ((default-directory (or project-dir default-directory))
760+ (cmdlist (if (consp cmd)
761+ (list cmd)
762+ (split-string cmd)))
763+ (repl-type (or (unless prefix-arg
764+ inf-clojure-custom-repl-type)
765+ (car (rassoc cmd inf-clojure-startup-forms))
766+ (inf-clojure--prompt-repl-type))))
767+ (message " Starting Clojure REPL via `%s' ... " cmd)
768+ (with-current-buffer (apply #'make-comint
769+ " inf-clojure" (car cmdlist) nil (cdr cmdlist))
770+ (inf-clojure-mode)
771+ (setq-local inf-clojure-repl-type repl-type)
772+ (hack-dir-local-variables-non-file-buffer ))))
773+ ; ; update the default comint buffer and switch to it
772774 (setq inf-clojure-buffer (get-buffer repl-buffer-name))
773775 (if inf-clojure-repl-use-same-window
774776 (pop-to-buffer-same-window repl-buffer-name)
0 commit comments