In the use-package documentation https://github.com/jwiegley/use-package#diminishing-and-delighting-minor-modes there is an example that considers emacs as a package(i.e (use-package emacs))

Usually the installed packages reside in the subdirectory of '~/.emacs.d/...'. How does use-package handle the package emacs ? Is it handled as a special case ?


It is not packages that use-package loads but features (which are things you can require and test for with featurep). From this point of view, use-package is essentially a fancy wrapper for require.

While use-package can often seem like magic, you can demystify by placing point after a use-package stanza and doing M-x pp-macroexpand-last-sexp. In the case you reference, macro-expanding

(use-package emacs
  (auto-fill-function " AF")


     (require 'emacs nil t))
    (display-warning 'use-package
             (format "Cannot load %s" 'emacs)
      (fboundp 'delight)
       '((auto-fill-function " AF" emacs)
     (visual-line-mode nil emacs)))))

wrapped in some error-checking, messages and timing.

This is helpful: you can use the nice use-package interface to configure built-in things like dired.

| improve this answer | |
  • So (featurep 'emacs) is true. (Who knew?) And the reason is...? I wonder. – Drew Oct 18 at 1:41
  • I did not know until I tried it. No idea why... – Fran Burstall Oct 18 at 9:40
  • It can be a convenience when writing code which deals with features if there's a feature which is guaranteed to always be present. Rather than dealing with special-cases, you can just supply the emacs feature. I don't know for certain if this is the reason for it existing, but I think it's a good thing that it does. – phils Oct 18 at 9:49
  • 1
    I asked on help-gnu-emacs@gnu.org, and @stefan replied saying "emacs was added as a feature as a consequence of xemacs being a feature." – Drew Oct 18 at 15:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.