help-gnu-emacs
[Top][All Lists]
Advanced

[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: Tue, 11 Aug 2015 21:36:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I happen to prefer :load-path, since relying on Emacs' automated discovery
>> takes longer than loading my entire init.el now.
>
> If you use ELPA and package-initialize to install your packages,
> the load-path and the autoloads are already set and that time is
> already "wasted".
>
> So are you saying that use-package is designed for the case where you
> don't use ELPA?  It is the impression I got when I looked at
> use-package, but it seems like an odd position nowadays.

I think a few examples might help.

I do use use-package for that reason. For example this is my
configuration for pabbrev.

(use-my-package pabbrev
  :diminish (pabbrev-mode . "pab")
  :defer 5
  :commands global-pabbrev-mode
  ;; pabbrev is useless until first idle anyway, and it's quite slow to load,
  ;; so might as well defer and init it later
  :config (progn
            (global-pabbrev-mode)
            ;; till we get org mode sorted out!
            (define-key pabbrev-mode-map [tab] 'pabbrev-expand-maybe)
            (setq pabbrev-idle-timer-verbose t)
            ;;(setq pabbrev-debug-display t)
            ;; the default anyway
            (setq pabbrev-debug-display nil)
            (setq pabbrev-read-only-error nil)))


`use-my-package' is my own macro which expands to a valid `use-package'
call with load-path set (based on the package name). I run my own
packages without installing them via ELPA.

This is good practice, because I can change the source, and test
everything works. It's also poor practice because it means that I, as
the author of the package, is not testing the environment that other
people are getting. The recently fixed missing autoloads in omn-mode.el
were a victim of this.

But the rest of the config is valid.


But this form of use is the exception. Here is a more normal example,
for a well behaved package (with slightly less well behaved
configuration).

(use-package tex-site
  :ensure auctex
  :init
  ;; after latex because we add stuff to latex-mode-map
  (eval-after-load "latex"
    '(load "philtex.el")))

Here, we integrate tightly with ELPA. I synchronize my .emacs to several
machines, and I do not want to have to install auctex by hand on all of
them. `:ensure' achieves this. Other people use pallet or cask to achieve
the same thing, but I like being able to embed the requirement for a
package with the init statements ("philtex.el" will get moved into this
form -- it's a hangover from my pre ELPA days).


>>> IOW, in many cases, it would be better for people to report the problem as a
>>> bug rather than to reach for use-package.
>> The idea that use-package will never make it into core because "package
>> authors should do things a better way" strikes me as a very odd argument.
>
> To be more precise, I don't think those problems in packages are
> particularly frequent, so it's perfectly OK to report them in those rare
> remaining cases.


I would like to ask a more specific question. use-package is nice, but
is more of a PITA to use than it should because because of a bootstrap
problem which can only be fixed by putting it in core.

What changes would you want to see before to it to make it acceptible in
core? Obviously, this is assuming the authors agree, and copyright
assignment, and all that jazz.

Phil



reply via email to

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