@@ -720,6 +720,11 @@ to suppress the usage of the target buffer discovery logic."
720
720
(call-interactively #'inf-clojure )
721
721
(rename-buffer target-buffer-name)))
722
722
723
+ (defun inf-clojure--project-name (dir )
724
+ " Extract a project name from a project DIR.
725
+ The name is simply the final segment of the path."
726
+ (file-name-nondirectory (directory-file-name dir)))
727
+
723
728
;;;### autoload
724
729
(defun inf-clojure (cmd )
725
730
" Run an inferior Clojure process, input and output via buffer `*inf-clojure*' .
@@ -744,26 +749,29 @@ process buffer for a list of commands.)"
744
749
(mapcar #'cdr inf-clojure-startup-forms)
745
750
nil
746
751
'confirm-after-completion ))))
747
- (if (not (comint-check-proc " *inf-clojure*" ))
748
- ; ; run the new process in the project's root when in a project folder
749
- (let ((default-directory (or (clojure-project-dir) default-directory))
750
- (cmdlist (if (consp cmd)
751
- (list cmd)
752
- (split-string cmd)))
753
- (repl-type (or (unless prefix-arg
754
- inf-clojure-custom-repl-type)
755
- (car (rassoc cmd inf-clojure-startup-forms))
756
- (inf-clojure--prompt-repl-type))))
757
- (message " Starting Clojure REPL via `%s' ... " cmd)
758
- (with-current-buffer (apply #'make-comint
759
- " inf-clojure" (car cmdlist) nil (cdr cmdlist))
760
- (inf-clojure-mode)
761
- (setq-local inf-clojure-repl-type repl-type)
762
- (hack-dir-local-variables-non-file-buffer ))))
763
- (setq inf-clojure-buffer (get-buffer " *inf-clojure*" ))
764
- (if inf-clojure-repl-use-same-window
765
- (pop-to-buffer-same-window " *inf-clojure*" )
766
- (pop-to-buffer " *inf-clojure*" )))
752
+ (let* ((project-dir (clojure-project-dir))
753
+ (repl-buffer-name (if project-dir (format " *inf-clojure %s * " (inf-clojure--project-name project-dir)) " *inf-clojure*" ))
754
+ (comint-name (string-trim repl-buffer-name " *" " *" )))
755
+ (if (not (comint-check-proc repl-buffer-name))
756
+ ; ; run the new process in the project's root when in a project folder
757
+ (let ((default-directory (or project-dir default-directory))
758
+ (cmdlist (if (consp cmd)
759
+ (list cmd)
760
+ (split-string cmd)))
761
+ (repl-type (or (unless prefix-arg
762
+ inf-clojure-custom-repl-type)
763
+ (car (rassoc cmd inf-clojure-startup-forms))
764
+ (inf-clojure--prompt-repl-type))))
765
+ (message " Starting Clojure REPL via `%s' ... " cmd)
766
+ (with-current-buffer (apply #'make-comint
767
+ comint-name (car cmdlist) nil (cdr cmdlist))
768
+ (inf-clojure-mode)
769
+ (setq-local inf-clojure-repl-type repl-type)
770
+ (hack-dir-local-variables-non-file-buffer ))))
771
+ (setq inf-clojure-buffer (get-buffer repl-buffer-name))
772
+ (if inf-clojure-repl-use-same-window
773
+ (pop-to-buffer-same-window repl-buffer-name)
774
+ (pop-to-buffer repl-buffer-name))))
767
775
768
776
;;;### autoload
769
777
(defun inf-clojure-connect (host port )
@@ -1436,7 +1444,7 @@ Useful for commands that can invoked outside of an ‘inf-clojure’ buffer
1436
1444
" Send FORM and apply MATCH-P on the result of sending it to PROC.
1437
1445
Note that this function will add a \n to the end of the string
1438
1446
for evaluation, therefore FORM should not include it."
1439
- (funcall match-p (inf-clojure--process-response form proc nil )))
1447
+ p (funcall match-p (inf-clojure--process-response form proc nil )))
1440
1448
1441
1449
(provide 'inf-clojure )
1442
1450
0 commit comments