In Emacs 28 a new scheme to enable global minor modes was introduced. In
easy-mmode.el, the turn-on-function is wrapped as follows:
(setq turn-on-function
`(lambda ()
(require 'easy-mmode)
(when (easy-mmode--globalized-predicate-p ,MODE-predicate)
(funcall ,turn-on-function)))))
It would be great if we could back port
easy-mmode--globalized-predicate-p via Compat, such that global minor
modes supporting Emacs 27 and older could take advantage of this scheme.
See for example corfu--on and global-corfu-modes in corfu.el.
I don't want to provide easy-mmode--globalized-predicate-p in Compat as
is, since the function is private. We could however propose an upstream
renaming to easy-mmode-globalized-predicate-p. The renamed function
should be autoloaded and could used like this in easy-mmode.el:
(setq turn-on-function
`(lambda ()
(when (easy-mmode-globalized-predicate-p ,MODE-predicate)
(funcall ,turn-on-function)))))
I am not sure if this argument is convincing for upstream however. The
other possibility would be to add an extended version of
define-globalized-minor-mode to compat-28.el, which could be used via
compat-call. The downside of this would be that autoload cookie parsing
will be broken. That's the reason why I haven't taken this approach so far:
;;;###autoload
(compat-call define-globalized-minor-mode ...)
One could work around this with some explicit specification, but that's
also not great.
;;;###autoload (autoload ...)
(compat-call define-globalized-minor-mode ...)
Thoughts? Thanks!
Daniel