branch: elpa/aidermacs commit d9e15165f3e0c979f9d7ba63d293eb7b4ff2a906 Author: Kang Tu <tni...@gmail.com> Commit: GitHub <nore...@github.com>
Feat: new function - aider-add-files-in-current-window (#11) * feat: Add function to add files in current window to Aider buffer * re-organize menu --- aider.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aider.el b/aider.el index 0f20b0fe38..6ff439c804 100644 --- a/aider.el +++ b/aider.el @@ -55,8 +55,9 @@ This function can be customized or redefined by the user." ] ["Add file to aider" ("f" "Add Current File" aider-add-current-file) - ("F" "Find Files in the Git Repo" aider-repo-find-name-dired) + ("w" "Add All Files in Current Window" aider-add-files-in-current-window) ("b" "Batch Add Dired Marked Files" aider-batch-add-dired-marked-files) + ("F" "Find Files in the Git Repo" aider-repo-find-name-dired) ("R" "Open Git Repo Root Dired" aider-git-repo-root-dired) ] ["Code change" @@ -302,6 +303,21 @@ The command will be formatted as \"/architect \" followed by the user command an map) "Keymap for Aider Minor Mode.") +;; New function to add files in all buffers in current emacs window +(defun aider-add-files-in-current-window () + "Add files in all buffers in the current Emacs window to the Aider buffer." + (interactive) + (let ((files (mapcar (lambda (buffer) + (with-current-buffer buffer + (when buffer-file-name + (expand-file-name buffer-file-name)))) + (mapcar 'window-buffer (window-list))))) + (setq files (delq nil files)) + (if files + (let ((command (concat "/add " (mapconcat 'identity files " ")))) + (aider--send-command command t)) + (message "No files found in the current window.")))) + ;; Define the Aider Minor Mode (define-minor-mode aider-minor-mode "Minor mode for Aider with keybindings."