I know this was asked in other contexts already, but I couldn't find anything related to C++ development with my hooks that could help me.
I am working a lot with replace
and query-replace
and query-replace-regexp
and I love it.
Now I have the very annoying problem that after a while I am working in a buffer I suddenly get the error mentioned in the title after the first replace.
This happens not always but after a while it suddenly appears. Reopening the buffer fixes it for a while but is not a solution.
In other answers the before-changes-functions
and the after-change-functions
are mentioned. Because the error occurs after the first replace, I would assume it should be located in the after-change-functions
hook. The value for this in the buffer is:
(c-after-change flycheck-handle-change flymake-after-change-function lsp-on-change jit-lock-after-change t)
I failed to find out what is going on there, so any help on that is highly appreciated.
EDIT: Thanks to Alex Karbivnichiy for the answer. I like your idea of a custom replace.
It inspired me to do some more testing with before-change-functions
and after-change-functions
without success. I had a buffer with the clobbered problem and started to disable minor modes. Nothing helped. I then set both change functions to nil and even this did not solve the problem.
I killed and reopened the buffer and replace is working as expected again.
Am I missing any other variable or function that can cause this problem.