all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, help-gnu-emacs@gnu.org
Subject: Re: use-package
Date: Wed, 04 May 2016 03:33:45 +0000	[thread overview]
Message-ID: <CAFyQvY3xTa-pu95e=kT03_uJoeQ9HSpp=R0wfHMAoi6QVpQ=Hw@mail.gmail.com> (raw)
In-Reply-To: <jwvpot2eq9l.fsf-monnier+gmane.emacs.help@gnu.org>

>
> In my point of view, the job that use-package does is only useful when
> the corresponding package is poorly setup to start with.


> IOW, if use-package is helpful, usually it indicates a shortcoming in
> the package or in the way the package is installed.
>

That, or the user installing the package is just not completely aware of
implications of during (require 'PKG-NAME) for all the installed packages.

I can talk of myself that when I began using emacs, I simply did (require
'PKG-NAME) for any new package I installed, because sometimes I got errors
like undefined variable blah at emacs startup. And using the require
magically solved the problem.

For instance, we cannot do (add-to-list 'package-archives '("org" . "
http://orgmode.org/elpa/") t) before doing (require 'package). Well, this
is a valid case where we need to do require first as package-archives does
not autoload package.

At one point, it became a "style" to require all the installed packages. I
had never head of eval-after-load at that time. Even if I had heard, I
would have thought that that's probably for "advanced" emacs user and I as
a newbie probably doesn't need to learn or use that.

use-package adds a simply syntactic sugar that does that "advanced stuff"
under the hood.

Another useful function that use-package uses is run-with-idle-timer using
which you can lazy load a package which you typically don't care about
loading immediately at startup.. like yasnippet; by using the :defer
keyword in use-package.

I am not qualified enough to judge if yasnippet could have been coded
better so that I didn't need to lazy load it. But delaying loading this
package made a significant difference to my emacs startup, especially
because I save and load desktop with about 50-60 files open. I do not need
yasnippet to load the snippets for all the major modes in those 50-60 files
immediately at startup.

That's right.  But that's already the case without doing any config at
> all (because org-mode is setup properly to start with), so you shouldn't
> need use-package for that.
>

That's correct. The syntactic sugar for eval-after-load applies here too.

(Also, it's easy to simply prevent loading of a package you suspect to be
misbehaving by adding :disabled keyword for that package's use-package
form. With that you prevent loading that package and also evaluating your
config for that package like keybindings, advices, overrides, wrapper
defuns, etc).


> I see use-package as having 2 benefits:
> - work around package shortcomings as described above.
> - help the user structure his .emacs configuration.
>

And also, get a new user acquaint themself to different ways by which a
package loading can be delayed using various use-package keywords like
:commands, :bind, :defer, :mode.


> I'd like to see those two parts separated, FWIW.
>

I don't understand why that is important.
-- 

-- 
Kaushal Modi


  reply	other threads:[~2016-05-04  3:33 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02 17:07 use-package Uwe Brauer
2016-05-02 18:47 ` use-package Kaushal Modi
2016-05-03 10:47   ` use-package Uwe Brauer
2016-05-03 14:01     ` use-package Kaushal Modi
2016-05-03 22:28       ` use-package Stefan Monnier
2016-05-04  3:33         ` Kaushal Modi [this message]
2016-05-04 12:09           ` use-package Stefan Monnier
2016-05-04 16:22         ` use-package Phillip Lord
2016-05-04 16:44           ` use-package Drew Adams
2016-05-05 13:34             ` use-package Phillip Lord
2016-05-05 14:00               ` use-package Drew Adams
2016-05-05 15:56                 ` use-package Kaushal Modi
2016-05-05 16:12                   ` use-package Drew Adams
2016-05-10  9:20                     ` use-package Phillip Lord
2016-05-10  9:18                   ` use-package Phillip Lord
2016-05-11 11:42                     ` use-package Kaushal Modi
2016-05-12 21:04                       ` use-package Phillip Lord
2016-05-13 11:56                         ` use-package Stefan Monnier
2016-05-14 22:27                           ` use-package Phillip Lord
2016-05-15  3:22                             ` use-package Stefan Monnier
2016-05-13 15:38                         ` use-package Drew Adams
2016-05-16 15:16                           ` use-package Phillip Lord
2016-05-16 16:49                             ` use-package Drew Adams
     [not found]                         ` <mailman.2761.1463153947.7477.help-gnu-emacs@gnu.org>
2016-05-14  7:37                           ` use-package Rusi
2016-05-10  9:13                 ` use-package Phillip Lord
2016-05-05  9:51       ` use-package Uwe Brauer
2016-05-05 13:38         ` use-package Phillip Lord
2016-05-03 22:21 ` use-package Stefan Monnier
2016-05-05 10:15   ` use-package Uwe Brauer
2016-05-05 23:41     ` use-package Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY3xTa-pu95e=kT03_uJoeQ9HSpp=R0wfHMAoi6QVpQ=Hw@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.