emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use-package.el -> Emacs core


From: Oleh Krehel
Subject: Re: use-package.el -> Emacs core
Date: Tue, 10 Nov 2015 13:40:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Juanma Barranquero <address@hidden> writes:

> On Tue, Nov 10, 2015 at 1:10 PM, Oleh Krehel <address@hidden> wrote:
>
>> Customize is for people that aren't yet ready to learn Elisp. Once they
>> do, it indeed becomes redundant.
>
> Then, that's an argument *for* use-package. It's for users that aren't yet 
> ready to learn Elisp, but who want to load a package easily from their 
> init.el.
>
> use-package is syntactic sugar, yes, and as such, it's easier to use that the 
> "real deal". It is its own language, but that's a feature: if you're a user 
> not interested in learning Elisp, to borrow from Phillip's example, certainly

I have a completely opposite opinion regarding syntactic sugar: it's
detrimental unless you know what it does. In fact, I generally dislike
it even if I know what it does (see my thread on `pcase').

A user who's copy-pasting syntactic sugar won't see the structure behind
it.  A user who's copy-pasting a bunch of `setq', `define-key' and
`add-hook' statements will eventually see the pattern and actually learn
the language.

> (use-package foo
> :load-path "~/foo"
> :commands foo-a foo-b foo-c
> :defer 5
> )
>
> seems much easier than
>
> (progn
> (eval-and-compile
> (push "~/foo" load-path))
> (run-with-idle-timer 5 nil #'require 'foo nil t)
> (unless
> (fboundp 'foo-a)
> (autoload #'foo-a "foo" nil t))
> (unless
> (fboundp 'foo-b)
> (autoload #'foo-b "foo" nil t))
> (unless
> (fboundp 'foo-c)
> (autoload #'foo-c "foo" nil t)))

The above `use-package' example essentially translates to 0 lines of
code if one uses package.el, since all commands are autoloaded
anyway. Regarding idle loading, I've found exactly one use for it - Org:
it simply doesn't pay off for the other packages.

Compare to this code, if the user decides against package.el for some reason:

(add-to-list 'load-path "~/foo")
(require 'foo)

The above 2 lines show how Emacs actually works, and are in fact very
simple. And they teach the new user `add-to-list' and `require' which
are relevant absolutely everywhere, not just in init config setups.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]