From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4GLdNOQrD2Mb1wAAbAwnHQ (envelope-from ) for ; Wed, 31 Aug 2022 11:37:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id aCcFNOQrD2P+lwAAG6o9tA (envelope-from ) for ; Wed, 31 Aug 2022 11:37:40 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5B6A53CA43 for ; Wed, 31 Aug 2022 11:37:40 +0200 (CEST) Received: from localhost ([::1]:52958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTKAF-00023j-D6 for larch@yhetil.org; Wed, 31 Aug 2022 05:37:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTK9e-00023a-7T for guix-patches@gnu.org; Wed, 31 Aug 2022 05:37:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTK9d-0007Sr-T0 for guix-patches@gnu.org; Wed, 31 Aug 2022 05:37:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTK9d-0000IO-Ky for guix-patches@gnu.org; Wed, 31 Aug 2022 05:37:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57280] [PATCH 0/3] Add documentation-files argument to emacs build system. References: <87mtc18ko9.fsf@trop.in> Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 31 Aug 2022 09:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57280 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 57280@debbugs.gnu.org Received: via spool by 57280-submit@debbugs.gnu.org id=B57280.16619385821086 (code B ref 57280); Wed, 31 Aug 2022 09:37:01 +0000 Received: (at 57280) by debbugs.gnu.org; 31 Aug 2022 09:36:22 +0000 Received: from localhost ([127.0.0.1]:38228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTK8z-0000HR-4X for submit@debbugs.gnu.org; Wed, 31 Aug 2022 05:36:21 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:35773) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTK8u-0000H8-OH for 57280@debbugs.gnu.org; Wed, 31 Aug 2022 05:36:20 -0400 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 9A01C40010; Wed, 31 Aug 2022 09:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1661938570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=ISCeWSTbmsI+1UoOihwtRiS0bzSWZSMlWhLFYsuiyNs=; b=ThgO+P0Ph4qanoVuGstRF14ZEWa5AOWNTdwXVd64QjRK1RKANRjMI9oIP+twPHlbt9Ho6m KT/r3b7LILwtvo3cVPXEgaIugE9tdOozOF1TxlJe8L6GHYTdikQP5rPJX8wfRazxiVvPPH h7ii7NQL44E4sAZB1eMVJeCFKDogUyADEHQ2jg9dmekr396OcAfxhsMiHUfnWppze596yS xVYY0xk34+aqlWPgMgbnQoBLp+Ez2V0zptmUYiBWUNFO9UoUwLqD2Il3qc6sURiTGBNhrz jJsUeJU0PyWpcGQ+sSXD2VyLbHBsR/mg7qR4QsNNXg0xDNmKqdVzrSjeXRNLQg== From: Andrew Tropin In-Reply-To: <4b09e4416d637e121a71a316c1eb5d8912b05430.camel@gmail.com> Date: Wed, 31 Aug 2022 12:36:06 +0300 Message-ID: <87v8q8u54p.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661938660; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=ISCeWSTbmsI+1UoOihwtRiS0bzSWZSMlWhLFYsuiyNs=; b=FfmTKkxTg1ugDgw2JqZibjDSO2wgMPpBFf4n04Q546+u+8b75iPLVk0Em7gpzU84fUubR3 JSQd7TifH7hMZ8ORAIUE9mRJClCf3D345DdkD120Zo975HwszrtbXUq+jlvOSmln3QusjW x0JszMoFseLl0/6B2CBIKhOccH/OiG3td7rTOpvRiguYHAPGIPqL4En3sT2cz3hYC3xBXQ G/nCz8qOVPP+Okh9O3SqTjr1XvbBFc0O4TWT8bowm0N7czsxVVLbVmRkvHudkpc85fbcVy UPdmDURbGLyANlqnfuaYeKHtKFPAnslwqGMag0NJPaa308c+BtHoxLEwqXGqsA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661938660; a=rsa-sha256; cv=none; b=PgOLE4W5GakMumpOnkuBr724f8Nvp+DUT6Ik5tgTlnZbhHUlPhZwdtcw3k6L8FseJxyZVv tubsmk+dyFc+bMKQHgBdfIH8iPQ1Byx+62m8aIfN/IJn3JuCZL8erDTaFFXy/7TaB5YXRF YhPaanF6CX0b/Hivo9rXHgiAWxHWopfz+pSyCuCXeB/W7GayXkJiQRoh4gWlkFMVqzT7wV WEUwes3os9N4OJih01LA2tvPrJ7S8byAJJ4Wz432tTHxngaUj1YunVey5vAbsnIOUzPDIS pP4RKAzrb4bXnxevlxh6pe1g2mC2DG7D6dTdWJseSrmZxYIkja4sIvB8frrQdA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=ThgO+P0P; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 0.51 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=ThgO+P0P; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 5B6A53CA43 X-Spam-Score: 0.51 X-Migadu-Scanner: scn1.migadu.com X-TUID: r/zF/R3MFaEj --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-08-30 10:28, Liliana Marie Prikler wrote: > Am Dienstag, dem 30.08.2022 um 11:15 +0300 schrieb Andrew Tropin: >> On 2022-08-29 18:38, Liliana Marie Prikler wrote: >>=20 >> > Am Freitag, dem 26.08.2022 um 17:33 +0300 schrieb Andrew Tropin: >> >=20 >> > > > > >=20 >> > > > Cheers >> > >=20 >> > > I went through a few popular packages and came up with conclusion >> > > that it's hard to make good heuristic for automatical >> > > documentation >> > > build: >> > >=20 >> > > 1. I tried (find-files "." "\\.(texi|txi|texinfo)$") with >> > > consequent >> > > for-each and it doesn't work in general case because it will >> > > build >> > > files intended for inclusion, not standalone building. >> > Fair enough, there's probably similar issues with org etc.=C2=A0 That >> > said, >> > wouldn't the top-level info/org/whatever file share the package >> > name? >> >=20 >>=20 >> In many cases, yes it would, but not always. >>=20 >> magit: ("docs/magit.texi" "docs/magit-section.texi") > Is magit-section a top-level file? Yes. In 3.3.0 it's Documentation/magit.texi and Documentation/magit-section.texi, but in recent not yet released version it's ("docs/magit.texi" "docs/magit-section.texi"), there are also org counterparts of magit and magit-section files, but they are in sync with texi files. > >> geiser: ("doc/geiser.texi") > I think trying docs?/whatever is good praxis, so I count that as a hit. > >> geiser-guile: ("geiser-guile.texi") > Hit. > >> dash: ("dash.texi") > Hit. > >> orderless: ("orderless.texi") > Hit. > >> consult/cape/tempel: ("README.org") > Hit for README.whatever > >> cider: ("doc/modules/ROOT/nav.adoc") > Miss. > >> all-the-icons: ("README.md") > Hit for README.whatever > >> citar: ("README.org") > Hit for README.whatever > >> org-roam: ("doc/org-roam.texi") > Hit. > >> debbugs: ("debbugs.texi" "debbugs-ug.texi") > Is debbugs-ug a top-level file? Yes, the second one is User Guide. > >> modus-themes: ("doc/modus-themes.org") > Hit. > >> >=20 >> >=20 >> > > It seems that manual approach is more precise, less intrusive and >> > > helps to get rid of many custom and non-uniform documentation >> > > build >> > > phases. >> > If you're going for a "manual" approach, I'd suggest instead making >> > a curried ((build-documentation #:texinfo-files #:texinfo-regexp >> > ...) >> > #:outputs ...) so that the files can be written directly into the >> > (add-after ...) syntax. >>=20 >> Do you mean to make a helper function, which can be used to generate >> a closure of build phase, which can be added with replace/add-after? >>=20 >> Another idea is to make a separate functions for different >> documentation >> type: build-{texinfo,markdown,org,etc}-documentation.=C2=A0 Also, it see= ms >> useful outside of emacs-build-system as well. > Hmm, if we wanted to make that even more generic than just emacs, it'd > go to core-updates.=20=20 > >> In such case user will need to accomplish following steps: 1. add >> texinfo/pandoc/emacs-org dependency 2. use modify-phases to add >> (build-{texinfo,whatever}-documentation #:texinfo-files >> '("doc/manual.{texi,whatever}")), seems a little less convenient than >> simple #:documentation-files #~(list "manual.{texi,whatever}"), but >> also work, at least documentation will be built more uniformly for >> different packages. >>=20 >> WDYT? > I think if we want to go this more generic route, we'd have to redesign > this a little. For instance, (build-texinfo-documentation) should take > regular expressions as remaining arguments.=20=20 What can be a good place (module) for such build phases? > As for the native-inputs required, there has already been a precedent > set with bash-minimal that anything requiring extraneous inputs needs > to declare them explicitly. I think it will work, need to experiment with (build-*-documentation) to get the feeling. Attaching the latest version of the documentation-files patch I have: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-build-system-emacs-Add-documentation-files-argume.patch Content-Transfer-Encoding: quoted-printable From=20a1534b2158c97986e1048379661ee9d250ad6c02 Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Thu, 18 Aug 2022 17:43:14 +0300 Subject: [PATCH v2 1/2] build-system: emacs: Add documentation-files argume= nt. Allows to build info files from texinfo or org. * guix/build-system/emacs.scm (default-texinfo): New variable. * guix/build-system/emacs.scm (lower): New arguments. * guix/build/emacs-build-system.scm (generate-docs): New variable. =2D-- guix/build-system/emacs.scm | 16 ++++++++++++++-- guix/build/emacs-build-system.scm | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index 3df68789ff..02379ee54c 100644 =2D-- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -56,8 +56,16 @@ (define (default-emacs) (let ((emacs-mod (resolve-interface '(gnu packages emacs)))) (module-ref emacs-mod 'emacs-minimal))) =20 +(define (default-texinfo) + "Return the default texinfo package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((texinfo-mod (resolve-interface '(gnu packages texinfo)))) + (module-ref texinfo-mod 'texinfo))) + (define* (lower name #:key source inputs native-inputs outputs system target + documentation-files + (texinfo (default-texinfo)) (emacs (default-emacs)) #:allow-other-keys #:rest arguments) @@ -76,8 +84,10 @@ (define private-keywords =20 ;; Keep the standard inputs of 'gnu-build-system'. ,@(standard-packages))) =2D (build-inputs `(("emacs" ,emacs) =2D ,@native-inputs)) + (build-inputs `(,@native-inputs + ("emacs" ,emacs) + ;; ,@(if (null? documentation-files) '() ) + ("texinfo" ,texinfo))) (outputs outputs) (build emacs-build) (arguments (strip-keyword-arguments private-keywords arguments)))= )) @@ -87,6 +97,7 @@ (define* (emacs-build name inputs (tests? #f) (parallel-tests? #t) (test-command ''("make" "check")) + (documentation-files ''()) (phases '%standard-phases) (outputs '("out")) (include (quote %default-include)) @@ -109,6 +120,7 @@ (define builder #:test-command #$test-command #:tests? #$tests? #:parallel-tests? #$parallel-tests? + #:documentation-files #$documentation-files #:phases #$phases #:outputs #$(outputs->gexp outputs) #:include #$include diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-sys= tem.scm index 6a6918bfdd..3ffa196862 100644 =2D-- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -274,6 +274,27 @@ (define (match-stripped-file action regex) (install-file? file stat #:verbose? #t))) #f)))) =20 +(define* (generate-documentation + #:key outputs documentation-files + #:allow-other-keys) + "Convert texinfo or org files specified in DOCUMENTATION-FILES argument = to +info files. And move info files site-lisp directory." + (for-each (lambda (f) + (if (regexp-exec + (make-regexp "\\.(txi|texi|texinfo)" regexp/icase) + f) + (invoke "makeinfo" f) + (emacs-batch-script ; else org file + `(progn + (require 'ox-texinfo) + (find-file ,f) + (org-texinfo-export-to-info))))) + documentation-files) + (for-each (lambda (f) + (install-file f (string-append (assoc-ref outputs "out") + %install-dir))) + (find-files "." "\\.info$"))) + (define* (move-doc #:key outputs #:allow-other-keys) "Move info files from the ELPA package directory to the info directory." (let* ((out (assoc-ref outputs "out")) @@ -343,6 +364,7 @@ (define %standard-phases (modify-phases gnu:%standard-phases (replace 'unpack unpack) (add-after 'unpack 'expand-load-path expand-load-path) + (add-after 'expand-load-path 'generate-documentation generate-document= ation) (delete 'bootstrap) (delete 'configure) (delete 'build) =2D-=20 2.37.2 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0002-gnu-emacs-xyz-Add-documentation-files-example-usa.patch Content-Transfer-Encoding: quoted-printable From=208adbef898ef80851753ba9d64b31eed727bb34de Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Wed, 31 Aug 2022 12:16:10 +0300 Subject: [PATCH v2 2/2] gnu: emacs-xyz: Add documentation-files example usa= ge. * gnu/packages/emacs-xyz.scm (emacs-geiser, emacs-geiser-guile, emacs-magit, emacs-dash, emacs-consult, emacs-tempel): Add documentation-files example usage. =2D-- gnu/packages/emacs-xyz.scm | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index 90ee485f1e..df0570a4a1 100644 =2D-- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm @@ -262,7 +262,8 @@ (define-public emacs-geiser (base32 "1pm33zlcq84h61xhplmrlicckrax1pv39zrmv8ryzhi9mqrb6bdg")))) (build-system emacs-build-system) (arguments =2D '(#:phases + '(#:documentation-files (list "doc/geiser.texi") + #:phases (modify-phases %standard-phases ;; Move the source files to the top level, which is included in ;; the EMACSLOADPATH. @@ -271,12 +272,7 @@ (define-public emacs-geiser (let ((el-files (find-files "./elisp" ".*\\.el$"))) (for-each (lambda (f) (rename-file f (basename f))) =2D el-files)))) =2D (add-before 'install 'make-info =2D (lambda _ =2D (with-directory-excursion "doc" =2D (invoke "makeinfo" "--no-split" =2D "-o" "geiser.info" "geiser.texi"))))))) + el-files))))))) (native-inputs (list texinfo)) (home-page "https://www.nongnu.org/geiser/") @@ -311,6 +307,7 @@ (define-public emacs-geiser-guile (arguments (list #:include #~(cons "^src/" %default-include) + #:documentation-files #~(list "geiser-guile.texi") #:phases #~(modify-phases %standard-phases (add-after 'unpack 'patch-geiser-guile-binary @@ -978,17 +975,11 @@ (define-public emacs-magit #:exclude #~(cons* "magit-libgit.el" "magit-libgit-pkg.el" %default-exclude) + #:documentation-files #~(list "Documentation/magit.texi" + "Documentation/magit-section.texi") #:phases #~(modify-phases %standard-phases =2D (add-after 'unpack 'build-info-manual =2D (lambda _ =2D (invoke "make" "info") =2D ;; Copy info files to the lisp directory, which acts as =2D ;; the root of the project for the emacs-build-system. =2D (for-each (lambda (f) =2D (install-file f "lisp")) =2D (find-files "Documentation" "\\.info$")))) =2D (add-after 'build-info-manual 'set-magit-version + (add-after 'unpack 'set-magit-version (lambda _ (make-file-writable "lisp/magit.el") (emacs-substitute-variables "lisp/magit.el" @@ -3909,6 +3900,7 @@ (define-public emacs-dash (build-system emacs-build-system) (arguments (list #:tests? #t + #:documentation-files #~(list "dash.texi") #:phases #~(modify-phases %standard-phases (add-after 'unpack 'disable-byte-compile-error-on-warn @@ -9188,6 +9180,7 @@ (define-public emacs-consult (sha256 (base32 "0sy4rn1vjk1g50r8z14hzj8lds6s7ij2zkjqfi6mfash5il75wnq")) (file-name (git-file-name name version)))) + (arguments (list #:documentation-files #~(list "README.org"))) (build-system emacs-build-system) (propagated-inputs (list emacs-compat)) (home-page "https://github.com/minad/consult") @@ -14145,6 +14138,7 @@ (define-public emacs-tempel (base32 "0iyh6wxchqg83gpwvg6lz4qy4c2qh25iqjpjm56kif52346a99d2")))) (build-system emacs-build-system) + (arguments (list #:documentation-files #~(list "README.org"))) (home-page "https://github.com/minad/tempel") (synopsis "Simple templates for Emacs") (description =2D-=20 2.37.2 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 Best regards, Andrew Tropin --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmMPK4YACgkQIgjSCVjB 3rBWlBAAh59C6bqMbM7/Z8D/LjfUiibCfubL1TPZ2LUMrJ5nky8Kkvs62CehVQm1 cSdtAqfiJAHO4ru3xKSfOBYMsfutT0vNY0KI93H5KNVqzQVe26Mivd2aqvNzDRrz UAVz/xQYucCWW4higWOnr5Q8tud7JS+b3umA79TDrRi8VF95huKs8iG2M/P+7gVJ qBAa7u0HfKsoi8raVNXUKZm6c6KxPL6rTGmx+PWGi9m/b8cKBR9ZNIwMVKTYaegG dueZZQQ0GijUxQ8CT50yNwzk9fW53oFYGV2UvlIn/N2RIj7ob0Q+UzoU1F7ldU0z TpCGBYAS373VdxZoUWwkVsv9YkVYWekIUOjY42/SOa8CkB1POIVRa9ouhsoAf/jQ 741ESDyK2EskoK17x2G9d6bMUDqWjaguTj1ItaJyYHRUVOCyPxI5Fi/A8M+zRN+m t8asNL66RXP7kuM7VzHVq7pyAktKQTPHB/7x77HrTAM91vHH1oQJ2/FoEc0OEk/M UIWnQk/HaLI78E45YI1buIf0r6w2l9f3qgOmYfOI5b+/McgNcRlVNUa72S1PI1v5 ttdBViHmfnEGs+0qWqPR3XnljnfdJwOJwb5vDlK3oNeDz2XbeGFLcBNUWPn8KqBp SVUkTh2Tdi7Wn9Xl51zQvYfmCZXqtPfrQpCs2q3fmGighpgF2L0= =GLod -----END PGP SIGNATURE----- --==-=-=--