branch: elpa/aidermacs
commit 4159552f3f2ac26767f6aa72662a00e23351ca25
Author: Mingde (Matthew) Zeng <[email protected]>
Commit: Mingde (Matthew) Zeng <[email protected]>
Sync aidermacs-doom with transient menus and improve code organization
- Reorganized aidermacs-doom keybindings to better match transient menu
structure
- Added missing "Architect Discuss" command to code actions
- Improved consistency between ask-question commands:
- Renamed `aidermacs-ask-question` to `aidermacs-ask-question-context`
- Standardized prompt text across question commands
- Enhanced error handling in `aidermacs-get-last-output`
- Simplified `aidermacs-debug-exception` implementation
- Updated menu descriptions for better clarity
- Grouped related commands in both transient menus and doom keybindings
- Fixed minor formatting issues in transient menu definitions
---
aidermacs-doom.el | 44 ++++++++++++++++++++++++--------------------
aidermacs.el | 38 ++++++++++++++++++++------------------
2 files changed, 44 insertions(+), 38 deletions(-)
diff --git a/aidermacs-doom.el b/aidermacs-doom.el
index 25150d1d99..662cbdc2fd 100644
--- a/aidermacs-doom.el
+++ b/aidermacs-doom.el
@@ -33,37 +33,41 @@
:desc "Refactor" "r" #'aidermacs-function-or-region-refactor
:desc "Go Ahead" "g" #'aidermacs-go-ahead
- ;; File Commands
+ ;; File & Code
(:prefix ("F" . "File Commands")
- :desc "Add Current File" "f"
#'aidermacs-add-current-file
- :desc "Add File Interactively" "i"
#'aidermacs-add-files-interactively
- :desc "Add Window Files" "w"
#'aidermacs-add-files-in-current-window
- :desc "Add Directory Files" "d"
#'aidermacs-add-same-type-files-under-dir
- :desc "Add Dired Marked" "m"
#'aidermacs-batch-add-dired-marked-files
- :desc "Drop File Interactively" "j"
#'aidermacs-drop-file
- :desc "Drop Current File" "k"
#'aidermacs-drop-current-file
- :desc "Drop All Files" "a"
#'aidermacs-drop-all-files
- :desc "List Files" "l" #'aidermacs-list-added-files)
+ :desc "File Commands" "F"
#'aidermacs-transient-file-commands
+ ;; File Actions
+ :desc "Add Current File" "f"
#'aidermacs-add-current-file
+ :desc "Add File Interactively" "i"
#'aidermacs-add-files-interactively
+ :desc "Add Window Files" "w"
#'aidermacs-add-files-in-current-window
+ :desc "Add Directory Files" "d"
#'aidermacs-add-same-type-files-under-dir
+ :desc "Add Dired Marked" "m"
#'aidermacs-batch-add-dired-marked-files
+ :desc "Drop File Interactively" "j"
#'aidermacs-drop-file
+ :desc "Drop Current File" "k"
#'aidermacs-drop-current-file
+ :desc "Drop All Files" "a"
#'aidermacs-drop-all-files
+ :desc "List Files" "l"
#'aidermacs-list-added-files)
- ;; Code Commands
(:prefix ("C" . "Code Commands")
- :desc "Code Change" "c" #'aidermacs-code-change
- :desc "Refactor Code" "r"
#'aidermacs-function-or-region-refactor
- :desc "Implement TODO" "i"
#'aidermacs-implement-todo
- :desc "Write Tests" "t" #'aidermacs-write-unit-test
- :desc "Fix Test" "T"
#'aidermacs-fix-failing-test-under-cursor
- :desc "Debug Exception" "x"
#'aidermacs-debug-exception
- :desc "Undo Auto Git Commit" "u"
#'aidermacs-undo-last-commit)
+ :desc "Code Commands" "C"
#'aidermacs-transient-code-commands
+ ;; Code Actions
+ :desc "Code Change" "c" #'aidermacs-code-change
+ :desc "Refactor Code" "r"
#'aidermacs-function-or-region-refactor
+ :desc "Architect Discuss" "a"
#'aidermacs-architect-discussion
+ :desc "Implement TODO" "i"
#'aidermacs-implement-todo
+ :desc "Write Tests" "t" #'aidermacs-write-unit-test
+ :desc "Fix Test" "T"
#'aidermacs-fix-failing-test-under-cursor
+ :desc "Debug Exception" "x"
#'aidermacs-debug-exception
+ :desc "Undo Auto Git Commit" "u"
#'aidermacs-undo-last-commit)
;; Understanding
:desc "Show Last Commit" "m"
#'aidermacs-magit-show-last-commit
:desc "Ask General Question" "Q"
#'aidermacs-ask-question-general
- :desc "Ask Question" "q" #'aidermacs-ask-question
+ :desc "Ask Question" "q" #'aidermacs-ask-question-context
:desc "Explain This Code" "e"
#'aidermacs-function-or-region-explain
:desc "Explain This Symbol" "p"
#'aidermacs-explain-symbol-under-point
;; Others
- :desc "Toggle Architect Mode" "A"
#'aidermacs-toggle-architect-mode
+ :desc "Toggle Architect Mode (Separate Reasoner/Editor)"
"A" #'aidermacs-toggle-architect-mode
:desc "Session History" "H" #'aidermacs-show-output-history
:desc "Copy Last Aidermacs Output" "L"
#'aidermacs-get-last-output
:desc "Clear Model Selection Cache" "O"
#'aidermacs-clear-model-cache
diff --git a/aidermacs.el b/aidermacs.el
index efb2e33f1c..81add5274c 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -131,13 +131,15 @@ PROMPT is the text to display. INITIAL-INPUT is the
default value."
(transient-define-prefix aidermacs-transient-code-commands ()
"Code modification commands."
["Code Actions"
- ("c" "Code Change" aidermacs-code-change)
- ("r" "Refactor Code" aidermacs-function-or-region-refactor)
- ("i" "Implement TODO" aidermacs-implement-todo)
- ("t" "Write Tests" aidermacs-write-unit-test)
- ("T" "Fix Test" aidermacs-fix-failing-test-under-cursor)
- ("x" "Debug Exception" aidermacs-debug-exception)
- ("u" "Undo Auto Git Commit" aidermacs-undo-last-commit)])
+ [("c" "Code Change" aidermacs-code-change)
+ ("r" "Refactor Code" aidermacs-function-or-region-refactor)
+ ("a" "Architect Discuss" aidermacs-architect-discussion)]
+
+ [("i" "Implement TODO" aidermacs-implement-todo)
+ ("t" "Write Tests" aidermacs-write-unit-test)
+ ("T" "Fix Test" aidermacs-fix-failing-test-under-cursor)
+ ("x" "Debug Exception" aidermacs-debug-exception)]
+ [("u" "Undo Auto Git Commit" aidermacs-undo-last-commit)]])
;; Main transient menu
(transient-define-prefix aidermacs-transient-menu ()
@@ -163,7 +165,7 @@ PROMPT is the text to display. INITIAL-INPUT is the
default value."
["Understanding"
("m" "Show Last Commit" aidermacs-magit-show-last-commit)
("Q" "Ask General Question" aidermacs-ask-question-general)
- ("q" "Ask Question" aidermacs-ask-question)
+ ("q" "Ask Question" aidermacs-ask-question-context)
("e" "Explain This Code" aidermacs-function-or-region-explain)
("p" "Explain This Symbol" aidermacs-explain-symbol-under-point)]
@@ -487,13 +489,14 @@ Sends the \"/ls\" command and returns the list of files
via callback."
(defun aidermacs-get-last-output ()
"Get the most recent output from aidermacs."
(interactive)
- (message aidermacs--current-output)
- (kill-new aidermacs--current-output)
- aidermacs--current-output)
+ (when (stringp aidermacs--current-output)
+ (message aidermacs--current-output)
+ (kill-new aidermacs--current-output)
+ aidermacs--current-output))
;;;###autoload
-(defun aidermacs-ask-question ()
+(defun aidermacs-ask-question-context ()
"Prompt the user for a question.
If a region is active, append the region text to the question.
If cursor is inside a function, include the function name as context."
@@ -501,7 +504,7 @@ If cursor is inside a function, include the function name
as context."
;; Dispatch to general question if in aidermacs buffer
(when (string= (buffer-name) (aidermacs-buffer-name))
(call-interactively 'aidermacs-ask-question-general)
- (cl-return-from aidermacs-ask-question))
+ (cl-return-from aidermacs-ask-question-context))
(aidermacs-add-current-file)
(when-let ((command (aidermacs--form-prompt "/ask" "Ask")))
(aidermacs--send-command command t)))
@@ -510,7 +513,7 @@ If cursor is inside a function, include the function name
as context."
(defun aidermacs-ask-question-general ()
"Prompt the user for a general question prefixed with \"/ask \"."
(interactive)
- (when-let ((command (aidermacs--form-prompt "/ask" "Ask general question"
t)))
+ (when-let ((command (aidermacs--form-prompt "/ask" "Ask question" t)))
(aidermacs--send-command command t)))
;;;###autoload
@@ -524,16 +527,15 @@ If cursor is inside a function, include the function name
as context."
(defun aidermacs-architect-discussion ()
"Prompt the user for an input prefixed with \"/architect \"."
(interactive)
- (when-let ((command (aidermacs--form-prompt "/architect" "Architect
Discussion")))
+ (when-let ((command (aidermacs--form-prompt "/architect" "Discuss")))
(aidermacs--send-command command t)))
;;;###autoload
(defun aidermacs-debug-exception ()
"Prompt the user for an input and send it to aidemracs prefixed with
\"/debug \"."
(interactive)
- (when-let ((user-command (aidermacs--form-prompt "/ask" "Enter exception,
can be multiple lines")))
- (let ((command (concat "/ask Investigate the following exception, with
current added files as context: " user-command)))
- (aidermacs--send-command command t))))
+ (when-let ((command (aidermacs--form-prompt "/ask" "Debug exception")))
+ (aidermacs--send-command command t)))
;;;###autoload
(defun aidermacs-go-ahead ()