6

Emacs noob here, I want to use melpa-stable whenever possible for my packages.

use-package has an option for this, use-package-always-pin.

By default package.el prefers melpa over melpa-stable due to the versioning (> evil-20141208.623 evil-1.0.9), so even if you are tracking only a single package from melpa, you will need to tag all the non-melpa packages with the appropriate archive. If this really annoys you, then you can set use-package-always-pin to set a default.

How am I supposed to set this?

The documentation for the variable is:

use-package-always-pin is a variable defined in `use-package.el'.
Its value is nil

Documentation:
Treat every package as though it had specified `:pin SYM.

You can customize this variable.

Since you would :pin like this

(use-package smooth-scrolling
  :pin melpa-stable)

I would assume that it would one of these

(setq use-package-always-pin melpa-stable)
(setq use-package-always-pin 'melpa-stable)

but either one (tried separately) gets me the error:

Symbol's value as variable is void: melpa-stable

If I start emacs and then eval (setq use-package-always-pin 'melpa-stable) it seems to work as expected. I would guess it was some kind of load order issue, but I'm pretty clueless about how that works.

I tried:

(with-eval-after-load 'use-package
  (setq use-package-always-pin 'melpa-stable))

No luck.

Drew
  • 77,472
  • 10
  • 114
  • 243
Dean
  • 203
  • 1
  • 9

1 Answers1

2

The use-package-always-pin variable should be set to a string. Setting it prior to your (use-package) is supposed to be how you use it. It’s meant to provide the default value so that you don’t have to set :pin a bunch of times. For example:

;; Automatically :ensure each use-package.
(setq use-package-always-ensure t)
;; Default value for :pin in each use-package.
(setq use-package-always-pin "melpa-stable")

(use-package editorconfig
  :config (editorconfig-mode 1))

(use-package js2-mode
  :pin "melpa" ;; Use unstable version.
  :mode ("\\.js\\'" . js2-jsx-mode)
  :interpreter ("node" . js2-jsx-mode))

That is supposed to work, but :pin and :ensure do not work optimally in use-package (at least as of 2017-06-24), so you may have mixed results.

binki
  • 121
  • 5