Skip to content

Conversation

@La-Loutre
Copy link

Automatically enables gptel-mode for files with a .gptel extension. This allows users to create new chat files or reload saved conversations without having to manually enable the mode.

I find this extremely useful. Simply open a new file named myconv.gptel, and you're chatting with the AI in a buffer that can be saved and reopened without running any command. You don't need to run M-x gptel anymore.

Automatically enables gptel-mode for files with a .gptel
extension. This allows users to create new chat files or reload saved
conversations without having to manually enable the mode.
@La-Loutre
Copy link
Author

Screencast.From.2025-08-09.00-28-36.mp4

@Igrom
Copy link

Igrom commented Sep 20, 2025

Why is it necessary to define a new mode?

  • gptel-mode is supposed to be a minor mode, not a major mode
  • you're pinning the mode as text-mode. If opening a new buffer by calling gptel based on the value of gptel-default-mode.

You can achieve the same with a one-liner that respects the value of gptel-default-mode. See master...Igrom:gptel:feature/add-gptel-file-association-to-auto-mode-alist. (though I'm not sure if I'm not abusing auto-mode-alist here).

I'm not even convinced if that's the way to go. File associations could be added to the installation section in the README (e.g. to the :init section of use-package), as it is the case for many other packages.

@karthink FYI (esp. regarding the last point)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants