[Top][All Lists]

[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 08:55:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

John Wiegley <address@hidden> writes:

> `use-package' is a macro to abstract a common pattern among .emacs files, such
> as:
>     (add-hook 'foo-init-hook 'some-function)
>     (add-to-list 'auto-mode-alist '("\\.foo$" . foo-mode))
>     (eval-after-load "foo-mode"
>       '(progn
>          (define-key foo-mode-map (kbd "C-c k") 'foo-hello)))
> It abstracts the common cases I encountered in my use of 100+ Emacs packages,
> and macroexpands to code that tries to minimize Emacs load time as much as
> possible. It also adds features that would be cumbersome to do manually, such
> as optionally installing an idle-timer so a package is always loaded if Emacs
> has been idle for X seconds.
>     (use-package foo-mode
>       :mode "\\.foo$"
>       :bind (:map foo-mode-map
>              ("C-c k" . foo-hello))
>       :init (add-hook 'foo-init-hook 'some-function))

I have some reservations for this. While I use use-package, I started
with it long after learning basic Elisp.  Essentially, use-package is a
black box that abstracts and creates new syntax.  Which is fine for
veteran users, since they have an idea of what it does.  But I think it
might be detrimental to new Elisp users. Using the first method, they
learn what `add-hook' is, what `add-to-list' is, what keymaps are etc.
These things are useful in all kinds of places, not just in the context
of setting up packages.

Concerning bind-key: if the functionality is useful, it should be merged
into `define-key', instead of adding yet another syntax for the same

One more concern that I see is the stability of use-package API. I
wouldn't want to add logic to my config to disable the built-in
use-package and install the new version to use a new feature.  This was
the case for CEDET for a long time, and it was a headache.

Having said all that, I'm against adding use-package to the core. It
would add potential headache without adding utility, since I don't see
any code in the core benefiting from re-using use-package.  I am for
augmenting `define-key' with `bind-key' features, though.

reply via email to

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