dgutov / diff-hl

Emacs package for highlighting uncommitted changes
GNU General Public License v3.0
914 stars 44 forks source link

Prevent diff-hl-side from triggering infloop #159

Closed wyuenho closed 3 years ago

wyuenho commented 3 years ago

When diff-hl.el is being loaded, and this defcustom is being defined, it is possible the setter will encounter a variable global-diff-hl-mode that is both bound and true, maybe due to a customs file with a (custom-set-variable '(global-diff-hl-mode t)) in it being loaded before diff-hl.el. Therefore, during this defcustom definition, the default initializer will call the setter, which will attempt to call an autoloaded function global-diff-hl-mode, which will trigger another load of diff-hl.el, ad infinitum.

This PR uses the suggested fix in the elisp manual to only call the setter during customization.

dgutov commented 3 years ago

Excellent, thank you.