branch: elpa/aidermacs
commit f6458bcd8a12dd475b37c6b720bc535fbc06cc1b
Author: Mingde (Matthew) Zeng <[email protected]>
Commit: Mingde (Matthew) Zeng <[email protected]>
Add aidermacs-add-files-interactively
---
README.md | 8 ++++++++
aidermacs-doom.el | 1 +
aidermacs.el | 21 ++++++++++++++++-----
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index fbf1f62300..b84f11475b 100644
--- a/README.md
+++ b/README.md
@@ -60,6 +60,7 @@ With `Aidermacs`, you get:
- List files currently in chat with `M-x aidermacs-list-added-files`
- Drop specific files from chat with `M-x aidermacs-drop-file`
- View output history with `M-x aidermacs-show-output-history`
+ - Interactively select files to add with `M-x
aidermacs-add-files-interactively`
- and more
6. Greater Configurability
@@ -183,6 +184,8 @@ From the transient menu:
- `.` Start in current directory (good for monorepos)
- `^` Toggle "Start in New Frame" option
- `o` Change AI model
+- `s` Reset session
+- `x` Exit session
The session buffer will be named `*aidermacs:your-repo-name*` where you can
interact with the AI.
@@ -193,6 +196,11 @@ Most common operations are available directly:
- `r` Refactor code at point/region
- `d` Drop current file from chat
- `g` Accept AI's proposal ("go ahead")
+- `u` Undo last change
+- `Q` Ask general question
+- `q` Ask question about current code
+- `e` Explain code at point/region
+- `p` Explain symbol under point
#### 3. Specialized Commands
Access more specific commands through submenus:
diff --git a/aidermacs-doom.el b/aidermacs-doom.el
index d04b1ab527..fcdff8fe0d 100644
--- a/aidermacs-doom.el
+++ b/aidermacs-doom.el
@@ -25,6 +25,7 @@
:desc "File read-only" "f"
#'aidermacs-add-current-file-read-only
:desc "Files in window" "w"
#'aidermacs-add-files-in-current-window
:desc "Add Same Type Files under dir" "d"
#'aidermacs-add-same-type-files-under-dir
+ :desc "Add files interactively" "i"
#'aidermacs-add-files-interactively
:desc "Batch direct marked files" "b"
#'aidermacs-batch-add-dired-marked-files
)
diff --git a/aidermacs.el b/aidermacs.el
index db7cab72d3..9190a967ae 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -131,13 +131,14 @@ This function can be customized or redefined by the user."
["File Actions"
["Add File Actions"
("f" "Add Current File" aidermacs-add-current-file)
- ("r" "Add Read-Only" aidermacs-add-current-file-read-only)
- ("w" "Add Window Files" aidermacs-add-files-in-current-window)
- ("d" "Add Directory Files" aidermacs-add-same-type-files-under-dir)
- ("m" "Add Marked Files" aidermacs-batch-add-dired-marked-files)]
+ ("i" "Add File Interactively" aidermacs-add-files-interactively)
+ ("r" "Add Current Read-Only" aidermacs-add-current-file-read-only)
+ ("w" "Add Current Window Files" aidermacs-add-files-in-current-window)
+ ("d" "Add Current Directory Files" aidermacs-add-same-type-files-under-dir)
+ ("m" "Add Dired Marked Files" aidermacs-batch-add-dired-marked-files)]
["Drop Actions"
- ("j" "Drop File" aidermacs-drop-file)
+ ("j" "Drop File Interactively" aidermacs-drop-file)
("k" "Drop Current File" aidermacs-drop-current-file)]
[("l" "List Files" aidermacs-list-added-files)]])
@@ -622,6 +623,16 @@ If point is in a function, explain that function."
(aidermacs--send-command command t))
(message "No files marked in Dired."))))
+;;;###autoload
+(defun aidermacs-add-files-interactively ()
+ "Add files to aidermacs by interactively selecting them using `find-file`.
+Multiple files can be selected by calling the command multiple times."
+ (interactive)
+ (when-let ((file (expand-file-name (read-file-name "Select file to add: "))))
+ (if (file-exists-p file)
+ (aidermacs--send-command (concat "/add " file) t)
+ (message "File does not exist: %s" file))))
+
;;;###autoload
(defun aidermacs-add-same-type-files-under-dir ()
"Add all files with same suffix as current file under current directory to
aidermacs.