From e83a055602ea2ad6cf8de5909bcbd8e44f2b5c22 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 20 Jul 2026 23:44:36 -0500 Subject: 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. --- modules/ai-term.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'modules/ai-term.el') 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)))) -- cgit v1.2.3