copilot.el icon indicating copy to clipboard operation
copilot.el copied to clipboard

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

Open wthe2004 opened this issue 1 year ago • 4 comments

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

wthe2004 avatar May 15 '24 07:05 wthe2004

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).

YueRen avatar May 15 '24 19:05 YueRen

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.😭

wthe2004 avatar May 16 '24 01:05 wthe2004

	(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.

wthe2004 avatar May 21 '24 00:05 wthe2004

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

tuliolima avatar Jun 07 '24 02:06 tuliolima