mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 11:49:37 +00:00
Always wrap the expanded body from use-package in (progn)
This commit is contained in:
parent
21b9b6551d
commit
f5b034154f
2 changed files with 65 additions and 57 deletions
|
@ -1760,25 +1760,25 @@ this file. Usage:
|
||||||
(symbol-name name)) nil t)))))))))
|
(symbol-name name)) nil t)))))))))
|
||||||
|
|
||||||
(let ((body
|
(let ((body
|
||||||
(macroexp-progn
|
`(progn
|
||||||
(use-package-process-keywords name
|
,@(use-package-process-keywords name
|
||||||
(let ((args*
|
(let ((args*
|
||||||
(use-package-sort-keywords
|
(use-package-sort-keywords
|
||||||
(if (and use-package-always-demand
|
(if (and use-package-always-demand
|
||||||
(not (memq :defer args)))
|
(not (memq :defer args)))
|
||||||
(plist-put args :demand t)
|
(plist-put args :demand t)
|
||||||
args))))
|
args))))
|
||||||
(when (and use-package-always-ensure
|
(when (and use-package-always-ensure
|
||||||
(plist-member args* :load-path)
|
(plist-member args* :load-path)
|
||||||
(not (plist-member orig-args :ensure)))
|
(not (plist-member orig-args :ensure)))
|
||||||
(plist-put args* :ensure nil))
|
(plist-put args* :ensure nil))
|
||||||
(unless (plist-member args* :init)
|
(unless (plist-member args* :init)
|
||||||
(plist-put args* :init nil))
|
(plist-put args* :init nil))
|
||||||
(unless (plist-member args* :config)
|
(unless (plist-member args* :config)
|
||||||
(plist-put args* :config '(t)))
|
(plist-put args* :config '(t)))
|
||||||
args*)
|
args*)
|
||||||
(and use-package-always-defer
|
(and use-package-always-defer
|
||||||
(list :deferred t))))))
|
(list :deferred t))))))
|
||||||
(when use-package-debug
|
(when use-package-debug
|
||||||
(display-buffer
|
(display-buffer
|
||||||
(save-current-buffer
|
(save-current-buffer
|
||||||
|
@ -1787,6 +1787,7 @@ this file. Usage:
|
||||||
(emacs-lisp-mode)
|
(emacs-lisp-mode)
|
||||||
(insert (pp-to-string body))
|
(insert (pp-to-string body))
|
||||||
(current-buffer)))))
|
(current-buffer)))))
|
||||||
|
(message "body = %s" body)
|
||||||
body))))
|
body))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -267,59 +267,59 @@
|
||||||
(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)
|
||||||
`(if (symbol-value 't)
|
`(progn
|
||||||
(progn
|
(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))
|
||||||
`(if (and t t)
|
`(progn
|
||||||
(progn
|
(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)
|
||||||
`(if nil
|
`(progn
|
||||||
(progn
|
(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)
|
||||||
`(if (symbol-value 't)
|
`(progn
|
||||||
(progn
|
(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))
|
||||||
`(if (and t t)
|
`(progn
|
||||||
(progn
|
(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)
|
||||||
`(if nil
|
`(progn
|
||||||
(progn
|
(when nil
|
||||||
(require 'foo nil 'nil)))))
|
(require 'foo nil 'nil)))))
|
||||||
|
|
||||||
(ert-deftest use-package-test/:when ()
|
(ert-deftest use-package-test/:unless ()
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :unless t)
|
(use-package foo :unless t)
|
||||||
`(if (symbol-value 't)
|
`(progn
|
||||||
nil
|
(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))
|
||||||
`(if (and t t)
|
`(progn
|
||||||
nil
|
(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)
|
||||||
`(if nil
|
`(progn
|
||||||
nil
|
(unless nil
|
||||||
(require 'foo nil 'nil))))
|
(require 'foo nil 'nil)))))
|
||||||
|
|
||||||
;; (ert-deftest use-package-test/:requires ()
|
;; (ert-deftest use-package-test/:requires ()
|
||||||
;; (should (equal (macroexpand (use-package))
|
;; (should (equal (macroexpand (use-package))
|
||||||
|
@ -446,7 +446,8 @@
|
||||||
(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)
|
||||||
`(require 'foo nil 'nil))
|
`(progn
|
||||||
|
(require 'foo nil 'nil)))
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -463,7 +464,8 @@
|
||||||
(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)
|
||||||
`(require 'foo nil 'nil))
|
`(progn
|
||||||
|
(require 'foo nil 'nil)))
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -479,13 +481,17 @@
|
||||||
|
|
||||||
(match-expansion
|
(match-expansion
|
||||||
(use-package foo :defer t :functions bar)
|
(use-package foo :defer t :functions bar)
|
||||||
`nil)
|
`(progn))
|
||||||
|
|
||||||
;; jww (2017-12-01): This exposes a bug.
|
(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
|
||||||
;; `'nil))
|
(eval-and-compile
|
||||||
|
(declare-function bar "foo")
|
||||||
|
(eval-when-compile
|
||||||
|
(with-demoted-errors "Cannot load foo: %S" nil
|
||||||
|
(load "foo" nil t)))))))
|
||||||
|
|
||||||
(let ((byte-compile-current-file t))
|
(let ((byte-compile-current-file t))
|
||||||
(match-expansion
|
(match-expansion
|
||||||
|
@ -576,8 +582,9 @@
|
||||||
(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)
|
||||||
`(eval-after-load 'bar
|
`(progn
|
||||||
'(require 'foo nil t))))
|
(eval-after-load 'bar
|
||||||
|
'(require 'foo nil t)))))
|
||||||
|
|
||||||
;; (ert-deftest use-package-test/:demand ()
|
;; (ert-deftest use-package-test/:demand ()
|
||||||
;; (should (equal (macroexpand (use-package))
|
;; (should (equal (macroexpand (use-package))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue