Commit 22a46fff authored by steckerhalter's avatar steckerhalter

add advice to override use-package-always-ensure

parent f3ff315e
......@@ -5,6 +5,10 @@
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 24.4
Assuming you have bootstrapped `quelpa`, install `quelpa-use-package` (which installs `use-package` as a dependency) and require the library:
......@@ -15,6 +19,8 @@ Assuming you have bootstrapped `quelpa`, install `quelpa-use-package` (which ins
(require 'quelpa-use-package)
## Usage
After that it is possible to call `use-package` with the `:quelpa` keyword:
......@@ -39,6 +45,8 @@ After that it is possible to call `use-package` with the `:quelpa` keyword:
:quelpa ((abc-mode :fetcher github :repo "mkjunker/abc-mode") :upgrade t))
### 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:
......@@ -56,3 +64,19 @@ Likewise you can use `:requires` to make the installation depend on a feature be
: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 and advice for this purpose which can be activated thus:
and to disable it again you can use:
......@@ -5,7 +5,7 @@
;; Author: steckerhalter
;; URL:
;; Version: 0.0.1
;; Package-Requires: ((quelpa "0") (use-package "2"))
;; Package-Requires: ((emacs "24.4") (quelpa "0") (use-package "2"))
;; Keywords: package management elpa use-package
;; This file is not part of GNU Emacs.
......@@ -33,7 +33,7 @@
;;; Requirements:
;; `quelpa' and `use-package'
;; Emacs 24.4, `quelpa' and `use-package'
;;; Code:
......@@ -75,6 +75,23 @@
(defun quelpa-use-package-override-:ensure (func name-symbol keyword ensure rest state)
(let ((ensure (if (plist-member rest :quelpa)
(funcall func name-symbol keyword ensure rest state)))
(defun quelpa-use-package-activate-advice ()
(defun quelpa-use-package-deactivate-advice ()
;; register keyword on require
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment