gptel in Emacs: presets, rewrites and agent workflows
Explore gptel presets in Emacs, including JSON responses, targeted rewrites and Flymake annotations, plus the speaker's warnings about preset syntax.
Player not loading? Watch on YouTube
This demonstration explores gptel, an LLM client for Emacs, through presets that control a request's context, model settings and response handling. The speaker treats queries as text transformations and compares their inputs and outputs to shell pipelines. It is a tour of possible workflows rather than an installation tutorial.
The Tutor preset bundles a guiding system prompt with model and interface settings. Introspect gives the model tools to inspect Emacs documentation and state, while JSON accepts a shorthand schema for structured responses. Other examples expand shell commands or Emacs Lisp expressions before submission, collect visible buffer content, or include selected files.
Response handling gets equal attention. Rewrite previews a replacement for selected text so the user can inspect and accept changes. In the repository example, read-only tools supply context while edits stay within the selected region. Annotate presents explanations as Flymake diagnostics beside the relevant text. The speaker also gives macher and gptel-agent the same coding task, then tests macher's patch for inspecting and accepting suggested replacements.
The speaker warns that accidental preset tokens can execute code before a request reaches the model. They also report partial KV-cache invalidation from tokens in earlier prompts and say dynamic presets require Emacs Lisp knowledge. The demo does not establish an offline or local model setup.