(defun require-package (package &optional min-version no-refresh)
"Install given PACKAGE, optionally requiring MIN-VERSION.
If NO-REFRESH is non-nil, the available package lists will not be
re-downloaded in order to locate PACKAGE."
(if (package-installed-p package min-version)
t
(if (or (assoc package package-archive-contents) no-refresh)
(if (boundp 'package-selected-packages)
;; Record this as a package the user installed explicitly
(package-install package nil)
(package-install package))
(progn
(package-refresh-contents)
(require-package package min-version t)))))
能提供一下 use-package-always-ensure 和 :ensure t 区别的文档么?
我查到这个:
The ‘:ensure’ keyword causes the package(s)
to be installed automatically if not already present on your system (set
‘(setq use-package-always-ensure t)’ if you wish this behavior to be
global for all packages):
我看到了:
if you wish this behavior to be global for all packages
(defcustom use-package-always-ensure nil
"Treat every package as though it had specified using `:ensure SEXP'.
See also `use-package-defaults', which uses this value."
:type 'sexp
:group 'use-package-ensure)