unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Naoya Yamashita <conao3@gmail.com>
To: thibaut.verron@gmail.com
Cc: eliz@gnu.org, emacs-devel@gnu.org, rms@gnu.org, spacibba@aol.com
Subject: Re: Include leaf in Emacs distribution
Date: Mon, 12 Oct 2020 01:50:06 +0900 (JST)	[thread overview]
Message-ID: <20201012.015006.609810755286080528.conao3@gmail.com> (raw)
In-Reply-To: <CAFsi02Qcg7A+eXnJ=YRYZtpwE1CwwAw=FqfiSNrcj59xWB-4zA@mail.gmail.com>


> Even if it is what the author expects, it is not enforced. For
> instance, I have several instances in my init.el of packages with two
> use-package specifications: one to specify where to find the package
> and one to apply settings.
> 
> And I have several "use-package emacs" instances for settings which
> don't belong to any package.

Good point.  Since `(use-package emacs)` generates `(require
'emacs)`, we need to use such a hack to generate a harmless
require statement.  Since leaf generates prog1 without a keyword,
no hack is needed.  You can write a leaf expression with free
descriptive symbols such as `(leaf *elpa-workaround)`.  You can
also descrive this using use-package, but this requires the
`:no-require` keyword in each use-package expression to suppress
generate `require` Sexp.

EXAMPLE (leaf/use-package :no-require comparison):
```
(use-package package
  :custom ((package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
                               ("melpa" . "https://melpa.org/packages/")
                               ("org" . "https://orgmode.org/elpa/"))))
  :config
  (use-package *elpa-workaround
    :no-require
    :when (version= emacs-version "26.2")
    :custom ((gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))))

(leaf package
  :custom ((package-archives . '(("gnu" . "https://elpa.gnu.org/packages/")
                                 ("melpa" . "https://melpa.org/packages/")
                                 ("org" . "https://orgmode.org/elpa/"))))
  :config
  (leaf *elpa-workaround
    :emacs= "26.2"
    :custom ((gnutls-algorithm-priority . "NORMAL:-VERS-TLS1.3"))))
```

(use-package/leaf divided by such a chunk of configuration gives
us the opportunity to disable that unit using `:disabled`
keyword.  And jump to the Sexp quickly using `imenu`.)

>> And
>> the keywordless use-package will be converted into a `require`
>> statement using the first argument.
>
> Isn't it eval-after-load?

No.  Please expand like `(use-package flymake)`.  This
use-package expression is expanded `(require 'flymake)`.  On the
other hand, `(leaf flymake)` is expanded `(prog1 'flymake)` which
just wrap other generated Sexps.

> In particular, if there are no autoloads, you need to explicitly
> "require" the package in :init, no?

If you need `require` package, you can use explicit `:require`
keyword in leaf.  But, because now modern packages is well
configured and maintained autoload comment, we don't needed
explicit `require` Sexp.  So leaf contribute speeding up Emacs's
startup time.  This has been reported by users who have migrated
from use-package to leaf.

> In usual tree terminology (both in graph theory and in botany), leaves
> do not have children. So the name does not really convey the meaning
> that leaves are expected to be nested.

Yes, good point.  This is true.

Since I manage over 200 packages with this package, I needed to
find the names of the packages as short as possible as I would be
describing them over and over again.

My favorite features in use-package are :disabled and :when.  As
a chunk of configuration, these could be disabled on a
situational basis, contributing to quick init.el management.  For
me, as a Japanese, I find the same heart as Bonsai[1] in the
Emacs setup.  A Bonsai is something he will spend a long time
loving, depending on his preferences.  In this analogy, If it's
divided into functional units using leaf, you might be able to
incorporate someone else's leaf into your Bonsai.  And you may be
able to absorb the differences in your some of environment by
temporarily disabling the leaf.

And already leaf is an ELPA package[2] and has a large number of
users with over 150,000+ downloads from MELPA[3].  In addition,
there are several packages[3] that depend on leaf.  Changing the
name of leaf from now on is not practical I think.

(DISCLAIMER:
use-package is downloaded 1,100,000+ from MELPA[4].  This is
because it's been distributed by MELPA since 2013 and because
it's the first package in this field.  leaf has been distributed
since 2019 and is in the process of rapidly growing its user base.)

[1]: https://en.wikipedia.org/wiki/Bonsai
[2]: https://elpa.gnu.org/packages/leaf.html
[3]: https://melpa.org/#/?q=leaf
[4]: https://melpa.org/#/?q=use-package



  reply	other threads:[~2020-10-11 16:50 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08  1:37 Include leaf in Emacs distribution Naoya Yamashita
2020-10-08  9:00 ` Ergus
2020-10-08  9:22   ` Naoya Yamashita
2020-10-10 10:11     ` Eli Zaretskii
2020-10-11  5:24       ` Richard Stallman
2020-10-11  8:39         ` Naoya Yamashita
2020-10-11  9:52           ` Thibaut Verron
2020-10-11 16:50             ` Naoya Yamashita [this message]
2020-10-11 17:12               ` Thibaut Verron
2020-10-12  2:10                 ` Naoya Yamashita
2020-10-12 20:23                   ` Ergus via Emacs development discussions.
2020-10-11 17:02           ` Stefan Kangas
2020-10-11 16:51   ` Stefan Kangas
2020-10-12 20:53     ` Mingde (Matthew) Zeng
2020-10-11 17:22 ` Stefan Kangas
2020-10-12  1:35   ` Naoya Yamashita
2020-10-12 22:13     ` Stefan Kangas
2020-10-12 22:19       ` Qiantan Hong
2020-10-12 22:39       ` Caio Henrique
2020-10-13 13:23         ` Stefan Monnier
2020-10-13 14:14           ` Thibaut Verron
2020-10-13 14:29             ` Stefan Monnier
2020-10-13 15:29               ` Thibaut Verron
2020-10-18  9:32                 ` Phil Sainty
2020-10-13 15:25           ` Caio Henrique
2020-10-23  2:37             ` Naoya Yamashita
2020-10-23  3:41               ` John Wiegley
2020-10-23 14:33                 ` Stefan Monnier
2020-10-23 15:53                   ` Naoya Yamashita
2020-10-23 16:46                     ` Warnings in init files (was: Include leaf in Emacs distribution) Stefan Monnier
2020-10-23 18:11                     ` Include leaf in Emacs distribution T.V Raman
2020-10-23 18:41               ` Stefan Kangas
2020-10-23 20:04                 ` John Wiegley
2020-11-16  5:29                   ` Naoya Yamashita
2020-11-17  0:39                     ` John Wiegley
2020-11-20 11:04                       ` Naoya Yamashita
2020-11-20 11:29                         ` Pankaj Jangid
2020-11-20 15:44                         ` T.V Raman

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=20201012.015006.609810755286080528.conao3@gmail.com \
    --to=conao3@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=spacibba@aol.com \
    --cc=thibaut.verron@gmail.com \
    /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).