Extra functions for gptel, a package that allows you to use OpenAI's GPT for text generation and completion directly from Emacs.
-
Clone the repository to a local directory with:
git clone https://github.com/kamushadenes/gptel-extensions.el.git
-
Add the following to your Emacs init file (usually
~/.emacs
or~/.emacs.d/init.el
):(add-to-list 'load-path "path/to/gptel-extensions") (require 'gptel-extensions)
Replace
path/to/gptel-extensions
with the path where you cloned the repository. -
Restart Emacs, or evaluate the added code with
M-x eval-buffer
while in the init file.
Send the whole buffer to ChatGPT.
Load the current buffer into a session so you can ask questions about it.
Rewrite the region or sentence at point and replace it with the response. Extracted from the Wiki.
Refactor the region or sentence at point.
Prefix to use when asking questions about a document. Defaults to:
Your task is to answer questions about the following document. If you don't know the answer, reply with "I don't know"
###### DOCUMENT START ######
Suffix to use when asking questions about a document. Defaults to:
###### DOCUMENT END ######
### Question:
Directive to use when refactoring code. Defaults to:
You are a programmer. Refactor my code to improve readability. Reply only with the code.
This merely extends the amazing gptel by Karthik Chikmagalur, who performed all the hard work.