Create and set addOpener before package activation


Is there a way to create an addOpener function (within a package) which runs before a package is activated, or is that a barrier we’re not allowed to breach? I understand why we’re not supposed to run executable code at startup, since that wrecks startup time, but I feel setting an addOpener is different since it:

  1. Takes very little time to register a callback function
  2. Doesn’t add anything else to startup time, since it only gets called when a new file is opened (this assumes the user doesn’t start atom with something like remember-session which opens files at startup)

Is there some hook to register addOpener functions outside of the standard package activation? Is there a better way to do what I’m trying to do? I want the addOpener function to “just work” without requiring the user to run package:start beforehand.

How to correctly use addOpener (not registering function)

Hi. It’s me again. We seem to be crossing paths a lot.

Why don’t you just set up your package to activate at load time and then register the opener? A file can’t be opened before then, right?


Just searched up how to do that and it worked swimmingly. Didn’t realize activationEvents existed.