5

I saw that use-package has an :after section that can be used, which:

Defer loading of a package until after any of the named features are loaded.

The wording uses "any" instead of "all", so would that mean that if I set something like :after one two three, it will start loading even if only one is loaded but not two and three? The source seems to show that this is the case, but I'm not entirely sure.

If this is the case, though, what is the point of specifying more than one feature? Wouldn't it be preferable to defer until all of the specified features are loaded?

I have trouble envisioning a scenario in which it would be useful to defer a package until any of the specified features is loaded. Perhaps I'm misunderstanding the purpose of :after?

  • 1
    Say you want to use a spellchecker when writing some latex or when putting down some notes in org-mode. It makes sense to defer the loading of the spellchecker until after either your favorite latex-mode or org-mode is loaded. I'm pretty sure that there are cleaner ways of achieving this, though. – T. Verron Jan 20 '16 at 9:10
  • Ohhh! I guess the idea is that if, in your example, a hypothetical 'latex' package were deferred, and so was a hypothetical 'org' package, :after (latex org) would essentially defer package X until either one of them was loaded, since X would be needed for either one. I guess that sounds obvious now that I say it, but I was pretty confused. I feel like that answered my question. If you like, write it up as an answer and I will accept it. – Jorge Israel Peña Jan 20 '16 at 9:22
  • Neither latex-mode nor org-mode are hypothetical (;)) but that's the idea. I'll post an answer if nobody can come up with something better... this usecase still leaves me uncomfortable as "not the proper way". – T. Verron Jan 20 '16 at 9:26
  • Haha I am aware, but I don't think you would write :after (latex-mode org-mode). It seems like you would have to write the feature names that define latex-mode and org-mode no? Any ideas on how to figure out what those are reliably? I tried c-h f latex-mode for example to see which file it was defined in and to see if that had a (provides 'blah) form, but I couldn't find any. – Jorge Israel Peña Jan 20 '16 at 9:29
  • Org's feature is org; Latex is more complicated: apparently the built-in mode provides tex-mode and AUCTeX provides tex. But any of the subfiles would work, for example latex is provided by latex.el in AUCTeX and would work. – T. Verron Jan 20 '16 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.