From 843cec2bc7ac0716d1b69f7f3e116da1350d7e4f Mon Sep 17 00:00:00 2001 From: "nohz.afk" <149959021+nohzafk@users.noreply.github.com> Date: Sun, 12 Apr 2026 18:53:06 +0200 Subject: [PATCH] Add hook to customize @ file completion --- agent-shell-completion.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/agent-shell-completion.el b/agent-shell-completion.el index 62423e53..d6c0e858 100644 --- a/agent-shell-completion.el +++ b/agent-shell-completion.el @@ -39,6 +39,15 @@ :type 'boolean :group 'agent-shell) +(defcustom agent-shell-file-completion-function + #'agent-shell--file-completion-at-point + "Function to call for @ file completion. +Called with no arguments when @ is typed at a word boundary. +If it returns non-nil, `completion-at-point' is not called. +If it returns nil, falls through to the standard CAPF." + :type 'function + :group 'agent-shell) + (defun agent-shell--completion-bounds (char-class trigger-char) "Find completion bounds for CHAR-CLASS, if TRIGGER-CHAR precedes them. Returns alist with :start and :end if TRIGGER-CHAR is found before @@ -105,7 +114,8 @@ preventing spurious completions mid-word or in paths." (memq (char-before (1- (point))) '(?\s ?\t ?\n)))) (cond ((eq (char-before) ?@) - (completion-at-point)) + (unless (funcall agent-shell-file-completion-function) + (completion-at-point))) ((and (eq (char-before) ?/) (agent-shell--command-completion-at-point)) (completion-at-point)))))