branch: elpa/aidermacs
commit d57f52202b046047880638744bee5ff0694813f6
Author: Kang Tu <[email protected]>
Commit: GitHub <[email protected]>
Feat: Improve loading of aider-helm.el (#28)
* increase log history to 10k
* refactor: Modify buffer switching to use custom function
* feat: Add syntax highlighting from source buffer to aider comint mode
fix: Remove non-existent font-lock-keywords-keywords function call
refactor: Simplify font-lock handling in aider-run-aider function
refactor: Improve syntax highlighting for aider comint buffer
fix: Remove unnecessary trailing parenthesis in aider.el
refactor: Enhance syntax highlighting for aider buffer with source buffer's
mode
refactor: Improve syntax highlighting inheritance in aider-run-aider
function
refactor: Remove unnecessary blank lines in aider.el
docs: Convert comments in aider-run-aider to English
refactor: Simplify aider-run-aider function and extract source highlighting
logic
* feat: Add autoload cookies to interactive functions in aider.el
* refactor: Conditionally inherit syntax highlighting for prog-mode buffers
* move font-lock code into when block
* feat: Add syntax highlighting inheritance message in aider buffer
* feat: Add initial-input support to helm string reading functions
* feat: Add aider-function-refactor for refactoring function under cursor
* re-indent, adjust menu item. update README
* fix typo
* docs: improve documentation clarity and formatting
* refactor: Restructure aider-helm.el for optional Helm support
* docs: improve README formatting and aider-minor-mode docs
---
README.org | 60 ++++++++++++++++++++++++++++++++++++++++++-----------------
aider-helm.el | 23 ++++++++++++++++++++---
aider.el | 12 ++++++------
3 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/README.org b/README.org
index 6f39284a56..e1b8375744 100644
--- a/README.org
+++ b/README.org
@@ -2,34 +2,34 @@
* Introduction
-- Do you like the AI features of [[https://www.cursor.com/][Cursor AI Code
Editor]], but prefer to stay within Emacs?
+- Do you like the AI features of the [[https://www.cursor.com/][Cursor AI Code
Editor]] but prefer to stay within Emacs?
-- [[https://github.com/paul-gauthier/aider][Aider]] is well-known, really good
AI pair programming in the terminal.
+- [[https://github.com/paul-gauthier/aider][Aider]] is a well-known and highly
effective AI pair programming tool for the terminal.
-- aider.el provides an interactive interface to communicate with Aider in
emacs.
- - Most of the Elisp code in this repository was generated by aider /
aider.el.
+- The `aider.el` package offers an interactive interface to communicate with
Aider in Emacs.
+ - Most of the Elisp code in this repository was generated by Aider or
`aider.el`.
-* Why Use aider.el in Emacs?
+* Why Use `aider.el` in Emacs?
- Pop-up Menu: No need to remember commands. (aider-transient-menu)
[[file:./transient_menu.png]]
-- Git Repository-Specific aider Sessions in Emacs: Automatically identify the
Git repository of the current file and create a new aider session for it.
Multiple aider sessions can exist for different Git repositories.
+- Git Repository-Specific Aider Sessions in Emacs: Automatically identify the
Git repository of the current file and create a new Aider session for it.
Multiple Aider sessions can exist for different Git repositories.
-- More ways to add files to aider buffer
- - Add current buffer file: (aider-add-current-file)
- - Add all buffers in current window: (aider-add-files-in-current-window)
- - Batch add files from dired buffer (aider-batch-add-dired-marked-files):
Add multiple Dired marked files to the Aider buffer.
+- More ways to add files to the Aider buffer:
+ - Add the current buffer file: (`aider-add-current-file`)
+ - Add all buffers in the current window:
(`aider-add-files-in-current-window`)
+ - Batch add files from the Dired buffer:
(`aider-batch-add-dired-marked-files`) Add multiple Dired marked files to the
Aider buffer.
-- Refactor function under cursor
- - (aider-function-refactor): Ask aider to refactor the function under
cursor given your instruction.
+- Refactor function under the cursor:
+ - (`aider-function-refactor`): Ask Aider to refactor the function under the
cursor given your instruction.
-- Region-Based Explain / Refactor Support
- - Explain: (aider-region-explain): You can select a region (e.g., a code
block) in a file and ask aider to explain it.
- - Refactor: (aider-region-refactor): Ask aider to refactor it given your
input instruction
+- Region-Based Explain / Refactor Support:
+ - Explain: (`aider-region-explain`): Select a region (e.g., a code block) in
a file and ask Aider to explain it.
+ - Refactor: (`aider-region-refactor`): Ask Aider to refactor it given your
input instruction.
-- And More: Add your own Elisp functions to support your use case. You can
certainly ask aider / aider.el to do that.
+- And More: Add your own Elisp functions to support your use case. You can
certainly ask Aider / `aider.el` to do that.
* Installation
@@ -79,9 +79,35 @@ The aider prefix is "A".
** Optional
-- You might want to try [[./aider-helm.el][aider-helm.el]]. That file added
support of command history and completion from helm.
+*** Optional Helm Support
+
+You can enable Helm-based completion in two ways:
+
+1. Using use-package:
+
+#+BEGIN_SRC emacs-lisp
+ ;; Basic aider installation
+ (use-package aider
+ :straight (:host github :repo "tninja/aider.el" :files ("aider.el")))
+
+ ;; Optional helm support
+ (use-package aider-helm
+ :straight (:host github :repo "tninja/aider.el" :files ("aider-helm.el"))
+ :after (aider helm))
+#+END_SRC
+
+2. Manual loading:
+
+#+BEGIN_SRC emacs-lisp
+ ;; Load helm support after both aider and helm are loaded
+ (with-eval-after-load 'helm
+ (require 'aider-helm))
+#+END_SRC
+
+*** Aider script interactive mode: aider-minor-mode
- If you enjoy writing aider command in a separate file and send them to aider
session, just like working on python or R script and send code block into REPL,
you might want to try aider-minor-mode. It by default bind C-c C-n to send
current line to aider session, and C-c C-c to send current region to aider
session.
+ - Enable aider-minor-mode for your editing buffer
- To automatically enable aider-minor-mode to any file with aider inside
filename
#+BEGIN_SRC emacs-lisp
diff --git a/aider-helm.el b/aider-helm.el
index 520dae3980..60c0fad8f8 100644
--- a/aider-helm.el
+++ b/aider-helm.el
@@ -1,4 +1,16 @@
-;; optional helm based completion, need to be manually loaded when needed
+;;; aider-helm.el --- Helm completion for aider.el -*- lexical-binding: t; -*-
+
+;; Author: Kang Tu <[email protected]>
+;; Version: 0.2.0
+;; Package-Requires: ((emacs "25.1") (helm "3.0"))
+;; Keywords: convenience, tools
+;; URL: https://github.com/tninja/aider.el
+
+;;; Commentary:
+;; Optional Helm completion interface for aider.el
+;; To use this, ensure both aider.el and helm are installed.
+
+;;; Code:
(require 'helm)
(require 'cl-lib) ; For `cl-subseq`
@@ -38,6 +50,11 @@ PROMPT is the prompt string.
INITIAL-INPUT is optional initial input string."
(helm-read-string-with-history prompt "aider-helm-read-string-history.el"
initial-input))
-(defalias 'aider-read-string 'aider-helm-read-string)
+(declare-function aider-read-string "aider")
+
+;;;###autoload
+(with-eval-after-load 'aider
+ (defalias 'aider-read-string 'aider-helm-read-string))
-;; how to copy candidate to mini-buffer? C-c C-y:
https://emacs.stackexchange.com/questions/47588/in-a-helm-prompt-how-do-i-copy-a-candidate-for-editing
+(provide 'aider-helm)
+;;; aider-helm.el ends here
diff --git a/aider.el b/aider.el
index f1081a2261..d312a2b0fd 100644
--- a/aider.el
+++ b/aider.el
@@ -58,28 +58,28 @@ This function can be customized or redefined by the user."
;;;###autoload (autoload 'aider-transient-menu "aider" "Transient menu for
Aider commands." t)
(transient-define-prefix aider-transient-menu ()
"Transient menu for Aider commands."
- ["Aider: AI pair programming"
- ["Aider process"
+ ["Aider: AI Pair Programming"
+ ["Aider Process"
("a" "Run Aider" aider-run-aider)
("z" "Switch to Aider Buffer" aider-switch-to-buffer)
("l" "Clear Aider" aider-clear)
("s" "Reset Aider" aider-reset)
("x" "Exit Aider" aider-exit)
]
- ["Add file to aider"
+ ["Add File to Aider"
("f" "Add Current File" aider-add-current-file)
("o" "Add Current File Read-Only" aider-current-file-read-only)
("w" "Add All Files in Current Window" aider-add-files-in-current-window)
("b" "Batch Add Dired Marked Files" aider-batch-add-dired-marked-files)
- ("F" "Find Files in the Git Repo" aider-repo-find-name-dired)
+ ("F" "Find Files in Git Repo" aider-repo-find-name-dired)
("R" "Open Git Repo Root Dired" aider-git-repo-root-dired)
]
- ["Code change"
+ ["Code Change"
("c" "Code Change" aider-code-change)
("t" "Architect Discuss and Change" aider-architect-discussion)
("R" "Refactor Function Under Cursor" aider-function-refactor)
("r" "Refactor Code in Selected Region" aider-region-refactor)
- ("m" "Show last commit with magit" aider-magit-show-last-commit)
+ ("m" "Show Last Commit with Magit" aider-magit-show-last-commit)
("u" "Undo Last Change" aider-undo-last-change)
]
["Discussion"