branch: elpa/aidermacs
commit 7b05676948fd6a5d0c1d59c06965d5ec9046512c
Author: Julien Tant <785518+julient...@users.noreply.github.com>
Commit: GitHub <nore...@github.com>

    Using universal argument prompts user to change `aider-args` (#57)
    
    * allow using universal argument to change the args
    
    * fix
    
    * Update README
---
 README.org |  1 +
 aider.el   | 17 +++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index 537cb0a257..0d450a9155 100644
--- a/README.org
+++ b/README.org
@@ -21,6 +21,7 @@
   - (`aider-run-aider`): Creates a comint-based, *git repo-specific Aider 
session* for interactive conversation.
     - Git repository identification is based on the current file's path
     - Multiple Aider sessions can run simultaneously for different Git 
repositories
+When being called with the universal argument (`C-u`), a prompt will offer the 
user to change the content of `aider-args` for this session.
   - (`aider-switch-to-buffer`): Switch to the Aider buffer.
     - use "^" in the menu to toggle open aider session in other window inside 
current frame, or open a dedicate frame for aider session
 
diff --git a/aider.el b/aider.el
index 5e7d11a137..b7c9ebaf50 100644
--- a/aider.el
+++ b/aider.el
@@ -174,14 +174,20 @@ If not in a git repository, an error is raised."
               font-lock-keywords-case-fold-search 
source-keywords-case-fold-search)))))
 
 ;;;###autoload
-(defun aider-run-aider ()
-  "Create a comint-based buffer and run \"aider\" for interactive 
conversation."
-  (interactive)
+(defun aider-run-aider (&optional edit-args)
+  "Create a comint-based buffer and run \"aider\" for interactive conversation.
+With the universal argument, prompt to edit aider-args before running."
+  (interactive "P")
   (let* ((buffer-name (aider-buffer-name))
          (comint-terminfo-terminal "dumb")
+         (current-args (if edit-args
+                           (split-string
+                            (read-string "Edit aider arguments: "
+                                        (mapconcat 'identity aider-args " ")))
+                         aider-args))
          (source-buffer (window-buffer (selected-window))))
     (unless (comint-check-proc buffer-name)
-      (apply 'make-comint-in-buffer "aider" buffer-name aider-program nil 
aider-args)
+      (apply 'make-comint-in-buffer "aider" buffer-name aider-program nil 
current-args)
       (with-current-buffer buffer-name
         (comint-mode)
         (font-lock-add-keywords nil aider-font-lock-keywords t)
@@ -192,8 +198,7 @@ If not in a git repository, an error is raised."
           (font-lock-mode 1)
           (font-lock-ensure)
           (message "Aider buffer syntax highlighting inherited from %s"
-                   (with-current-buffer source-buffer major-mode)))
-        ))
+                   (with-current-buffer source-buffer major-mode)))))
     (aider-switch-to-buffer)))
 
 ;; Function to switch to the Aider buffer

Reply via email to