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
#+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-agenda-files)
`(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
(gptel-make-tool
:function #'gptel-org-tools--org-ql-select-all-rifle
:name "org-ql-select-all-rifle"
:function #'gptel-org-tools--org-ql-select-all-regexp
:name "org-ql-select-all-regexp"
:description "Run regexp on ALL files at once."
:args (list '(:name "query"
:type string

View file

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