mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 03:39:38 +00:00
A great deal of internal reorganization and simplification
All handlers now address their own domain of work; :after has become safer; keyword normalization is multi-stage process; setting use-package-verbose to `debug' produces useful output in the *use-package* buffer in the case of load time errors; use-package errors (even internal) won't stop Emacs from starting (though a serious internal bug that errors out every use-package form may stop anything from being configured!); and more.
This commit is contained in:
parent
a9429350d5
commit
9ab797cccd
3 changed files with 719 additions and 590 deletions
|
@ -18,6 +18,12 @@
|
||||||
- The `:defer-install` keyword has been remove. It may reappear as an add-on
|
- The `:defer-install` keyword has been remove. It may reappear as an add-on
|
||||||
module for use-package in a future release. See issue #442 for more details.
|
module for use-package in a future release. See issue #442 for more details.
|
||||||
|
|
||||||
|
- The ordering of several elements of `use-package-keywords' have changed; if
|
||||||
|
you have this customized you will need to rework your changes.
|
||||||
|
|
||||||
|
- There is no longer a `use-package-debug` option, since `use-package-verbose`
|
||||||
|
already has the possible value of `debug`.
|
||||||
|
|
||||||
### Other changes
|
### Other changes
|
||||||
|
|
||||||
- Upgrade license to GPL 3.
|
- Upgrade license to GPL 3.
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,23 +26,36 @@
|
||||||
(require 'use-package)
|
(require 'use-package)
|
||||||
|
|
||||||
(setq use-package-always-ensure nil
|
(setq use-package-always-ensure nil
|
||||||
use-package-verbose nil
|
use-package-verbose 'errors
|
||||||
use-package-expand-minimally t
|
use-package-expand-minimally t
|
||||||
max-lisp-eval-depth 8000)
|
max-lisp-eval-depth 8000
|
||||||
|
max-specpdl-size 8000)
|
||||||
;; (let ((byte-compile-current-file nil)) (expand-minimally ()))
|
|
||||||
(fset 'insert-expansion
|
|
||||||
[?\C-\M- ?\M-w ?\M-: ?\M-p ?\C-e ?\C-b ?\C-b ?\C-\M-b ?\C-y ?\C-\M-k return ?\C-\M- ?\M-w C-return ?\C-z ?\C-n ?\C-f ?\C-y ?\C-\M-k])
|
|
||||||
|
|
||||||
(defmacro expand-minimally (form)
|
(defmacro expand-minimally (form)
|
||||||
`(let ((use-package-verbose nil)
|
`(let ((use-package-verbose 'errors)
|
||||||
(use-package-expand-minimally t))
|
(use-package-expand-minimally t))
|
||||||
(macroexpand ',form)))
|
(macroexpand-1 ',form)))
|
||||||
|
|
||||||
(defmacro match-expansion (form &rest value)
|
(defmacro match-expansion (form &rest value)
|
||||||
`(should (pcase (expand-minimally ,form)
|
`(should (pcase (expand-minimally ,form)
|
||||||
,@(mapcar #'(lambda (x) (list x t)) value))))
|
,@(mapcar #'(lambda (x) (list x t)) value))))
|
||||||
|
|
||||||
|
(defun fix-expansion ()
|
||||||
|
(interactive)
|
||||||
|
(save-excursion
|
||||||
|
(unless (looking-at "(match-expansion")
|
||||||
|
(backward-up-list))
|
||||||
|
(when (looking-at "(match-expansion")
|
||||||
|
(search-forward "(use-package")
|
||||||
|
(goto-char (match-beginning 0))
|
||||||
|
(let ((decl (read (current-buffer))))
|
||||||
|
(kill-sexp)
|
||||||
|
(let ((use-package-verbose 'errors)
|
||||||
|
(use-package-expand-minimally t))
|
||||||
|
(insert ?\n ?\` (pp-to-string (macroexpand-1 decl))))))))
|
||||||
|
|
||||||
|
(bind-key "C-c C-u" #'fix-expansion emacs-lisp-mode-map)
|
||||||
|
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(defun plist-delete (plist property)
|
(defun plist-delete (plist property)
|
||||||
"Delete PROPERTY from PLIST"
|
"Delete PROPERTY from PLIST"
|
||||||
|
@ -87,11 +100,6 @@
|
||||||
(ert-deftest use-package-test/:disabled ()
|
(ert-deftest use-package-test/:disabled ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :disabled t)
|
(use-package foo :disabled t)
|
||||||
`())
|
|
||||||
|
|
||||||
(match-expansion
|
|
||||||
;; jww (2017-11-30): Should :disabled ignore its argument?
|
|
||||||
(use-package foo :disabled nil)
|
|
||||||
`()))
|
`()))
|
||||||
|
|
||||||
(ert-deftest use-package-test/:preface ()
|
(ert-deftest use-package-test/:preface ()
|
||||||
|
@ -176,8 +184,7 @@
|
||||||
(ert-deftest use-package-test/:defer-install ()
|
(ert-deftest use-package-test/:defer-install ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defer-install t)
|
(use-package foo :defer-install t)
|
||||||
`(progn
|
`(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test-normalize/:ensure ()
|
(ert-deftest use-package-test-normalize/:ensure ()
|
||||||
(flet ((norm (&rest args)
|
(flet ((norm (&rest args)
|
||||||
|
@ -230,7 +237,6 @@
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :load-path "foo")
|
(use-package foo :load-path "foo")
|
||||||
`(progn
|
`(progn
|
||||||
(use-package-ensure-elpa 'foo 'nil 'nil)
|
|
||||||
(eval-and-compile
|
(eval-and-compile
|
||||||
(add-to-list 'load-path ,(pred stringp)))
|
(add-to-list 'load-path ,(pred stringp)))
|
||||||
(require 'foo nil nil))))
|
(require 'foo nil nil))))
|
||||||
|
@ -283,77 +289,82 @@
|
||||||
(ert-deftest use-package-test/:if ()
|
(ert-deftest use-package-test/:if ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :if t)
|
(use-package foo :if t)
|
||||||
`(progn
|
`(when t
|
||||||
(when (symbol-value 't)
|
(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :if (and t t))
|
(use-package foo :if (and t t))
|
||||||
`(progn
|
`(when (and t t)
|
||||||
(when (and t t)
|
(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :if nil)
|
(use-package foo :if nil)
|
||||||
`(progn
|
`(when nil
|
||||||
(when nil
|
(require 'foo nil nil))))
|
||||||
(require 'foo nil nil)))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:when ()
|
(ert-deftest use-package-test/:when ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :when t)
|
(use-package foo :when t)
|
||||||
`(progn
|
`(when t
|
||||||
(when (symbol-value 't)
|
(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :when (and t t))
|
(use-package foo :when (and t t))
|
||||||
`(progn
|
`(when (and t t)
|
||||||
(when (and t t)
|
(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :when nil)
|
(use-package foo :when nil)
|
||||||
`(progn
|
`(when nil
|
||||||
(when nil
|
(require 'foo nil nil))))
|
||||||
(require 'foo nil nil)))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:unless ()
|
(ert-deftest use-package-test/:unless ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :unless t)
|
(use-package foo :unless t)
|
||||||
`(progn
|
`(when (not t)
|
||||||
(unless (symbol-value 't)
|
(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :unless (and t t))
|
(use-package foo :unless (and t t))
|
||||||
`(progn
|
`(when (not (and t t))
|
||||||
(unless (and t t)
|
(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :unless nil)
|
(use-package foo :unless nil)
|
||||||
`(progn
|
`(unless nil
|
||||||
(unless nil
|
(require 'foo nil nil))))
|
||||||
(require 'foo nil nil)))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:requires ()
|
(ert-deftest use-package-test/:requires ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :requires bar)
|
(use-package foo :requires bar)
|
||||||
`(progn
|
`(when (featurep 'bar)
|
||||||
(when (not (member nil (mapcar #'featurep '(bar))))
|
(require 'foo nil nil)))
|
||||||
(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :requires bar)
|
(use-package foo :requires bar)
|
||||||
`(progn
|
`(when (featurep 'bar)
|
||||||
(when (not (member nil (mapcar #'featurep '(bar))))
|
(eval-and-compile
|
||||||
(eval-and-compile
|
(eval-when-compile
|
||||||
(eval-when-compile
|
(with-demoted-errors
|
||||||
(with-demoted-errors "Cannot load foo: %S" nil
|
"Cannot load foo: %S" nil
|
||||||
(load "foo" nil t))))
|
(load "foo" nil t))))
|
||||||
(require 'foo nil nil))))))
|
(require 'foo nil nil))))
|
||||||
|
|
||||||
|
(match-expansion
|
||||||
|
(use-package foo :requires (bar quux))
|
||||||
|
`(when (not (member nil (mapcar #'featurep '(bar quux))))
|
||||||
|
(require 'foo nil nil)))
|
||||||
|
|
||||||
|
(let ((byte-compile-current-file t))
|
||||||
|
(match-expansion
|
||||||
|
(use-package foo :requires bar)
|
||||||
|
`(when (featurep 'bar)
|
||||||
|
(eval-and-compile
|
||||||
|
(eval-when-compile
|
||||||
|
(with-demoted-errors "Cannot load foo: %S" nil
|
||||||
|
(load "foo" nil t))))
|
||||||
|
(require 'foo nil nil)))))
|
||||||
|
|
||||||
(ert-deftest use-package-test/:load-path ()
|
(ert-deftest use-package-test/:load-path ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -420,7 +431,7 @@
|
||||||
(ert-deftest use-package-test/:no-require ()
|
(ert-deftest use-package-test/:no-require ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :no-require t)
|
(use-package foo :no-require t)
|
||||||
`(progn))
|
`nil)
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :no-require t :config (config))
|
(use-package foo :no-require t :config (config))
|
||||||
|
@ -431,10 +442,9 @@
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :no-require t)
|
(use-package foo :no-require t)
|
||||||
`(progn
|
`(eval-and-compile
|
||||||
(eval-and-compile
|
(eval-when-compile
|
||||||
(eval-when-compile
|
(with-demoted-errors "Cannot load foo: %S" nil nil))))))
|
||||||
(with-demoted-errors "Cannot load foo: %S" nil nil)))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test-normalize/:bind ()
|
(ert-deftest use-package-test-normalize/:bind ()
|
||||||
(flet ((norm (&rest args)
|
(flet ((norm (&rest args)
|
||||||
|
@ -469,41 +479,35 @@
|
||||||
(ert-deftest use-package-test/:bind-keymap ()
|
(ert-deftest use-package-test/:bind-keymap ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :bind-keymap ("C-k" . key))
|
(use-package foo :bind-keymap ("C-k" . key))
|
||||||
`(progn
|
`(ignore
|
||||||
(ignore
|
(bind-key "C-k"
|
||||||
(bind-key "C-k"
|
#'(lambda nil
|
||||||
#'(lambda ()
|
(interactive)
|
||||||
(interactive)
|
(use-package-autoload-keymap 'key 'foo nil))))))
|
||||||
(use-package-autoload-keymap 'key 'foo nil)))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:bind-keymap* ()
|
(ert-deftest use-package-test/:bind-keymap* ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :bind-keymap* ("C-k" . key))
|
(use-package foo :bind-keymap* ("C-k" . key))
|
||||||
`(progn
|
`(ignore
|
||||||
(ignore
|
(bind-key* "C-k"
|
||||||
(bind-key* "C-k"
|
#'(lambda ()
|
||||||
#'(lambda ()
|
(interactive)
|
||||||
(interactive)
|
(use-package-autoload-keymap 'key 'foo t))))))
|
||||||
(use-package-autoload-keymap 'key 'foo t)))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:interpreter ()
|
(ert-deftest use-package-test/:interpreter ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :interpreter "interp")
|
(use-package foo :interpreter "interp")
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'interpreter-mode-alist '("interp" . foo))
|
||||||
(unless (fboundp 'foo)
|
(unless (fboundp 'foo)
|
||||||
(autoload #'foo "foo" nil t))
|
(autoload #'foo "foo" nil t))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'interpreter-mode-alist
|
|
||||||
'("interp" . foo)))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :interpreter ("interp" . fun))
|
(use-package foo :interpreter ("interp" . fun))
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'interpreter-mode-alist '("interp" . fun))
|
||||||
(unless (fboundp 'fun)
|
(unless (fboundp 'fun)
|
||||||
(autoload #'fun "foo" nil t))
|
(autoload #'fun "foo" nil t)))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'interpreter-mode-alist
|
|
||||||
'("interp" . fun))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test-normalize/:mode ()
|
(ert-deftest use-package-test-normalize/:mode ()
|
||||||
(flet ((norm (&rest args)
|
(flet ((norm (&rest args)
|
||||||
|
@ -524,65 +528,52 @@
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :mode "interp")
|
(use-package foo :mode "interp")
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'auto-mode-alist '("interp" . foo))
|
||||||
(unless (fboundp 'foo)
|
(unless (fboundp 'foo)
|
||||||
(autoload #'foo "foo" nil t))
|
(autoload #'foo "foo" nil t))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'auto-mode-alist
|
|
||||||
'("interp" . foo)))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :mode ("interp" . fun))
|
(use-package foo :mode ("interp" . fun))
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'auto-mode-alist '("interp" . fun))
|
||||||
(unless (fboundp 'fun)
|
(unless (fboundp 'fun)
|
||||||
(autoload #'fun "foo" nil t))
|
(autoload #'fun "foo" nil t)))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'auto-mode-alist
|
|
||||||
'("interp" . fun))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:magic ()
|
(ert-deftest use-package-test/:magic ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :magic "interp")
|
(use-package foo :magic "interp")
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'magic-mode-alist '("interp" . foo))
|
||||||
(unless (fboundp 'foo)
|
(unless (fboundp 'foo)
|
||||||
(autoload #'foo "foo" nil t))
|
(autoload #'foo "foo" nil t))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'magic-mode-alist
|
|
||||||
'("interp" . foo)))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :magic ("interp" . fun))
|
(use-package foo :magic ("interp" . fun))
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'magic-mode-alist '("interp" . fun))
|
||||||
(unless (fboundp 'fun)
|
(unless (fboundp 'fun)
|
||||||
(autoload #'fun "foo" nil t))
|
(autoload #'fun "foo" nil t)))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'magic-mode-alist
|
|
||||||
'("interp" . fun))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:magic-fallback ()
|
(ert-deftest use-package-test/:magic-fallback ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :magic-fallback "interp")
|
(use-package foo :magic-fallback "interp")
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'magic-fallback-mode-alist '("interp" . foo))
|
||||||
(unless (fboundp 'foo)
|
(unless (fboundp 'foo)
|
||||||
(autoload #'foo "foo" nil t))
|
(autoload #'foo "foo" nil t))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'magic-fallback-mode-alist
|
|
||||||
'("interp" . foo)))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :magic-fallback ("interp" . fun))
|
(use-package foo :magic-fallback ("interp" . fun))
|
||||||
`(progn
|
`(progn
|
||||||
|
(add-to-list 'magic-fallback-mode-alist '("interp" . fun))
|
||||||
(unless (fboundp 'fun)
|
(unless (fboundp 'fun)
|
||||||
(autoload #'fun "foo" nil t))
|
(autoload #'fun "foo" nil t)))))
|
||||||
(ignore
|
|
||||||
(add-to-list 'magic-fallback-mode-alist
|
|
||||||
'("interp" . fun))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test/:commands ()
|
(ert-deftest use-package-test/:commands ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :commands bar)
|
(use-package foo :commands bar)
|
||||||
`(progn
|
`(unless (fboundp 'bar)
|
||||||
(unless (fboundp 'bar)
|
(autoload #'bar "foo" nil t)))
|
||||||
(autoload #'bar "foo" nil t))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :commands (bar quux))
|
(use-package foo :commands (bar quux))
|
||||||
|
@ -612,8 +603,7 @@
|
||||||
(ert-deftest use-package-test/:defines ()
|
(ert-deftest use-package-test/:defines ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defines bar)
|
(use-package foo :defines bar)
|
||||||
`(progn
|
`(require 'foo nil nil))
|
||||||
(require 'foo nil nil)))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -630,8 +620,7 @@
|
||||||
(ert-deftest use-package-test/:functions ()
|
(ert-deftest use-package-test/:functions ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :functions bar)
|
(use-package foo :functions bar)
|
||||||
`(progn
|
`(require 'foo nil nil))
|
||||||
(require 'foo nil nil)))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -647,17 +636,16 @@
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defer t :functions bar)
|
(use-package foo :defer t :functions bar)
|
||||||
`(progn))
|
`nil)
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defer t :functions bar)
|
(use-package foo :defer t :functions bar)
|
||||||
`(progn
|
`(eval-and-compile
|
||||||
(eval-and-compile
|
(declare-function bar "foo")
|
||||||
(declare-function bar "foo")
|
(eval-when-compile
|
||||||
(eval-when-compile
|
(with-demoted-errors "Cannot load foo: %S" nil
|
||||||
(with-demoted-errors "Cannot load foo: %S" nil
|
(load "foo" nil t))))))
|
||||||
(load "foo" nil t)))))))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -677,8 +665,7 @@
|
||||||
(ert-deftest use-package-test/:defer ()
|
(ert-deftest use-package-test/:defer ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo)
|
(use-package foo)
|
||||||
`(progn
|
`(require 'foo nil nil))
|
||||||
(require 'foo nil nil)))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -692,16 +679,15 @@
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defer t)
|
(use-package foo :defer t)
|
||||||
`(progn))
|
`nil)
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defer t)
|
(use-package foo :defer t)
|
||||||
`(progn
|
`(eval-and-compile
|
||||||
(eval-and-compile
|
(eval-when-compile
|
||||||
(eval-when-compile
|
(with-demoted-errors "Cannot load foo: %S" nil
|
||||||
(with-demoted-errors "Cannot load foo: %S" nil
|
(load "foo" nil t)))))))
|
||||||
(load "foo" nil t))))))))
|
|
||||||
|
|
||||||
(ert-deftest use-package-test-normalize/:hook ()
|
(ert-deftest use-package-test-normalize/:hook ()
|
||||||
(flet ((norm (&rest args)
|
(flet ((norm (&rest args)
|
||||||
|
@ -726,7 +712,7 @@
|
||||||
(ert-deftest use-package-test/:hook ()
|
(ert-deftest use-package-test/:hook ()
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(should
|
(should
|
||||||
(equal ; pcase crashes
|
(equal
|
||||||
(expand-minimally
|
(expand-minimally
|
||||||
(use-package foo
|
(use-package foo
|
||||||
:bind (("C-a" . key))
|
:bind (("C-a" . key))
|
||||||
|
@ -734,8 +720,10 @@
|
||||||
'(progn
|
'(progn
|
||||||
(eval-and-compile
|
(eval-and-compile
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(with-demoted-errors "Cannot load foo: %S" nil
|
(with-demoted-errors
|
||||||
(load "foo" nil t))))
|
"Cannot load foo: %S" nil
|
||||||
|
(load "foo" nil t))))
|
||||||
|
(add-hook 'hook-hook #'fun)
|
||||||
(unless (fboundp 'fun)
|
(unless (fboundp 'fun)
|
||||||
(autoload #'fun "foo" nil t))
|
(autoload #'fun "foo" nil t))
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
|
@ -744,7 +732,6 @@
|
||||||
(autoload #'key "foo" nil t))
|
(autoload #'key "foo" nil t))
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(declare-function key "foo"))
|
(declare-function key "foo"))
|
||||||
(add-hook 'hook-hook #'fun)
|
|
||||||
(ignore
|
(ignore
|
||||||
(bind-keys :package foo ("C-a" . key))))))))
|
(bind-keys :package foo ("C-a" . key))))))))
|
||||||
|
|
||||||
|
@ -796,9 +783,8 @@
|
||||||
(ert-deftest use-package-test/:after ()
|
(ert-deftest use-package-test/:after ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after bar)
|
(use-package foo :after bar)
|
||||||
`(progn
|
`(eval-after-load 'bar
|
||||||
(eval-after-load 'bar
|
'(require 'foo nil nil)))
|
||||||
'(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -813,93 +799,96 @@
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (bar quux))
|
(use-package foo :after (bar quux))
|
||||||
`(progn
|
`(eval-after-load 'quux
|
||||||
(eval-after-load 'quux
|
'(eval-after-load 'bar
|
||||||
'(eval-after-load 'bar
|
'(require 'foo nil nil))))
|
||||||
'(require 'foo nil nil)))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (:all bar quux))
|
(use-package foo :after (:all bar quux))
|
||||||
`(progn
|
`(eval-after-load 'quux
|
||||||
(eval-after-load 'quux
|
'(eval-after-load 'bar
|
||||||
'(eval-after-load 'bar
|
'(require 'foo nil nil))))
|
||||||
'(require 'foo nil nil)))))
|
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (:any bar quux))
|
(use-package foo :after (:any bar quux))
|
||||||
`(progn
|
`(lexical-let ,_
|
||||||
(progn
|
(lexical-let ,_
|
||||||
(eval-after-load 'bar
|
(progn
|
||||||
'(require 'foo nil nil))
|
(eval-after-load 'bar
|
||||||
(eval-after-load 'quux
|
`(funcall ,_))
|
||||||
'(require 'foo nil nil)))))
|
(eval-after-load 'quux
|
||||||
|
`(funcall ,_))))))
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (:all (:any bar quux) bow))
|
(use-package foo :after (:all (:any bar quux) bow))
|
||||||
`(progn
|
`(lexical-let ,_
|
||||||
(eval-after-load 'bow
|
(lexical-let ,_
|
||||||
'(progn
|
(eval-after-load 'bow
|
||||||
(eval-after-load 'bar
|
'(progn
|
||||||
'(require 'foo nil nil))
|
(eval-after-load 'bar
|
||||||
(eval-after-load 'quux
|
`(funcall ,_))
|
||||||
'(require 'foo nil nil))))))
|
(eval-after-load 'quux
|
||||||
|
`(funcall ,_)))))))
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (:any (:all bar quux) bow))
|
(use-package foo :after (:any (:all bar quux) bow))
|
||||||
`(progn
|
`(lexical-let ,_
|
||||||
(progn
|
(lexical-let ,_
|
||||||
(eval-after-load 'quux
|
(progn
|
||||||
'(eval-after-load 'bar
|
(eval-after-load 'quux
|
||||||
'(require 'foo nil nil)))
|
'(eval-after-load 'bar
|
||||||
(eval-after-load 'bow
|
`(funcall ,_)))
|
||||||
'(require 'foo nil nil)))))
|
(eval-after-load 'bow
|
||||||
|
`(funcall ,_))))))
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (:all (:any bar quux) (:any bow baz)))
|
(use-package foo :after (:all (:any bar quux) (:any bow baz)))
|
||||||
`(progn
|
`(lexical-let ,_
|
||||||
(progn
|
(lexical-let ,_
|
||||||
(eval-after-load 'bow
|
(progn
|
||||||
'(progn
|
(eval-after-load 'bow
|
||||||
(eval-after-load 'bar
|
'(progn
|
||||||
'(require 'foo nil nil))
|
(eval-after-load 'bar
|
||||||
(eval-after-load 'quux
|
`(funcall ,_))
|
||||||
'(require 'foo nil nil))))
|
(eval-after-load 'quux
|
||||||
(eval-after-load 'baz
|
`(funcall ,_))))
|
||||||
'(progn
|
(eval-after-load 'baz
|
||||||
(eval-after-load 'bar
|
'(progn
|
||||||
'(require 'foo nil nil))
|
(eval-after-load 'bar
|
||||||
(eval-after-load 'quux
|
`(funcall ,_))
|
||||||
'(require 'foo nil nil)))))))
|
(eval-after-load 'quux
|
||||||
|
`(funcall ,_))))))))
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (:any (:all bar quux) (:all bow baz)))
|
(use-package foo :after (:any (:all bar quux) (:all bow baz)))
|
||||||
`(progn
|
`(lexical-let ,_
|
||||||
(progn
|
(lexical-let ,_
|
||||||
(eval-after-load 'quux
|
(progn
|
||||||
'(eval-after-load 'bar
|
(eval-after-load 'quux
|
||||||
'(require 'foo nil nil)))
|
'(eval-after-load 'bar
|
||||||
(eval-after-load 'baz
|
`(funcall ,_)))
|
||||||
'(eval-after-load 'bow
|
(eval-after-load 'baz
|
||||||
'(require 'foo nil nil))))))
|
'(eval-after-load 'bow
|
||||||
|
`(funcall ,_)))))))
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :after (:any (:all bar quux) (:any bow baz)))
|
(use-package foo :after (:any (:all bar quux) (:any bow baz)))
|
||||||
`(progn
|
`(lexical-let ,_
|
||||||
(progn
|
(lexical-let ,_
|
||||||
(eval-after-load 'quux
|
|
||||||
'(eval-after-load 'bar
|
|
||||||
'(require 'foo nil nil)))
|
|
||||||
(progn
|
(progn
|
||||||
(eval-after-load 'bow
|
(eval-after-load 'quux
|
||||||
'(require 'foo nil nil))
|
'(eval-after-load 'bar
|
||||||
(eval-after-load 'baz
|
`(funcall ,_)))
|
||||||
'(require 'foo nil nil)))))))
|
(progn
|
||||||
|
(eval-after-load 'bow
|
||||||
|
`(funcall ,use-package--next142993))
|
||||||
|
(eval-after-load 'baz
|
||||||
|
`(funcall ,_))))))))
|
||||||
|
|
||||||
(ert-deftest use-package-test/:demand ()
|
(ert-deftest use-package-test/:demand ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :demand t)
|
(use-package foo :demand t)
|
||||||
`(progn
|
`(require 'foo nil nil))
|
||||||
(require 'foo nil nil)))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -933,9 +922,8 @@
|
||||||
;; #529 - :demand should not override an explicit use of :after
|
;; #529 - :demand should not override an explicit use of :after
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :demand t :after bar)
|
(use-package foo :demand t :after bar)
|
||||||
`(progn
|
`(eval-after-load 'bar
|
||||||
(eval-after-load 'bar
|
'(require 'foo nil nil)))
|
||||||
'(require 'foo nil nil))))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -946,7 +934,40 @@
|
||||||
(with-demoted-errors "Cannot load foo: %S" nil
|
(with-demoted-errors "Cannot load foo: %S" nil
|
||||||
(load "foo" nil t))))
|
(load "foo" nil t))))
|
||||||
(eval-after-load 'bar
|
(eval-after-load 'bar
|
||||||
'(require 'foo nil nil))))))
|
'(require 'foo nil nil)))))
|
||||||
|
|
||||||
|
(match-expansion
|
||||||
|
(use-package counsel
|
||||||
|
:load-path "site-lisp/swiper"
|
||||||
|
:after ivy
|
||||||
|
:demand t
|
||||||
|
:diminish
|
||||||
|
:bind (("C-*" . counsel-org-agenda-headlines)
|
||||||
|
("M-x" . counsel-M-x))
|
||||||
|
:commands (counsel-minibuffer-history
|
||||||
|
counsel-find-library
|
||||||
|
counsel-unicode-char)
|
||||||
|
:preface (preface-code)
|
||||||
|
:init
|
||||||
|
;; This is actually wrong, but it's just part of the example.
|
||||||
|
(define-key minibuffer-local-map (kbd "M-r")
|
||||||
|
'counsel-minibuffer-history))
|
||||||
|
`(progn
|
||||||
|
(eval-and-compile
|
||||||
|
(add-to-list 'load-path "/Users/johnw/.emacs.d/site-lisp/swiper"))
|
||||||
|
(eval-and-compile
|
||||||
|
(preface-code))
|
||||||
|
(eval-after-load 'ivy
|
||||||
|
'(progn
|
||||||
|
(define-key minibuffer-local-map (kbd "M-r")
|
||||||
|
'counsel-minibuffer-history)
|
||||||
|
(require 'counsel nil nil)
|
||||||
|
(if (fboundp 'diminish)
|
||||||
|
(diminish 'counsel-mode))
|
||||||
|
(ignore
|
||||||
|
(bind-keys :package counsel
|
||||||
|
("C-*" . counsel-org-agenda-headlines)
|
||||||
|
("M-x" . counsel-M-x))))))))
|
||||||
|
|
||||||
(ert-deftest use-package-test/:config ()
|
(ert-deftest use-package-test/:config ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -970,11 +991,10 @@
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defer t :config (config))
|
(use-package foo :defer t :config (config))
|
||||||
`(progn
|
`(eval-after-load 'foo
|
||||||
(eval-after-load 'foo
|
'(progn
|
||||||
'(progn
|
(config)
|
||||||
(config)
|
t)))
|
||||||
t))))
|
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue