[Top][All Lists]

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

master e84493eae91 2/2: Drop footer line warning for packages requiring

From: Stefan Kangas
Subject: master e84493eae91 2/2: Drop footer line warning for packages requiring Emacs 30.1
Date: Fri, 22 Dec 2023 19:51:04 -0500 (EST)

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

    Drop footer line warning for packages requiring Emacs 30.1
    The reason for warning about a missing footer line (";;; foo.el ends
    here") is that package.el up until version 27.1 would refuse to
    install a package without it.  Emacs 27.1 or later will install such
    packages, but will issue a warning, the purpose of which is to
    encourage package authors not to break backwards-compatibility.
    However, if the minimum required Emacs version for a package is 30.1,
    we do not need to worry about compatibility with earlier versions of
    Emacs -- the package author has already explicitly said that the
    package will not work on earlier versions.  For such packages, there
    is no need to warn about a missing footer line.
    In the future, this warning could be removed, but it is premature to
    do that now.  (See Bug#26490.)  Thus, for packages that does not
    specify a minimum version of Emacs, we continue to issue the warning.
    We will also continue to warn for packages requiring Emacs 27 to 29,
    since those versions will themselves warn if the footer is missing.
    * lisp/emacs-lisp/package.el (package-buffer-info): Don't warn if the
    footer line is missing for packages requiring Emacs 30.1 or later.
 lisp/emacs-lisp/package.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0e21f57fc3f..1434db3d1f4 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1173,8 +1173,14 @@ boundaries."
     ;; requirement for a "footer line" without unduly impacting users
     ;; on earlier Emacs versions.  See Bug#26490 for more details.
     (unless (search-forward (concat ";;; " file-name ".el ends here") nil 
-      (lwarn '(package package-format) :warning
-             "Package lacks a terminating comment"))
+      ;; Starting in Emacs 30.1, avoid warning if the minimum Emacs
+      ;; version is specified as 30.1 or later.
+      (let ((min-emacs (cadar (seq-filter (lambda (x) (eq (car x) 'emacs))
+                                          (lm-package-requires)))))
+        (when (or (null min-emacs)
+                  (version< min-emacs "30.1"))
+          (lwarn '(package package-format) :warning
+                 "Package lacks a terminating comment"))))
     ;; Try to include a trailing newline.
     (narrow-to-region start (point))

reply via email to

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