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

Don't warn about copilot-max-char during normal Emacs functions

Open amake opened this issue 1 year ago • 4 comments

I get warnings like the below when I update packages via e.g. package-update-all.

⛔ Warning (copilot):  *temp*-529187 size exceeds 'copilot-max-char' (100000), copilot completions may not work

I am activating copilot-mode in prog-mode-hook, so I assume that it's catching large Elisp files that are opened at package install time. I do want copilot-mode in regular Elisp files, so I don't think it's feasible to be more selective about what hook I put it on.

Would it make sense to have copilot ignore buffers with the *temp*- prefix?

Originally posted by @amake in https://github.com/copilot-emacs/copilot.el/issues/311#issuecomment-2146427990

amake avatar Jun 04 '24 04:06 amake

I had the same issue. And thanks to that pull request that was made to, at least partially, resolve this, managed to suppress the warning by adding this line to my init.el (if you're using Doom Emacs, though, it would be in your config.el)

(setq copilot-max-char-warning-disabled t)

You might have already known and done this, but for anyone else searching for solutions to this issue and is even newer to Emacs than I am, hopefully, this helps.

ryankhart avatar Feb 15 '25 19:02 ryankhart

Hi! I still see this warning even after following the advice:

I had the same issue. And thanks to that pull request that was made to, at least partially, resolve this, managed to suppress the warning by adding this line to my init.el (if you're using Doom Emacs, though, it would be in your config.el)

(setq copilot-max-char-warning-disabled t)

You might have already known and done this, but for anyone else searching for solutions to this issue and is even newer to Emacs than I am, hopefully, this helps.

Is anyone else still experiencing the same issue?

Also, just to clarify, could the variable name be without the final d, like this?

(setq copilot-max-char-warning-disable t)

Lastly, even when I set:

(setq copilot-max-char -1) ;; -1 means no limit

I'm still getting the same warning in Spacemacs. I confirmed that both variables are set to the correct values.

jackgris avatar May 17 '25 16:05 jackgris

Also getting the warning, even with:

(setq copilot-max-char-warning-disabled t)

Wheest avatar Aug 06 '25 16:08 Wheest

At least for me, the only solution I’ve found is to modify the value directly in the function in copilot.el to a higher number or to -1.

(defcustom copilot-max-char 1000000
  "Maximum number of characters to send to Copilot, -1 means no limit."
  :group 'copilot
  :type 'integer
  :package-version '(copilot . "0.1"))

Or copilot-max-char-warning-disable to true

(defcustom copilot-max-char-warning-disable t
  "When non-nil, disable warning about buffer size exceeding `copilot-max-char'."
  :group 'copilot
  :type 'boolean
  :package-version '(copilot . "0.1"))

Probably, in my case, it’s something related to the Spacemacs layer. I need to research a bit more.

jackgris avatar Aug 11 '25 00:08 jackgris