branch: elpa/aidermacs
commit a051885a92f939425452b7cb3536faaa072a76d1
Author: Kang Tu <[email protected]>
Commit: Kang Tu (aider) <[email protected]>
feat: add aider-debug function to replace newlines and send to Aider buffer
with menu entry
---
aider.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/aider.el b/aider.el
index 45339a4f96..b4d75c6362 100644
--- a/aider.el
+++ b/aider.el
@@ -46,6 +46,7 @@ This function can be customized or redefined by the user."
["Discussion"
("q" "Ask Question" aider-ask-question)
("t" "Architect Discussion" aider-architect-discussion)
+ ("d" "Debug Command" aider-debug) ;; Menu item for debug command
]
["Other"
("g" "General Command" aider-general-command)
@@ -169,6 +170,18 @@ COMMAND should be a string representing the command to
send."
(let ((command (aider-read-string "Enter architect command: ")))
(aider-send-command-with-prefix "/architect " command)))
+;; New function to get command from user and send it prefixed with "/debug "
+(defun aider-debug ()
+ "Prompt the user for a command and send it to the corresponding aider comint
buffer prefixed with \"/debug \",
+replacing all newline characters except for the one at the end."
+ (interactive)
+ (let ((command (read-string "Enter debug command: ")))
+ ;; Replace all newline characters with a space, except for the last one
+ (setq command (replace-regexp-in-string "\n" " " command))
+ (when (string-match-p "\n" command)
+ (setq command (concat (string-trim command) "\n"))) ;; Add a newline at
the end
+ (aider--send-command (concat "/debug " command))))
+
;; Modified function to get command from user and send it based on selected
region
(defun aider-undo-last-change ()
"Undo the last change made by Aider."