branch: elpa/aidermacs commit 4fad406c4dae9cc266336051e624839c8494a49b Author: Mingde (Matthew) Zeng <matthew...@posteo.net> Commit: Mingde (Matthew) Zeng <matthew...@posteo.net>
Rename to aidermacs--send-command-redirect-comint --- aidermacs-backend-comint.el | 2 +- aidermacs-backends.el | 10 ++++------ aidermacs.el | 8 ++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/aidermacs-backend-comint.el b/aidermacs-backend-comint.el index bc2d259368..f489eb56ac 100644 --- a/aidermacs-backend-comint.el +++ b/aidermacs-backend-comint.el @@ -260,7 +260,7 @@ This allows for multi-line input without sending the command." (set-marker (process-mark process) (point)) (comint-send-string process (concat command "\n"))))) -(defun aidermacs--redirect-send-command-comint (buffer command) +(defun aidermacs--send-command-redirect-comint (buffer command) "Send COMMAND to the aidermacs comint BUFFER and collect result into OUTPUT-BUFFER." (with-current-buffer buffer (let ((process (get-buffer-process buffer)) diff --git a/aidermacs-backends.el b/aidermacs-backends.el index e2e6a1952c..a371b33d45 100644 --- a/aidermacs-backends.el +++ b/aidermacs-backends.el @@ -93,16 +93,14 @@ and BUFFER-NAME is the name for the aidermacs buffer." (aidermacs-run-comint program args buffer-name)))) (defun aidermacs--send-command-backend (buffer command) - "Send COMMAND to BUFFER using the appropriate backend. -CALLBACK if provided will be called with the command output when available." + "Send COMMAND to BUFFER using the appropriate backend." (setq aidermacs--last-command command - aidermacs--current-output nil - aidermacs--current-callback nil) + aidermacs--current-output nil) (if (eq aidermacs-backend 'vterm) (aidermacs--send-command-vterm buffer command) (aidermacs--send-command-comint buffer command))) -(defun aidermacs--redirect-send-command-backend (buffer command &optional callback) +(defun aidermacs--send-command-redirect-backend (buffer command &optional callback) "Send COMMAND to BUFFER using the appropriate backend. CALLBACK if provided will be called with the command output when available." (setq aidermacs--last-command command @@ -110,7 +108,7 @@ CALLBACK if provided will be called with the command output when available." aidermacs--current-callback callback) (if (eq aidermacs-backend 'vterm) (aidermacs--send-command-vterm buffer command) - (aidermacs--redirect-send-command-comint buffer command))) + (aidermacs--send-command-redirect-comint buffer command))) (provide 'aidermacs-backends) diff --git a/aidermacs.el b/aidermacs.el index 6157bb6b1a..4b60d4244d 100644 --- a/aidermacs.el +++ b/aidermacs.el @@ -275,7 +275,7 @@ If SWITCH-TO-BUFFER is non-nil, switch to the aidermacs buffer." (when (and switch-to-buffer (not (string= (buffer-name) buffer-name))) (aidermacs-switch-to-buffer)))) -(defun aidermacs--redirect-send-command (command callback) +(defun aidermacs--send-command-redirect (command callback) "Send COMMAND to the corresponding aidermacs process in the background. CALLBACK will be called with the command output when available." (let* ((buffer-name (aidermacs-buffer-name)) @@ -283,7 +283,7 @@ CALLBACK will be called with the command output when available." (progn (aidermacs-run) (get-buffer buffer-name)))) (processed-command (aidermacs--process-message-if-multi-line command))) - (aidermacs--redirect-send-command-backend buffer processed-command callback))) + (aidermacs--send-command-redirect-backend buffer processed-command callback))) ;; Function to switch to the aidermacs buffer @@ -443,7 +443,7 @@ Returns a deduplicated list of such file names." "List all files currently added to the chat session. Sends the \"/ls\" command and returns the list of files via callback." (interactive) - (aidermacs--redirect-send-command + (aidermacs--send-command-redirect "/ls" (lambda (output) (let ((files (aidermacs--parse-ls-output output))) @@ -454,7 +454,7 @@ Sends the \"/ls\" command and returns the list of files via callback." (defun aidermacs-drop-file () "Drop a file from the chat session by selecting from currently added files." (interactive) - (aidermacs--redirect-send-command + (aidermacs--send-command-redirect "/ls" (lambda (output) (if-let* ((files (aidermacs--parse-ls-output output))