John Wiegley [Thu, 16 Feb 2017 21:48:05 +0000 (13:48 -0800)]
Support multiple symbols passed to :after
The following expressions are now permitted:
foo ; load after foo is loaded
foo bar ; load after both foo and bar are loaded
:all foo bar ; same as previous
:any foo bar ; load after either foo or bar is loaded
:any (:all foo bar) baz ; more complex combinations...
:any (:all foo bar) (:all baz wow)
:all (:any foo bar) (:any baz wow)
Radon Rosborough [Mon, 13 Feb 2017 20:48:48 +0000 (12:48 -0800)]
Fix use-package-defaults
This patch should address issues https://github.com/jwiegley/use-package/issues/428 and https://github.com/jwiegley/use-package/issues/429. See https://github.com/jwiegley/use-package/issues/426 for
discussion. In brief, the issue was that use-package-sort-keywords was
not applied when the predicates in use-package-defaults did not return
true, when it should have been applied unconditionally.
Radon Rosborough [Mon, 16 Jan 2017 21:47:31 +0000 (13:47 -0800)]
Add use-package-defaults
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.
John Wiegley [Thu, 22 Dec 2016 17:02:52 +0000 (09:02 -0800)]
Add new customization option `use-package-always-demand`
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).
Jonas Bernoulli [Sun, 18 Dec 2016 14:47:36 +0000 (15:47 +0100)]
Delay decision whether to use eval-after-load until run-time
Just because a keymap variable is bound at macro-expansion-time
doesn't mean that it must be bound at run-time too.
Change `bind-keys-form', which is used by `bind-keys' and other
macros, to return a form which delays the decision on whether to
wrap the binding forms with `eval-after-load' until run-time.
Jonas Bernoulli [Sat, 17 Dec 2016 14:26:15 +0000 (15:26 +0100)]
Support outline-minor-mode
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.
Noam Postavsky [Thu, 26 May 2016 19:09:46 +0000 (15:09 -0400)]
Don't allow nil as a mode function
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")).
Noam Postavsky [Thu, 26 May 2016 19:08:32 +0000 (15:08 -0400)]
Refactor pair normalizers; add tests for them
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.
Mike Appleby [Mon, 15 Aug 2016 03:43:36 +0000 (22:43 -0500)]
Ensure package-pinned-packages is bound before referencing it
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
Matthew Feinberg [Thu, 21 Jul 2016 12:38:30 +0000 (08:38 -0400)]
Make pin and ensure compatible
`: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.
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).
Justin Burkett [Thu, 23 Jun 2016 14:01:33 +0000 (10:01 -0400)]
Move :init forms before :after and :demand
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.
Justin Burkett [Thu, 23 Jun 2016 02:46:32 +0000 (22:46 -0400)]
Add function use-package-jump-to-package-form
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.
Justin Burkett [Wed, 15 Jun 2016 02:37:56 +0000 (22:37 -0400)]
Improve imenu support
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.
Bjarte Johansen [Fri, 26 Feb 2016 15:19:24 +0000 (15:19 +0000)]
Quote variable in `bind-keys*'
* bind-key.el (bind-keys*): `override-global-map' needs to be quoted so
the symbol is passed to `bind-keys-form' and not the value.
GitHub-reference: fixes https://github.com/jwiegley/use-package/issues/323
Justin Talbott [Fri, 8 Jan 2016 19:35:17 +0000 (14:35 -0500)]
allow string values in cons for :bind keywords
It is possible with `bind-key` and `define-key` (and also `bind-chord`
and `key-chord-define`) to define a binding to a string's value, i.e:
``` elisp
(bind-key "C-;" "the ")
(bind-chord "^^" "λ")
```
This adds an option for `(use-package-normalize-pairs)` that allows
string values to be given with the `:bind` (and also `:chord`) keywords
to expand into these definitions.