unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: 57280@debbugs.gnu.org
Cc: Liliana Marie Prikler <liliana.prikler@gmail.com>
Subject: [bug#57280] [PATCH 0/3] Add documentation-files argument to emacs build system.
Date: Thu, 18 Aug 2022 21:35:02 +0300	[thread overview]
Message-ID: <87mtc18ko9.fsf@trop.in> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 527 bytes --]


This patch adds a handy way for generating info documentation for emacs
packages from texinfo or org files.

Andrew Tropin (3):
  build-system: emacs: Add documentation-files argument.
  gnu: emacs-orderless: Use documentation-files argument.
  gnu: emacs-consult: Use documentation-files argument.

 gnu/packages/emacs-xyz.scm        | 11 +++--------
 guix/build-system/emacs.scm       | 11 +++++++++++
 guix/build/emacs-build-system.scm | 17 +++++++++++++++++
 3 files changed, 31 insertions(+), 8 deletions(-)

-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-build-system-emacs-Add-documentation-files-argument.patch --]
[-- Type: text/x-patch, Size: 4079 bytes --]

From 74b671b94d16db2f21c1df02672fef0b5228a08a Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
Date: Thu, 18 Aug 2022 17:43:14 +0300
Subject: [PATCH 1/3] build-system: emacs: Add documentation-files argument.

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.
---
 guix/build-system/emacs.scm       | 11 +++++++++++
 guix/build/emacs-build-system.scm | 17 +++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index 3df68789ff..632ba2ddb3 100644
--- 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)))
 
+(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)
@@ -77,6 +85,7 @@ (define private-keywords
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("emacs" ,emacs)
+                         ,@(if (null? documentation-files) '() `(("texinfo" ,texinfo)))
                          ,@native-inputs))
          (outputs outputs)
          (build emacs-build)
@@ -87,6 +96,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 +119,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-system.scm
index 6a6918bfdd..08c61ddfd8 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -274,6 +274,22 @@ (define (match-stripped-file action regex)
                            (install-file? file stat #:verbose? #t)))
       #f))))
 
+(define* (generate-docs #:key outputs documentation-files #:allow-other-keys)
+  "Convert texinfo or org files specified in DOCUMENTATION-FILES argument to
+info files."
+  (map
+   (lambda (path)
+     (if (or (string-suffix? ".texi" path)
+             (string-suffix? ".texinfo" path)
+             (string-suffix? ".txi" path))
+         (invoke "makeinfo" path)
+         (emacs-batch-script ; else org file
+          `(progn
+            (require 'ox-texinfo)
+            (find-file ,path)
+            (org-texinfo-export-to-info)))))
+   documentation-files))
+
 (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 +359,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-docs generate-docs)
     (delete 'bootstrap)
     (delete 'configure)
     (delete 'build)
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-gnu-emacs-orderless-Use-documentation-files-argument.patch --]
[-- Type: text/x-patch, Size: 1283 bytes --]

From 6c8fb7d173c24ef6c00aca5a7697cf14d1353f37 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
Date: Thu, 18 Aug 2022 17:49:18 +0300
Subject: [PATCH 2/3] gnu: emacs-orderless: Use documentation-files argument.

* gnu/packages/emacs-xyz.scm (emacs-orderless): Use documentation-files argument.
---
 gnu/packages/emacs-xyz.scm | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 811e293c1d..f3d515b3c6 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -9045,14 +9045,7 @@ (define-public emacs-orderless
        (file-name (git-file-name name version))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'install 'makeinfo
-           (lambda* (#:key outputs #:allow-other-keys)
-             (invoke "makeinfo" "orderless.texi")
-             (install-file "orderless.info"
-                           (string-append (assoc-ref outputs "out")
-                                          "/share/info")))))))
+     (list #:documentation-files #~'("orderless.texi")))
     (native-inputs
      (list texinfo))
     (home-page "https://github.com/oantolin/orderless")
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: 0003-gnu-emacs-consult-Use-documentation-files-argument.patch --]
[-- Type: text/x-patch, Size: 985 bytes --]

From d3ad4d4446ba4275bec5f9ed2aaa7e74289727f2 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
Date: Thu, 18 Aug 2022 17:50:00 +0300
Subject: [PATCH 3/3] gnu: emacs-consult: Use documentation-files argument.

* gnu/packages/emacs-xyz.scm (emacs-consult): Use documentation-files argument.
---
 gnu/packages/emacs-xyz.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index f3d515b3c6..cab1ad9dee 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -9071,6 +9071,8 @@ (define-public emacs-consult
         (base32 "0sy4rn1vjk1g50r8z14hzj8lds6s7ij2zkjqfi6mfash5il75wnq"))
        (file-name (git-file-name name version))))
     (build-system emacs-build-system)
+    (arguments
+     (list #:documentation-files #~'("README.org")))
     (propagated-inputs (list emacs-compat))
     (home-page "https://github.com/minad/consult")
     (synopsis "Consulting completing-read")
-- 
2.37.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

             reply	other threads:[~2022-08-18 18:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 18:35 Andrew Tropin [this message]
2022-08-18 19:31 ` [bug#57280] [PATCH 0/3] Add documentation-files argument to emacs build system Liliana Marie Prikler
     [not found] <87wnb5lhyr.fsf@trop.in>
     [not found] ` <107d9c475d47842d67db4f0a7d85d63ae11f9f3c.camel@gmail.com>
2022-08-19  3:33   ` Andrew Tropin
2022-08-19  4:19     ` Liliana Marie Prikler
2022-08-19  6:21       ` Andrew Tropin
2022-08-19 15:39         ` Liliana Marie Prikler
2022-08-26 14:33           ` Andrew Tropin
2022-08-29 16:38             ` Liliana Marie Prikler
2022-08-30  8:15               ` Andrew Tropin
2022-08-30  8:28                 ` Liliana Marie Prikler
2022-08-31  9:36                   ` Andrew Tropin
2022-08-31 10:07                     ` Liliana Marie Prikler
2022-09-02 14:02                       ` Andrew Tropin
2022-09-02 14:52                         ` Liliana Marie Prikler
2023-04-26  4:40                           ` bug#57280: " Andrew Tropin

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://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtc18ko9.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=57280@debbugs.gnu.org \
    --cc=liliana.prikler@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/guix.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).