gptel-autocomplete
An Emacs package that shows AI-generated code completions as inline ghost text at the cursor, built on the gptel package, with configurable context windows and an optional idle-triggered automatic mode.
gptel-autocomplete requests a code completion from an LLM through the existing gptel package and displays it as ghost text at the cursor, which can be previewed and then accepted into the buffer. A configurable number of lines before and after the cursor is sent as context, and additional context can be supplied through gptel's own context features, such as gptel-add.
An in-flight completion request is cancelled automatically if a newer one is triggered, so only the latest request keeps running. An optional minor mode triggers completion automatically after a configurable idle delay, and a custom system prompt and sampling temperature can be set.
It requires Emacs 27.2 or newer and an already-configured gptel package, and installs through straight.el by pointing at the project's GitHub repository.