branch: elpa/aidermacs commit e829b9e2964a41aa1b1754c44dd46031fb2d5d0d Author: Reza A'masyi <mnurrr...@gmail.com> Commit: Matthew Zeng <matthew...@gmail.com>
feat: Split read-only files config into global and project --- aidermacs.el | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/aidermacs.el b/aidermacs.el index 22c723c2ea..6cb1ddd1c2 100644 --- a/aidermacs.el +++ b/aidermacs.el @@ -77,8 +77,15 @@ ignoring other configuration settings except `aidermacs-extra-args'." "Additional arguments to pass to the aidermacs command." :type '(repeat string)) -(defcustom aidermacs-read-only-files '() - "When non-nil, add read-only files to the aidermacs session." +(defcustom aidermacs-global-read-only-files '() + "When non-nil, add read-only files to the aidermacs session. This +is for files that are set not relative to project +directory, ie. project agnostic" + :type '(repeat string)) + +(defcustom aidermacs-project-read-only-files '() + "When non-nil, add read-only files to the aidermacs session. This +is for files that exist relative to the project root." :type '(repeat string)) (defcustom aidermacs-subtree-only nil @@ -341,10 +348,15 @@ This function sets up the appropriate arguments and launches the process." (list "--weak-model" aidermacs-weak-model)) (when aidermacs-subtree-only '("--subtree-only")) - (when aidermacs-read-only-files + (when aidermacs-global-read-only-files (apply #'append - (mapcar (lambda (file) (list "--read" file)) - aidermacs-read-only-files)))))) + (mapcar (lambda (file) (list "--read" file)) + aidermacs-global-read-only-files))) + (when aidermacs-project-read-only-files + (apply #'append + (mapcar (lambda (file) (list "--read" + (expand-file-name file (aidermacs-project-root)))) + aidermacs-project-read-only-files)))))) ;; Take the original aidermacs-extra-args instead of the flat ones (final-args (append backend-args aidermacs-extra-args))) (if (aidermacs--live-p buffer-name) @@ -355,6 +367,7 @@ This function sets up the appropriate arguments and launches the process." (setq-local aidermacs--current-mode (if aidermacs-use-architect-mode 'architect 'code))) (aidermacs-switch-to-buffer buffer-name)))) + (defun aidermacs-run-in-current-dir () "Run aidermacs in the current directory with --subtree-only flag. This is useful for working in monorepos where you want to limit aider's scope."