use-package icon indicating copy to clipboard operation
use-package copied to clipboard

Conditional package pinning, loading, etc.

Open jthaman opened this issue 4 years ago • 1 comments

Is it possible to conditionally pin and demand package? For example,

  • If OS is windows, then demand package
  • If OS is windows, then pin package to melpa-stable

I think I can do this outside of use-package, but I'm wondering if there is an idiomatic solution.

Thanks. John

jthaman avatar Mar 01 '21 14:03 jthaman

I think the following kind of gets you what you want. Package foo will only be loaded and initialised on Windows. It will be installed on other systems though but just not loaded. Is that acceptable?

(use-package foo
  :if (eq system-type 'windows-nt)
  :ensure t
  :pin melpa-stable)

doolio avatar Nov 14 '22 19:11 doolio