I have package that has no relation to evil-mode, but doesn't work well when the command is repeated.
While the repeat command can be disabled, I don't want to add a dependency on evil mode just to do this.
I also want to avoid the load-order of my package and evil causing my package not to detect evil mode.
While this works, it's not elegant, is there a better way to handle this?
(if (fboundp 'evil-declare-not-repeat)
(progn
(evil-declare-not-repeat 'my-foo-cmd)
(evil-declare-not-repeat 'my-bar-cmd)
(evil-declare-not-repeat 'my-baz-cmd))
(with-eval-after-load 'evil
(evil-declare-not-repeat 'my-foo-cmd)
(evil-declare-not-repeat 'my-bar-cmd)
(evil-declare-not-repeat 'my-baz-cmd)))
eval-after-load
isn't enough here, without wrapping it in anif
statement. – Tyler Jan 10 '20 at 12:06with-eval-after-load
runs the body code immediately if the feature is already loaded, and immediately after the feature is loaded if it isn't already. If the feature is never loaded, body is never run. so your(if (fboundp 'evil-declare-not-repeat) ...)
isn't necessary - it doesn't add anything that isn't already covered bywith-eval-after-load
. – Tyler Jan 10 '20 at 13:52