Wrap regexp tool query in word boundary
This commit is contained in:
parent
87ab252815
commit
18c52fa9d7
2 changed files with 14 additions and 10 deletions
13
README.org
13
README.org
|
@ -757,11 +757,14 @@ This means that /every org-mode file I have/ is part of this search.
|
|||
***** org-ql-select-all-regexp
|
||||
#+begin_src elisp
|
||||
(defun gptel-org-tools--org-ql-select-all-regexp (query)
|
||||
(org-ql-select
|
||||
(org-agenda-files)
|
||||
`(regexp ,query)
|
||||
:action #'gptel-org-tools--heading-body))
|
||||
(let ((bound-query (format "\\b%s\\b" (regexp-quote query))))
|
||||
(org-ql-select
|
||||
(org-agenda-files)
|
||||
`(regexp ,bound-query)
|
||||
:action #'gptel-org-tools--heading-body)))
|
||||
#+end_src
|
||||
|
||||
#+begin_src elisp
|
||||
(add-to-list 'gptel-org-tools
|
||||
(gptel-make-tool
|
||||
:function #'gptel-org-tools--org-ql-select-all-regexp
|
||||
|
@ -769,7 +772,7 @@ This means that /every org-mode file I have/ is part of this search.
|
|||
:description "Run regexp on ALL files at once."
|
||||
:args (list '(:name "query"
|
||||
:type string
|
||||
:description "Regexp, Emacs Lisp format."))
|
||||
:description "Regexp, Emacs Lisp format. Automatically wrapped in a word boundary by the tool."))
|
||||
:category "org-ql"))
|
||||
#+end_src
|
||||
|
||||
|
|
|
@ -375,10 +375,11 @@
|
|||
:category "org-ql"))
|
||||
|
||||
(defun gptel-org-tools--org-ql-select-all-regexp (query)
|
||||
(org-ql-select
|
||||
(org-agenda-files)
|
||||
`(regexp ,query)
|
||||
:action #'gptel-org-tools--heading-body))
|
||||
(let ((bound-query (format "\\b%s\\b" (regexp-quote query))))
|
||||
(org-ql-select
|
||||
(org-agenda-files)
|
||||
`(regexp ,bound-query)
|
||||
:action #'gptel-org-tools--heading-body)))
|
||||
|
||||
(add-to-list 'gptel-org-tools
|
||||
(gptel-make-tool
|
||||
|
@ -387,7 +388,7 @@
|
|||
:description "Run regexp on ALL files at once."
|
||||
:args (list '(:name "query"
|
||||
:type string
|
||||
:description "Regexp, Emacs Lisp format."))
|
||||
:description "Regexp, Emacs Lisp format. Automatically wrapped in a word boundary by the tool."))
|
||||
:category "org-ql"))
|
||||
|
||||
(provide 'gptel-org-tools)
|
||||
|
|
Loading…
Add table
Reference in a new issue