emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Include leaf in Emacs distribution


From: Naoya Yamashita
Subject: Re: Include leaf in Emacs distribution
Date: Mon, 12 Oct 2020 01:50:06 +0900 (JST)

> 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 via email to

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