]> git.eshelyaron.com Git - emacs.git/commitdiff
checkdoc: Verify format of yes-or-no-p and format-message
authorStefan Kangas <stefan@marxist.se>
Sun, 19 Sep 2021 12:09:20 +0000 (14:09 +0200)
committerStefan Kangas <stefan@marxist.se>
Sun, 19 Sep 2021 13:55:06 +0000 (15:55 +0200)
* 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.

lisp/emacs-lisp/checkdoc.el

index 7b3c0689fbe39c2660a389cd6f0776d3d185d158..8650d62a77fb7c69f91c83947e4636c4780571f9 100644 (file)
@@ -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 "\""))