aboutsummaryrefslogtreecommitdiff
path: root/modules/ai-term.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-20 23:44:36 -0500
committerCraig Jennings <c@cjennings.net>2026-07-20 23:44:36 -0500
commite83a055602ea2ad6cf8de5909bcbd8e44f2b5c22 (patch)
treef6475411a629139751d4316e8560e071b4cec270 /modules/ai-term.el
parent3a39d41f396bdd825074d7264ebb72149b8cd3b9 (diff)
downloaddotemacs-e83a055602ea2ad6cf8de5909bcbd8e44f2b5c22.tar.gz
dotemacs-e83a055602ea2ad6cf8de5909bcbd8e44f2b5c22.zip
perf(ai-term): fetch the tmux session list once per launch
The launch path spawned tmux list-sessions up to three times: in the project picker's sorting, in the launcher's fresh check, and again inside show-or-create. The list is now fetched once and threaded through; the cycling path still fetches its own.
Diffstat (limited to 'modules/ai-term.el')
-rw-r--r--modules/ai-term.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/ai-term.el b/modules/ai-term.el
index 37eb61de..52494c18 100644
--- a/modules/ai-term.el
+++ b/modules/ai-term.el
@@ -351,16 +351,18 @@ it runs.
EAT renders in terminal frames as well as GUI frames, so this
launches from either."
(interactive "P")
- (let* ((dir (cj/--ai-term-pick-project))
+ ;; One tmux fetch per launch: the same list feeds the picker's sorting,
+ ;; the fresh check here, and show-or-create's own fresh check.
+ (let* ((sessions (cj/--ai-term-live-tmux-sessions))
+ (dir (cj/--ai-term-pick-project sessions))
(name (cj/--ai-term-buffer-name dir))
(existing (get-buffer name))
(fresh (and (not (and existing
(cj/--ai-term-process-live-p existing)))
- (not (cj/--ai-term-session-active-p
- dir (cj/--ai-term-live-tmux-sessions)))))
+ (not (cj/--ai-term-session-active-p dir sessions))))
(command (when fresh
(cj/--ai-term-runtime-command (cj/--ai-term-pick-runtime))))
- (buf (cj/--ai-term-show-or-create dir name command)))
+ (buf (cj/--ai-term-show-or-create dir name command sessions)))
(unless arg
(let ((win (get-buffer-window buf)))
(when win (select-window win))))