Skip to content

Commit a6d146a

Browse files
committed
fix: shell-project-buffers
1 parent 1b13953 commit a6d146a

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

agent-shell-menu.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ When a permission request is pending, permission responses are spliced into the
322322

323323
;;; Project session switching
324324

325-
(defun agent-shell-extras--same-project-buffers ()
325+
;;;###autoload
326+
(defun agent-shell-menu-project-buffers ()
326327
"Return live agent-shell buffers sharing the current buffer's project directory."
327328
(let ((dir default-directory)
328329
(cb (current-buffer)))
@@ -336,7 +337,7 @@ When a permission request is pending, permission responses are spliced into the
336337
(defun agent-shell-switch-project-session ()
337338
"Switch to another agent-shell session in the same project directory."
338339
(interactive)
339-
(let ((bufs (or (agent-shell-extras--same-project-buffers)
340+
(let ((bufs (or (agent-shell-menu-project-buffers)
340341
(user-error "No other agent-shell sessions for this project"))))
341342
(switch-to-buffer
342343
(get-buffer

test/test-agent-shell-menu.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,18 @@ produced 'Each alist entry must be a cons cell; got: #<buffer ...>'."
214214
(should-error (agent-shell-extras--pick-buffer "test: ") :type 'user-error)))
215215

216216
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
217-
;;; agent-shell-extras--same-project-buffers
217+
;;; agent-shell-menu-project-buffers
218218

219219
(ert-deftest agent-shell-menu/same-project-buffers-empty-when-no-agent-buffers ()
220220
(with-temp-buffer
221221
(cl-letf (((symbol-function 'agent-shell-buffers) (lambda () nil)))
222-
(should (null (agent-shell-extras--same-project-buffers))))))
222+
(should (null (agent-shell-menu-project-buffers))))))
223223

224224
(ert-deftest agent-shell-menu/same-project-buffers-excludes-current-buffer ()
225225
(with-temp-buffer
226226
(let ((cur (current-buffer)))
227227
(cl-letf (((symbol-function 'agent-shell-buffers) (lambda () (list cur))))
228-
(should (null (agent-shell-extras--same-project-buffers)))))))
228+
(should (null (agent-shell-menu-project-buffers)))))))
229229

230230
(ert-deftest agent-shell-menu/same-project-buffers-includes-same-dir-buffer ()
231231
(let ((other (generate-new-buffer "*mock-agent*")))
@@ -235,7 +235,7 @@ produced 'Each alist entry must be a cons cell; got: #<buffer ...>'."
235235
(with-current-buffer other
236236
(setq-local default-directory "/tmp/test-proj/"))
237237
(cl-letf (((symbol-function 'agent-shell-buffers) (lambda () (list other))))
238-
(should (memq other (agent-shell-extras--same-project-buffers)))))
238+
(should (memq other (agent-shell-menu-project-buffers)))))
239239
(kill-buffer other))))
240240

241241
(ert-deftest agent-shell-menu/same-project-buffers-excludes-different-dir-buffer ()
@@ -246,7 +246,7 @@ produced 'Each alist entry must be a cons cell; got: #<buffer ...>'."
246246
(with-current-buffer other
247247
(setq-local default-directory "/tmp/proj-b/"))
248248
(cl-letf (((symbol-function 'agent-shell-buffers) (lambda () (list other))))
249-
(should (null (agent-shell-extras--same-project-buffers)))))
249+
(should (null (agent-shell-menu-project-buffers)))))
250250
(kill-buffer other))))
251251

252252
(ert-deftest agent-shell-menu/same-project-buffers-returns-only-matching ()
@@ -261,7 +261,7 @@ produced 'Each alist entry must be a cons cell; got: #<buffer ...>'."
261261
(setq-local default-directory "/tmp/different/"))
262262
(cl-letf (((symbol-function 'agent-shell-buffers)
263263
(lambda () (list match other))))
264-
(let ((result (agent-shell-extras--same-project-buffers)))
264+
(let ((result (agent-shell-menu-project-buffers)))
265265
(should (memq match result))
266266
(should-not (memq other result)))))
267267
(kill-buffer match)
@@ -464,7 +464,7 @@ not a raw buffer list or a single annotation string."
464464
(let* ((other (generate-new-buffer "*mock-proj-session*"))
465465
captured-table)
466466
(unwind-protect
467-
(cl-letf (((symbol-function 'agent-shell-extras--same-project-buffers)
467+
(cl-letf (((symbol-function 'agent-shell-menu-project-buffers)
468468
(lambda () (list other)))
469469
((symbol-function 'agent-shell--buffer-annotation) (lambda (_) "ann"))
470470
((symbol-function 'annotated-completing-read)

0 commit comments

Comments
 (0)