Disabling diff-hl on certain modes

What happened?

I tried to add org-mode as an exclusion to diff-hl-global-modes like so

(setq diff-hl-global-modes '(not image-mode org-mode))

But diff-hl still turns itself on when I visit an org file. Am I not understanding how its used?

No, you’ve understood it correctly, the problem is that Doom doesn’t use global-diff-hl-mode to enable diff-hl. It adds the hook to find-file-hook, which makes is effectively enabling it globally and unconditionally for any file-visiting buffer (bypassing diff-hl-global-modes entirely).

I realize the problem with that though and will correct it shortly. In the meantime, this should work around the issue for you:

(remove-hook 'find-file-hook #'diff-hl-mode)
(remove-hook 'vc-dir-mode-hook #'diff-hl-mode)
(add-hook 'find-file-hook #'diff-hl--global-turn-on)
(add-hook 'vc-dir-mode-hook #'diff-hl--global-turn-on)
1 Like

Should be fixed as of:

Thank you greatly!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.