branch: elpa/aidermacs commit b00f0ad33e361abd44056a2f8fb4ff911c9fcc50 Author: StrawberryTea <l...@strawberrytea.xyz> Commit: GitHub <nore...@github.com>
Add a history variable for aider-plain-read-string (#69) * feat: Add history variable for aider read string inputs * feat: Save aider-read-string-history across Emacs sessions * refactor: Replace with-eval-after-load with conditional savehist handling --- aider.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aider.el b/aider.el index 51ec11911f..8caa550d00 100644 --- a/aider.el +++ b/aider.el @@ -22,6 +22,14 @@ :prefix "aider-" :group 'convenience) +(defvar aider-read-string-history nil + "History list for aider read string inputs.") +(if (bound-and-true-p savehist-loaded) + (add-to-list 'savehist-additional-variables 'aider-read-string-history) + (add-hook 'savehist-mode-hook + (lambda () + (add-to-list 'savehist-additional-variables 'aider-read-string-history)))) + (defcustom aider-program "aider" "The name or path of the aider program." :type 'string @@ -69,7 +77,7 @@ Also based on aider LLM benchmark: https://aider.chat/docs/leaderboards/" (defun aider-plain-read-string (prompt &optional initial-input) "Read a string from the user with PROMPT and optional INITIAL-INPUT. This function can be customized or redefined by the user." - (read-string prompt initial-input)) + (read-string prompt initial-input 'aider-read-string-history)) ;;;###autoload (defalias 'aider-read-string 'aider-plain-read-string)