Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid "Match data clobbered by buffer modification hooks" error #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LouisStrous
Copy link

@LouisStrous LouisStrous commented Apr 17, 2020

I found a reliable reproduction scenario and a code change that fixes #56 for me.

Reproduction scenario:

  1. Visit a C++ file that contains a syntax error. (Presumably the programming language is not important.)
  2. Do revert-buffer. This is a workaround for the issue, so we get to a state where query-replace works.
  3. Do a query-replace that replaces multiple occurrences. This succeeds.
  4. Undo the replacement.
  5. Do compile. The syntax error is reported.
  6. Do next-error to move to the (first) syntax error.
  7. Do a query-replace that replaces multiple occurrences. Only the first occurrence is replaced, and the error message "Match data clobbered by buffer modification hooks" is generated. This reproduces the problem.

The fix that works for me is to edit function origami-header-overlay-range in origami.el by wrapping the body of the save-excursion call in a save-match-data call, yielding

       (save-excursion
         (save-match-data
           (goto-char (overlay-end fold-overlay))
           (when (looking-at ".")
             (forward-char 1)
             (when (looking-at "\n")
               (forward-char 1)))
           (point))

@jcs090218
Copy link

Hi, just want inform people here that have started a new branch here.

If you don't mind using celpa, you can open the PR there instead! Thanks!

For reason why? See elp-revive/origami.el#1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

query-replace fails with origami
2 participants