copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.74k stars 124 forks source link

Allow enabling copilot only in specific major modes #149

Closed solita-perttikellomaki closed 1 year ago

solita-perttikellomaki commented 1 year ago

In a corporate environment it is nice to be able to control explicitly in which modes copilot is turned on.

The selection is done in .emacs like this:

(setq copilot-only-in-modes '(clojure-mode clojurescript-mode))

zerolfx commented 1 year ago

Instead of using global-copilot-mode, why not use copilot-mode?

You can use something like (add-hook 'clojure-mode-hook #'copilot-mode).

solita-perttikellomaki commented 1 year ago

Ah, maybe I'm mistaken. It's been a long time since I've done any elisp. I thought this makes copilot-mode automatically global https://github.com/zerolfx/copilot.el/blob/efd6c1079a0abe989c8645cf1fb1c2e6c5e97c70/copilot.el#L720

I am using this as my starting point https://github.com/rksm/copilot-emacsd/blob/master/init.el and it does call global-copilot-mode. So all I need to do is tweak it a little. Thanks! I'll close the PR.