emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/package-lint 5713222666 3/5: Handle macros added by compat


From: ELPA Syncer
Subject: [nongnu] elpa/package-lint 5713222666 3/5: Handle macros added by compat
Date: Fri, 3 Nov 2023 16:01:29 -0400 (EDT)

branch: elpa/package-lint
commit 57132226660287baf1b4bde1bcd49cdc0565ae52
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>

    Handle macros added by compat
---
 package-lint-test.el | 19 +++++++++++++++++--
 package-lint.el      |  4 ++--
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/package-lint-test.el b/package-lint-test.el
index 39c79efe26..ca4bb798bb 100644
--- a/package-lint-test.el
+++ b/package-lint-test.el
@@ -372,9 +372,9 @@ Alternatively, depend on (emacs \"24.3\") or greater, in 
which cl-lib is bundled
 (ert-deftest package-lint-test-error-new-functions ()
   (should
    (equal
-    '((6 1 error "You should depend on (emacs \"25.1\") if you need 
`when-let'."))
+    '((6 1 error "You should depend on (emacs \"24.1\") if you need 
`window-resize'."))
     (package-lint-test--run
-     "(when-let ((foo (bar))) (message \"ok\"))"))))
+     "(window-resize foobar)"))))
 
 (ert-deftest package-lint-test-error-new-functions-as-quote ()
   (should
@@ -471,6 +471,21 @@ Alternatively, depend on (emacs \"24.3\") or greater, in 
which cl-lib is bundled
      ";; Package-Requires: ((compat \"29\"))
 \(proper-list-p '(foo))"))))
 
+(ert-deftest package-lint-test-error-new-compat-macros ()
+  (should
+   (equal
+    '((6 1 error "You should depend on (emacs \"27.1\") or the compat package 
if you need `with-suppressed-warnings'."))
+    (package-lint-test--run
+     "(with-suppressed-warnings (foo))"))))
+
+(ert-deftest package-lint-test-accepts-new-macros-with-compat ()
+  (should
+   (equal
+    '()
+    (package-lint-test--run
+     ";; Package-Requires: ((compat \"29\"))
+\(with-suppressed-warnings (foo))"))))
+
 (ert-deftest package-lint-test-error-nonstandard-symbol-separator ()
   (should
    (equal
diff --git a/package-lint.el b/package-lint.el
index 62b6a27764..cc07a2ea42 100644
--- a/package-lint.el
+++ b/package-lint.el
@@ -182,10 +182,10 @@ symbol such as `variable-added'.")
           (insert-file-contents el-path)
           (goto-char (point-min))
           ;; TODO convert to rx
-          (while (search-forward-regexp "^(compat-\\(defun\\|\\defvar\\) 
+\\_<\\(.*?\\)\\_>" nil t)
+          (while (search-forward-regexp 
"^(compat-\\(defun\\|defmacro\\|\\defvar\\) +\\_<\\(.*?\\)\\_>" nil t)
             (pcase (match-string 1)
               ("defvar" (push (intern (match-string 2)) symbols))
-              ("defun" (push (intern (match-string 2)) functions)))))))
+              ((or "defun" "defmacro") (push (intern (match-string 2)) 
functions)))))))
     (cons symbols functions))
   "A cons cell of (VARS . FUNCTIONS) supported by \"compat\".")
 



reply via email to

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