Fix name, outputs.

This commit is contained in:
Phil Bajsicki 2025-04-17 02:37:02 +02:00
parent 7fba16a02e
commit 87ab252815
2 changed files with 39 additions and 39 deletions

View file

@ -756,7 +756,7 @@ This means that /every org-mode file I have/ is part of this search.
***** org-ql-select-all-regexp ***** org-ql-select-all-regexp
#+begin_src elisp #+begin_src elisp
(defun gptel-org-tools--org-ql-select-all-rifle (query) (defun gptel-org-tools--org-ql-select-all-regexp (query)
(org-ql-select (org-ql-select
(org-agenda-files) (org-agenda-files)
`(regexp ,query) `(regexp ,query)
@ -764,8 +764,8 @@ This means that /every org-mode file I have/ is part of this search.
(add-to-list 'gptel-org-tools (add-to-list 'gptel-org-tools
(gptel-make-tool (gptel-make-tool
:function #'gptel-org-tools--org-ql-select-all-rifle :function #'gptel-org-tools--org-ql-select-all-regexp
:name "org-ql-select-all-rifle" :name "org-ql-select-all-regexp"
:description "Run regexp on ALL files at once." :description "Run regexp on ALL files at once."
:args (list '(:name "query" :args (list '(:name "query"
:type string :type string

View file

@ -46,27 +46,27 @@
'"\n---\n")) '"\n---\n"))
(defun gptel-org-tools--heading-body () (defun gptel-org-tools--heading-body ()
(concat (concat
(buffer-substring-no-properties (buffer-substring-no-properties
(line-beginning-position) (line-beginning-position)
(progn (progn
(outline-next-heading) (outline-next-heading)
(line-beginning-position))) (line-beginning-position)))
"---\n")) "---\n"))
(defun gptel-org-tools--heading-subtree () (defun gptel-org-tools--heading-subtree ()
(concat (concat
(buffer-substring-no-properties (buffer-substring-no-properties
(line-beginning-position) (line-beginning-position)
(org-end-of-subtree)) (org-end-of-subtree))
"---\n")) "---\n"))
(add-to-list 'gptel-org-tools (add-to-list 'gptel-org-tools
(gptel-make-tool (gptel-make-tool
:function (lambda (arg) :function (lambda (arg)
(list-buffers-noselect) (list-buffers-noselect)
(with-current-buffer "*Buffer List*" (with-current-buffer "*Buffer List*"
(buffer-string))) (buffer-string)))
:name "list-buffers" :name "list-buffers"
:description "Access the list of buffers open in Emacs, including file names and full paths." :description "Access the list of buffers open in Emacs, including file names and full paths."
:args (list '(:name "arg" :args (list '(:name "arg"
@ -107,11 +107,11 @@
(add-to-list 'gptel-org-tools (add-to-list 'gptel-org-tools
(gptel-make-tool (gptel-make-tool
:function (lambda (file) :function (lambda (file)
(with-current-buffer (get-buffer-create file) (with-current-buffer (get-buffer-create file)
(insert-file-contents file) (insert-file-contents file)
(concat (concat
(current-buffer) (current-buffer)
"\n---\nTool execution complete. Proceed with next step."))) "\n---\nTool execution complete. Proceed with next step.")))
:name "open-file-inactive" :name "open-file-inactive"
:description "Open the file in a background buffer. This doesn't interfere with the user." :description "Open the file in a background buffer. This doesn't interfere with the user."
:args (list '(:name "file" :args (list '(:name "file"
@ -173,11 +173,11 @@
(defun gptel-org-tools--org-extract-headings (buffer) (defun gptel-org-tools--org-extract-headings (buffer)
(if (member buffer gptel-org-tools-skip-heading-extraction) (if (member buffer gptel-org-tools-skip-heading-extraction)
(user-error "Buffer %s has too many headings, use org-extract-tags or org-ql-select-rifle." buffer) (user-error "Buffer %s has too many headings, use org-extract-tags or org-ql-select-rifle." buffer)
(with-current-buffer buffer (with-current-buffer buffer
(org-map-entries (org-map-entries
#'gptel-org-tools--heading #'gptel-org-tools--heading
t t
'file)))) 'file))))
(add-to-list 'gptel-org-tools (add-to-list 'gptel-org-tools
(gptel-make-tool (gptel-make-tool
@ -225,7 +225,7 @@
:category "org")) :category "org"))
(defun gptel-org-tools--org-ql-select-headings (buf query) (defun gptel-org-tools--org-ql-select-headings (buf query)
(org-ql-select (org-ql-select
(get-buffer buf) (get-buffer buf)
`(heading ,query) `(heading ,query)
:action #''gptel-org-tools--heading)) :action #''gptel-org-tools--heading))
@ -245,10 +245,10 @@
:category "org-ql")) :category "org-ql"))
(defun gptel-org-tools--org-ql-select-headings-rifle (buf query) (defun gptel-org-tools--org-ql-select-headings-rifle (buf query)
(org-ql-select (org-ql-select
(get-buffer buf) (get-buffer buf)
`(rifle ,query) `(rifle ,query)
:action #'gptel-org-tools--heading)) :action #'gptel-org-tools--heading))
(add-to-list 'gptel-org-tools (add-to-list 'gptel-org-tools
@ -265,7 +265,7 @@
:category "org-ql")) :category "org-ql"))
(defun gptel-org-tools--org-ql-select-tags-local (buf query) (defun gptel-org-tools--org-ql-select-tags-local (buf query)
(org-ql-select (org-ql-select
(get-buffer buf) (get-buffer buf)
`(tags-local ,query) `(tags-local ,query)
:action #'gptel-org-tools-heading-body)) :action #'gptel-org-tools-heading-body))
@ -285,7 +285,7 @@
:category "org-ql")) :category "org-ql"))
(defun gptel-org-tools--org-ql-select-tags (buf query) (defun gptel-org-tools--org-ql-select-tags (buf query)
(org-ql-select (org-ql-select
(get-buffer buf) (get-buffer buf)
`(tags ,query) `(tags ,query)
:action #'gptel-org-tools--heading-body)) :action #'gptel-org-tools--heading-body))
@ -304,7 +304,7 @@
:category "org-ql")) :category "org-ql"))
(defun gptel-org-tools--org-ql-select-rifle (buf query) (defun gptel-org-tools--org-ql-select-rifle (buf query)
(let ((buffer (get-buffer buf))) (let ((buffer (get-buffer buf)))
(if buffer (if buffer
(org-ql-select (org-ql-select
buffer buffer
@ -374,7 +374,7 @@
:description "The keyword to match entry headings and content against.")) :description "The keyword to match entry headings and content against."))
:category "org-ql")) :category "org-ql"))
(defun gptel-org-tools--org-ql-select-all-rifle (query) (defun gptel-org-tools--org-ql-select-all-regexp (query)
(org-ql-select (org-ql-select
(org-agenda-files) (org-agenda-files)
`(regexp ,query) `(regexp ,query)
@ -382,8 +382,8 @@
(add-to-list 'gptel-org-tools (add-to-list 'gptel-org-tools
(gptel-make-tool (gptel-make-tool
:function #'gptel-org-tools--org-ql-select-all-rifle :function #'gptel-org-tools--org-ql-select-all-regexp
:name "org-ql-select-all-rifle" :name "org-ql-select-all-regexp"
:description "Run regexp on ALL files at once." :description "Run regexp on ALL files at once."
:args (list '(:name "query" :args (list '(:name "query"
:type string :type string