branch: elpa/aidermacs
commit f8240d8537be5e31d56fc0a6c9c4440ba0c9605f
Author: Mingde (Matthew) Zeng <matthew...@posteo.net>
Commit: Mingde (Matthew) Zeng <matthew...@posteo.net>

    Fix docstrings, remove unused aidermacs-utils.el
---
 aidermacs-backend-comint.el | 23 +++++++----
 aidermacs-backend-vterm.el  | 25 +++++++-----
 aidermacs-backends.el       | 16 +++++---
 aidermacs-helm.el           |  4 +-
 aidermacs-models.el         | 15 ++++---
 aidermacs-utils.el          | 29 --------------
 aidermacs.el                | 97 ++++++++++++++++++++++++---------------------
 7 files changed, 103 insertions(+), 106 deletions(-)

diff --git a/aidermacs-backend-comint.el b/aidermacs-backend-comint.el
index 387c32bb63..a3febb065a 100644
--- a/aidermacs-backend-comint.el
+++ b/aidermacs-backend-comint.el
@@ -73,7 +73,7 @@ This allows for multi-line input without sending the command."
   "Temporary buffer used for syntax highlighting operations.")
 
 (defun aidermacs-reset-font-lock-state ()
-  "Reset font lock state to default for processing another a new src block."
+  "Reset font lock state to default for processing a new source block."
   (unless (equal aidermacs--syntax-block-delimiter aidermacs-diff-marker)
     ;; if we are processing the other half of a SEARCH/REPLACE block, we need 
to
     ;; keep the mode
@@ -84,7 +84,8 @@ This allows for multi-line input without sending the command."
         aidermacs--syntax-block-end-pos nil))
 
 (defun aidermacs-fontify-blocks (_output)
-  "Fontify search/replace blocks in comint output."
+  "Fontify search/replace blocks in comint output.
+OUTPUT is the text to be processed."
   (save-excursion
     (goto-char (or aidermacs--syntax-last-output-pos
                    comint-last-output-start))
@@ -134,7 +135,7 @@ This allows for multi-line input without sending the 
command."
               (condition-case e
                   (let ((inhibit-message t))
                     (funcall mode))
-                (error "aidermacs: failed to init major-mode `%s' for 
font-locking: %s" mode e)))))
+                (error "aidermacs: Failed to init major-mode `%s' for 
font-locking: %s" mode e)))))
 
         ;; Process initial content
         (aidermacs--fontify-block)))))
@@ -217,17 +218,20 @@ This allows for multi-line input without sending the 
command."
      'fundamental-mode)))
 
 (defun aidermacs-kill-buffer ()
-  "Clean-up fontify buffer."
+  "Clean up the fontify buffer."
   (when (bufferp aidermacs--syntax-work-buffer)
     (kill-buffer aidermacs--syntax-work-buffer)))
 
 (defun aidermacs-input-sender (proc string)
-  "Reset font-lock state before executing a command."
+  "Reset font-lock state before executing a command.
+PROC is the process to send to.  STRING is the command to send."
   (aidermacs-reset-font-lock-state)
   (comint-simple-send proc (aidermacs--process-message-if-multi-line string)))
 
 (defun aidermacs-run-comint (program args buffer-name)
-  "Create a comint-based buffer and run aidermacs PROGRAM with ARGS in 
BUFFER-NAME."
+  "Create a comint-based buffer and run aidermacs program.
+PROGRAM is the executable path.  ARGS are command line arguments.
+BUFFER-NAME is the name for the aidermacs buffer."
   (let ((comint-terminfo-terminal "eterm-color")
         (args (append args (list "--no-pretty" "--no-fancy-input"))))
     (unless (comint-check-proc buffer-name)
@@ -247,7 +251,8 @@ This allows for multi-line input without sending the 
command."
         (font-lock-add-keywords nil aidermacs-font-lock-keywords t)))))
 
 (defun aidermacs--send-command-comint (buffer command)
-  "Send COMMAND to the aidermacs comint BUFFER."
+  "Send command to the aidermacs comint buffer.
+BUFFER is the target buffer.  COMMAND is the text to send."
   (with-current-buffer buffer
     (let ((process (get-buffer-process buffer))
           (inhibit-read-only t))
@@ -261,7 +266,9 @@ This allows for multi-line input without sending the 
command."
       (comint-send-string process (concat command "\n")))))
 
 (defun aidermacs--send-command-redirect-comint (buffer command)
-  "Send COMMAND to the aidermacs comint BUFFER and collect result into 
OUTPUT-BUFFER."
+  "Send command to the aidermacs comint buffer and collect result.
+BUFFER is the target buffer.  COMMAND is the text to send.
+The output is collected and passed to the current callback."
   (with-current-buffer buffer
     (let ((process (get-buffer-process buffer))
           (output-buffer (get-buffer-create " *aider-redirect-buffer*")))
diff --git a/aidermacs-backend-vterm.el b/aidermacs-backend-vterm.el
index b01b7c92a3..74275a8500 100644
--- a/aidermacs-backend-vterm.el
+++ b/aidermacs-backend-vterm.el
@@ -18,9 +18,12 @@
 (defvar vterm-buffer-name)
 
 (defun aidermacs--vterm-check-finish-sequence-repeated (proc orig-filter 
start-point expected)
-  "Check for the finish sequence repeatedly in PROC’s buffer.
-Force a vterm render and redisplay. If the finish sequence is detected,
-store the output via `aidermacs--store-output`, restore ORIG-FILTER, and 
return t."
+  "Check for the finish sequence repeatedly in PROC's buffer.
+PROC is the process to check.  ORIG-FILTER is the original process filter.
+START-POINT is the starting position for output capture.  EXPECTED is the
+pattern to match.  Forces a vterm render and redisplay.  If the finish
+sequence is detected, store the output via `aidermacs--store-output`,
+restore ORIG-FILTER, and return t."
   (when (buffer-live-p (process-buffer proc))
     (with-current-buffer (process-buffer proc)
       ;; Force vterm to update its display.
@@ -46,9 +49,10 @@ store the output via `aidermacs--store-output`, restore 
ORIG-FILTER, and return
           t)))))
 
 (defun aidermacs--vterm-output-advice (orig-fun &rest args)
-  "Advice for vterm output: capture output until the finish sequence appears.
-This sets a temporary process filter and installs a repeating timer
-to force vterm to update until the expected finish sequence is detected."
+  "Capture vterm output until the finish sequence appears.
+ORIG-FUN is the original function being advised.  ARGS are its arguments.
+This sets a temporary process filter and installs a repeating timer to
+force vterm to update until the expected finish sequence is detected."
   (if (and (bound-and-true-p aidermacs-minor-mode)
            (eq major-mode 'vterm-mode))
       (let* ((start-point (vterm--get-prompt-point))
@@ -75,9 +79,9 @@ to force vterm to update until the expected finish sequence 
is detected."
     (apply orig-fun args)))
 
 (defun aidermacs-run-vterm (program args buffer-name)
-  "Create a vterm-based buffer and run aidermacs PROGRAM with ARGS in 
BUFFER-NAME.
-PROGRAM is the command to run, ARGS is a list of arguments,
-and BUFFER-NAME is the name of the vterm buffer."
+  "Create a vterm-based buffer and run aidermacs program.
+PROGRAM is the command to run.  ARGS is a list of command line arguments.
+BUFFER-NAME is the name for the vterm buffer."
   (unless (require 'vterm nil t)
     (error "vterm package is not available"))
   (unless (get-buffer buffer-name)
@@ -94,7 +98,8 @@ and BUFFER-NAME is the name of the vterm buffer."
   buffer-name)
 
 (defun aidermacs--send-command-vterm (buffer command)
-  "Send COMMAND to the aidermacs vterm BUFFER."
+  "Send command to the aidermacs vterm buffer.
+BUFFER is the target buffer to send to.  COMMAND is the text to send."
   (with-current-buffer buffer
     (vterm-send-string command)
     (vterm-send-return)))
diff --git a/aidermacs-backends.el b/aidermacs-backends.el
index a371b33d45..581e7ab321 100644
--- a/aidermacs-backends.el
+++ b/aidermacs-backends.el
@@ -21,7 +21,7 @@
 
 (defcustom aidermacs-backend 'comint
   "Backend to use for the aidermacs process.
-Options are 'comint (the default) or 'vterm. When set to 'vterm, aidermacs will
+Options are 'comint (the default) or 'vterm.  When set to 'vterm, aidermacs 
will
 launch a fully functional vterm buffer (with bracketed paste support) instead
 of using a comint process."
   :type '(choice (const :tag "Comint" comint)
@@ -50,6 +50,7 @@ Each entry is a cons cell (timestamp . output-text).")
 
 (defun aidermacs-get-output-history (&optional limit)
   "Get the output history, optionally limited to LIMIT entries.
+LIMIT is the maximum number of entries to return.
 Returns a list of (timestamp . output-text) pairs, most recent first."
   (let ((history aidermacs--output-history))
     (if limit
@@ -68,7 +69,8 @@ Returns a list of (timestamp . output-text) pairs, most 
recent first."
   "Flag to prevent recursive callbacks.")
 
 (defun aidermacs--store-output (output)
-  "Store OUTPUT string in the history with timestamp.
+  "Store output string in the history with timestamp.
+OUTPUT is the string to store.
 If there's a callback function, call it with the output."
   (setq aidermacs--current-output (substring-no-properties output))
   (push (cons (current-time) (substring-no-properties output)) 
aidermacs--output-history)
@@ -84,8 +86,8 @@ If there's a callback function, call it with the output."
 ;; Backend dispatcher functions
 (defun aidermacs-run-backend (program args buffer-name)
   "Run aidermacs using the selected backend.
-PROGRAM is the aidermacs executable path, ARGS are command line arguments,
-and BUFFER-NAME is the name for the aidermacs buffer."
+PROGRAM is the aidermacs executable path.  ARGS are command line arguments.
+BUFFER-NAME is the name for the aidermacs buffer."
   (cond
    ((eq aidermacs-backend 'vterm)
     (aidermacs-run-vterm program args buffer-name))
@@ -93,7 +95,8 @@ 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."
+  "Send command to buffer using the appropriate backend.
+BUFFER is the target buffer.  COMMAND is the text to send."
   (setq aidermacs--last-command command
         aidermacs--current-output nil)
   (if (eq aidermacs-backend 'vterm)
@@ -101,7 +104,8 @@ and BUFFER-NAME is the name for the aidermacs buffer."
     (aidermacs--send-command-comint buffer command)))
 
 (defun aidermacs--send-command-redirect-backend (buffer command &optional 
callback)
-  "Send COMMAND to BUFFER using the appropriate backend.
+  "Send command to buffer using the appropriate backend.
+BUFFER is the target buffer.  COMMAND is the text to send.
 CALLBACK if provided will be called with the command output when available."
   (setq aidermacs--last-command command
         aidermacs--current-output nil
diff --git a/aidermacs-helm.el b/aidermacs-helm.el
index a419ed2d43..94d40a7759 100644
--- a/aidermacs-helm.el
+++ b/aidermacs-helm.el
@@ -17,8 +17,8 @@
 
 (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.
-INITIAL-INPUT is optional initial input string."
+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
diff --git a/aidermacs-models.el b/aidermacs-models.el
index 6c795d89f1..355f32117f 100644
--- a/aidermacs-models.el
+++ b/aidermacs-models.el
@@ -46,7 +46,7 @@ Defaults to `aidermacs-default-model` if not explicitly set."
   (message "Architect Mode: %s" (if aidermacs-use-architect-mode "ON" "OFF"))
   (when (get-buffer (aidermacs-buffer-name))
     (when (yes-or-no-p
-           (format "Aidermacs Architect Mode %s. Change will take affect next 
session. Close the session now? "
+           (format "Aidermacs Architect Mode %s. Change will take affect next 
session.  Close the session now? "
                    (if aidermacs-use-architect-mode "ON" "OFF")))
       (aidermacs-exit))))
 
@@ -58,7 +58,7 @@ Defaults to `aidermacs-default-model` if not explicitly set."
     "deepseek/deepseek-chat"
     )
   "List of available AI models for selection.
-Each model should be in the format expected by the aidermacs command line 
interface.
+Each model should be in the format expected by the aidermacs CLI.
 Also based on aidermacs LLM benchmark: 
https://aidermacs.chat/docs/leaderboards/";
   :type '(repeat string)
   :group 'aidermacs-models)
@@ -67,7 +67,7 @@ Also based on aidermacs LLM benchmark: 
https://aidermacs.chat/docs/leaderboards/
   "Cache of available AI models.")
 
 (defun aidermacs--fetch-openai-compatible-models (url)
-  "Fetch available models from an OpenAI compatible API endpoint at 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."
   (let* ((url-parsed (url-generic-parse-url url))
@@ -116,14 +116,16 @@ Returns a list of model names with appropriate prefixes 
based on the API provide
 
 
 (defun aidermacs--select-model ()
-  "Private function for model selection with completion."
+  "Provide model selection with completion.
+This is a private function used internally."
   (let ((model (with-local-quit
                  (completing-read "Select AI model: " aidermacs--cached-models 
nil t))))
     (when model
       (aidermacs--send-command (format "/model %s" model) t))))
 
 (defun aidermacs--get-available-models ()
-  "Get list of models supported by aider using the /models command."
+  "Get list of models supported by aider using the /models command.
+This fetches models from various API providers and caches them."
   (aidermacs--send-command-redirect
    "/models /"
    (lambda (output)
@@ -153,7 +155,8 @@ Returns a list of model names with appropriate prefixes 
based on the API provide
        (aidermacs--select-model)))))
 
 (defun aidermacs-clear-model-cache ()
-  "Clear the cached models, forcing a fresh fetch on next use."
+  "Clear the cached models, forcing a fresh fetch on next use.
+This is useful when available models have changed."
   (interactive)
   (setq aidermacs--cached-models nil)
   (message "Model cache cleared"))
diff --git a/aidermacs-utils.el b/aidermacs-utils.el
deleted file mode 100644
index e3269b6494..0000000000
--- a/aidermacs-utils.el
+++ /dev/null
@@ -1,29 +0,0 @@
-;; Author: Mingde (Matthew) Zeng <matthew...@posteo.net>
-;; 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 <tni...@gmail.com> Aider.el
-
-;; New function to run `find-name-dired` from the Git repository root directory
-;;;###autoload
-(defun aidermacs-repo-find-name-dired (pattern)
-  "Run `find-name-dired` from the Git repository root directory with the given 
PATTERN."
-  (interactive "sFind name (pattern): ")
-  (let* ((git-repo-path (shell-command-to-string "git rev-parse 
--show-toplevel"))
-         (repo-path (string-trim git-repo-path)))
-    (if (string-match-p "fatal" repo-path)
-        (message "Not in a git repository")
-      (find-name-dired repo-path pattern))))
-
-;;;###autoload
-(defun aidermacs-git-repo-root-dired ()
-  "Open a Dired buffer at the root of the current Git repository."
-  (interactive)
-  (let ((git-repo-path (shell-command-to-string "git rev-parse 
--show-toplevel")))
-    (if (string-match-p "fatal" git-repo-path)
-        (message "The current buffer is not in a Git repository.")
-      (let ((repo-path (string-trim git-repo-path)))
-        (dired-other-window repo-path)))))
-
-(provide 'aidermacs-utils)
diff --git a/aidermacs.el b/aidermacs.el
index c031e465b0..9c616844a2 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -40,7 +40,7 @@
 (defcustom aidermacs-config-file nil
   "Path to aider configuration file.
 When set, Aidermacs will pass this to aider via --config flag,
-ignoring other configuration settings except aidermacs-extra-args."
+ignoring other configuration settings except `aidermacs-extra-args'."
   :type '(choice (const :tag "None" nil)
                  (file :tag "Config file"))
   :group 'aidermacs)
@@ -52,7 +52,7 @@ The model argument will be added automatically based on 
`aidermacs-default-model
   :group 'aidermacs)
 
 (defcustom aidermacs-subtree-only nil
-  "When non-nil, run aider with --subtree-only flag to only consider files in 
current directory.
+  "When non-nil, run aider with --subtree-only in the current directory.
 This is useful for working in monorepos where you want to limit aider's scope."
   :type 'boolean
   :group 'aidermacs)
@@ -64,7 +64,8 @@ When nil, disable auto-commits requiring manual git commits."
   :group 'aidermacs)
 
 (defun aidermacs-project-root ()
-  "Get the project root using project.el, VC, or fallback to file directory."
+  "Get the project root using project.el, VC, or fallback to file directory.
+This function tries multiple methods to determine the project root."
   (or (when (and (fboundp 'project-current) (project-current))
         (project-root (project-current)))
       (vc-git-root default-directory)
@@ -84,7 +85,7 @@ When nil, disable auto-commits requiring manual git commits."
   :group 'aidermacs)
 
 (defcustom aidermacs-prompt-file-name ".aider.prompt.org"
-  "File name that will automatically enable aidermacs-minor-mode when opened.
+  "File name that will automatically enable `aidermacs-minor-mode' when opened.
 This is the file name without path."
   :type 'string
   :group 'aidermacs)
@@ -102,7 +103,7 @@ This is the file name without path."
 ;;;###autoload
 (defun aidermacs-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."
+PROMPT is the text to display.  INITIAL-INPUT is the default value."
   (read-string prompt initial-input 'aidermacs-read-string-history))
 
 ;;;###autoload
@@ -148,7 +149,7 @@ This function can be customized or redefined by the user."
 
 ;; Main transient menu
 (transient-define-prefix aidermacs-transient-menu ()
-  "AI Pair Programming Interface"
+  "AI Pair Programming Interface."
   ["Aidermacs: AI Pair Programming"
    ["Core Actions"
     ("a" "Start/Open Session" aidermacs-run)
@@ -184,7 +185,7 @@ This function can be customized or redefined by the user."
 
 (defun aidermacs-buffer-name ()
   "Generate the aidermacs buffer name based on project root or current 
directory.
-Prefers existing sessions closer to current directory."
+This function prefers existing sessions closer to current directory."
   (let* ((root (aidermacs-project-root))
          (current-dir (file-truename default-directory))
          ;; Get all existing aidermacs buffers
@@ -228,7 +229,8 @@ Prefers existing sessions closer to current directory."
 
 ;;;###autoload
 (defun aidermacs-run ()
-  "Run aidermacs process using the selected backend."
+  "Run aidermacs process using the selected backend.
+This function sets up the appropriate arguments and launches the process."
   (interactive)
   (let* ((buffer-name (aidermacs-buffer-name))
          ;; Process extra args: split each string on whitespace.
@@ -284,8 +286,8 @@ This is useful for working in monorepos where you want to 
limit aider's scope."
     (aidermacs-run)))
 
 (defun aidermacs--send-command (command &optional switch-to-buffer)
-  "Send COMMAND to the corresponding aidermacs process.
-If SWITCH-TO-BUFFER is non-nil, switch to the aidermacs 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."
   (let* ((buffer-name (aidermacs-buffer-name))
          (buffer (or (get-buffer buffer-name)
                      (progn (aidermacs-run)
@@ -296,8 +298,8 @@ If SWITCH-TO-BUFFER is non-nil, switch to the aidermacs 
buffer."
       (aidermacs-switch-to-buffer))))
 
 (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."
+  "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."
   (let* ((buffer-name (aidermacs-buffer-name))
          (buffer (or (get-buffer buffer-name)
                      (progn (aidermacs-run)
@@ -344,10 +346,11 @@ If the current buffer is already the aidermacs buffer, do 
nothing."
 
 
 (defun aidermacs--process-message-if-multi-line (str)
-  "Entering multi-line chat messages
-https://aidermacs.chat/docs/usage/commands.html#entering-multi-line-chat-messages
-If STR contains newlines and isn't already wrapped in {aidermacs...aidermacs},
-wrap it in {aidermacs\nstr\naidermacs}. Otherwise return STR unchanged."
+  "Process multi-line chat messages for proper formatting.
+STR is the message to process.  If STR contains newlines and isn't already
+wrapped in {aidermacs...aidermacs}, wrap it.
+Otherwise return STR unchanged.  See documentation at:
+https://aidermacs.chat/docs/usage/commands.html#entering-multi-line-chat-messages";
   (if (and (string-match-p "\n" str)
            (not (string-match-p "^{aidermacs\n.*\naidermacs}$" str)))
       (format "{aidermacs\n%s\naidermacs}" str)
@@ -355,7 +358,9 @@ wrap it in {aidermacs\nstr\naidermacs}. Otherwise return 
STR unchanged."
 
 ;;;###autoload
 (defun aidermacs-act-on-current-file (command-prefix)
-  "Send the command \"COMMAND-PREFIX <current buffer file full path>\" to the 
corresponding aidermacs comint buffer."
+  "Send a command with the current file path to the aidermacs buffer.
+COMMAND-PREFIX is the command to prepend to the file path.
+The full command will be \"COMMAND-PREFIX <current buffer file full path>\"."
   ;; Ensure the current buffer is associated with a file
   (if (not buffer-file-name)
       (message "Current buffer is not associated with a file.")
@@ -377,7 +382,7 @@ wrap it in {aidermacs\nstr\naidermacs}. Otherwise return 
STR unchanged."
 ;; Function to send a custom command to corresponding aidermacs buffer
 ;;;###autoload
 (defun aidermacs-general-command ()
-  "Prompt the user to input COMMAND and send it to the corresponding aidermacs 
comint buffer."
+  "Prompt the user to input COMMAND and send it to the aidemracs."
   (interactive)
   (let ((command (aidermacs-read-string "Enter general aider command: ")))
     ;; Use the shared helper function to send the command
@@ -386,17 +391,18 @@ wrap it in {aidermacs\nstr\naidermacs}. Otherwise return 
STR unchanged."
 ;; New function to get command from user and send it prefixed with "/code "
 ;;;###autoload
 (defun aidermacs-code-change ()
-  "Prompt the user for a command and send it to the corresponding aidermacs 
comint buffer prefixed with \"/code \"."
+  "Prompt the user for an input and send it to aidemracs prefixed with \"/code 
\"."
   (interactive)
   (when-let ((command (aidermacs--form-prompt "/code" "Code change" t)))
     (aidermacs--send-command command t)))
 
 (defun aidermacs--parse-ls-output (output)
-  "Parse the /ls command OUTPUT to extract files in chat.
-After the \"Files in chat:\" header, each subsequent line that begins with
-whitespace is processed. The first non-whitespace token is taken as the file 
name.
-Relative paths are resolved using the repository root (if available) or
-`default-directory`. Only files that exist on disk are included in the result.
+  "Parse the /ls command output to extract files in chat.
+OUTPUT is the text returned by the /ls command.  After the \"Files in chat:\"
+header, each subsequent line that begins with whitespace is processed.
+The first non-whitespace token is taken as the file name.  Relative paths are
+resolved using the repository root (if available) or `default-directory`.
+Only files that exist on disk are included in the result.
 Returns a deduplicated list of such file names."
   (when output
     (with-temp-buffer
@@ -494,7 +500,7 @@ Sends the \"/ls\" command and returns the list of files via 
callback."
 
 ;;;###autoload
 (defun aidermacs-ask-question ()
-  "Prompt the user for a command and send it to the corresponding aidermacs 
comint buffer prefixed with \"/ask \".
+  "Prompt the user for a question.
 If a region is active, append the region text to the question.
 If cursor is inside a function, include the function name as context."
   (interactive)
@@ -508,29 +514,28 @@ 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 the corresponding 
aidermacs comint buffer prefixed with \"/ask \"."
+  "Prompt the user for a general question and send it to aidemracs 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 a command and send it to the corresponding aidermacs 
comint buffer prefixed with \"/help \"."
+  "Prompt the user for an input and send it to aidemracs 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 a command and send it to the corresponding aidermacs 
comint buffer prefixed with \"/architect \"."
+  "Prompt the user for an input and send it to aidemracs prefixed with 
\"/architect \"."
   (interactive)
   (when-let ((command (aidermacs--form-prompt "/architect" "Architect 
Discussion")))
     (aidermacs--send-command command t)))
 
 ;;;###autoload
 (defun aidermacs-debug-exception ()
-  "Prompt the user for a command and send it to the corresponding aidermacs 
comint buffer prefixed with \"/debug \",
-replacing all newline characters except for the one at the end."
+  "Prompt the user for an input and send it to aidemracs prefixed with 
\"/debug \"."
   (interactive)
   (when-let ((user-command (aidermacs--form-prompt "/ask" "Enter exception, 
can be multiple lines")))
     (let ((command (concat "/ask Investigate the following exception, with 
current added files as context: " user-command)))
@@ -538,7 +543,7 @@ replacing all newline characters except for the one at the 
end."
 
 ;;;###autoload
 (defun aidermacs-go-ahead ()
-  "Send the command \"go ahead\" to the corresponding aidermacs comint buffer."
+  "Send the command \"go ahead\" to the aidemracs."
   (interactive)
   (aidermacs--send-command "go ahead" t))
 
@@ -560,6 +565,7 @@ If Magit is not installed, report that it is required."
 ;;;###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.
 If IGNORE-CONTEXT is non-nil, skip function and region context.
 If region is active, use that region's text.
 If point is in a function, use function name."
@@ -603,17 +609,19 @@ If point is in a function, explain that function."
                 (line-end-position)))
          (prompt (format "/ask Please explain what '%s' means in the context 
of this code line: %s"
                          symbol line)))
-    (aidermacs-add-current-file)    
+    (aidermacs-add-current-file)
     (aidermacs--send-command prompt t)))
 
 (defun aidermacs-send-command-with-prefix (prefix command)
-  "Send COMMAND to the aidermacs buffer prefixed with PREFIX."
+  "Send COMMAND to the aidermacs buffer with PREFIX.
+PREFIX is the text to prepend.  COMMAND is the text to send."
   (aidermacs-add-current-file)
   (aidermacs--send-command (concat prefix command) t))
 
 (defun aidermacs--add-files-helper (files read-only &optional message)
-  "Helper function to add FILES with READ-ONLY flag.
-Optional MESSAGE can override the default success message."
+  "Helper function to add files with read-only flag.
+FILES is a list of file paths to add.  READ-ONLY determines if files are added
+as read-only.  Optional MESSAGE can override the default success message."
   (let* ((cmd (if read-only "/read-only" "/add"))
          (files (delq nil files)))
     (if files
@@ -629,7 +637,7 @@ Optional MESSAGE can override the default success message."
 ;;;###autoload
 (defun aidermacs-add-current-file (&optional read-only)
   "Add current file with optional READ-ONLY flag.
-With prefix argument C-u, add as read-only."
+With prefix argument `C-u', add as read-only."
   (interactive "P")
   (aidermacs--add-files-helper
    (if buffer-file-name (list buffer-file-name) nil)
@@ -642,7 +650,7 @@ With prefix argument C-u, add as read-only."
 ;;;###autoload
 (defun aidermacs-add-files-in-current-window (&optional read-only)
   "Add window files with READ-ONLY flag.
-With prefix argument C-u, add as read-only."
+With prefix argument `C-u', add as read-only."
   (interactive "P")
   (let* ((files (mapcar (lambda (buffer)
                          (with-current-buffer buffer
@@ -654,8 +662,8 @@ With prefix argument C-u, add as read-only."
 
 ;;;###autoload
 (defun aidermacs-batch-add-dired-marked-files (&optional read-only)
-  "Add dired files with READ-ONLY flag.
-With prefix argument C-u, add as read-only."
+  "Add Dired files with READ-ONLY flag.
+With prefix argument `C-u', add as read-only."
   (interactive "P")
   (aidermacs--add-files-helper (dired-get-marked-files) read-only))
 
@@ -663,7 +671,7 @@ With prefix argument C-u, add as read-only."
 (defun aidermacs-add-files-interactively (&optional read-only)
   "Add files to aidermacs by interactively selecting them using `find-file`.
 Multiple files can be selected by calling the command multiple times.
-With prefix argument C-u, add as read-only."
+With prefix argument `C-u', add as READ-ONLY."
   (interactive "P")
   (when-let ((file (expand-file-name (read-file-name "Select file to add: "))))
     (when (file-exists-p file)
@@ -671,9 +679,9 @@ With prefix argument C-u, add as read-only."
 
 ;;;###autoload
 (defun aidermacs-add-same-type-files-under-dir (&optional read-only)
-  "Add all files with same suffix as current file under current directory to 
aidermacs.
+  "Add all files with same suffix as current file under current directory.
 If there are more than 40 files, refuse to add and show warning message.
-With prefix argument C-u, add as read-only."
+With prefix argument `C-u', add as READ-ONLY."
   (interactive "P")
   (if (not buffer-file-name)
       (message "Current buffer is not visiting a file")
@@ -789,8 +797,7 @@ Otherwise, send the line under cursor."
 
 ;;;###autoload
 (defun aidermacs-send-region-by-line ()
-  "Get the text of the current selected region, split into lines,
-and send each non-empty line to aidermacs session."
+  "Send the text of the current selected region, split into lines."
   (interactive)
   (if (use-region-p)
       (let* ((text (buffer-substring-no-properties (region-beginning) 
(region-end)))
@@ -873,7 +880,7 @@ These are exact filename matches (including the dot 
prefix)."
   :group 'aidermacs)
 
 (defun aidermacs--should-enable-minor-mode-p (filename)
-  "Determine if aidermacs-minor-mode should be enabled for 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'."
   (when filename
     (let ((base-name (file-name-nondirectory filename)))

Reply via email to