diff options
author | Steve Purcell <steve@sanityinc.com> | 2024-02-20 23:03:30 +0000 |
---|---|---|
committer | Steve Purcell <steve@sanityinc.com> | 2024-02-20 23:03:30 +0000 |
commit | eeb585eaceeba483d9bc7ab543e7422c82920e35 (patch) | |
tree | a3ca8a6819a5af3a178d03849fab690f1d68d749 | |
parent | 86371484e56f8f0f92624bfaf58fe2fbad7e199c (diff) |
Allow fboundp to guard use of removed functions (fixes #240)
-rw-r--r-- | package-lint-test.el | 13 | ||||
-rw-r--r-- | package-lint.el | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/package-lint-test.el b/package-lint-test.el index e50c813..3fe44f8 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 e491b0f..43b91e2 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." |