10

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?

4
  • 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. Commented Sep 9, 2015 at 19:56
  • Your code to set compilation-scroll-output is a noop, it should be (progn (setq compilation-scroll-output t))
    – npostavs
    Commented Sep 9, 2015 at 20:41
  • Thank you npostavs. For some unknown reason I was trying to use ' as an alias of setq. Commented Sep 9, 2015 at 21:02
  • @npostavs I didn't even notice that.. fixed that in my answer too. Commented Sep 9, 2015 at 21:15

1 Answer 1

14

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
  • 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
    Commented Dec 22, 2015 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. Commented Dec 22, 2015 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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