branch: elpa/aidermacs commit 25b10e6e594b38dc34e5d3b907c661ca106f787b Author: Mingde (Matthew) Zeng <matthew...@posteo.net> Commit: Mingde (Matthew) Zeng <matthew...@posteo.net>
Improve aidermacs--last-command, aidermacs--parse-output-for-files --- aidermacs-backend-comint.el | 7 ++++--- aidermacs-backend-vterm.el | 1 + aidermacs-backends.el | 11 ++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/aidermacs-backend-comint.el b/aidermacs-backend-comint.el index 008213776f..d4991f9321 100644 --- a/aidermacs-backend-comint.el +++ b/aidermacs-backend-comint.el @@ -272,9 +272,10 @@ PROC is the process to send to. STRING is the command to send." (aidermacs-reset-font-lock-state) ;; Store the command for tracking in the correct buffer (with-current-buffer (process-buffer proc) - (setq-local aidermacs--last-command string) - ;; Always prepare for potential edits - (aidermacs--prepare-for-code-edit)) + (unless (member string '("" "y" "n" "d" "yes" "no")) + (setq aidermacs--last-command string) + ;; Always prepare for potential edits + (aidermacs--prepare-for-code-edit))) (comint-simple-send proc (aidermacs--process-message-if-multi-line string))) (defun aidermacs-run-comint (program args buffer-name) diff --git a/aidermacs-backend-vterm.el b/aidermacs-backend-vterm.el index a5c8fffb58..b5747c5d88 100644 --- a/aidermacs-backend-vterm.el +++ b/aidermacs-backend-vterm.el @@ -203,6 +203,7 @@ ORIG-FUN is the original function being advised. ARGS are its arguments." (when (and (aidermacs--is-aidermacs-buffer-p) (eq this-command 'vterm-send-return)) ;; Get the current line content which should be the command + ;; TODO: current line may not be enough (save-excursion (let* ((prompt-point (condition-case nil (vterm--get-prompt-point) diff --git a/aidermacs-backends.el b/aidermacs-backends.el index d2b1eb1313..fed3f98883 100644 --- a/aidermacs-backends.el +++ b/aidermacs-backends.el @@ -106,7 +106,8 @@ Remove any files that don't exist." (defun aidermacs--parse-output-for-files (output) "Parse OUTPUT for files and add them to `aidermacs--tracked-files'." (when output - (let ((lines (split-string output "\n"))) + (let ((lines (split-string output "\n")) + (last-line "")) (dolist (line lines) (cond ;; Applied edit to <filename> @@ -144,14 +145,14 @@ Remove any files that don't exist." (add-to-list 'aidermacs--tracked-files file)))) ;; <file>\nAdd file to the chat? - ((string-match "\\(\\./\\)?\\(.+\\)\nAdd file to the chat?" line) - (when-let ((file (match-string 2 line))) - (add-to-list 'aidermacs--tracked-files file))) + ((string-match "Add file to the chat?" line) + (add-to-list 'aidermacs--tracked-files last-line)) ;; <file> is already in the chat as an editable file ((string-match "\\(\\./\\)?\\(.+\\) is already in the chat as an editable file" line) (when-let ((file (match-string 2 line))) - (add-to-list 'aidermacs--tracked-files file))))) + (add-to-list 'aidermacs--tracked-files file)))) + (setq last-line line)) ;; Verify all tracked files exist (aidermacs--verify-tracked-files))))