Consider:
;;; a.el
(defun a () nil)
(provide 'a)
;;; b.el
(require 'a)
(defun b () nil)
(provide 'b)
In traditional Emacs this byte compiles fine:
;;; use.el
(require 'b)
(a) ;This is automatically available "transitively" (without native-comp)
(b)
But --with-native-comp
complains that a
is unknown; transitive require
s are insufficient. Instead you must directly require everything, e.g.:
;;; use.el
(require 'a) ;NEW
(require 'b)
(a)
(b)
Alternatively I suppose b.el
could (provide 'b)
as well as (provide 'a)
?
Presumably this is because each native compilation is isolated and inherits no state/environment from previous compilations?
Although this isn't necessarily a bad change (I can see the argument for it being an improvement) it's a significant change.
In searching (so far, maybe I've missed something) I haven't seen an explanation in quite these terms. For example: "Tip: To work with native compilation, you cannot rely on a require
automatically providing features its has require
d. Either add direct require
s, or, have the required file use multiple provide
s to supply the expected features.
- Is my understanding of the situation correct?
- Is my "Tip" correct?