Previously, the :config, :ensure, and :pin keywords had default
values (dependent on the values of the use-package-always-ensure and
use-package-always-pin). This change allows the user to customize the
default values used for those keywords, and add default values for
their own keywords in a non-hacky way.
This functionality would be useful for (as an example) the
quelpa-use-package package, which needs to use an advice to override
the functionality of :ensure. The same problem prevents adding a
use-package-always-quelpa variable in any reasonable way, without a
way to customize the default values of keywords.
This is equivalent to adding `:demand t` to all `use-package` declarations,
and has the same semantics as doing so (meaning it can be overridden locally
using `:defer t` in a declaration).
Fixes https://github.com/jwiegley/use-package/issues/423
In "use-package.el" prefix headings with ";;;" instead of just
";;". In "bind-key.el" add the missing ";;; Code:" heading.
In both libraries set `outline-regexp' to an appropriate value.
This means (use-package foopkg :mode (".foo")) will add (".foo"
. foopkg) into auto-mode-alist instead of the broken (".foo" . nil),
this is more consistent with the behaviour of (use-package foopkg
:mode (".foo" ".bar")).
This is not a pure refactoring, it also fixes a bug where
:bind ([keysym] . "string") would actually bind keysym to nil (i.e.,
unbind it). It now binds to "string" as expected.
Add a bound-and-true-p guard to package-pinned-packages before
referencing it in use-package-ensure-elpa.
Package pinning was introduced in Emacs 24.4, and hence
package-pinned-packages in unbound by default in earlier versions.
Relevant commits:
72452b5 Merge pull request https://github.com/jwiegley/use-package/issues/367 from ketbra/master
5053f75 Make pin and ensure compatible
Fixes https://github.com/jwiegley/use-package/issues/375
Copyright-paperwork-exempt: yes
`:pin` does not work with `:ensure`, because it doesn't add the package to package-pinned-packages until after reading the package archive contents. This change causes the package archive contents to be reread if the package is pinned and `:ensure` is being used.
Copyright-paperwork-exempt: yes
for use-package-process-keywords, because the function may modify the
list object. Modifying a quoted constant can lead to unexpected side
effects (e.g. values from previous use-package forms end up in
subsequent ones).
The docstring of use-package says that :init should run before the
package is loaded but using :after moves the require statement ahead of
:init when any package specified in :after is already loaded. In the
following example, in the first case bar-x might get set before or after
bar is loaded depending on if foo is already loaded at the time, while
the second case always sets bar-x first.
(use-package bar
:after (foo)
:init (setq bar-x 2)
:config (bar-mode))
(use-package bar
:init (setq bar-x 2)
:config (bar-mode))
This commit fixes the issue and makes sure that bar-x is set before bar
is loaded by use-package. Fixes https://github.com/jwiegley/use-package/issues/352.
This is an attempt at resolving https://github.com/jwiegley/use-package/issues/329. The new interactive function
use-package-jump-to-package-form will prompt with a completing read of
all known packages. After selecting a package, use-package-find-require
searches load-history to see where the package was required and then I
attempt to find the correct use-package form using
use-package-form-regexp.
It will fail if the use-package form you are looking for did not
actually load the package. For example it could be something that is a
dependency of a library that was already loaded. In some sense this is a
feature because it is helpful to know that the library was already
loaded when your use-package form was encountered. It will also fail if
your use-package declaration doesn't match the regexp used, but this is
easily adjusted.
Instead of using defvar for lisp-mode-symbol-regexp, wait until
lisp-mode is loaded and check for its existence to avoid making
use-package the place where this variable is declared.
Also shutup bytecompiler about package-archive-contents.
* use-package.el (use-package-ensure-elpa): Add package to selected package
by using second arg of package install.