diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-20 23:44:36 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-20 23:44:36 -0500 |
| commit | e83a055602ea2ad6cf8de5909bcbd8e44f2b5c22 (patch) | |
| tree | f6475411a629139751d4316e8560e071b4cec270 /modules/ai-term-sessions.el | |
| parent | 3a39d41f396bdd825074d7264ebb72149b8cd3b9 (diff) | |
| download | dotemacs-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-sessions.el')
| -rw-r--r-- | modules/ai-term-sessions.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/ai-term-sessions.el b/modules/ai-term-sessions.el index eb09d2e9..57d735d1 100644 --- a/modules/ai-term-sessions.el +++ b/modules/ai-term-sessions.el @@ -351,8 +351,11 @@ the metadata keeps the order ALIST was built in." (cycle-sort-function . identity)) (complete-with-action action alist string predicate)))) -(defun cj/--ai-term-pick-project () +(defun cj/--ai-term-pick-project (&optional sessions) "Prompt for an AI-agent project; return its absolute path. +SESSIONS, when non-nil, is a pre-fetched result of +`cj/--ai-term-live-tmux-sessions', so a caller that already paid for the +tmux subprocess can thread it through instead of spawning another. Candidates come from `cj/--ai-term-candidates', ordered by `cj/--ai-term-sort-candidates' so projects with a live tmux session @@ -368,7 +371,7 @@ Signals `user-error' when no candidates exist." (append cj/ai-term-project-roots cj/ai-term-container-roots) ", "))) - (let* ((sessions (cj/--ai-term-live-tmux-sessions)) + (let* ((sessions (or sessions (cj/--ai-term-live-tmux-sessions))) (sorted (cj/--ai-term-sort-candidates candidates sessions)) (display-alist (mapcar (lambda (p) |
