aboutsummaryrefslogtreecommitdiff
path: root/archive/gptel/gptel-tools/read_buffer.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-23 20:12:58 -0400
committerCraig Jennings <c@cjennings.net>2026-06-23 20:12:58 -0400
commite41c25068d0cec9434895a6d3e3a25d3a26f645f (patch)
tree5e30938a3fd6d80f501ffe3e6c1c187c5ddeb2c9 /archive/gptel/gptel-tools/read_buffer.el
parenta936e081b7270fbd4f1e7e9cb67ca1d4c2291ce6 (diff)
downloaddotemacs-e41c25068d0cec9434895a6d3e3a25d3a26f645f.tar.gz
dotemacs-e41c25068d0cec9434895a6d3e3a25d3a26f645f.zip
chore(ai): archive gptel and remove it from the live config
I archived gptel to archive/gptel/ since I rarely use it. Moved there: the six gptel modules (ai-config, ai-conversations, ai-conversations-browser, ai-mcp, ai-quick-ask, ai-rewrite), the gptel-tools/ directory, custom/gptel-prompts.el, their test files and utilities, and the four gptel-only specs. Scrubbed from the live config: the ai-config require in init.el, which also drops the whole C-; a keymap; the gptel-mode emojify hook in font-config.el; the gptel-tools entries in the Makefile clean target and the coverage runner; and the gptel feature notes in README. Cancelled the open gptel tasks in todo.org (the AI Open Work issues, the feature-extension brainstorm, the velox gptel-magit bug). ai-term stays. It is the ghostel Claude launcher, independent of gptel. Verified: every module loads, a batch init launch reaches completion clean, and the full test suite shows only pre-existing coverage failures unrelated to this change.
Diffstat (limited to 'archive/gptel/gptel-tools/read_buffer.el')
-rw-r--r--archive/gptel/gptel-tools/read_buffer.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/archive/gptel/gptel-tools/read_buffer.el b/archive/gptel/gptel-tools/read_buffer.el
new file mode 100644
index 000000000..c9136e3cf
--- /dev/null
+++ b/archive/gptel/gptel-tools/read_buffer.el
@@ -0,0 +1,33 @@
+;;; read_buffer.el --- Read buffer tool for GPTel -*- coding: utf-8; lexical-binding: t; -*-
+
+;;; Commentary:
+;; Gptel tool that returns the contents of an Emacs buffer by name.
+
+;;; Code:
+
+(require 'gptel)
+
+(defun cj/read-buffer--get-content (buffer)
+ "Return the substring of BUFFER from `point-min' to `point-max'.
+BUFFER may be a buffer object or a buffer name string. Signal an
+error when no live buffer matches."
+ (unless (buffer-live-p (get-buffer buffer))
+ (error "Buffer %s is not live" buffer))
+ (with-current-buffer buffer
+ (save-restriction
+ (widen)
+ (buffer-substring-no-properties (point-min) (point-max)))))
+
+(gptel-make-tool
+ :name "read_buffer"
+ :function (lambda (buffer) (cj/read-buffer--get-content buffer))
+ :description "return the contents of an emacs buffer"
+ :args (list '(:name "buffer"
+ :type string
+ :description "the name of the buffer whose contents are to be retrieved"))
+ :category "emacs")
+
+(add-to-list 'gptel-tools (gptel-get-tool '("emacs" "read_buffer")))
+
+(provide 'read_buffer)
+;;; read_buffer.el ends here