unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Naoya Yamashita <conao3@gmail.com>
Cc: Stefan Kangas <stefankangas@gmail.com>,
	 Akib Azmain Turja <akib@disroot.org>,
	 Payas Relekar <relekarpayas@gmail.com>,
	emacs-devel@gnu.org,  John Wiegley <johnw@gnu.org>
Subject: Re: What does use-package do?
Date: Tue, 11 Oct 2022 09:17:56 +0000	[thread overview]
Message-ID: <87lepmg1mj.fsf@posteo.net> (raw)
In-Reply-To: <CAEPcJam8GY9UQRcSnaAi1MayJWH4C+VejpkvgLckUfgPLzw2QA@mail.gmail.com> (Naoya Yamashita's message of "Tue, 11 Oct 2022 13:46:45 +0900")

Naoya Yamashita <conao3@gmail.com> writes:

> (I used to send Email from gnus, but I have already lost my gnus
> settings and will reply from Gmail.  I hope I get it right.)
>
>> There was talk of integrating leaf into use-package a year ago.
>
> Nothing is going on with integrating leaf and use-package as no
> one is working on it.  Honestly, I don't like use-package because
> it has surprising behavior that often seems nosy.  That is why
> leaf was created, to organize/reduce the features that
> use-package has and to give user a better interface, which is
> why it cannot be integrated.
>
> On the other hand, I agree that leaf has a puzzling internal
> structure.  It has huge conditional branches directly in a list,
> dynamically generating S-expressions and eval'ing them.  This
> structure makes debugging difficult and adding new features
> difficult for new people. (I can do it, though.)  This is why I
> am hesitant to have it standardized in Emacs.
>
> In summary, the functionality that use-package already provides
> should be sorted out because it contains magic.  The interface
> provided by leaf is pretty, but it has a puzzling internal
> structure.  I would support a third use-package that should come
> standard with Emacs, if there is one.  And some people said that
> the name "LEAF" is a bad name.  Hopefully the third use-package
> will have a better name.

I am not sure if there is any interest, but my `setup' package[0] might
be such a candidate, when combined with a "declarative to imperative"
translation layer.  I was playing with such a concept a few months
ago[1], but never completed it.  This specific implementation might be
too "cl-generic"-heavy.  But in principle it works:

We start with a declarative expression:

        (use-setup foo
          :init
          (first we have)
          (to eval this)
          :config
          (do this)
          (then that)
          :hook (bar-mode)
          :bind ("C-f" . foo-forward)
          :custom (foo-option t))

which is translated into a `setup'-expression:

        (setup foo
          (:option foo-option t)
          (:bind "C-f" foo-forward)
          (:hook-into bar-mode)
          (:when-loaded :when-loaded
                        (do this))
          (progn
            (to eval this)
            (first we have)))

that then expands to regular code:

        (progn
          (progn
            (custom-load-symbol 'foo-option)
            (funcall
             (or
              (get 'foo-option 'custom-set)
              (function set-default))
             'foo-option t))
          (eval-after-load 'foo
            (function
             (lambda nil
               (define-key foo-mode-map ""
                           (function foo-forward)))))
          (add-hook 'bar-mode-hook
                    (function foo-mode))
          (eval-after-load 'foo
            (function
             (lambda nil
               (do this)
               (then that))))
          (progn
            (to eval this)
            (first we have)))

[0] https://git.sr.ht/~pkal/setup
[1] https://paste.sr.ht/~pkal/4b8519fca721e0ac651d5598f6d582ae92ff84dd

> 2022年10月10日(月) 5:16 Stefan Kangas <stefankangas@gmail.com>:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>> > Do you remember what thread that was, the only one I remember is
>> >
>> https://yhetil.org/emacs-devel/20201008.103747.1339582189858984269.conao3@gmail.com/
>> .
>>
>> Yes, that's the one I'm thinking of.
>>
>> I think you want to start reading at:
>>
>> https://yhetil.org/emacs-devel/CADwFkm=mSZHeKf0=G7rXhOKOqSxOYWwOQfUv8=7fZWEaDOCTKg@mail.gmail.com/
>>



  parent reply	other threads:[~2022-10-11  9:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-08  4:38 What does use-package do? Payas Relekar
2022-10-08  6:55 ` Eli Zaretskii
2022-10-08 22:34   ` Richard Stallman
2022-10-08 12:46 ` Akib Azmain Turja
2022-10-08 23:49   ` Stefan Kangas
2022-10-09 12:44     ` Philip Kaludercic
2022-10-09 20:16       ` Stefan Kangas
2022-10-11  4:46         ` Naoya Yamashita
2022-10-11  5:13           ` John Wiegley
2022-10-11  6:15             ` Emanuel Berg
2022-10-11  6:45           ` Stefan Kangas
2022-10-11  9:17           ` Philip Kaludercic [this message]
2022-10-11 15:21             ` John Wiegley
  -- strict thread matches above, loose matches on Subject: below --
2022-09-24 12:56 Progress on merging use-package? Payas Relekar
2022-09-24 14:08 ` Philip Kaludercic
2022-09-24 14:22   ` Payas Relekar
2022-09-24 14:35     ` Philip Kaludercic
2022-09-24 14:36       ` Payas Relekar
2022-09-24 20:24         ` John Wiegley
2022-09-25  2:34           ` Payas Relekar
2022-09-25  8:39             ` Philip Kaludercic
2022-09-28 22:57               ` chad
2022-09-29  8:20                 ` Eli Zaretskii
2022-09-29  8:36                   ` Philip Kaludercic
2022-10-07 22:47                     ` What does use-package do? Richard Stallman
2022-10-08  4:50                       ` John Wiegley

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=87lepmg1mj.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=akib@disroot.org \
    --cc=conao3@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=johnw@gnu.org \
    --cc=relekarpayas@gmail.com \
    --cc=stefankangas@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).