Subject: 29.0.50; [PATCH] New check-man target to check man pages for errors
From: Stefan Kangas <[email-masked]>
To: [email-masked]
Date: Sun, 27 Nov 2022 07:23:49 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Severity: wishlist

The attached patch adds a new check-man target to check our man pages
for errors.  I know we prefer info over man, but why not.  It will catch
mistakes, like using unknown macros, etc.

To test this, change a macro like ".B" to ".BBB" in doc/man/emacs.1 and
run "make check-man".
From cc83e75ad0bc02d003b14a789f15dc94c6ab7899 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sun, 27 Nov 2022 16:03:31 +0100
Subject: [PATCH] Add new check-man target

* Makefile.in (check-man): New target to check man pages for errors.
---
 Makefile.in | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index 93609a4e16..2d86df09bb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -69,6 +69,10 @@
 #      check-expensive includes additional tests that can be slow.
 #      check-all runs all tests, including ones that can be slow, or
 #        fail unpredictably
+#
+# make check-man
+#      Check man pages for errors.
+#
 
 SHELL = @SHELL@
 
@@ -1322,6 +1326,15 @@ check-declare:
 	$(MAKE) -C lisp $@
 	$(MAKE) -C test $@
 
+.PHONY: check-man
+
+check-man:
+	@cd ${mansrcdir}; \
+	for page in *.1; do \
+	  LC_ALL=C.UTF-8 MANROFFSEQ='' MANWIDTH=80 \
+	  man --warnings -E UTF-8 -l -Tutf8 -Z "$$page" >/dev/null; \
+	done
+
 .PHONY: gitmerge
 
 GITMERGE_EMACS = ./src/emacs${EXEEXT}
-- 
2.35.1