ledger-mode
ledger-mode copied to clipboard
When ledger-highlight-xact-under-point is nil, do not attach to post-command-hook.
Nothing major, but if ledger-highlight-xact-under-point is nil, then there would be no need to have the post-command-hook calling a function that automatically exits every command loop. E.g.,
Change (add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t) to (when ledger-highlight-xact-under-point ....)
The current code is idiomatic because with your suggested change users would have to reinitialise the major mode to make any changes to the variable take effect.
The alternate idiomatic way to handle this would be to instead have a ledger-highlight-xact-minor-mode which could be toggled, and it would add/remove the post-command hook entry when being enabled/disabled.