branch: elpa/aidermacs
commit 9d7b067a11a3fc771569d9845bbb6c1575cbbebb
Author: Mingde (Matthew) Zeng (aider) <matthew...@posteo.net>
Commit: Mingde (Matthew) Zeng <matthew...@posteo.net>

    feat: Add interactive function to drop files from chat session
---
 aidermacs.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/aidermacs.el b/aidermacs.el
index 9ff7e78d70..83be129d3f 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -375,7 +375,19 @@ Returns a deduplicated list of such file names."
       (progn
         (message "%s" (prin1-to-string files))
         files)
-    (message "No files currently in chat or unable to parse output")))
+    (error "No files currently added to chat or unable to parse output")))
+
+;;;###autoload
+(defun aidermacs-drop-file ()
+  "Drop a file from the chat session by selecting from currently added files."
+  (interactive)
+  (aidermacs--send-command "/ls" t)
+  ;; Wait briefly for output to be processed
+  (sleep-for 0.5)
+  (if-let* ((files (aidermacs-list-added-files))
+            (file (completing-read "Select file to drop: " files nil t)))
+      (aidermacs--send-command (format "/drop %s" file) t)
+    (error "No files available to drop")))
 
 ;;;###autoload
 (defun aidermacs-show-output-history ()

Reply via email to