Subject: bug#76446: 0003-Makefile-Add-target-to-run-checkdoc-on-all-files.patch

From: Morgan Smith <[email-masked]>
Date: Fri, 21 Feb 2025 13:15:53 -0500

Michael Albinus <[email-masked]> writes:

> Morgan Smith <[email-masked]> writes:
>
>> --- /dev/null
>> +++ b/.dir-locals.el
>> @@ -0,0 +1,18 @@
>> +;;; Directory Local Variables            -*- no-byte-compile: t -*-
>> +;;; For more information see (info "(emacs) Directory Variables")
>> +
>> +((emacs-lisp-mode . ((checkdoc-package-keywords-flag . t)
>> +                     (checkdoc-ispell-lisp-words
>> +                      .
>> +                      ("ChangeLog" "ChangeLogs" "UTF" "alist" "args"
>> +                       "armstrong" "backend" "bcc" "bugreport" "cdate" "cedet"
>> +                       "coreutils" "cygwin" "debbugs" "debian" "el" "emacs"
>> +                       "etags" "freemail" "fsf" "guix" "gw" "henoch" "hu"
>> +                       "hyperestraier" "keymap" "magit" "magnus" "maint"
>> +                       "maintainer" "maintainer's" "mbox" "mboxes" "minibuffer"
>> +                       "moreinfo" "multibyte" "notabug" "paren" "persistency"
>> +                       "regexp" "rescan" "rgm" "rmail" "severities" "sexp"
>> +                       "solaris" "src" "sublist" "submitter" "submitter's"
>> +                       "subproduct" "subqueries" "subquery" "teardown"
>> +                       "unarchived" "unibyte" "unreproducible" "url" "util"
>> +                       "wishlist" "wontfix" "wsdl" "www" "xsd" "zltuz")))))
>
> This is needed for the checkdoc target in make only, isn't it? Shouldn't
> we activate it for just this case?
>

Ya this seems a little inelegant.  See the attached patch for an attempt
to do this a different way.

>> --- a/Makefile
>> +++ b/Makefile
>> +checkdoc: $(SOURCE) $(TESTSOURCE)
>> +	@$(EMACS) -Q --batch "--eval=(setq enable-local-variables :all \
>> +                                       checkdoc-spellcheck-documentation-flag t)" \
>> +    -L . $(foreach file,$^,"--eval=(checkdoc-file \"$(file)\")")
>
> Do we need '-L .'?

We do not!

> Best regards, Michael.

>From 9d6fc20715ae9a13a82811bf7b3b3469e060bd45 Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email-masked]>
Date: Fri, 21 Feb 2025 12:52:35 -0500
Subject: [PATCH v2 4/5] Makefile: Add target to run checkdoc on all files

* Makefile: Add target to run checkdoc on all files.
* test/debbugs-checkdoc-config.el: New file.
---
 Makefile                        |  5 +++-
 test/debbugs-checkdoc-config.el | 50 +++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 test/debbugs-checkdoc-config.el

diff --git a/Makefile b/Makefile
index eec1c65a14..8ed6a917fe 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ TESTTARGET=$(patsubst %.el,%.elc,$(TESTSOURCE))
 
 INFOMANUALS=debbugs.info debbugs-ug.info
 
-.PHONY: all build check clean
+.PHONY: all build check clean checkdoc
 .PRECIOUS: %.elc
 
 %.elc: %.el
@@ -26,6 +26,9 @@ doc: $(INFOMANUALS)
 
 build: $(TARGET)
 
+checkdoc: $(SOURCE) $(TESTSOURCE)
+	@$(EMACS) -Q --batch -l test/debbugs-checkdoc-config.el $(foreach file,$^,"--eval=(checkdoc-file \"$(file)\")")
+
 check: build $(TESTTARGET)
 	@$(EMACS) -Q --batch -L . -L ./test $(foreach file,$(TESTSOURCE), -l $(file)) -f ert-run-tests-batch-and-exit
 
diff --git a/test/debbugs-checkdoc-config.el b/test/debbugs-checkdoc-config.el
new file mode 100644
index 0000000000..d09b1adfe5
--- /dev/null
+++ b/test/debbugs-checkdoc-config.el
@@ -0,0 +1,50 @@
+;;; debbugs-checkdoc-config.el --- Configuration for running checkdoc on debbugs -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Author: Morgan Smith <[email-masked]>
+;; Package: debbugs
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(defvar checkdoc-package-keywords-flag)
+(defvar checkdoc-spellcheck-documentation-flag)
+(defvar checkdoc-ispell-lisp-words)
+
+(with-eval-after-load "checkdoc"
+  (setq checkdoc-package-keywords-flag t)
+  (setq checkdoc-spellcheck-documentation-flag t)
+  (setq checkdoc-ispell-lisp-words
+        '("ChangeLog" "ChangeLogs" "UTF" "alist" "args"
+          "armstrong" "backend" "bcc" "bugreport" "cdate" "cedet"
+          "coreutils" "cygwin" "debbugs" "debian" "el" "emacs"
+          "etags" "freemail" "fsf" "guix" "gw" "henoch" "hu"
+          "hyperestraier" "keymap" "magit" "magnus" "maint"
+          "maintainer" "maintainer's" "mbox" "mboxes" "minibuffer"
+          "moreinfo" "multibyte" "notabug" "paren" "persistency"
+          "regexp" "rescan" "rgm" "rmail" "severities" "sexp"
+          "solaris" "src" "sublist" "submitter" "submitter's"
+          "subproduct" "subqueries" "subquery" "teardown"
+          "unarchived" "unibyte" "unreproducible" "url" "util"
+          "wishlist" "wontfix" "wsdl" "www" "xsd" "zltuz")))
+
+(provide 'debbugs-checkdoc-config)
+
+;;; debbugs-checkdoc-config.el ends here
-- 
2.48.1