diff --git a/README.org b/README.org index 017a96a..0d4b4d1 100644 --- a/README.org +++ b/README.org @@ -125,7 +125,7 @@ Stuff, headers, etc. These tools are primarily concerned with Emacs, Emacs Lisp, and files-or-buffers. -**** exec_lisp +**** eval Dangerous, but occasionally useful for pure chaos and amusement... I would like to say. But in actuality, especially with the 'smarter' models, they can surprise with the varied approaches they have to problem-solving. @@ -148,7 +148,7 @@ Highly not recommended, but sometimes an LLM can pull a rabbit out of pure entro :category "emacs") #+end_src -**** emacs-list-buffers +**** list-buffers I wanted the assistant to have an easier time finding my files and buffers, and this has proven to be a great choice. I have yet to manage to get rid of the =:args=, but having them optional/ do nothing works well enough. The rationale behind using ~ibuffer~ is the same as with dired. They both display a lot of data, densely. So instead of trying to use some workaround with ~buffer-file-name~ or other functions, I'd rather just grab a 'text capture' of the same UI I'm looking at, and call it a day. @@ -170,7 +170,7 @@ Seems to be one of the most reliable tools in the basket... mostly because :optional t)) :category "emacs") #+end_src -**** dired-list +**** dired See above, same reasoning. There's very little reason to use the ~directory-files~ function for this (as in another tool I saw.) The reason is, ~directory-files~ doesn't provide nearly as much information about the items in that directory. Not even a distinction between files and directories. ~directory-files-and-attributes~ might, but I personally found its output horrendous to read, and still somehow more expensive context-wise than just plain ol' dired. @@ -196,7 +196,7 @@ Be sure to customize the function to point to your org directory, if you wish. I :category "filesystem") #+end_src -**** emacs-find-buffer-visiting +**** find-buffer-visiting #+begin_src elisp (gptel-make-tool :function (lambda (filename) @@ -208,7 +208,7 @@ Be sure to customize the function to point to your org directory, if you wish. I :description "The filename to compare to open buffers.")) :category "org-mode") #+end_src -**** emacs-find-file-noselect +**** find-file-noselect Continuation from above. Open a file into a buffer for processing. Onec it's found by dired-list. #+begin_src elisp (gptel-make-tool diff --git a/gptel-org-tools.el b/gptel-org-tools.el index f61ee1b..2017a4b 100644 --- a/gptel-org-tools.el +++ b/gptel-org-tools.el @@ -39,8 +39,8 @@ (with-temp-buffer (ibuffer) (let ((content (buffer-string))) - (kill-buffer (current-buffer)) - content))) + (kill-buffer (current-buffer)) + content))) :name "list-buffers" :description "Access the list of buffers open in Emacs, including file names and full paths." :args (list '(:name "arg" @@ -76,12 +76,12 @@ (gptel-make-tool :function (lambda (file) - (find-file-noselect file)) + (find-file-noselect file)) :name "find-file-noselect" :description "Open the file in a buffer. This doesn't interfere with the user." :args (list '(:name "file" - :type string - :description "Path to file..")) + :type string + :description "Path to file..")) :category "filesystem") (defun gptel-org-tools-org-extract-tags (buffer) @@ -136,8 +136,8 @@ (buffer-substring-no-properties (line-beginning-position) (progn - (outline-next-heading) - (line-beginning-position))))))) + (outline-next-heading) + (line-beginning-position))))))) (gptel-make-tool :function #'gptel-org-tools-org-ql-select @@ -179,8 +179,8 @@ (with-temp-buffer (org-agenda-list (or days 14)) (let ((content (buffer-string))) - (kill-buffer (current-buffer)) - content))) + (kill-buffer (current-buffer)) + content))) :name "org-agenda-fortnight" :description "Get the next 14 days of user's org-agenda." :args (list '(:name "days" @@ -212,27 +212,27 @@ :category "org-ql") (defun gptel-org-tools-org-ql-select-headings-rifle (buf query) - (org-ql-select - (get-buffer buf) - `(rifle ,query) - :action :action #'(lambda () - (concat - (buffer-substring-no-properties - (line-beginning-position) - (line-end-position)))))) + (org-ql-select + (get-buffer buf) + `(rifle ,query) + :action :action #'(lambda () + (concat + (buffer-substring-no-properties + (line-beginning-position) + (line-end-position)))))) - (gptel-make-tool - :function #'gptel-org-tools-org-ql-select-headings-rifle - :name "org-ql-select-headings-rifle" - :description "Retreive headings from buffer using org-ql-select. Matches against both heading and content. Using filename fails." - :args (list '(:name "buffer" - :type string - :description "The name of the buffer. See the NAME column in ~emacs-list-buffers~.") - '(:name "query" - :type string - :description "The string to pass into org-ql-select-headings-rifle. This is a bare string. Example: \"searchterm\"")) - :category "org-ql") +(gptel-make-tool + :function #'gptel-org-tools-org-ql-select-headings-rifle + :name "org-ql-select-headings-rifle" + :description "Retreive headings from buffer using org-ql-select. Matches against both heading and content. Using filename fails." + :args (list '(:name "buffer" + :type string + :description "The name of the buffer. See the NAME column in ~emacs-list-buffers~.") + '(:name "query" + :type string + :description "The string to pass into org-ql-select-headings-rifle. This is a bare string. Example: \"searchterm\"")) + :category "org-ql") (defun gptel-org-tools-org-ql-select-tags-local (buf query) (org-ql-select @@ -243,8 +243,8 @@ (buffer-substring-no-properties (line-beginning-position) (progn - (outline-next-heading) - (line-beginning-position))))))) + (outline-next-heading) + (line-beginning-position))))))) (gptel-make-tool @@ -268,8 +268,8 @@ (buffer-substring-no-properties (line-beginning-position) (progn - (outline-next-heading) - (line-beginning-position))))))) + (outline-next-heading) + (line-beginning-position))))))) (gptel-make-tool @@ -293,8 +293,8 @@ (buffer-substring-no-properties (line-beginning-position) (progn - (outline-next-heading) - (line-beginning-position))))))) + (outline-next-heading) + (line-beginning-position))))))) (gptel-make-tool :function #'gptel-org-tools-org-ql-select-rifle