ledger-mode icon indicating copy to clipboard operation
ledger-mode copied to clipboard

When ledger-highlight-xact-under-point is nil, do not attach to post-command-hook.

Open lawlist opened this issue 4 years ago • 2 comments

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 ....)

lawlist avatar Nov 29 '20 23:11 lawlist

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.

purcell avatar Nov 30 '20 00:11 purcell

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.

purcell avatar Nov 30 '20 00:11 purcell