summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/checkdoc.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-09-19 14:09:20 +0200
committerStefan Kangas <stefan@marxist.se>2021-09-19 15:55:06 +0200
commit83508013a8d55bc70dfb716c253c7c4ec8848ab4 (patch)
treee6359e1d6ccdffeb84e4bdc897b97edff244ed31 /lisp/emacs-lisp/checkdoc.el
parent8772d81966f0b1cec400fd638c5ab809cae91df4 (diff)
downloademacs-83508013a8d55bc70dfb716c253c7c4ec8848ab4.tar.gz
checkdoc: Verify format of yes-or-no-p and format-message
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-next-string): Check also for "yes-or-no-p" and "format-message". Convert regexps to use rx.
Diffstat (limited to 'lisp/emacs-lisp/checkdoc.el')
-rw-r--r--lisp/emacs-lisp/checkdoc.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 7b3c0689fbe..8650d62a77f 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -2463,10 +2463,18 @@ Return the message classification.
Argument END is the maximum bounds to search in."
(let ((return nil))
(while (and (not return)
- (re-search-forward
- "(\\s-*\\(\\(\\w\\|\\s_\\)*error\\|\
-\\(\\w\\|\\s_\\)*y-or-n-p\\(-with-timeout\\)?\
-\\|checkdoc-autofix-ask-replace\\)[ \t\n]+" end t))
+ (re-search-forward
+ (rx "("
+ (* (syntax whitespace))
+ (group
+ (or (seq (* (group (or wordchar (syntax symbol))))
+ "error")
+ (seq (* (group (or wordchar (syntax symbol))))
+ (or "y-or-n-p" "yes-or-no-p")
+ (? (group "-with-timeout")))
+ "checkdoc-autofix-ask-replace"))
+ (+ (any "\n\t ")))
+ end t))
(let* ((fn (match-string 1))
(type (cond ((string-match "error" fn)
'error)
@@ -2475,7 +2483,7 @@ Argument END is the maximum bounds to search in."
(progn (forward-sexp 2)
(skip-chars-forward " \t\n")))
(if (and (eq type 'y-or-n-p)
- (looking-at "(format[ \t\n]+"))
+ (looking-at (rx "(format" (? "-message") (+ (any " \t\n")))))
(goto-char (match-end 0)))
(skip-chars-forward " \t\n")
(if (not (looking-at "\""))