emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d826240fa56 4/4: checkdoc: Relax footer line check for recent Ema


From: Stefan Kangas
Subject: master d826240fa56 4/4: checkdoc: Relax footer line check for recent Emacs
Date: Sat, 6 Jul 2024 13:00:52 -0400 (EDT)

branch: master
commit d826240fa56230ef1561d5b4807284ce98a8c6b6
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    checkdoc: Relax footer line check for recent Emacs
    
    * lisp/emacs-lisp/checkdoc.el (checkdoc-file-comments-engine):
    Don't require a footer line unless 'lm-package-needs-footer-line'
    returns true.
---
 etc/NEWS                    | 20 ++++++++++++++++++++
 lisp/emacs-lisp/checkdoc.el | 39 ++++++++++++++++++++++++---------------
 2 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 3d2b86cfb6a..ba58fa7b319 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -70,6 +70,26 @@ Advanced" node in the EWW manual.
 By customizing 'shr-image-zoom-levels', you can change the list of zoom
 levels that SHR cycles through when calling 'shr-zoom-image'.
 
+** Emacs Lisp mode
+
+---
+*** Checkdoc no longer warns about missing footer lines in some cases.
+Emacs Lisp libraries have traditionally ended with a footer line
+(sometimes referred to as "terminating comment").  Their purpose was to
+easily detect files that had been truncated in transit on ancient and
+less reliable connections:
+
+    ;; some-cool-package.el ends here
+
+'checkdoc' will no longer warn if that line is missing for packages that
+explicitly only support Emacs 30.1 or later, as specified in the
+"Package-Requires" header.  The reason for keeping the warning for
+packages that support earlier versions of Emacs is that package.el in
+those versions can't install packages where that line is missing.
+
+This change affects both 'M-x checkdoc' and the corresponding flymake
+backend.
+
 
 * New Modes and Packages in Emacs 31.1
 
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 11d335d811a..a329638ed1c 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -2476,21 +2476,30 @@ Code:, and others referenced in the style guide."
         ;; * Library footer
        (save-excursion
          (goto-char (point-max))
-         (if (not (re-search-backward
-                    ;; This should match the requirement in
-                    ;; `package-buffer-info'.
-                    (concat "^;;; " (regexp-quote (concat fn fe)) " ends here")
-                   nil t))
-              (if (checkdoc-y-or-n-p "No identifiable footer!  Add one?")
-                 (progn
-                   (goto-char (point-max))
-                   (insert "\n(provide '" fn ")\n\n;;; " fn fe " ends here\n"))
-               (checkdoc-create-error
-                (format "The footer should be: (provide '%s)\\n;;; %s%s ends 
here"
-                        fn fn fe)
-                 ;; The buffer may be empty.
-                (max (point-min) (1- (point-max)))
-                 (point-max)))))
+          (let* ((footer-line (lm-package-needs-footer-line)))
+            (if (not (re-search-backward
+                      ;; This should match the requirement in
+                      ;; `package-buffer-info'.
+                      (if footer-line
+                          (concat "^;;; " (regexp-quote (concat fn fe)) " ends 
here")
+                        (concat "\n(provide '" fn ")\n"))
+                      nil t))
+                (if (checkdoc-y-or-n-p (if footer-line
+                                   "No identifiable footer!  Add one?"
+                                 "No `provide' statement!  Add one?"))
+                    (progn
+                      (goto-char (point-max))
+                      (insert (if footer-line
+                                  (concat "\n(provide '" fn ")\n\n;;; " fn fe 
" ends here\n")
+                                (concat "\n(provide '" fn ")\n"))))
+                  (checkdoc-create-error
+                   (if footer-line
+                       (format "The footer should be: (provide '%s)\\n;;; %s%s 
ends here"
+                               fn fn fe)
+                     (format "The footer should be: (provide '%s)\\n" fn))
+                   ;; The buffer may be empty.
+                   (max (point-min) (1- (point-max)))
+                   (point-max))))))
        err))
       ;; The below checks will not return errors if the user says NO
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]