Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gptel-mode should work with any text-mode derived mode. #454

Open
1 task done
prenaux opened this issue Nov 2, 2024 · 1 comment
Open
1 task done

gptel-mode should work with any text-mode derived mode. #454

prenaux opened this issue Nov 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@prenaux
Copy link

prenaux commented Nov 2, 2024

Please update gptel first -- errors are often fixed by the time they're reported.

  • I have updated gptel to the latest commit and tested that the issue still exists

Bug Description

gptel-mode only works with org-mode and markdown-mode derived modes. I have some text-mode derived mode I use it with but oob it fails because of the mode compatibility check.

Here's how I fixed it in gptel.el:

  (if gptel-mode
      (progn
        (unless (or (derived-mode-p 'org-mode 'markdown-mode 'text-mode) ;; <<< Change here, add 'text-mode
                    (eq major-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)

Steps to Reproduce

Try to use gptel-mode with a text-mode derived mode that isnt text-mode itself.

@prenaux prenaux added the bug Something isn't working label Nov 2, 2024
@karthink
Copy link
Owner

karthink commented Nov 3, 2024

The reason(s) support for modes derived from text-mode is not currently enabled are:

  1. Many modes derive from text-mode where it does not make sense to use a chat interface. For example, yaml-mode.
  2. You can use gptel in any buffer -- turning on the mode is not necessary to use gptel. (gptel-mode only adds the prompt/resposne prefixes and the header-line.)

Can you describe the use case you have in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants