[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/aidermacs 9a8575e7de 430/466: Use minor mode for relevant
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/aidermacs 9a8575e7de 430/466: Use minor mode for relevant functions |
Date: |
Sat, 15 Mar 2025 19:19:36 -0400 (EDT) |
branch: elpa/aidermacs
commit 9a8575e7de91f2cacfa16434911eeaea60f18538
Author: Mingde (Matthew) Zeng <matthewzmd@posteo.net>
Commit: Mingde (Matthew) Zeng <matthewzmd@posteo.net>
Use minor mode for relevant functions
---
aidermacs-backends.el | 9 +++------
aidermacs.el | 10 ++++------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/aidermacs-backends.el b/aidermacs-backends.el
index d87d682498..5b50829ed2 100644
--- a/aidermacs-backends.el
+++ b/aidermacs-backends.el
@@ -222,14 +222,11 @@ BUFFER-NAME is the name for the aidermacs buffer."
(defun aidermacs--is-aidermacs-buffer-p (&optional buffer)
"Check if BUFFER is any type of aidermacs buffer.
If BUFFER is nil, check the current buffer.
-Returns non-nil if the buffer name matches the aidermacs buffer pattern
-and is using either comint or vterm mode."
+Returns non-nil if the buffer has either aidermacs-comint-mode or
aidermacs-vterm-mode enabled."
(let ((buf (or buffer (current-buffer))))
(with-current-buffer buf
- (and (string-match-p "^\\*aidermacs:" (buffer-name buf))
- (or (derived-mode-p 'comint-mode)
- (and (fboundp 'vterm-mode)
- (derived-mode-p 'vterm-mode)))))))
+ (or (bound-and-true-p aidermacs-comint-mode)
+ (bound-and-true-p aidermacs-vterm-mode)))))
(defun aidermacs--send-command-backend (buffer command &optional redirect)
"Send command to buffer using the appropriate backend.
diff --git a/aidermacs.el b/aidermacs.el
index 30f961665c..39e6a84353 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -184,8 +184,7 @@ If there are multiple, prompt to select one interactively.
Returns nil if no aidermacs buffers exist.
This is used when you want to target an existing session."
(let* ((buffers (cl-remove-if-not
- (lambda (buf)
- (string-match-p "^\\*aidermacs:" (buffer-name buf)))
+ #'aidermacs--is-aidermacs-buffer-p
(buffer-list)))
(buffer-names (mapcar #'buffer-name buffers)))
(cond
@@ -203,8 +202,7 @@ If USE-EXISTING is non-nil, use an existing buffer instead
of creating new."
;; Get all existing aidermacs buffers
(aidermacs-buffers
(cl-remove-if-not
- (lambda (buf)
- (string-match-p "^\\*aidermacs:" (buffer-name buf)))
+ #'aidermacs--is-aidermacs-buffer-p
(buffer-list)))
;; Extract directory paths and subtree status from buffer names
(buffer-dirs
@@ -710,7 +708,7 @@ If cursor is inside a function, include the function name
as context.
If called from the aidermacs buffer, use general question instead."
(interactive)
;; Dispatch to general question if in aidermacs buffer
- (if (string= (buffer-name) (aidermacs-get-buffer-name))
+ (if (aidermacs--is-aidermacs-buffer-p)
(call-interactively #'aidermacs-general-question)
(when-let ((command (aidermacs--form-prompt "/ask" "Question")))
(aidermacs-add-current-file)
@@ -1211,7 +1209,7 @@ configuring, troubleshooting, etc."
;; Add a hook to clean up temp buffers when an aidermacs buffer is killed
(defun aidermacs--cleanup-on-buffer-kill ()
"Clean up temporary buffers when an aidermacs buffer is killed."
- (when (string-match "^\\*aidermacs:" (buffer-name))
+ (when (aidermacs--is-aidermacs-buffer-p)
(aidermacs--cleanup-temp-buffers)))
(defun aidermacs--setup-cleanup-hooks ()
- [nongnu] elpa/aidermacs 3f49d59402 404/466: Bump to 1.0.0, (continued)
- [nongnu] elpa/aidermacs 3f49d59402 404/466: Bump to 1.0.0, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 69cdacaaa0 409/466: Requested changes, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs b641c16de5 407/466: Fix linting, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 3f84f16668 405/466: Fix aidermacs--prepare-for-code-edit, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs d76bc38c0b 411/466: Improve aidermacs--detect-edited-files, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs c42ff4fbd1 414/466: Format README, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 5b812f26e5 419/466: Check udiff cases, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 0c236ac3d6 421/466: Fix aidermacs-prompt-regexp and fix aidermacs--parse-ls-output, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs ddd8000e17 424/466: Add Melpa!, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs b4a771c777 425/466: Fix #52, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 9a8575e7de 430/466: Use minor mode for relevant functions,
ELPA Syncer <=
- [nongnu] elpa/aidermacs 389d69fddb 428/466: refactor: add aidermacs-comint-mode minor mode., ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 66d04629bc 431/466: Fix linting, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 1971d48717 432/466: Fix linting, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 9644836022 434/466: Do not suggest auto commit, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 47327b96d2 435/466: fix(aidermacs-models): ensure correct parsing by moving to end of headers, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 3b9f5b5dd5 437/466: Introduce aidermacs-show-diff-after-change to control diff, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 4af8c4283d 436/466: Merge pull request #55 from zsxh/fix/fetch-models, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 22f59e2b8a 441/466: Update README with Tramp support, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 77ed294a6f 444/466: The Community Speaks, ELPA Syncer, 2025/03/15
- [nongnu] elpa/aidermacs 1c2d4ac340 443/466: Fix typo, ELPA Syncer, 2025/03/15