mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 11:49:37 +00:00
Correction to error detection at both :init and :config times
This commit is contained in:
parent
8428dafcfa
commit
35b975563c
1 changed files with 45 additions and 43 deletions
28
up-core.el
28
up-core.el
|
@ -1115,8 +1115,7 @@ deferred until the prefix key sequence is pressed."
|
||||||
',(use-package-as-symbol name) nil t)))
|
',(use-package-as-symbol name) nil t)))
|
||||||
(if (or (not arg) (null body))
|
(if (or (not arg) (null body))
|
||||||
body
|
body
|
||||||
`((eval-after-load ',name
|
`((eval-after-load ',name ',(macroexp-progn body)))))))
|
||||||
',(funcall use-package--hush-function body)))))))
|
|
||||||
|
|
||||||
;;;; :after
|
;;;; :after
|
||||||
|
|
||||||
|
@ -1242,10 +1241,12 @@ no keyword implies `:all'."
|
||||||
(let ((init-body
|
(let ((init-body
|
||||||
(use-package-hook-injector (use-package-as-string name)
|
(use-package-hook-injector (use-package-as-string name)
|
||||||
:init arg)))
|
:init arg)))
|
||||||
|
(when init-body
|
||||||
|
(funcall use-package--hush-function
|
||||||
(if use-package-check-before-init
|
(if use-package-check-before-init
|
||||||
`((if (locate-library ,(use-package-as-string name))
|
`((when (locate-library ,(use-package-as-string name))
|
||||||
,(macroexp-progn init-body)))
|
,@init-body))
|
||||||
init-body))
|
init-body))))
|
||||||
(use-package-process-keywords name rest state)))
|
(use-package-process-keywords name rest state)))
|
||||||
|
|
||||||
;;;; :load
|
;;;; :load
|
||||||
|
@ -1269,16 +1270,16 @@ no keyword implies `:all'."
|
||||||
(defun use-package-handler/:config (name keyword arg rest state)
|
(defun use-package-handler/:config (name keyword arg rest state)
|
||||||
(let* ((body (use-package-process-keywords name rest state))
|
(let* ((body (use-package-process-keywords name rest state))
|
||||||
(name-symbol (use-package-as-symbol name)))
|
(name-symbol (use-package-as-symbol name)))
|
||||||
(if (or (null arg)
|
(if (or (null arg) (equal arg '(t)))
|
||||||
(equal arg '(t)))
|
|
||||||
body
|
body
|
||||||
(use-package-with-elapsed-timer
|
(use-package-with-elapsed-timer
|
||||||
(format "Configuring package %s" name-symbol)
|
(format "Configuring package %s" name-symbol)
|
||||||
|
(funcall use-package--hush-function
|
||||||
(use-package-concat
|
(use-package-concat
|
||||||
(use-package-hook-injector
|
(use-package-hook-injector
|
||||||
(symbol-name name-symbol) :config arg)
|
(symbol-name name-symbol) :config arg)
|
||||||
body
|
body
|
||||||
(list t))))))
|
(list t)))))))
|
||||||
|
|
||||||
;;;; :diminish
|
;;;; :diminish
|
||||||
|
|
||||||
|
@ -1324,7 +1325,7 @@ no keyword implies `:all'."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defun use-package-hush (name args args* expanded body)
|
(defun use-package-hush (name args args* expanded body)
|
||||||
`(condition-case-unless-debug err
|
`((condition-case-unless-debug err
|
||||||
,(macroexp-progn body)
|
,(macroexp-progn body)
|
||||||
(error
|
(error
|
||||||
(let ((msg (format "%s: %s" ',name (error-message-string err))))
|
(let ((msg (format "%s: %s" ',name (error-message-string err))))
|
||||||
|
@ -1342,14 +1343,14 @@ no keyword implies `:all'."
|
||||||
"\n ==>\n\n"
|
"\n ==>\n\n"
|
||||||
(pp-to-string (macroexp-progn expanded))))
|
(pp-to-string (macroexp-progn expanded))))
|
||||||
(emacs-lisp-mode))))
|
(emacs-lisp-mode))))
|
||||||
(ignore (display-warning 'use-package msg :error))))))
|
(ignore (display-warning 'use-package msg :error)))))))
|
||||||
|
|
||||||
(defun use-package-core (name args)
|
(defun use-package-core (name args)
|
||||||
(let* ((args* (use-package-normalize-keywords name args))
|
(let* ((args* (use-package-normalize-keywords name args))
|
||||||
(use-package--hush-function
|
(use-package--hush-function
|
||||||
(if use-package-expand-minimally
|
(if use-package-expand-minimally
|
||||||
#'macroexp-progn
|
#'identity
|
||||||
(let ((use-package--hush-function #'macroexp-progn))
|
(let ((use-package--hush-function #'identity))
|
||||||
(apply-partially
|
(apply-partially
|
||||||
#'use-package-hush name args args*
|
#'use-package-hush name args args*
|
||||||
(let ((use-package-verbose 'errors)
|
(let ((use-package-verbose 'errors)
|
||||||
|
@ -1419,6 +1420,7 @@ this file. Usage:
|
||||||
:pin Pin the package to an archive."
|
:pin Pin the package to an archive."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
(unless (memq :disabled args)
|
(unless (memq :disabled args)
|
||||||
|
(macroexp-progn
|
||||||
(if (eq use-package-verbose 'errors)
|
(if (eq use-package-verbose 'errors)
|
||||||
(use-package-core name args)
|
(use-package-core name args)
|
||||||
(condition-case-unless-debug err
|
(condition-case-unless-debug err
|
||||||
|
@ -1427,7 +1429,7 @@ this file. Usage:
|
||||||
(ignore
|
(ignore
|
||||||
(let ((msg (format "Failed to parse package %s: %s"
|
(let ((msg (format "Failed to parse package %s: %s"
|
||||||
name (error-message-string err))))
|
name (error-message-string err))))
|
||||||
(display-warning 'use-package msg :error))))))))
|
(display-warning 'use-package msg :error)))))))))
|
||||||
|
|
||||||
(put 'use-package 'lisp-indent-function 'defun)
|
(put 'use-package 'lisp-indent-function 'defun)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue