mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 19:29:37 +00:00
Merge pull request from raxod502/fix-use-package-defaults
Fix use-package-defaults GitHub-reference: https://github.com/jwiegley/use-package/issues/430
This commit is contained in:
commit
f95d487d03
1 changed files with 28 additions and 20 deletions
|
@ -192,6 +192,20 @@ The default value uses package.el to install the package."
|
||||||
(function :tag "Custom"))
|
(function :tag "Custom"))
|
||||||
:group 'use-package)
|
:group 'use-package)
|
||||||
|
|
||||||
|
(defcustom use-package-defaults
|
||||||
|
'((:config '(t) t)
|
||||||
|
(:ensure use-package-always-ensure use-package-always-ensure)
|
||||||
|
(:pin use-package-always-pin use-package-always-pin))
|
||||||
|
"Alist of default values for `use-package' keywords.
|
||||||
|
Each entry in the alist is a list of three elements. The first
|
||||||
|
element is the `use-package' keyword and the second is a form
|
||||||
|
that can be evaluated to get the default value. The third element
|
||||||
|
is a form that can be evaluated to determine whether or not to
|
||||||
|
assign a default value; if it evaluates to nil, then the default
|
||||||
|
value is not assigned even if the keyword is not present in the
|
||||||
|
`use-package' form."
|
||||||
|
:type '(repeat (list symbol sexp sexp)))
|
||||||
|
|
||||||
(when use-package-enable-imenu-support
|
(when use-package-enable-imenu-support
|
||||||
;; Not defined in Emacs 24
|
;; Not defined in Emacs 24
|
||||||
(defvar lisp-mode-symbol-regexp
|
(defvar lisp-mode-symbol-regexp
|
||||||
|
@ -1153,43 +1167,37 @@ this file. Usage:
|
||||||
:pin Pin the package to an archive."
|
:pin Pin the package to an archive."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
(unless (member :disabled args)
|
(unless (member :disabled args)
|
||||||
(let* ((name-symbol (if (stringp name) (intern name) name))
|
(let ((name-symbol (if (stringp name) (intern name) name))
|
||||||
(args0 (use-package-plist-maybe-put
|
(args (use-package-normalize-plist name args)))
|
||||||
(use-package-normalize-plist name args)
|
(dolist (spec use-package-defaults)
|
||||||
:config '(t)))
|
(setq args (use-package-sort-keywords
|
||||||
(args* (use-package-sort-keywords
|
(if (eval (nth 2 spec))
|
||||||
(if use-package-always-ensure
|
(use-package-plist-maybe-put
|
||||||
(use-package-plist-maybe-put
|
args (nth 0 spec) (eval (nth 1 spec)))
|
||||||
args0 :ensure use-package-always-ensure)
|
args))))
|
||||||
args0)))
|
|
||||||
(args* (use-package-sort-keywords
|
|
||||||
(if use-package-always-pin
|
|
||||||
(use-package-plist-maybe-put
|
|
||||||
args* :pin use-package-always-pin)
|
|
||||||
args*))))
|
|
||||||
|
|
||||||
;; When byte-compiling, pre-load the package so all its symbols are in
|
;; When byte-compiling, pre-load the package so all its symbols are in
|
||||||
;; scope.
|
;; scope.
|
||||||
(if (bound-and-true-p byte-compile-current-file)
|
(if (bound-and-true-p byte-compile-current-file)
|
||||||
(setq args*
|
(setq args
|
||||||
(use-package-plist-cons
|
(use-package-plist-cons
|
||||||
args* :preface
|
args :preface
|
||||||
`(eval-when-compile
|
`(eval-when-compile
|
||||||
,@(mapcar #'(lambda (var) `(defvar ,var))
|
,@(mapcar #'(lambda (var) `(defvar ,var))
|
||||||
(plist-get args* :defines))
|
(plist-get args :defines))
|
||||||
(with-demoted-errors
|
(with-demoted-errors
|
||||||
,(format "Cannot load %s: %%S" name)
|
,(format "Cannot load %s: %%S" name)
|
||||||
,(if (eq use-package-verbose 'debug)
|
,(if (eq use-package-verbose 'debug)
|
||||||
`(message "Compiling package %s" ',name-symbol))
|
`(message "Compiling package %s" ',name-symbol))
|
||||||
,(unless (plist-get args* :no-require)
|
,(unless (plist-get args :no-require)
|
||||||
(use-package-load-name name)))))))
|
(use-package-load-name name)))))))
|
||||||
|
|
||||||
(let ((body
|
(let ((body
|
||||||
(macroexp-progn
|
(macroexp-progn
|
||||||
(use-package-process-keywords name
|
(use-package-process-keywords name
|
||||||
(if use-package-always-demand
|
(if use-package-always-demand
|
||||||
(append args* '(:demand t))
|
(append args '(:demand t))
|
||||||
args*)
|
args)
|
||||||
(and use-package-always-defer (list :deferred t))))))
|
(and use-package-always-defer (list :deferred t))))))
|
||||||
(if use-package-debug
|
(if use-package-debug
|
||||||
(display-buffer
|
(display-buffer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue