[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-clojure 07b2738 301/313: Include the project name auto
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-clojure 07b2738 301/313: Include the project name automatically in the REPL buffer name |
Date: |
Wed, 11 Aug 2021 10:00:38 -0400 (EDT) |
branch: elpa/inf-clojure
commit 07b27380c4ce456ad112fedfc0e98be2abd07cfc
Author: Bozhidar Batsov <bozhidar@batsov.com>
Commit: Bozhidar Batsov <bozhidar@batsov.com>
Include the project name automatically in the REPL buffer name
---
CHANGELOG.md | 1 +
inf-clojure.el | 50 +++++++++++++++++++++++++++++---------------------
2 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1468d2b..a1b244d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
* [#190](https://github.com/clojure-emacs/inf-clojure/pull/190): Helper
function `inf-clojure-set-repl` to select inf-clojure process buffer.
* Auto-enable `inf-clojure-minor-mode` after invoking `inf-clojure`. This
behaviour is controlled via `inf-clojure-auto-mode`.
+* Include the project name automatically in the REPL buffer name.
### Bugs fixed
diff --git a/inf-clojure.el b/inf-clojure.el
index 84b9d38..6d1bbab 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -720,6 +720,11 @@ to suppress the usage of the target buffer discovery
logic."
(call-interactively #'inf-clojure)
(rename-buffer target-buffer-name)))
+(defun inf-clojure--project-name (dir)
+ "Extract a project name from a project DIR.
+The name is simply the final segment of the path."
+ (file-name-nondirectory (directory-file-name dir)))
+
;;;###autoload
(defun inf-clojure (cmd)
"Run an inferior Clojure process, input and output via buffer
`*inf-clojure*'.
@@ -744,26 +749,29 @@ process buffer for a list of commands.)"
(mapcar #'cdr
inf-clojure-startup-forms)
nil
'confirm-after-completion))))
- (if (not (comint-check-proc "*inf-clojure*"))
- ;; run the new process in the project's root when in a project folder
- (let ((default-directory (or (clojure-project-dir) default-directory))
- (cmdlist (if (consp cmd)
- (list cmd)
- (split-string cmd)))
- (repl-type (or (unless prefix-arg
- inf-clojure-custom-repl-type)
- (car (rassoc cmd inf-clojure-startup-forms))
- (inf-clojure--prompt-repl-type))))
- (message "Starting Clojure REPL via `%s'..." cmd)
- (with-current-buffer (apply #'make-comint
- "inf-clojure" (car cmdlist) nil (cdr
cmdlist))
- (inf-clojure-mode)
- (setq-local inf-clojure-repl-type repl-type)
- (hack-dir-local-variables-non-file-buffer))))
- (setq inf-clojure-buffer (get-buffer "*inf-clojure*"))
- (if inf-clojure-repl-use-same-window
- (pop-to-buffer-same-window "*inf-clojure*")
- (pop-to-buffer "*inf-clojure*")))
+ (let* ((project-dir (clojure-project-dir))
+ (repl-buffer-name (if project-dir (format "*inf-clojure %s*"
(inf-clojure--project-name project-dir)) "*inf-clojure*"))
+ (comint-name (string-trim repl-buffer-name "*" "*")))
+ (if (not (comint-check-proc repl-buffer-name))
+ ;; run the new process in the project's root when in a project
folder
+ (let ((default-directory (or project-dir default-directory))
+ (cmdlist (if (consp cmd)
+ (list cmd)
+ (split-string cmd)))
+ (repl-type (or (unless prefix-arg
+ inf-clojure-custom-repl-type)
+ (car (rassoc cmd inf-clojure-startup-forms))
+ (inf-clojure--prompt-repl-type))))
+ (message "Starting Clojure REPL via `%s'..." cmd)
+ (with-current-buffer (apply #'make-comint
+ comint-name (car cmdlist) nil (cdr
cmdlist))
+ (inf-clojure-mode)
+ (setq-local inf-clojure-repl-type repl-type)
+ (hack-dir-local-variables-non-file-buffer))))
+ (setq inf-clojure-buffer (get-buffer repl-buffer-name))
+ (if inf-clojure-repl-use-same-window
+ (pop-to-buffer-same-window repl-buffer-name)
+ (pop-to-buffer repl-buffer-name))))
;;;###autoload
(defun inf-clojure-connect (host port)
@@ -1436,7 +1444,7 @@ Useful for commands that can invoked outside of an
‘inf-clojure’ buffer
"Send FORM and apply MATCH-P on the result of sending it to PROC.
Note that this function will add a \n to the end of the string
for evaluation, therefore FORM should not include it."
- (funcall match-p (inf-clojure--process-response form proc nil)))
+p (funcall match-p (inf-clojure--process-response form proc nil)))
(provide 'inf-clojure)
- [nongnu] elpa/inf-clojure f1c8323 261/313: Fix some wording, (continued)
- [nongnu] elpa/inf-clojure f1c8323 261/313: Fix some wording, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 23492b5 263/313: Trim some whitespace, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 8be9cec 269/313: Use kbd-style keybindings everywhere, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 68ab0f7 282/313: Bump the required Emacs version, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 81e0912 287/313: Tweak some features, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 675e9be 290/313: Handle newlines between forms for `inf-clojure-eval-buffer`, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure b601d48 266/313: Tweak the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 91145b0 293/313: Function to select repls as the current active connection, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure d79e4eb 299/313: Remove a redundant call to with-current-buffer, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 397272d 300/313: Auto-enable inf-clojure-minor-mode on starting inf-clojure, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 07b2738 301/313: Include the project name automatically in the REPL buffer name,
ELPA Syncer <=
- [nongnu] elpa/inf-clojure c3ff2f4 308/313: Add a note about comint, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 37cfe85 307/313: Update some wording, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 696e5ef 309/313: Add a link to Discord, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 49b2257 310/313: Remove the TOC, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure fcf30b5 210/313: README: Add instructions for including socket config in .dir-locals.el or .emacs., ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure b53074a 216/313: Tweak README and discourage terminal REPLs, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure e14dbba 145/313: Update the commentary section of the package, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 59868ff 218/313: Remove quotes from reload and fix argument parsing (#148), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure d0d269d 226/313: Tweak the changelog, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 2445af7 235/313: Add insert commands to the changelog, ELPA Syncer, 2021/08/11