copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.71k stars 122 forks source link

How can I set copilot-mode enable by deafult in certain modes and disable in others? #306

Open goodmorning-hwt opened 1 month ago

goodmorning-hwt commented 1 month ago

How can I set copilot-mode enable by deafult in certain modes and disable in others? Thanks in advance for any help!

YueRen commented 1 month ago

Depends strongly on how you are loading copilot in the first place. If you are using use-package, then check their readme, especially the passage where they explain how to use :mode (the python example there will make it so that python-mode is automatically activated when you open .py files).

goodmorning-hwt commented 1 month ago

Depends strongly on how you are loading copilot in the first place. If you are using use-package, then check their readme, especially the passage where they explain how to use :mode (the python example there will make it so that python-mode is automatically activated when you open .py files).

I use spacemacs, and I do not know how spacemacs organize additional packages, I just copied the readme's instruction.😭

goodmorning-hwt commented 1 month ago
    (add-hook 'prog-mode-hook 'my/disable-copilot-mode)
  (add-hook 'latex-mode-hook 'my/enable-copilot-m) 

I used these lines now to disable copilot in some mode. However, in this way, the Emacs starts the copilot first and then disable it, which I believe is unnecessary.

tuliolima commented 3 weeks ago

If you don't want copilot starting in prog-mode just remove the (add-hook 'prog-mode-hook 'my/disable-copilot-mode) line.