Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* 0.9.9.4

** Breaking changes
- gptel now requires Transient 0.7.8 or higher. Transient is a built-in package
and Emacs does not update it by default. Ensure that
=package-install-upgrade-built-in= is non-nil, or update Transient manually.

- The models =gpt-5-codex=, =o3=, =o3-mini=, =o4-mini=,
=claude-3.5-sonnet=, =claude-3.7-sonnet=, =claude-3.7-sonnet-thought=,
Expand Down
4 changes: 2 additions & 2 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ gptel uses Curl if available, but falls back to the built-in url-retrieve to wor

** Installation

Note: gptel requires Transient 0.7.4 or higher. Transient is a built-in package and Emacs does not update it by default. Ensure that =package-install-upgrade-built-in= is true, or update Transient manually.
Note: gptel requires Transient 0.7.8 or higher. Transient is a built-in package and Emacs does not update it by default. Ensure that =package-install-upgrade-built-in= is true, or update Transient manually.

- *Release version*: =M-x package-install= ⏎ =gptel= in Emacs.
- *Development snapshot*: Add MELPA or NonGNU-devel ELPA to your list of package sources, then install with =M-x package-install= ⏎ =gptel=.
Expand All @@ -151,7 +151,7 @@ Note: gptel requires Transient 0.7.4 or higher. Transient is a built-in package
#+html: <details><summary>
*** Manual
#+html: </summary>
Note: gptel requires Transient 0.7.4 or higher. Transient is a built-in package and Emacs does not update it by default. Ensure that =package-install-upgrade-built-in= is true, or update Transient manually.
Note: gptel requires Transient 0.7.8 or higher. Transient is a built-in package and Emacs does not update it by default. Ensure that =package-install-upgrade-built-in= is true, or update Transient manually.

Clone or download this repository and run =M-x package-install-file⏎= on the repository directory.
#+html: </details>
Expand Down
1 change: 1 addition & 0 deletions gptel-rewrite.el
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ By default, gptel uses the directive associated with the `rewrite'
;;;###autoload (autoload 'gptel-rewrite "gptel-rewrite" nil t)
(transient-define-prefix gptel-rewrite ()
"Rewrite or refactor text region using an LLM."
:environment #'gptel--transient-fix-evil-visual
[:description
(lambda ()
(gptel--describe-directive
Expand Down
24 changes: 24 additions & 0 deletions gptel-transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,29 @@ which see."
(propertize (symbol-name name) 'face 'transient-value))
(when transient--stack (run-at-time 0 nil #'transient-setup)))

(defun gptel--transient-fix-evil-visual (fn)
"Let evil-mode set up the region correctly before displaying a transient.

This is supposed to be used in the `:entry' slot of `transient-define-prefix'.

The transient display code may be called from an entry in `post-command-hook',
which may happen to run late, i.e., after evil-mode's entry in that hook has
already teared down the temporary expanding of the region to a possibly existing
visual selection. This environment will ensure that the region is always
expanded before calling the transient display code in FN.

If evil-mode is not in use, this function is a no-op and calls FN directly."
(if (and (boundp 'evil-visual-region-expanded)
(not evil-visual-region-expanded)
(fboundp 'evil-visual-expand-region)
(fboundp 'evil-visual-contract-region))
(progn
(evil-visual-expand-region)
(funcall fn)
(when evil-visual-region-expanded
(evil-visual-contract-region)))
(funcall fn)))


;; * Transient classes and methods for gptel

Expand Down Expand Up @@ -778,6 +801,7 @@ Also format the value of OBJ in the transient menu."
(transient-define-prefix gptel-menu ()
"Change parameters of prompt to send to the LLM."
:incompatible '(("m" "y" "i") ("e" "g" "b" "k"))
:environment #'gptel--transient-fix-evil-visual
;; :value (list (concat "b" (buffer-name)))
[:description gptel-system-prompt--format
[""
Expand Down
2 changes: 1 addition & 1 deletion gptel.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

;; Author: Karthik Chikmagalur <karthik.chikmagalur@gmail.com>
;; Version: 0.9.9.4
;; Package-Requires: ((emacs "27.1") (transient "0.7.4") (compat "30.1.0.0"))
;; Package-Requires: ((emacs "27.1") (transient "0.7.8") (compat "30.1.0.0"))
;; Keywords: convenience, tools
;; URL: https://github.com/karthink/gptel

Expand Down