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.
This commit is contained in:
parent
3cde006699
commit
d826240fa5
2 changed files with 44 additions and 15 deletions
20
etc/NEWS
20
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue