benchmark-init-el icon indicating copy to clipboard operation
benchmark-init-el copied to clipboard

Fixing "function might not be defined at runtime" errors.

Open chaosemer opened this issue 1 year ago • 2 comments

Without this, I get the following errors when depending on this package:

Error: the function "benchmark-init/node-root-p" might not be defined at runtime. Error: the function "benchmark-init/node-duration-adjusted" might not be defined at runtime. Error: the function "benchmark-init/flatten" might not be defined at runtime.

This error is accurate as the eval-when-compile does not force the require during a normal load.

chaosemer avatar Dec 29 '23 23:12 chaosemer

See the official docs on eval-when-compile, which say (emphasis added)

If you’re using another package, but only need macros from it (the byte compiler will expand those), then eval-when-compile can be used to load it for compiling, but not executing.

In this case, the mentioned items are functions, not macros and do need to be defined during runtime.

chaosemer avatar Dec 29 '23 23:12 chaosemer

@dholm, can you please take a look at this?

chaosemer avatar Jan 13 '24 04:01 chaosemer

Thank you @chaosemer, merged. Sorry for the delay.

dholm avatar Feb 02 '24 07:02 dholm