I was testing my config out on Windows with Emacs 29.3 and a fresh install of copilot.el, and encountered a strange bug.
Steps to reproduce: in any buffer where copilot-mode is enabled, use search-forward and replace-match to modify any string that begins with begins with an upper-case letter. Then the following crazy thing happens: all text coming earlier in the same buffer has its capitalization modified to match that of the replaced string.
For example, if the buffer consists of the lines
foo
Bar
and we position point at the beginning and do `M-: (progn (search-forward "Bar") (replace-match "sup")), then the buffer looks like
Foo
Sup
This of course makes copilot unusable in conjunction with anything that uses replace-match nontrivially; the buffer quickly becomes fully capitalized.
I wasn't able to diagnose the issue via edebug; it doesn't help that replace-match is in the C source code. The error doesn't seem to be with copilot--on-doc-change and copilot--post-command-hook. The offending substitution happens before the call to copilot--post-command-hook and between the second and third calls to copilot--on-doc-change during the edit.
Any advice for debugging this would be most appreciated.
I was testing my config out on Windows with Emacs 29.3 and a fresh install of copilot.el, and encountered a strange bug.
Steps to reproduce: in any buffer where
copilot-mode
is enabled, usesearch-forward
andreplace-match
to modify any string that begins with begins with an upper-case letter. Then the following crazy thing happens: all text coming earlier in the same buffer has its capitalization modified to match that of the replaced string.For example, if the buffer consists of the lines
and we position point at the beginning and do `M-: (progn (search-forward "Bar") (replace-match "sup")), then the buffer looks like
This of course makes copilot unusable in conjunction with anything that uses
replace-match
nontrivially; the buffer quickly becomes fully capitalized.I wasn't able to diagnose the issue via edebug; it doesn't help that
replace-match
is in the C source code. The error doesn't seem to be withcopilot--on-doc-change
andcopilot--post-command-hook
. The offending substitution happens before the call tocopilot--post-command-hook
and between the second and third calls tocopilot--on-doc-change
during the edit.Any advice for debugging this would be most appreciated.