diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2024-07-06 17:36:30 +0200 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2024-07-06 19:00:19 +0200 |
commit | d826240fa56230ef1561d5b4807284ce98a8c6b6 (patch) | |
tree | c5e48dde898d5e5b8d07de84cc5239d4962f1b48 /lisp/emacs-lisp/checkdoc.el | |
parent | 3cde0066998bc46a44a38583970d748badb0b850 (diff) | |
download | emacs-d826240fa56230ef1561d5b4807284ce98a8c6b6.tar.gz emacs-d826240fa56230ef1561d5b4807284ce98a8c6b6.tar.bz2 emacs-d826240fa56230ef1561d5b4807284ce98a8c6b6.zip |
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.
Diffstat (limited to 'lisp/emacs-lisp/checkdoc.el')
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 39 |
1 files changed, 24 insertions, 15 deletions
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 |