unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: [External] : Re: Adding use-package to core
Date: Mon, 14 Nov 2022 15:17:22 +1100	[thread overview]
Message-ID: <86sfimxfok.fsf@gmail.com> (raw)
In-Reply-To: <SJ0PR10MB5488DB1734C89EA26E378CF4F3029@SJ0PR10MB5488.namprd10.prod.outlook.com>


Drew Adams <drew.adams@oracle.com> writes:

>> To me, use-package and package.el are mainly orthogonal:
>> Package.el is for package management (installing, updating,
>> removing), while use-package is for customization beyond
>> what Customize provides -- or at least allows you to
>> concentrate changes related to the same package in one place.
>
> Speaking/asking from ignorance here...
>
> 1. "Customization beyond what Customize provides"
>
> What kinds of such customization, besides the
> one you call out next (#2)?
>
> 2. "allows you to concentrate changes related
> to the same package in one place"
>
> Can you be more specific here?  How does what
> you have in mind differ from what customize
> groups provide?
>
Hi Drew,

I'm not sure I agree with the statement from the post you are responding
to and wanted to give a different perspective which might clarify why
some like use-package.

At its most fundamental level, use-package is really just syntactic
sugar. It provides a somewhat more declarative way to manage package
loading, initialisation, configuration and customisation.  It takes
functionality which largely already exists and puts it together in one
declarative 'chunk'. Much of what it does is really just convenience
macros which define a DSL for installing, loading and configuring
packages. For example, it provides convenience features for defining key
bindings, setting interpreters, autoloads, file associations, loading on
demand or loading after something else has been loaded, adding hooks,
setting customize variables, etc. Instead of having

(unless (package-installed-p 'some-package)
  (package-install 'some-package))
(require 'some-package)
(add-hook 'some-package-hook 'my-some-package-setup)
(define-key some-package-map (kbd "C-c f") 'some-mode-do-something)
...
(custom-set-variables
  `(some-package-var t))
  
I might just have

(use-package some-package
  :ensure t
  :hook (some-package . my-some-package-setup)
  :bind ("C-c f" . some-mode-do-something)
  :custom (some-package-var t))
  
which would achieve the same thing.

The 3 main reasons I use it are

1. I don't like the customize interface. This is not a criticism of
customize. I don't like similar interfaces in other editors either. I
find them slow and cumbersome.

2. I like having all the configuration for a package in one
block/stanza. I could also do this with just normal elisp, but
use-package provides some additional syntactic sugar which makes things
less verbose. It also tends to lead to a more declarative configuration.

3. It makes it easy to delay loading of packages, temporarily disabling
or defining when a package is loaded and encourages better habits by
keeping all the configuration associated with a package together so that
if I do temporarily disable it, I don't get other init failures when
other parts of my init file try to reference something which is no
longer being loaded. This isn't so much about what the package does as
much as how it encourages better practice in managing your config.. 

In short, use-package doesn't provide new functionality as much as it
provides an alternative approach to existing functionality. It adds
another choice to how users can manage their configuration. Some people
will like it, some will hate it and probably most won't really care one
way or the other.  After using it for many years, I can say it has
certainly improved the management and maintenance of my init.el

I do think it is worth adding to Emacs and because it can also manage
installing packages from ELPA, I would love it if it was in Emacs core
so I can just use it instead of first ensuring it has been installed and
then using it. 



  parent reply	other threads:[~2022-11-14  4:17 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-13 16:11 Adding use-package to core xenodasein--- via Emacs development discussions.
2022-11-13 16:48 ` Eli Zaretskii
2022-11-13 17:53   ` John Wiegley
2022-11-13 18:13     ` Eli Zaretskii
2022-11-13 18:45       ` John Wiegley
2022-11-13 18:05 ` Stefan Kangas
     [not found] ` <838rkels13.fsf@gnu.org-NGltIw7----9>
2022-11-13 18:12   ` xenodasein--- via Emacs development discussions.
2022-11-13 18:22     ` Stefan Kangas
2022-11-13 18:31     ` Eli Zaretskii
2022-11-13 19:19       ` xenodasein--- via Emacs development discussions.
2022-11-13 20:08         ` Eli Zaretskii
2022-11-13 18:46     ` John Wiegley
2022-11-13 19:02       ` xenodasein--- via Emacs development discussions.
2022-11-13 19:48         ` John Wiegley
2022-11-13 22:03           ` [External] : " Drew Adams
2022-11-13 22:45             ` North Year
2022-11-13 23:13             ` Matthew Carter
2022-11-14  8:10               ` Juanma Barranquero
2022-11-14  4:17             ` Tim Cross [this message]
2022-11-14  6:02             ` John Wiegley
2022-11-13 20:04         ` Eli Zaretskii
2022-11-14 10:32           ` xenodasein--- via Emacs development discussions.
2022-11-14 13:30             ` Eli Zaretskii
2022-11-14  0:27 ` Po Lu
2022-11-14 10:12   ` xenodasein--- via Emacs development discussions.
2022-11-14 10:47     ` Po Lu
2022-11-14 11:52       ` xenodasein--- via Emacs development discussions.
2022-11-14 12:19         ` Po Lu
2022-11-15 15:39           ` Michael Albinus
2022-11-14 13:54         ` Eli Zaretskii
2022-11-14 14:47           ` xenodasein--- via Emacs development discussions.
2022-11-14 17:39             ` Eli Zaretskii
2022-11-15 15:38               ` xenodasein--- via Emacs development discussions.
2022-11-15 16:24                 ` Configuration helpers (wad: Adding use-package to core) Stefan Monnier
2022-11-15 19:22                 ` Adding use-package to core Eli Zaretskii
2022-11-18 19:29   ` Sean Whitton
2022-11-18 19:33     ` Philip Kaludercic
2022-11-18 19:48       ` [External] : " Drew Adams
2022-11-18 19:42     ` Eli Zaretskii
2022-11-18 20:43       ` Philip Kaludercic
2022-11-19  7:12         ` Eli Zaretskii
2022-11-19  7:33           ` Philip Kaludercic
2022-11-19  8:04             ` Eli Zaretskii
2022-11-19 10:09               ` Philip Kaludercic
2022-11-19 10:31                 ` Eli Zaretskii
2022-11-19 11:02                   ` Philip Kaludercic
2022-11-19 11:15                     ` Stefan Kangas
2022-11-19 11:58                     ` Eli Zaretskii
2022-11-19 12:15                       ` Philip Kaludercic
2022-11-19 15:28               ` Stefan Monnier
2022-11-19 15:36                 ` Philip Kaludercic
2022-11-19 15:46                 ` Eli Zaretskii
2022-11-19 15:26           ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=86sfimxfok.fsf@gmail.com \
    --to=theophilusx@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).