Skip to content

Commit

Permalink
Also handle aliases provided by compat, like string-split
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Nov 13, 2023
1 parent 5f2ae2d commit 8eb052b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions package-lint-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -459,17 +459,20 @@ Alternatively, depend on (emacs \"24.3\") or greater, in which cl-lib is bundled
(ert-deftest package-lint-test-error-new-compat-functions ()
(should
(equal
'((6 1 error "You should depend on (emacs \"27.1\") or the compat package if you need `proper-list-p'."))
'((6 1 error "You should depend on (emacs \"27.1\") or the compat package if you need `proper-list-p'.")
(7 1 error "You should depend on (emacs \"29.1\") or the compat package if you need `string-split'."))
(package-lint-test--run
"(proper-list-p '(foo))"))))
"(proper-list-p '(foo))
\(string-split s)"))))

(ert-deftest package-lint-test-accepts-new-functions-with-compat ()
(should
(equal
'()
(package-lint-test--run
";; Package-Requires: ((compat \"29\"))
\(proper-list-p '(foo))"))))
\(proper-list-p '(foo))
\(string-split s)"))))

(ert-deftest package-lint-test-error-new-compat-macros ()
(should
Expand Down
4 changes: 2 additions & 2 deletions package-lint.el
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ symbol such as `variable-added'.")
(insert-file-contents el-path)
(goto-char (point-min))
(while (search-forward-regexp (rx line-start
"(compat-" (group (or "defun" "defmacro" "defvar"))
"(compat-" (group (or "defun" "defmacro" "defvar" "defalias"))
(+ space)
symbol-start
(group (+? any))
symbol-end)
nil t)
(pcase (match-string 1)
("defvar" (push (intern (match-string 2)) symbols))
((or "defun" "defmacro") (push (intern (match-string 2)) functions)))))))
((or "defun" "defmacro" "defalias") (push (intern (match-string 2)) functions)))))))
(cons symbols functions))
"A cons cell of (VARS . FUNCTIONS) supported by \"compat\".")

Expand Down

0 comments on commit 8eb052b

Please sign in to comment.