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 11:10:45 +0900 (JST)

> Okay, that is definitely added value.

Thanks.

> Because I'm using straight the actual expansion is more complicated,
> but the require is there.

? Yes, use-package is expand `require` Sexp, but leaf is not.

```
(let ((use-package-expand-minimally t))
  (macroexpand-1
   '(use-package flymake)))
;;=> (require 'flymake nil nil)

(let ((leaf-expand-minimally t))
  (macroexpand-1
   '(leaf flymake)))
;;=> (prog1 'flymake)
```

> I was talking about use-package. I have a lot of requires in my
> init.el, but I don't know if they are all necessary. Maybe they are
> only needed for packages for which I had to supply :init
> specifications, or maybe they are not needed at all.
> 
> As for startup time, it is 2s and I use emacsclient. I voluntarily
> choose to load everything at start-up, those 2 seconds are a minor
> annoyance maybe once a day, which is a lot preferrable to several
> minor annoyances when I first open a tex, org or pdf file.
> 
> I have no doubt that leaf has a similar option as use-package to never
> defer loading. :)

leaf always trusts autoload and does not always require it, so
require is only done for packages that explicitly require
it. Therefore, require is only done for packages that explicitly
specify a requirement.  This design was not possible in 2013 when
use-package was created, but few current packages require an
explicit request.

> Interesting. For me :when is the most disappointing feature. My
> typical use-case for conditionally loading a package is the
> availability of some program on the system, or having or not sudo
> rights. Because the :when keyword applies to loading the package, as
> opposed to installing it, I cannot use it in this case.
> 
> So I have a couple (when my-bool (use-package ...)) in my init.

Oh, then you can use leaf's :when keyword.  :when is set more
priority from :ensure, so you can controll :ensure keyword using
:when keyword.

See this example.  leaf generate Sexp what you want.

```
(setq leaf-expand-minimally t)
(setq use-package-expand-minimally t)

(macroexpand-1
 '(use-package flyspell-correct
    :when (executable-find "aspell")
    :ensure t
    :hook org-mode-hook))
;;=> (progn
;;     (use-package-ensure-elpa 'flyspell-correct '(t) 'nil)
;;     (when (executable-find "aspell")
;;       (unless (fboundp 'flyspell-correct)
;;         (autoload #'flyspell-correct "flyspell-correct" nil t))
;;       (add-hook 'org-mode-hook-hook #'flyspell-correct)))

(macroexpand-1
 '(leaf flyspell-correct
    :when (executable-find "aspell")
    :ensure t
    :hook org-mode-hook))
;;=> (prog1 'flyspell-correct
;;     (unless (fboundp 'flyspell-correct-mode)
;;       (autoload #'flyspell-correct-mode "flyspell-correct" nil t))
;;     (when (executable-find "aspell")
;;       (leaf-handler-package flyspell-correct flyspell-correct nil)
;;       (add-hook 'org-mode-hook #'flyspell-correct-mode)))
```

> It might be the best we have, but counting downloads does not count
> individual users. Some users will bootstrap multiple instances of
> emacs with use-package or leaf, each resulting in one download.

It say `download` but download from same IP, count as 1, I
remmember (but no source comment...)

> Also some package managers, such as straight, can completely bypass
> melpa (and elpa too? not sure).

True.

> And I wouldn't be too surprised if a significant part of leaf's 150k
> were already included in the 1.1M of use-package.
> 
> It's only tangentially related, but maybe we could suggest that Melpa
> report downloads per year, that might already give a better measure of
> the number of current users.

There are idea[1] but it is not implemented?

[1]: https://github.com/melpa/melpa/issues/2416



reply via email to

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