I maintain an Elisp package that is split over many files, and each of the files has its own group of defcustom
s in it, as a subgroup of the main package name.
I am unsure of how to make these defcustom
s available before the specific file has been fully loaded. At the moment, the parent Elisp file contains a stack of autoloads for the functions it draws in from the rest of the package's files (for its entry points), but I'm unsure how to achieve the equivalent for the user options.
Specifically, I have an option that I would like to use to determine whether a function should run in the mode's hook, which runs on entering the mode. But it is from a file that would possibly only be loaded much later on.
It would also seem to me to make good sense to make all options visible from the outset, rather than hiding them from users until a particular functionality in the package has been used.
Are my only choices to use defcustom
in the main file (breaking the package's distribution into files based on its different aspects) or to require
the child file in the main file?
I have also seen defvar
used first in the child file then a second time, now without an init value or docstring, in the parent file, but i'm unclear if that is effective or not. (I think it's done to placate flycheck
.)