If I load my Emacs and wait until the idle timer fires, then this is the
sequence of events:
:init :idle <load> :config
But if I load Emacs and immediately type C-x L without waiting for the
idle timer to fire, this is the sequence of events:
:init <load> :config :idle
It's possible that the user could use `featurep` in their idle to test
for this case, but that's a subtlety I'd rather avoid.
What I would consider is this: `:idle [N]` is a keyword that simply
implies `:defer`, with an option number of N to specify a second count.
After that many seconds, if the package has not yet been loaded by
autoloading, it will be loaded via the idle timer.
This approach has the benefit of complete consistency for both the idle
and the autoloaded cases. Although, the fact that it implies `:defer`
means we don't have to consider what it means to add `:idle` behavior to
a demand-loaded configuration.
John Wiegley [Sun, 15 Mar 2015 07:22:17 +0000 (02:22 -0500)]
Add :preface, occurring before everything except :disabled
This can be used to establish function and variable definitions that
will 1) make the byte-compiler happy (it won't complain about functions
whose definitions are unknown because you have them within a guard
block), and 2) allow you to define code that can be used in an `:if`
test.
John Wiegley [Sat, 14 Mar 2015 10:22:43 +0000 (05:22 -0500)]
Begin refactoring for 2.0; NOTE: BREAKING CHANGES
The major change is that :init is now always performed before loading a
file, whether loading is deferred or not. This is a change from before,
where the semantics of :init varied between demand and defer. The new
usage is now entirely consistent.
Also, because :init and :config now mean "before" and "after", the
:pre-* and :post-* keywords are gone, as they should no longer be
necessary.
Lastly, an effort has been made to make your Emacs start even in the
presence of use-package configuration failures. So after this change,
be sure to check your *Messages* buffer. Most likely, you will have
several instances where you are using :init, but should be using :config
(this was the case for me in a number of places).
Jonas Bernoulli [Sun, 18 Jan 2015 10:41:13 +0000 (11:41 +0100)]
Allow using expanded macro without loading feature
In the macro `use-package-with-elapased-timer' use `bound-and-true-p'
go get the values of the customizable options `use-package-verbose'
and `use-package-minimum-reported-time'. This way the library only
has to be required at compile time, provided these options are not
actually customized. If the user has changed the values, then she
also has to load the library at runtime or the macros fall back to
the default of doing their job silently. See https://github.com/jwiegley/use-package/issues/149.
Jonas Bernoulli [Sun, 7 Sep 2014 12:43:56 +0000 (14:43 +0200)]
assume the declare-function macro exists
Since `declare-function' was added in Emacs 23.1 (five years ago), we
don't need to assert that it is defined. If the assertion was without
any problems there would be no harm in keeping it, but unfortunately it
causes a compile warning. Because `declare-function' is a macro with
always expands to `nil' the value of (fboundp 'declare-function) ends
up being unused.
Nicolas Richard [Thu, 6 Mar 2014 09:46:33 +0000 (10:46 +0100)]
Eval backquote earlier and support non-`progn' lists
* use-package.el (use-package-plist-get): add optional args: `eval-backquote'
and `no-progn' to control how arguments are retrieved.
(use-package-plist-get-value): remove this function
(use-package): replace calls to old function to modified function.
Rationale :
- use-package-plist-get-value was just another layer for no good reason,
and IMO its name was totally unclear.
- we now eval-as-backquote earlier, allowing constructs like:
(let ((my-list-of-commands-in-foo '(foo1 foo2)))
(use-package foo :commands ,@my-list-of-commands-in-foo))
instead of constructing equivalent key sequence by string concatenation.
This allows specifying vector key sequences, as in bind-key (since f0776c2aeb3f7f0af66597e10a3e4469ca26629d).
Nicolas Richard [Sun, 16 Feb 2014 10:59:59 +0000 (11:59 +0100)]
Add new option use-package-idle-interval
* use-package.el (use-package-idle-interval): new defcustom
(use-package-start-idle-timer): use it
(use-package-idle-eval): use it
* README.md: document it
This addresses bug https://github.com/jwiegley/use-package/issues/77
François Févotte [Mon, 17 Mar 2014 08:56:10 +0000 (09:56 +0100)]
:idle-priority keyword to change the running order of idle functions
Lower-priority idle functions are run first. Idle functions with no
specified priority default to 5 and all functions with the same priority
are run in the order in which they are evaluated, meaning the behaviour
is backwards compatible.
Jonas Bernoulli [Sun, 9 Mar 2014 17:50:01 +0000 (18:50 +0100)]
use-package-with-elapsed-timer: respect option at runtime
Previously the option `use-package-verbose' was consulted at macro
expansion time, and as a result customizing the option did nothing,
without also recompiling `use-package.el'.