I am using following solution for merge Git conflicts in Emacs, which is based on smerge. During merging smerge-mode creates <<<<<<< HEAD , ||||||||| parent lines for conflict detection.

But flycheck catches them as flycheck-error and changes their colors, hence they may become unreadable.

Would it be possible to prevent flycheck-mode to be disabled during merging or just can it ignore specific patterns to detected as flycheck-error' like: <<<<<<< HEAD`.

1 Answer 1


You can use M-x flycheck-mode to turn off flycheck in current buffer. Or alternatively, you can disable it for specific hooks (in this case smerge-mode):

(add-hook 'smerge-mode-hook (lambda () (flycheck-mode -1)))

*Note: I haven't tested this code yet. So, I don't know if this works or not.

  • I have tested and it works.
    – alper
    Commented Jul 19, 2021 at 9:16
  • Sorry for late response. I am getting Error running timer ‘lsp--on-idle’: (user-error "Flycheck mode disabled") error. After its disabled, it does not re-enable itself. Is it possible when smerge-mode is close automatically to re-enabe itself?
    – alper
    Commented Jul 22, 2021 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.