Skip to content

Commit

Permalink
Prefer rx for regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Nov 10, 2023
1 parent 5eba825 commit c541e67
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions package-lint.el
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,13 @@ symbol such as `variable-added'.")
(with-temp-buffer
(insert-file-contents el-path)
(goto-char (point-min))
;; TODO convert to rx
(while (search-forward-regexp "^(compat-\\(defun\\|defmacro\\|\\defvar\\) +\\_<\\(.*?\\)\\_>" nil t)
(while (search-forward-regexp (rx line-start
"(compat-" (group (or "defun" "defmacro" "defvar"))
(+ 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)))))))
Expand Down

0 comments on commit c541e67

Please sign in to comment.