Skip to content

Commit

Permalink
gptel: Support gptel-mode in text-derived modes (#454)
Browse files Browse the repository at this point in the history
* gptel.el (gptel-mode): gptel-mode can now be used in all modes
derived from `text-mode'.  This does not make sense for many
modes, like yaml-mode (which is derived from text), but it is up
to the user to handle these cases.  No changes to the
defaults.
  • Loading branch information
karthink committed Jan 2, 2025
1 parent 5eb88bd commit 4c553e4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions gptel.el
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,7 @@ file."
map)
(if gptel-mode
(progn
(unless (or (derived-mode-p 'org-mode 'markdown-mode)
(eq major-mode 'text-mode))
(unless (derived-mode-p 'org-mode 'markdown-mode 'text-mode)
(gptel-mode -1)
(user-error (format "`gptel-mode' is not supported in `%s'." major-mode)))
(add-hook 'before-save-hook #'gptel--save-state nil t)
Expand Down

0 comments on commit 4c553e4

Please sign in to comment.