branch: elpa/aidermacs commit 2894f82973d926c5866464f3e2eaf8f2e1e28c06 Author: Kang Tu <kang...@apple.com> Commit: Kang Tu (aider) <kang...@apple.com>
feat: add key bindings and function to drop current file in Aider buffer --- aider.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/aider.el b/aider.el index 49f3a723ba..43698b47aa 100644 --- a/aider.el +++ b/aider.el @@ -29,7 +29,9 @@ (define-key map (kbd "a") 'aider-run-aider) (define-key map (kbd "z") 'aider-switch-to-buffer) (define-key map (kbd "s") 'aider-add-current-file) + (define-key map (kbd "p") 'aider-drop-current-file) (define-key map (kbd "c") 'aider-send-command) + (define-key map (kbd "d") 'aider-code-command) (define-key map (kbd "q") 'aider-ask-question) (define-key map (kbd "t") 'aider-architect-command) (define-key map (kbd "e") 'aider-region-code-command) @@ -50,8 +52,10 @@ ("a" "Run Aider" aider-run-aider) ("s" "Add Current File" aider-add-current-file) ("z" "Switch to Aider Buffer" aider-switch-to-buffer) + ("p" "Drop Current File" aider-drop-current-file) ] ["Code change" + ("d" "Code Change" aider-code-command) ("e" "Region Code Change" aider-region-code-command) ("u" "Undo Last Change" aider-undo-last-change) ;; Menu item for undo last change ] @@ -139,6 +143,19 @@ COMMAND should be a string representing the command to send." ;; Use the shared helper function to send the command (aider--send-command command))))) +;; New function to send "/drop <current buffer file full path>" to *aider* buffer +(defun aider-drop-current-file () + "Send the command \"/drop <current buffer file full path>\" to the *aider* comint buffer." + (interactive) + ;; Ensure the current buffer is associated with a file + (if (not buffer-file-name) + (message "Current buffer is not associated with a file.") + (let ((file-path (expand-file-name buffer-file-name))) + ;; Construct the command + (let ((command (format "/drop %s" file-path))) + ;; Use the shared helper function to send the command + (aider--send-command command))))) + ;; Function to send a custom command to *aider* buffer (defun aider-send-command (command) "Prompt the user to input COMMAND and send it to the *aider* comint buffer.