mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-08 05:09:37 +00:00
Reduce some code duplication
This commit is contained in:
parent
28084551ac
commit
a1bdd958d3
1 changed files with 13 additions and 16 deletions
29
up-core.el
29
up-core.el
|
@ -1332,14 +1332,14 @@ no keyword implies `:all'."
|
||||||
(error (,context err)))))
|
(error (,context err)))))
|
||||||
|
|
||||||
(defun use-package-core (name args)
|
(defun use-package-core (name args)
|
||||||
(let ((context (gensym "use-package--warning"))
|
(let* ((context (gensym "use-package--warning"))
|
||||||
(args* (use-package-normalize-keywords name args))
|
(args* (use-package-normalize-keywords name args))
|
||||||
(use-package--hush-function #'identity))
|
(use-package--hush-function #'identity)
|
||||||
|
(process `(use-package-process-keywords ',name ',args*
|
||||||
|
',(and (plist-get args* :demand)
|
||||||
|
(list :demand t)))))
|
||||||
(if use-package-expand-minimally
|
(if use-package-expand-minimally
|
||||||
(funcall use-package--hush-function
|
(eval process)
|
||||||
(use-package-process-keywords name args*
|
|
||||||
(and (plist-get args* :demand)
|
|
||||||
(list :demand t))))
|
|
||||||
`((cl-flet
|
`((cl-flet
|
||||||
((,context
|
((,context
|
||||||
(err)
|
(err)
|
||||||
|
@ -1362,18 +1362,14 @@ no keyword implies `:all'."
|
||||||
(macroexp-progn
|
(macroexp-progn
|
||||||
(let ((use-package-verbose 'errors)
|
(let ((use-package-verbose 'errors)
|
||||||
(use-package-expand-minimally t))
|
(use-package-expand-minimally t))
|
||||||
(use-package-process-keywords name args*
|
(eval process))))))
|
||||||
(and (plist-get args* :demand)
|
|
||||||
(list :demand t))))))))
|
|
||||||
(emacs-lisp-mode))))
|
(emacs-lisp-mode))))
|
||||||
(ignore (display-warning 'use-package msg :error)))))
|
(ignore (display-warning 'use-package msg :error)))))
|
||||||
,(let ((use-package--hush-function
|
,(let ((use-package--hush-function
|
||||||
(apply-partially #'use-package-hush context)))
|
(apply-partially #'use-package-hush context)))
|
||||||
(macroexp-progn
|
(macroexp-progn
|
||||||
(funcall use-package--hush-function
|
(funcall use-package--hush-function
|
||||||
(use-package-process-keywords name args*
|
(eval process)))))))))
|
||||||
(and (plist-get args* :demand)
|
|
||||||
(list :demand t)))))))))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defmacro use-package (name &rest args)
|
(defmacro use-package (name &rest args)
|
||||||
|
@ -1439,9 +1435,10 @@ this file. Usage:
|
||||||
(use-package-core name args)
|
(use-package-core name args)
|
||||||
(error
|
(error
|
||||||
(ignore
|
(ignore
|
||||||
(let ((msg (format "Failed to parse package %s: %s"
|
(display-warning
|
||||||
name (error-message-string err))))
|
'use-package
|
||||||
(display-warning 'use-package msg :error)))))))))
|
(format "Failed to parse package %s: %s"
|
||||||
|
name (error-message-string err)) :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