Subject: Re: [bug#58730] [PATCH] Split emacs-piem and emacs-git-email

From: Declan Tsien <[email-masked]>
Date: Tue, 25 Oct 2022 09:15:52 +0800

Declan Tsien <[email-masked]> writes:

> Currently, emacs-piem and emacs-git-email bundle multiple lisp files with
> identical functionality but for different tastes. Split into separated
> packages would avoid pulling unnecessary dependencies into user profile.
>
> Also fix info manual for emacs-git-email and add info-manual for
> emacs-piem
>
> From 6b44b4998369f01365c0ddb1b935072cfefcbe1b Mon Sep 17 00:00:00 2001
> From: Declan Tsien <[email-masked]>
> Date: Sun, 23 Oct 2022 11:40:07 +0800
> Subject: [PATCH 1/4] gnu: emacs-git-email: Fix makeinfo.
>
> * gnu/packages/emacs-xyz.scm (emacs-git-email): Fix makeinfo.
> ---
>  gnu/packages/emacs-xyz.scm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index 06ec9dd904..be6d4c6ba3 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -17341,7 +17341,8 @@ (define-public emacs-git-email
>                 (delete-file "git-email-piem.el")))
>             (add-before 'install 'makeinfo
>               (lambda _
> -               (invoke "makeinfo" "doc/git-email.texi"))))))
> +               (invoke "make" "doc/git-email.info")
> +               (rename-file "doc/git-email.info" "git-email.info"))))))
>        (native-inputs
>         (list texinfo))
>        (propagated-inputs
>
> base-commit: 1f734a6f0a7db5b0e12091a0c869c5c4810ac80e
> -- 
> 2.38.0
>
> From 3d6c28a0cbeed2f38d91cd31155a257578675f6d Mon Sep 17 00:00:00 2001
> From: Declan Tsien <[email-masked]>
> Date: Sun, 23 Oct 2022 11:42:19 +0800
> Subject: [PATCH 2/4] gnu: emacs-piem: Add build-info-manual phase.
>
> * gnu/packages/emacs-xyz.scm (emacs-piem): Add build-info-manual phase.
> [native-inputs]: Add texinfo.
> ---
>  gnu/packages/emacs-xyz.scm | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index be6d4c6ba3..bc56067a7c 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -7151,9 +7151,15 @@ (define-public emacs-piem
>                   (lambda* (#:key inputs #:allow-other-keys)
>                     (emacs-substitute-variables "piem-b4.el"
>                       ("piem-b4-b4-executable"
> -                      (search-input-file inputs "/bin/b4"))))))))
> +                      (search-input-file inputs "/bin/b4")))))
> +               (add-after 'unpack 'build-info-manual
> +                 (lambda _
> +                   (invoke "make" "Documentation/piem.info")
> +                   (rename-file "Documentation/piem.info" "piem.info"))))))
>      (inputs
>       (list b4))
> +    (native-inputs
> +     (list texinfo))
>      (propagated-inputs
>       (list emacs-elfeed
>             emacs-notmuch
> -- 
> 2.38.0
>
> From ff45839e29bad8bd4fa5d9b4868b3f68fe8d300d Mon Sep 17 00:00:00 2001
> From: Declan Tsien <[email-masked]>
> Date: Sun, 23 Oct 2022 11:46:37 +0800
> Subject: [PATCH 3/4] gnu: emacs-piem: Split into multiple separated packages.
>
> emacs-piem currently bundles multiple lisp files with identical functionality
> but for different tastes. Split into separated packages would avoid pulling
> unnecessary dependencies into user profile.
>
> * gnu/packages/emacs-xyz.scm (emacs-piem): Split into multiple separated
> packages.
> * gnu/packages/emacs-xyz.scm (emacs-piem-b4): New variable.
> * gnu/packages/emacs-xyz.scm (emacs-piem-elfeed): New variable.
> * gnu/packages/emacs-xyz.scm (emacs-piem-eww): New variable.
> * gnu/packages/emacs-xyz.scm (emacs-piem-gnus): New variable.
> * gnu/packages/emacs-xyz.scm (emacs-piem-notmuch): New variable.
> * gnu/packages/emacs-xyz.scm (emacs-piem-rmail): New variable.
> * gnu/packages/emacs-xyz.scm (emacs-piem-lei): New variable.
> ---
>  gnu/packages/emacs-xyz.scm | 139 +++++++++++++++++++++++++++++--------
>  1 file changed, 109 insertions(+), 30 deletions(-)
>
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index bc56067a7c..3f62e92116 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -7134,45 +7134,124 @@ (define-public emacs-piem
>    (package
>      (name "emacs-piem")
>      (version "0.4.0")
> -    (source
> -     (origin
> -       (method git-fetch)
> -       (uri (git-reference
> -             (url "https://git.kyleam.com/piem")
> -             (commit (string-append "v" version))))
> -       (file-name (string-append name "-" version "-checkout"))
> -       (sha256
> -        (base32 "0wr6n6wvznngjdp4c0pmdr4xz05dark0kxi5svzhzxsg3rdaql3z"))))
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://git.kyleam.com/piem")
> +                    (commit (string-append "v" version))))
> +              (file-name (string-append name "-" version "-checkout"))
> +              (sha256
> +               (base32
> +                "0wr6n6wvznngjdp4c0pmdr4xz05dark0kxi5svzhzxsg3rdaql3z"))))
>      (build-system emacs-build-system)
>      (arguments
> -     (list #:phases
> -           #~(modify-phases %standard-phases
> -               (add-after 'unpack 'configure
> -                 (lambda* (#:key inputs #:allow-other-keys)
> -                   (emacs-substitute-variables "piem-b4.el"
> -                     ("piem-b4-b4-executable"
> -                      (search-input-file inputs "/bin/b4")))))
> -               (add-after 'unpack 'build-info-manual
> -                 (lambda _
> -                   (invoke "make" "Documentation/piem.info")
> -                   (rename-file "Documentation/piem.info" "piem.info"))))))
> -    (inputs
> -     (list b4))
> -    (native-inputs
> -     (list texinfo))
> -    (propagated-inputs
> -     (list emacs-elfeed
> -           emacs-notmuch
> -           emacs-transient))
> -    (home-page "https://docs.kyleam.com/piem")
> +     (list #:exclude #~(cons* "^piem-b4.el"
> +                              "^piem-elfeed.el"
> +                              "^piem-eww.el"
> +                              "^piem-gnus.el"
> +                              "^piem-lei.el"
> +                              "^piem-notmuch.el"
> +                              "^piem-rmail.el"
> +                              %default-exclude)
> +           #:phases #~(modify-phases %standard-phases
> +                        (add-after 'unpack 'build-info-manual
> +                          (lambda _
> +                            (invoke "make" "Documentation/piem.info")
> +                            (rename-file "Documentation/piem.info" "piem.info"))))))
> +    (native-inputs (list texinfo))
> +    (propagated-inputs (list emacs-transient))
> +    (home-page "https://docs.kyleam.com/piem/")
>      (synopsis "Glue for working with public-inbox archives")
> -    (description "This packages provides a collection of Emacs libraries for
> +    (description
> +     "This package provides a collection of Emacs libraries for
>  working with public-inbox archives.  As much of the hard work here is already
>  done by other Emacs libraries—things like mail clients, news readers, Git
>  interfaces, and even web browsers—piem is mostly about bridging some of these
>  parts for convenience.")
>      (license license:gpl3+)))
>  
> +(define-public emacs-piem-b4
> +  (package
> +    (inherit emacs-piem)
> +    (name "emacs-piem-b4")
> +    (inputs (list b4))
> +    (propagated-inputs (list emacs-piem))
> +    (arguments
> +     (list #:include #~(list "piem-b4.el")
> +           #:phases #~(modify-phases %standard-phases
> +                        (add-after 'unpack 'configure
> +                          (lambda* (#:key inputs #:allow-other-keys)
> +                            (emacs-substitute-variables "piem-b4.el"
> +                                                        ("piem-b4-b4-executable"
> +                                                         (search-input-file
> +                                                          inputs "/bin/b4"))))))))
> +    (synopsis "Emacs interface to the b4 tool")
> +    (description
> +     "This library provides a @code{emacs-transient} interface to @code{b4}.  It is
> +documented in the piem manual.")))
> +
> +(define-public emacs-piem-elfeed
> +  (package
> +    (inherit emacs-piem)
> +    (name "emacs-piem-elfeed")
> +    (propagated-inputs (list emacs-piem emacs-elfeed))
> +    (arguments
> +     (list #:include #~(list "piem-elfeed.el")))
> +    (synopsis "Elfeed integration for piem")
> +    (description
> +     "This library provides @code{emacs-elfeed} integration for @code{piem}.")))
> +
> +(define-public emacs-piem-eww
> +  (package
> +    (inherit emacs-piem)
> +    (name "emacs-piem-eww")
> +    (propagated-inputs (list emacs-piem))
> +    (arguments
> +     (list #:include #~(list "piem-eww.el")))
> +    (synopsis "EWW integration for piem")
> +    (description "This library provides EWW integration for @code{piem}.")))
> +
> +(define-public emacs-piem-gnus
> +  (package
> +    (inherit emacs-piem)
> +    (name "emacs-piem-gnus")
> +    (propagated-inputs (list emacs-piem))
> +    (arguments
> +     (list #:include #~(list "piem-gnus.el")))
> +    (synopsis "Gnus integration for piem")
> +    (description "This library provides Gnus integration for @code{piem}.")))
> +
> +(define-public emacs-piem-notmuch
> +  (package
> +    (inherit emacs-piem)
> +    (name "emacs-piem-notmuch")
> +    (propagated-inputs (list emacs-piem emacs-notmuch))
> +    (arguments
> +     (list #:include #~(list "piem-notmuch.el")))
> +    (synopsis "Notmuch integration for piem")
> +    (description
> +     "This library provides @code{emacs-notmuch} integration for @code{piem}.")))
> +
> +(define-public emacs-piem-rmail
> +  (package
> +    (inherit emacs-piem)
> +    (name "emacs-piem-rmail")
> +    (propagated-inputs (list emacs-piem))
> +    (arguments
> +     (list #:include #~(list "piem-rmail.el")))
> +    (synopsis "Rmail integration for piem")
> +    (description "This library provides Rmail integration for @code{piem}.")))
> +
> +(define-public emacs-piem-lei
> +  (package
> +    (inherit emacs-piem)
> +    (name "emacs-piem-lei")
> +    (propagated-inputs (list emacs-piem))
> +    (arguments
> +     (list #:include #~(list "piem-lei.el")))
> +    (synopsis "Lei integration for piem")
> +    (description "This library provides lei integration for @code{piem}.")))
> +
>  (define-public emacs-ert-expectations
>    (package
>      (name "emacs-ert-expectations")
> -- 
> 2.38.0
>
> From d0c79a8c055c3818c1ea97e4cf0aa373303025e5 Mon Sep 17 00:00:00 2001
> From: Declan Tsien <[email-masked]>
> Date: Sun, 23 Oct 2022 11:48:13 +0800
> Subject: [PATCH 4/4] gnu: emacs-git-email: Split into multiple separated
>  packages.
>
> emacs-git-email currently bundles multiple lisp files with identical
> functionality but for different tastes. Split into separated packages would
> avoid pulling unnecessary dependencies into user profile.
>
> * gnu/packages/emacs-xyz.scm (emacs-git-email): Split into multiple separated
> packages.
> * gnu/packages/emacs-xyz.scm (emacs-git-email-gnus): New Variable.
> * gnu/packages/emacs-xyz.scm (emacs-git-email-magit): New Variable.
> * gnu/packages/emacs-xyz.scm (emacs-git-email-mu4e): New Variable.
> * gnu/packages/emacs-xyz.scm (emacs-git-email-notmuch): New Variable.
> * gnu/packages/emacs-xyz.scm (emacs-git-email-piem): New Variable.
> ---
>  gnu/packages/emacs-xyz.scm | 115 +++++++++++++++++++++++++++++--------
>  1 file changed, 90 insertions(+), 25 deletions(-)
>
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index 3f62e92116..0bbae04f08 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -17405,39 +17405,104 @@ (define-public emacs-git-email
>      (package
>        (name "emacs-git-email")
>        (version (git-version "0.2.0" revision commit))
> -      (source
> -       (origin
> -         (method git-fetch)
> -         (uri (git-reference
> -               (url "https://git.sr.ht/~yoctocell/git-email")
> -               (commit commit)))
> -         (patches
> -          (search-patches "emacs-git-email-missing-parens.patch"))
> -         (file-name (git-file-name name version))
> -         (sha256
> -          (base32 "1lk1yds7idgawnair8l3s72rgjmh80qmy4kl5wrnqvpmjrmdgvnx"))))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://git.sr.ht/~yoctocell/git-email")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                  "1lk1yds7idgawnair8l3s72rgjmh80qmy4kl5wrnqvpmjrmdgvnx"))))
>        (build-system emacs-build-system)
>        (arguments
> -       `(#:phases
> -         (modify-phases %standard-phases
> -           ;; piem is not yet packaged in Guix.
> -           (add-after 'unpack 'remove-piem
> -             (lambda _
> -               (delete-file "git-email-piem.el")))
> -           (add-before 'install 'makeinfo
> -             (lambda _
> -               (invoke "make" "doc/git-email.info")
> -               (rename-file "doc/git-email.info" "git-email.info"))))))
> -      (native-inputs
> -       (list texinfo))
> -      (propagated-inputs
> -       (list mu emacs-magit emacs-notmuch))
> +       (list #:exclude #~(cons* "^git-email-gnus.el"
> +                                "^git-email-magit.el"
> +                                "^git-email-mu4e.el"
> +                                "^git-email-notmuch.el"
> +                                "^git-email-piem.el"
> +                                %default-exclude)
> +             #:phases #~(modify-phases %standard-phases
> +                          (add-before 'install 'makeinfo
> +                            (lambda _
> +                              (invoke "make" "doc/git-email.info")
> +                              (rename-file "doc/git-email.info"
> +                                           "git-email.info"))))))
> +      (native-inputs (list texinfo))
>        (license license:gpl3+)
>        (home-page "https://sr.ht/~yoctocell/git-email")
>        (synopsis "Format and send Git patches in Emacs")
>        (description "This package provides utilities for formatting and
>  sending Git patches via Email, without leaving Emacs."))))
>  
> +(define-public emacs-git-email-gnus
> +  (package
> +    (inherit emacs-git-email)
> +    (name "emacs-git-email-gnus")
> +    (propagated-inputs (list emacs-git-email))
> +    (arguments
> +     (list #:include #~(list "git-email-gnus.el")))
> +    (synopsis "Gnus integration for git-email")
> +    (description
> +     "This library sets some variables for git-email to make it work
> +better with Gnus.")))
> +
> +(define-public emacs-git-email-magit
> +  (package
> +    (inherit emacs-git-email)
> +    (name "emacs-git-email-magit")
> +    (propagated-inputs (list emacs-git-email emacs-magit))
> +    (arguments
> +     (list #:include #~(list "git-email-magit.el")))
> +    (synopsis "Magit integration for git-email")
> +    (description
> +     "This library offers transient commands in the magit-status buffer
> +for interacting with git-email.")))
> +
> +(define-public emacs-git-email-mu4e
> +  (package
> +    (inherit emacs-git-email)
> +    (name "emacs-git-email-mu4e")
> +    (propagated-inputs (list emacs-git-email mu))
> +    (inputs (list `("emacs-git-email-mu4e-patch" ,(car (search-patches
> +                                                        "emacs-git-email-missing-parens.patch")))))
> +    (arguments
> +     (list #:include #~(list "git-email-mu4e.el")
> +           #:phases #~(modify-phases %standard-phases
> +                        (add-after 'unpack 'apply-patch
> +                          (lambda* (#:key inputs #:allow-other-keys)
> +                            (let ((patch (assoc-ref inputs
> +                                          "emacs-git-email-mu4e-patch")))
> +                              (invoke "patch" "-p1" "--batch" "-i" patch)))))))
> +    (synopsis "Mu4e integration for git-email")
> +    (description
> +     "This library sets some variables for git-email to make it work
> +better with @code{mu}.")))
> +
> +(define-public emacs-git-email-notmuch
> +  (package
> +    (inherit emacs-git-email)
> +    (name "emacs-git-email-notmuch")
> +    (propagated-inputs (list emacs-git-email emacs-notmuch))
> +    (arguments
> +     (list #:include #~(list "git-email-notmuch.el")))
> +    (synopsis "Notmuch integration for git-email")
> +    (description
> +     "This library sets some variables for git-email to make it work
> +better with @code{emacs-notmuch}.")))
> +
> +(define-public emacs-git-email-piem
> +  (package
> +    (inherit emacs-git-email)
> +    (name "emacs-git-email-piem")
> +    (propagated-inputs (list emacs-git-email emacs-piem))
> +    (arguments
> +     (list #:include #~(list "git-email-piem.el")))
> +    (synopsis "Piem integration for git-email")
> +    (description
> +     "This library sets some variables for git-email to make it work
> +better with @code{emacs-piem}.")))
> +
>  (define-public emacs-erc-hl-nicks
>    (package
>      (name "emacs-erc-hl-nicks")
> -- 
> 2.38.0

Hey, Niklas Eklund and zimoun

Since you are the original contributors to =emacs-git-email= and
=emacs-piem=. Here are some changes you may need to be aware of.

I've split the package into multiple separate packages. So the user wants
=git-email-notmuch= or =piem-notmuch= don't have to populate there
home environment with =mu= and other dependencies.

Can you kindly review the changes, and give your thoughts on them?

Thanks