Update README.org

This commit is contained in:
Phil Bajsicki 2025-04-15 01:48:47 +02:00
parent 4b650dfd84
commit ca1fa23ca9
2 changed files with 39 additions and 39 deletions

View file

@ -125,7 +125,7 @@ Stuff, headers, etc.
These tools are primarily concerned with Emacs, Emacs Lisp, and files-or-buffers. 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... 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. 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") :category "emacs")
#+end_src #+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. 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. 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)) :optional t))
:category "emacs") :category "emacs")
#+end_src #+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. 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. ~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") :category "filesystem")
#+end_src #+end_src
**** emacs-find-buffer-visiting **** find-buffer-visiting
#+begin_src elisp #+begin_src elisp
(gptel-make-tool (gptel-make-tool
:function (lambda (filename) :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.")) :description "The filename to compare to open buffers."))
:category "org-mode") :category "org-mode")
#+end_src #+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. Continuation from above. Open a file into a buffer for processing. Onec it's found by dired-list.
#+begin_src elisp #+begin_src elisp
(gptel-make-tool (gptel-make-tool

View file

@ -39,8 +39,8 @@
(with-temp-buffer (with-temp-buffer
(ibuffer) (ibuffer)
(let ((content (buffer-string))) (let ((content (buffer-string)))
(kill-buffer (current-buffer)) (kill-buffer (current-buffer))
content))) content)))
: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"
@ -76,12 +76,12 @@
(gptel-make-tool (gptel-make-tool
:function (lambda (file) :function (lambda (file)
(find-file-noselect file)) (find-file-noselect file))
:name "find-file-noselect" :name "find-file-noselect"
:description "Open the file in a buffer. This doesn't interfere with the user." :description "Open the file in a buffer. This doesn't interfere with the user."
:args (list '(:name "file" :args (list '(:name "file"
:type string :type string
:description "Path to file..")) :description "Path to file.."))
:category "filesystem") :category "filesystem")
(defun gptel-org-tools-org-extract-tags (buffer) (defun gptel-org-tools-org-extract-tags (buffer)
@ -136,8 +136,8 @@
(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)))))))
(gptel-make-tool (gptel-make-tool
:function #'gptel-org-tools-org-ql-select :function #'gptel-org-tools-org-ql-select
@ -179,8 +179,8 @@
(with-temp-buffer (with-temp-buffer
(org-agenda-list (or days 14)) (org-agenda-list (or days 14))
(let ((content (buffer-string))) (let ((content (buffer-string)))
(kill-buffer (current-buffer)) (kill-buffer (current-buffer))
content))) content)))
:name "org-agenda-fortnight" :name "org-agenda-fortnight"
:description "Get the next 14 days of user's org-agenda." :description "Get the next 14 days of user's org-agenda."
:args (list '(:name "days" :args (list '(:name "days"
@ -212,27 +212,27 @@
: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 :action #'(lambda () :action :action #'(lambda ()
(concat (concat
(buffer-substring-no-properties (buffer-substring-no-properties
(line-beginning-position) (line-beginning-position)
(line-end-position)))))) (line-end-position))))))
(gptel-make-tool (gptel-make-tool
:function #'gptel-org-tools-org-ql-select-headings-rifle :function #'gptel-org-tools-org-ql-select-headings-rifle
:name "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." :description "Retreive headings from buffer using org-ql-select. Matches against both heading and content. Using filename fails."
:args (list '(:name "buffer" :args (list '(:name "buffer"
:type string :type string
:description "The name of the buffer. See the NAME column in ~emacs-list-buffers~.") :description "The name of the buffer. See the NAME column in ~emacs-list-buffers~.")
'(:name "query" '(:name "query"
:type string :type string
:description "The string to pass into org-ql-select-headings-rifle. This is a bare string. Example: \"searchterm\"")) :description "The string to pass into org-ql-select-headings-rifle. This is a bare string. Example: \"searchterm\""))
: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
@ -243,8 +243,8 @@
(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)))))))
(gptel-make-tool (gptel-make-tool
@ -268,8 +268,8 @@
(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)))))))
(gptel-make-tool (gptel-make-tool
@ -293,8 +293,8 @@
(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)))))))
(gptel-make-tool (gptel-make-tool
:function #'gptel-org-tools-org-ql-select-rifle :function #'gptel-org-tools-org-ql-select-rifle