-
Notifications
You must be signed in to change notification settings - Fork 0
/
quse-package.el
44 lines (38 loc) · 1.87 KB
/
quse-package.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;;; quse-package.el --- Install and configure packages in one convenient macro. -*- lexical-binding: t; -*-
;; Copyright (C) 2014-2018 Jacob MacDonald.
;; Author: Jacob MacDonald <[email protected]>.
;; Created: 18 December 2014.
;; Version: 2.2.5
;; Keywords: extensions lisp
;; Homepage: github.com/jaccarmac/quse-package
;; Package-Requires: ((quelpa "0") (use-package "0"))
;;; Commentary:
;; Use this package exactly like you would use-package, with the exception that
;; the package name should be a quelpa recipe. If the first argument after the
;; recipe is :upgrade, it will be treated as an :upgrade argument to quelpa.
;;; Code:
;;;###autoload
(defmacro quse-package (quelpa-form &rest use-package-forms)
"Download a package with quelpa and initialize it with ‘use-package’.
QUELPA-FORM should be an *unquoted* name or list compatible with
quelpa. USE-PACKAGE-FORMS should be whatever comes after the
package name in a ‘use-package’ call. If the first element of
USE-PACKAGE-FORMS is :upgrade, the next element is used as
the :upgrade parameter to the quelpa call."
(declare (indent 1))
(let* ((upgrade-form (if (and use-package-forms
(eq :upgrade (car use-package-forms)))
(list (car use-package-forms)
(cadr use-package-forms))))
(use-package-name (if (listp quelpa-form)
(car quelpa-form)
quelpa-form))
(use-package-forms (if upgrade-form
(cddr use-package-forms)
use-package-forms)))
`(progn (add-to-list 'package-selected-packages ',use-package-name)
(quelpa ',quelpa-form ,@upgrade-form)
(use-package ,use-package-name
,@use-package-forms))))
(provide 'quse-package)
;;; quse-package.el ends here