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

    Allow fboundp to guard use of removed functions (fixes #240)
---
 package-lint-test.el | 13 +++++++------
 package-lint.el      |  3 ++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/package-lint-test.el b/package-lint-test.el
index e50c8135ff..3fe44f8f74 100644
--- a/package-lint-test.el
+++ b/package-lint-test.el
@@ -578,14 +578,15 @@ Alternatively, depend on (emacs \"24.3\") or greater, in 
which cl-lib is bundled
     '((6 1 error "You should depend on (emacs \"25.1\") if you need 
`mm-url-encode-multipart-form-data'.")
       (6 1 error "`mm-url-encode-multipart-form-data' was removed in Emacs 
version 24.3."))
     (package-lint-test--run "(mm-url-encode-multipart-form-data)")))
-  (equal
-   ;; This is clunky, but won't currently fix
-   '((6 1 error "You should depend on (emacs \"25.1\") if you need 
`mm-url-encode-multipart-form-data'.")
-     (6 1 error "`mm-url-encode-multipart-form-data' was removed in Emacs 
version 24.3."))
-   (package-lint-test--run ";; Package-Requires: ((emacs 
\"24.1\"))\n(mm-url-encode-multipart-form-data)"))  (should
+  (should
+   (equal
+    '((7 1 error "You should depend on (emacs \"25.1\") if you need 
`mm-url-encode-multipart-form-data'.")
+      (7 1 error "`mm-url-encode-multipart-form-data' was removed in Emacs 
version 24.3."))
+    (package-lint-test--run ";; Package-Requires: ((emacs 
\"24.1\"))\n(mm-url-encode-multipart-form-data)")))
+  (should
    (equal
     '()
-    (package-lint-test--run ";; Package-Requires: ((emacs 
\"25.1\"))\n(mm-url-encode-multipart-form-data)"))))
+    (package-lint-test--run "(when (fboundp 
'mm-url-encode-multipart-form-data) (mm-url-encode-multipart-form-data))"))))
 
 (ert-deftest package-lint-test-accept-new-libraries-with-dep ()
   (should (equal '() (package-lint-test--run
diff --git a/package-lint.el b/package-lint.el
index e491b0fe7d..43b91e224d 100644
--- a/package-lint.el
+++ b/package-lint.el
@@ -769,7 +769,8 @@ the Emacs dependency matches the re-addition."
        (let ((removed-in-version .function-removed))
          (when removed-in-version
            (let ((emacs-version-dep (or (cadr (assq 'emacs valid-deps)) '(0))))
-             (unless (and .function-added (version-list-<= .function-added 
emacs-version-dep))
+             (unless (or (package-lint--seen-fboundp-check-for sym)
+                         (and .function-added (version-list-<= .function-added 
emacs-version-dep)))
                (list
                 'error
                 (format "`%s' was removed in Emacs version %s."

Reply via email to