Skip to content

quelpa/quelpa-use-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quelpa-use-package

Build Status MELPA MELPA Stable

If you are using use-package (which can help to simplify your .emacs) you can use the quelpa handler provided by quelpa-use-package.

Installation

Requirements: Emacs 25.1

Assuming you have bootstrapped quelpa, install quelpa-use-package (which installs use-package as a dependency) and require the library:

(quelpa
 '(quelpa-use-package
   :fetcher git
   :url "https://github.com/quelpa/quelpa-use-package.git"))
(require 'quelpa-use-package)

Usage

After that it is possible to call use-package with the :quelpa keyword:

;; installs abc-mode with quelpa
(use-package abc-mode :quelpa)

;; does the same (`t' is optional)
(use-package abc-mode :quelpa t)

;; again... (if the package would have another name)
(use-package abc-mode :quelpa abc-mode)

;; passes upgrade parameter to quelpa
(use-package abc-mode :quelpa (:upgrade t))

;; uses the given recipe
(use-package abc-mode
  :quelpa (abc-mode :fetcher github :repo "mkjunker/abc-mode"))

;; recipe with plist arguments
(use-package abc-mode
  :quelpa ((abc-mode :fetcher github :repo "mkjunker/abc-mode") :upgrade t))

The quelpa handler is compatible with MELPA's recipe format. You may want to check the optional properties not mentioned above.

Using quelpa with :ensure

To make :ensure t use quelpa instead of package.el set the use-package-ensure-function in your init file:

(setq use-package-ensure-function 'quelpa)

After that:

(use-package abc-mode :ensure t)

will install abc-mode with quelpa.

And if you enable use-package-always-ensure:

(setq use-package-always-ensure t)

then

(use-package abc-mode)

will install abc-mode with quelpa.

Conditional execution

Note that the :quelpa keyword is inserted after :if, :when, :unless and :requires so that you can make the installation of a package depend on some requirement, for example:

(use-package magit-filenotify
  :when (fboundp 'file-notify-add-watch)
  :quelpa (magit-filenotify :fetcher github :repo "magit/magit-filenotify")

In this case magit-filenotify is only installed if the function file-notify-add-watch is bound.

Likewise you can use :requires to make the installation depend on a feature being available:

(use-package magit-filenotify
  :requires filenotify
  :quelpa (magit-filenotify :fetcher github :repo "magit/magit-filenotify"))

Overriding use-package-always-ensure

To install some packages with quelpa but use use-package-always-ensure to install all others from an ELPA repo :ensure needs to be disabled if the :quelpa keyword is found.

quelpa-use-package provides an advice for this purpose which can be activated thus:

(quelpa-use-package-activate-advice)

To disable it again you can use:

(quelpa-use-package-deactivate-advice)