branch: externals/keymap-popup
commit b912e5feba399840e0e9992529d2abc7484a9590
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>

    build: Generate and install Info manual
---
 Makefile | 19 +++++++++++++++++--
 guix.scm | 26 ++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index a65718a361..74d34326e0 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,11 @@ SRCS = keymap-popup.el
 TESTS = tests/keymap-popup-tests.el
 BATCH = $(EMACS_CMD) -Q --batch
 
-.PHONY: all compile do-compile test do-test lint do-lint clean dev load
+ORG = docs/keymap-popup.org
+TEXI = docs/keymap-popup.texi
+INFO = docs/keymap-popup.info
+
+.PHONY: all compile do-compile test do-test lint do-lint doc do-doc clean dev 
load
 
 all: compile
 
@@ -42,6 +46,17 @@ do-lint:
        @echo "Running checkdoc..."
        @$(BATCH) --eval '(checkdoc-file "$(SRCS)")'
 
+doc:
+       @$(GUIX_WRAP) do-doc
+
+do-doc: $(INFO)
+
+$(INFO): $(ORG)
+       @echo "Building $(INFO)..."
+       @$(BATCH) --load org \
+         --eval "(with-current-buffer (find-file \"$(ORG)\") 
(org-texinfo-export-to-info))" \
+         --kill
+
 dev: compile lint test
 
 load:
@@ -53,4 +68,4 @@ load:
        @printf "\033[32mLoaded keymap-popup into Emacs\033[0m\n"
 
 clean:
-       rm -f *.elc
+       rm -f *.elc $(TEXI) $(INFO)
diff --git a/guix.scm b/guix.scm
index 82936a8615..991b8ebe9e 100644
--- a/guix.scm
+++ b/guix.scm
@@ -12,6 +12,7 @@
 ;;       guix shell -D -f guix.scm -- make test
 
 (use-modules (gnu packages emacs)
+             (gnu packages texinfo)
              (guix build-system emacs)
              ((guix licenses) #:prefix license:)
              (guix packages)
@@ -41,6 +42,8 @@ if the command fails."
     (not (or (string-prefix? "." name)
              (string-contains file "/refs/")
              (string-suffix? ".elc" file)
+             (string-suffix? ".info" file)
+             (string-suffix? ".texi" file)
              (string-suffix? "~" file)))))
 
 (define-public emacs-keymap-popup-git
@@ -52,6 +55,29 @@ if the command fails."
                         #:recursive? #t
                         #:select? source-file?))
     (build-system emacs-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'build-info-manual
+            (lambda _
+              (invoke "emacs" "-Q" "--batch"
+                      "--load" "org"
+                      "--eval" "(with-current-buffer (find-file 
\"docs/keymap-popup.org\") (org-texinfo-export-to-info))"
+                      "--kill")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "emacs" "-Q" "--batch"
+                        "-l" "ert"
+                        "-l" "keymap-popup.el"
+                        "-l" "tests/keymap-popup-tests.el"
+                        "-f" "ert-run-tests-batch-and-exit"))))
+          (add-after 'install 'install-info-manual
+            (lambda _
+              (install-file "docs/keymap-popup.info"
+                            (string-append #$output "/share/info")))))))
+    (native-inputs (list texinfo))
     (home-page "https://codeberg.org/thanosapollo/emacs-forgejo";)
     (synopsis "Described keymaps with popup help")
     (description

Reply via email to