From 5fcdd037c0b92e498bd05a68f2a3a56ef9b58eb7 Mon Sep 17 00:00:00 2001 From: Ruslan Kamashev Date: Sat, 25 Oct 2025 19:48:52 +0400 Subject: [PATCH] Use agent-shell-select-config for agent selection Replace manual choice building and completing-read with `agent-shell-select-config`, simplifying code and centralizing selection logic. --- agent-shell-sidebar.el | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/agent-shell-sidebar.el b/agent-shell-sidebar.el index 19aa55b..98f43c6 100644 --- a/agent-shell-sidebar.el +++ b/agent-shell-sidebar.el @@ -331,15 +331,8 @@ CONFIG should be an agent config alist." If `agent-shell-sidebar-default-config' is set, use that without prompting. Otherwise, interactively prompt the user to select from `agent-shell-agent-configs'." (or agent-shell-sidebar-default-config - (let* ((configs agent-shell-agent-configs) - (choices (mapcar (lambda (config) - (cons (or (map-elt config :mode-line-name) - (map-elt config :buffer-name) - "Unknown Agent") - config)) - configs)) - (selected-name (completing-read "Select agent: " choices nil t))) - (map-elt choices selected-name)))) + (agent-shell-select-config + :prompt "Select agent: "))) (cl-defun agent-shell-sidebar--save-last-window () "Save the currently selected window before entering sidebar."