[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using use-package
From: |
Phillip Lord |
Subject: |
Re: using use-package |
Date: |
Mon, 10 Aug 2015 10:52:16 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Putting in the core is rather some distance from promoting as the "one
>> true way"
>
> FWIW, lots of use-package is designed to work around flaws in packages.
>
> E.g. the :load-path thingy should never be necessary since the package's
> own autoloads should already take care of that.
You are correct about the :load-path thingy, although I use this for my
own packages which I run "straight from source" as it where, rather than
install as a ELPA package proper.
> Or to take another example from https://github.com/jwiegley/use-package:
>
> (use-package foo
> :init
> (setq foo-variable t)
> :config
> (foo-mode 1))
>
> For any properly written foo-mode, the above can be replaced with
>
> (setq foo-variable t)
> (foo-mode 1)
>
> and it should work just as well.
No, you are missing (several) points of use-package. First (and
trivially) the use-package statement groups everything syntactically.
So, it's more like:
(progn
(setq foo-variable t)
(foo-mode 1))
This is nicer because it groups all the configuration together, so you
can move, comment, delete or eval it all together. Of course, `progn'
achieves the same thing.
However, `use-package' also gives you configurable feedback on load
times. So if (require 'foo) takes a long time, use-package tells you,
and tells you how long it takes.
In your example,
(foo-mode 1)
will force an autoload. With use-package, also I can do
(use-package foo
:defer t
;;;etc
)
which will achieve the same. Or
(use-package foo
:defer 10)
will load foo in the idle cycle.
Or
(use-package foo
:ensure t)
will install from ELPA if `foo' is not present.
Or
(use-package foo
:if window-system)
will only load foo (and run the configuration) conditionally.
use-package is entirely complementary to existing package system. But,
it suffers from bootstrap. It's obviously not possible to do
(use-package use-package
:ensure t)
or configure use-package in any other way with use-package. Instead, you
have to do:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(when (not (package-installed-p 'use-package))
(package-install 'use-package))
- Re: using use-package, (continued)
- Re: using use-package, Ian Zimmerman, 2015/08/05
- Message not available
- Re: using use-package, Rusi, 2015/08/05
- Re: using use-package, Ian Zimmerman, 2015/08/05
- Message not available
- Re: using use-package, Rusi, 2015/08/05
- Re: using use-package, Ian Zimmerman, 2015/08/05
- Message not available
- Re: using use-package, Rusi, 2015/08/06
- Re: using use-package, Grant Rettke, 2015/08/07
- Message not available
- Re: using use-package, Rusi, 2015/08/07
- Re: using use-package, Stefan Monnier, 2015/08/08
- Re: using use-package, Grant Rettke, 2015/08/09
- Re: using use-package,
Phillip Lord <=
- Re: using use-package, Stefan Monnier, 2015/08/10
- Re: using use-package, Phillip Lord, 2015/08/10
- Message not available
- Re: using use-package, Rusi, 2015/08/10
- Re: using use-package, John Wiegley, 2015/08/11
- Re: using use-package, Stefan Monnier, 2015/08/11
- Re: using use-package, Phillip Lord, 2015/08/11
- Re: using use-package, John Wiegley, 2015/08/12
- Message not available
- Re: using use-package, Sebastien Vauban, 2015/08/11
- Re: using use-package, Nicolas Richard, 2015/08/11
- Re: using use-package, Alexis, 2015/08/11