branch: elpa/aidermacs
commit 090eebdbf5a75203a6b9a9460edaa34bf1259e6f
Author: Mingde (Matthew) Zeng <[email protected]>
Commit: Mingde (Matthew) Zeng <[email protected]>
Fix more lintings
---
.gitignore | 1 +
aidermacs-backend-comint.el | 2 +-
aidermacs-backend-vterm.el | 2 +-
aidermacs-backends.el | 6 ++--
aidermacs-doom.el | 79 ---------------------------------------------
aidermacs-helm.el | 43 ------------------------
aidermacs-models.el | 10 +++---
aidermacs.el | 38 +++++++++-------------
8 files changed, 26 insertions(+), 155 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4632933235..7364d48a21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.aider*
.env
__pycache__
+/*.elc
diff --git a/aidermacs-backend-comint.el b/aidermacs-backend-comint.el
index a3febb065a..06967020bd 100644
--- a/aidermacs-backend-comint.el
+++ b/aidermacs-backend-comint.el
@@ -1,7 +1,7 @@
;;; aidermacs-backend-comint.el --- Comint backend for aidermacs.el -*-
lexical-binding: t; -*-
;; Author: Mingde (Matthew) Zeng <[email protected]>
;; Version: 0.5.0
-;; Package-Requires: ((emacs "26.1") (transient "0.3.0"))
+;; Package-Requires: ((emacs "28.1") (transient "0.8.4"))
;; Keywords: ai emacs agents llm aider ai-pair-programming, convenience, tools
;; URL: https://github.com/MatthewZMD/aidermacs.el
;; Originally forked from: Kang Tu <[email protected]> Aider.el
diff --git a/aidermacs-backend-vterm.el b/aidermacs-backend-vterm.el
index 74275a8500..5fbef78148 100644
--- a/aidermacs-backend-vterm.el
+++ b/aidermacs-backend-vterm.el
@@ -1,7 +1,7 @@
;;; aidermacs-backend-vterm.el --- VTerm backend for aidermacs.el -*-
lexical-binding: t; -*-
;; Author: Mingde (Matthew) Zeng <[email protected]>
;; Version: 0.5.0
-;; Package-Requires: ((emacs "26.1") (transient "0.3.0"))
+;; Package-Requires: ((emacs "28.1") (transient "0.8.4"))
;; Keywords: ai emacs agents llm aider ai-pair-programming, convenience, tools
;; URL: https://github.com/MatthewZMD/aidermacs.el
;; Originally forked from: Kang Tu <[email protected]> Aider.el
diff --git a/aidermacs-backends.el b/aidermacs-backends.el
index 581e7ab321..58b2add7be 100644
--- a/aidermacs-backends.el
+++ b/aidermacs-backends.el
@@ -1,7 +1,7 @@
;;; aidermacs-backends.el --- Backend implementations for aidermacs.el -*-
lexical-binding: t; -*-
;; Author: Mingde (Matthew) Zeng <[email protected]>
;; Version: 0.5.0
-;; Package-Requires: ((emacs "26.1") (transient "0.3.0"))
+;; Package-Requires: ((emacs "28.1") (transient "0.8.4"))
;; Keywords: ai emacs agents llm aider ai-pair-programming, convenience, tools
;; URL: https://github.com/MatthewZMD/aidermacs.el
;; Originally forked from: Kang Tu <[email protected]> Aider.el
@@ -21,8 +21,8 @@
(defcustom aidermacs-backend 'comint
"Backend to use for the aidermacs process.
-Options are 'comint (the default) or 'vterm. When set to 'vterm, aidermacs
will
-launch a fully functional vterm buffer (with bracketed paste support) instead
+Options are `'comint' (the default) or `'vterm'. When set to `'vterm',
+aidermacs launches a fully functional vterm buffer instead
of using a comint process."
:type '(choice (const :tag "Comint" comint)
(const :tag "VTerm" vterm))
diff --git a/aidermacs-doom.el b/aidermacs-doom.el
deleted file mode 100644
index f314125d1b..0000000000
--- a/aidermacs-doom.el
+++ /dev/null
@@ -1,79 +0,0 @@
-;;; aidermacs-doom.el --- Description -*- lexical-binding: t; no-byte-compile:
t -*-
-;; Author: Mingde (Matthew) Zeng <[email protected]>
-;; Version: 0.5.0
-;; Package-Requires: ((emacs "26.1") (transient "0.3.0"))
-;; Keywords: ai emacs agents llm aider ai-pair-programming, convenience, tools
-;; URL: https://github.com/MatthewZMD/aidermacs.el
-;; Originally forked from: Kang Tu <[email protected]> Aider.el
-;;
-;; This file is not part of GNU Emacs.
-;;
-;;; Commentary:
-;;
-;; Doom integration for aidermacs
-;;
-;;; Code:
-
-(defun aidermacs-doom-setup-keys ()
- "Setup aidermacs keybindings if the current buffer is in a git repository."
- (when (and (featurep 'doom-keybinds)
- (vc-backend (or (buffer-file-name) default-directory)))
- (map! :leader
- (:prefix ("A" . "aidermacs")
- ;; Core Actions
- :desc "Start/Open Session" "."
#'aidermacs-run-in-current-dir
- :desc "Change Model" "o" #'aidermacs-change-model
- :desc "Reset Session" "s" #'aidermacs-reset
- :desc "Exit Session" "x" #'aidermacs-exit
-
- ;; Quick Actions
- :desc "Add Current File" "f" #'aidermacs-add-current-file
- :desc "Code Change" "c" #'aidermacs-code-change
- :desc "Refactor" "r" #'aidermacs-function-or-region-refactor
- :desc "Go Ahead" "g" #'aidermacs-go-ahead
- :desc "Undo Change" "u" #'aidermacs-undo-last-change
-
- ;; File Commands
- (:prefix ("F" . "File Commands")
- :desc "Add Current File" "f"
#'aidermacs-add-current-file
- :desc "Add File Interactively" "i"
#'aidermacs-add-files-interactively
- :desc "Add Current Read-Only" "r"
#'aidermacs-add-current-file-read-only
- :desc "Add Current Window Files" "w"
#'aidermacs-add-files-in-current-window
- :desc "Add Current Directory Files" "d"
#'aidermacs-add-same-type-files-under-dir
- :desc "Add Dired Marked Files" "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 "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 Change" "u"
#'aidermacs-undo-last-change)
-
- ;; 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 "Explain This Code" "e"
#'aidermacs-function-or-region-explain
- :desc "Explain This Symbol" "p"
#'aidermacs-explain-symbol-under-point
-
- ;; Others
- :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
- :desc "Clear Buffer" "l" #'aidermacs-clear
- :desc "Aider Help" "h" #'aidermacs-help
- ))))
-
-;; Add the setup function to appropriate hooks
-(add-hook 'find-file-hook #'aidermacs-doom-setup-keys)
-(add-hook 'dired-mode-hook #'aidermacs-doom-setup-keys)
-(add-hook 'after-change-major-mode-hook #'aidermacs-doom-setup-keys)
-
-(provide 'aidermacs-doom)
-;;; aidermacs-doom.el ends here
diff --git a/aidermacs-helm.el b/aidermacs-helm.el
deleted file mode 100644
index 94d40a7759..0000000000
--- a/aidermacs-helm.el
+++ /dev/null
@@ -1,43 +0,0 @@
-;;; aidermacs-helm.el --- Helm completion for aidermacs.el -*-
lexical-binding: t; -*-
-;; Author: Mingde (Matthew) Zeng <[email protected]>
-;; Version: 0.5.0
-;; Package-Requires: ((emacs "26.1") (helm "3.9.0"))
-;; Keywords: ai emacs agents llm aider ai-pair-programming, convenience, tools
-;; URL: https://github.com/MatthewZMD/aidermacs.el
-;; Originally forked from: Kang Tu <[email protected]> Aider.el
-
-;;; Commentary:
-;; Optional Helm completion interface for aidermacs.el
-;; To use this, ensure both aidermacs.el and helm are installed.
-
-;;; Code:
-
-(require 'helm)
-(require 'cl-lib) ; For `cl-subseq`
-
-(defun aidermacs-helm-read-string (prompt &optional initial-input)
- "Read a string with Helm completion for aidermacs, showing historical inputs.
-PROMPT is the prompt string to display.
-INITIAL-INPUT is optional initial input string to prefill."
- (let ((input (helm-comp-read
- prompt
- aidermacs-read-string-history
- :must-match nil
- :name "Aidermacs Input"
- :fuzzy t
- :initial-input initial-input)))
- ;; Add to history if non-empty
- (unless (string-empty-p input)
- (add-to-history 'aidermacs-read-string-history input))
- input))
-
-(declare-function aidermacs-read-string "aidermacs")
-
-;;;###autoload
-(with-eval-after-load 'aidermacs
- (if (featurep 'helm)
- (defalias 'aidermacs-read-string 'aidermacs-helm-read-string)
- (message "Helm is not available. Please install helm package to use
aidermacs-helm features")))
-
-(provide 'aidermacs-helm)
-;;; aidermacs-helm.el ends here
diff --git a/aidermacs-models.el b/aidermacs-models.el
index 355f32117f..b5d26abcc2 100644
--- a/aidermacs-models.el
+++ b/aidermacs-models.el
@@ -1,7 +1,7 @@
;;; aidermacs-models.el --- Model selection for aidermacs.el -*-
lexical-binding: t; -*-
;; Author: Mingde (Matthew) Zeng <[email protected]>
;; Version: 0.5.0
-;; Package-Requires: ((emacs "26.1") (transient "0.3.0"))
+;; Package-Requires: ((emacs "28.1") (transient "0.3.0"))
;; Keywords: ai emacs agents llm aider ai-pair-programming, convenience, tools
;; URL: https://github.com/MatthewZMD/aidermacs.el
;; Originally forked from: Kang Tu <[email protected]> Aider.el
@@ -55,8 +55,7 @@ Defaults to `aidermacs-default-model` if not explicitly set."
"o1-mini"
"gemini/gemini-2.0-flash"
"r1"
- "deepseek/deepseek-chat"
- )
+ "deepseek/deepseek-chat")
"List of available AI models for selection.
Each model should be in the format expected by the aidermacs CLI.
Also based on aidermacs LLM benchmark:
https://aidermacs.chat/docs/leaderboards/"
@@ -69,7 +68,8 @@ Also based on aidermacs LLM benchmark:
https://aidermacs.chat/docs/leaderboards/
(defun aidermacs--fetch-openai-compatible-models (url)
"Fetch available models from an OpenAI compatible API endpoint.
URL should be the base API endpoint, e.g. https://api.openai.com/v1.
-Returns a list of model names with appropriate prefixes based on the API
provider."
+Returns a list of model names with appropriate prefixes based on the
+API provider."
(let* ((url-parsed (url-generic-parse-url url))
(hostname (url-host url-parsed))
(prefix (cond ((string= hostname "api.openai.com") "openai")
@@ -175,7 +175,5 @@ This is useful when available models have changed."
(aidermacs--select-model)
(aidermacs--get-available-models)))
-
(provide 'aidermacs-models)
-
;;; aidermacs-models.el ends here
diff --git a/aidermacs.el b/aidermacs.el
index 9c616844a2..efb2e33f1c 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -1,7 +1,7 @@
-;;; aidermacs.el --- aidermacs package for interactive conversation with aider
-*- lexical-binding: t; -*-a
+;;; aidermacs.el --- Aidermacs package for interactive conversation with aider
-*- lexical-binding: t; -*-
;; Author: Mingde (Matthew) Zeng <[email protected]>
;; Version: 0.5.0
-;; Package-Requires: ((emacs "26.1") (transient "0.3.0"))
+;; Package-Requires: ((emacs "28.1") (transient "0.8.4"))
;; Keywords: ai emacs agents llm aider ai-pair-programming, convenience, tools
;; URL: https://github.com/MatthewZMD/aidermacs.el
;; Originally forked from: Kang Tu <[email protected]> Aider.el
@@ -35,7 +35,7 @@
:group 'aidermacs)
(define-obsolete-variable-alias 'aidermacs-args 'aidermacs-extra-args "0.5.0"
- "Old name for `aidermacs-extra-args', please update your config to use the
new name.")
+ "Old name for `aidermacs-extra-args', please update your config.")
(defcustom aidermacs-config-file nil
"Path to aider configuration file.
@@ -46,8 +46,7 @@ ignoring other configuration settings except
`aidermacs-extra-args'."
:group 'aidermacs)
(defcustom aidermacs-extra-args '()
- "Additional arguments to pass to the aidermacs command.
-The model argument will be added automatically based on
`aidermacs-default-model'."
+ "Additional arguments to pass to the aidermacs command."
:type '(repeat string)
:group 'aidermacs)
@@ -93,13 +92,6 @@ This is the file name without path."
(defvar aidermacs-read-string-history nil
"History list for aidermacs read string inputs.")
-(if (bound-and-true-p savehist-loaded)
- (add-to-list 'savehist-additional-variables 'aidermacs-read-string-history)
- (add-hook 'savehist-mode-hook
- (lambda ()
- (add-to-list 'savehist-additional-variables
'aidermacs-read-string-history))))
-
-
;;;###autoload
(defun aidermacs-plain-read-string (prompt &optional initial-input)
"Read a string from the user with PROMPT and optional INITIAL-INPUT.
@@ -287,7 +279,8 @@ This is useful for working in monorepos where you want to
limit aider's scope."
(defun aidermacs--send-command (command &optional switch-to-buffer)
"Send command to the corresponding aidermacs process.
-COMMAND is the text to send. If SWITCH-TO-BUFFER is non-nil, switch to the
aidermacs buffer."
+COMMAND is the text to send.
+If SWITCH-TO-BUFFER is non-nil, switch to the aidermacs buffer."
(let* ((buffer-name (aidermacs-buffer-name))
(buffer (or (get-buffer buffer-name)
(progn (aidermacs-run)
@@ -299,7 +292,8 @@ COMMAND is the text to send. If SWITCH-TO-BUFFER is
non-nil, switch to the aide
(defun aidermacs--send-command-redirect (command callback)
"Send command to the corresponding aidermacs process in the background.
-COMMAND is the text to send. CALLBACK will be called with the command output
when available."
+COMMAND is the text to send.
+CALLBACK will be called with the command output when available."
(let* ((buffer-name (aidermacs-buffer-name))
(buffer (or (get-buffer buffer-name)
(progn (aidermacs-run)
@@ -375,7 +369,7 @@ The full command will be \"COMMAND-PREFIX <current buffer
file full path>\"."
;;;###autoload
(defun aidermacs-drop-current-file ()
- "Send the command \"/drop <current buffer file full path>\" to the
corresponding aider comint buffer."
+ "Drop the current file from aidermacs session."
(interactive)
(aidermacs-act-on-current-file "/drop"))
@@ -514,21 +508,21 @@ If cursor is inside a function, include the function name
as context."
;;;###autoload
(defun aidermacs-ask-question-general ()
- "Prompt the user for a general question and send it to aidemracs prefixed
with \"/ask \"."
+ "Prompt the user for a general question prefixed with \"/ask \"."
(interactive)
(when-let ((command (aidermacs--form-prompt "/ask" "Ask general question"
t)))
(aidermacs--send-command command t)))
;;;###autoload
(defun aidermacs-help ()
- "Prompt the user for an input and send it to aidemracs prefixed with \"/help
\"."
+ "Prompt the user for an input prefixed with \"/help \"."
(interactive)
(when-let ((command (aidermacs--form-prompt "/help" nil t)))
(aidermacs--send-command command t)))
;;;###autoload
(defun aidermacs-architect-discussion ()
- "Prompt the user for an input and send it to aidemracs prefixed with
\"/architect \"."
+ "Prompt the user for an input prefixed with \"/architect \"."
(interactive)
(when-let ((command (aidermacs--form-prompt "/architect" "Architect
Discussion")))
(aidermacs--send-command command t)))
@@ -562,7 +556,6 @@ If Magit is not installed, report that it is required."
(interactive)
(aidermacs--send-command "/undo"))
-;;;###autoload
(defun aidermacs--form-prompt (command prompt-prefix &optional ignore-context)
"Get command based on context with COMMAND and PROMPT-PREFIX.
COMMAND is the text to prepend. PROMPT-PREFIX is the text to add after
COMMAND.
@@ -601,7 +594,7 @@ If point is in a function, explain that function."
;;;###autoload
(defun aidermacs-explain-symbol-under-point ()
- "Ask aidermacs to explain symbol under point, given the code line as
background info."
+ "Ask aidermacs to explain symbol under point."
(interactive)
(let* ((symbol (thing-at-point 'symbol))
(line (buffer-substring-no-properties
@@ -701,7 +694,7 @@ With prefix argument `C-u', add as READ-ONLY."
(defun aidermacs-write-unit-test ()
"Generate unit test code for current buffer.
Do nothing if current buffer is not visiting a file.
-If current buffer filename contains 'test':
+If current buffer filename contains `test':
- If cursor is inside a test function, implement that test
- Otherwise show message asking to place cursor inside a test function
Otherwise:
@@ -881,7 +874,8 @@ These are exact filename matches (including the dot
prefix)."
(defun aidermacs--should-enable-minor-mode-p (filename)
"Determine if `aidermacs-minor-mode' should be enabled for FILENAME.
-Returns t if the file matches any of the patterns in
`aidermacs-auto-mode-files'."
+Returns t if the file matches any of the patterns in
+`aidermacs-auto-mode-files'."
(when filename
(let ((base-name (file-name-nondirectory filename)))
(member base-name aidermacs-auto-mode-files))))