branch: elpa/package-lint
commit 078f403d57e3056338ef45e37973e7a27297f545
Author: Steve Purcell <st...@sanityinc.com>
Commit: Steve Purcell <st...@sanityinc.com>

    Allow functionp to guard use of unavailable functions, as with fboundp
---
 package-lint-test.el | 9 +++++++++
 package-lint.el      | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/package-lint-test.el b/package-lint-test.el
index 1453ddc4b23..f4f8ccdd40c 100644
--- a/package-lint-test.el
+++ b/package-lint-test.el
@@ -428,6 +428,15 @@ Alternatively, depend on (emacs \"24.3\") or greater, in 
which cl-lib is bundled
     (when-let blah)
   (bloop))"))))
 
+(ert-deftest package-lint-test-accept-new-functions-with-functionp ()
+  (should
+   (equal
+    '()
+    (package-lint-test--run
+     "(if (functionp 'when-let)
+    (when-let blah)
+  (bloop))"))))
+
 (ert-deftest package-lint-test-distinguishes-let-vars-from-function-calls ()
   (should (equal '() (package-lint-test--run "(let (seq-length '(foo)))")))
   (should (equal '() (package-lint-test--run "(let ((seq-length '(foo))))")))
diff --git a/package-lint.el b/package-lint.el
index 9b4664e8059..562980610d6 100644
--- a/package-lint.el
+++ b/package-lint.el
@@ -575,7 +575,7 @@ required version PACKAGE-VERSION.  If not, raise an error 
for DEP-POS."
   (save-excursion
     (save-match-data
       (and (re-search-backward
-            (concat "(" (regexp-opt '("fboundp" "macrop")) "\\s-+#?'" 
(regexp-quote sym) "\\_>") (point-min) t)
+            (concat "(" (regexp-opt '("fboundp" "functionp" "macrop")) 
"\\s-+#?'" (regexp-quote sym) "\\_>") (point-min) t)
            (not (package-lint--inside-comment-or-string-p))))))
 
 (defun package-lint--map-regexp-match (regexp callback)

Reply via email to