7

For the sake of tidiness, I'd like to group setq(s) under single, related banner. Let's say I want to set the value of compilation-scroll-output in "compilation" unit like this:

(use-package compilation
  :init
  (progn
    (setq compilation-scroll-output t)))

All I get is:

Could not load compilation

How is it?

  • 3
    FWIW, use describe-variable or describe-function to find out which package a var or func is in, then look down at the provide call to find out the package name. – Jordon Biondo Sep 9 '15 at 19:56
  • Your code to set compilation-scroll-output is a noop, it should be (progn (setq compilation-scroll-output t)) – npostavs Sep 9 '15 at 20:41
  • Thank you npostavs. For some unknown reason I was trying to use ' as an alias of setq. – jacekmigacz Sep 9 '15 at 21:02
  • @npostavs I didn't even notice that.. fixed that in my answer too. – Kaushal Modi Sep 9 '15 at 21:15
10

The package's name is compile.

Below should work.

(use-package compile
  :init
  (progn
    (setq compilation-scroll-output t)))

It would be worthwhile to note @JordonBiondo's comment on how to figure out a package's name.

If you want to know which package a variable belongs to, do C-h v or M-x describe-variable followed by the var name (for a function name, C-h f or M-x describe-function). From the *Help* window that pops up, navigate to the package's .el file and see the (provide ..) call to find out the package name.

  • 2
    Use-package's syntax around the keywords is slightly unusual. The forms following most of the keywords are bundled up for that keyword for you. So the progn is rarely needed. (use-package compile :init (message "init for compile") (setq compilation-scroll-output t)) – Ben Hyde Dec 22 '15 at 16:14
  • 5
    @BenHyde That's correct; progn is not required but I use it for convenience. If I have bunch of forms under :init and a bunch of forms under :config, having wrapped them in (progn ..) makes it very convenient to eval the whole of :init or :config using C-x C-e. – Kaushal Modi Dec 22 '15 at 16: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.