summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2024-07-07 13:37:55 +0200
committerStefan Kangas <stefankangas@gmail.com>2024-07-07 13:38:47 +0200
commite738c387dac674092eab4b5b32efd9fb6726dee6 (patch)
tree47e17e517ea5be72e6bca2e9cd82918257df2b69 /lisp/emacs-lisp
parent1883603dfc52f71aa515c60103967938a6eec002 (diff)
downloademacs-e738c387dac674092eab4b5b32efd9fb6726dee6.tar.gz
emacs-e738c387dac674092eab4b5b32efd9fb6726dee6.tar.bz2
emacs-e738c387dac674092eab4b5b32efd9fb6726dee6.zip
checkdoc: Flag formatting mistakes in warnings
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-next-string) (checkdoc-message-text-engine): Flag formatting mistakes in warnings. (checkdoc--warning-function-re): New variable.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/checkdoc.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 6eb9fc058f6..6355569b16f 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -2547,6 +2547,11 @@ The default boundary is the entire buffer."
(setq e (checkdoc-message-text-engine type)))
e))
+(defvar checkdoc--warning-function-re
+ (rx (or "display-warning" "org-display-warning"
+ "warn" "lwarn"
+ "message-box")))
+
(defun checkdoc-message-text-next-string (end)
"Move cursor to the next checkable message string after point.
Return the message classification.
@@ -2559,6 +2564,7 @@ Argument END is the maximum bounds to search in."
(group
(or (seq (* (or wordchar (syntax symbol)))
"error")
+ (regexp checkdoc--warning-function-re)
(seq (* (or wordchar (syntax symbol)))
(or "y-or-n-p" "yes-or-no-p")
(? "-with-timeout"))
@@ -2566,8 +2572,13 @@ Argument END is the maximum bounds to search in."
(+ (any "\n\t ")))
end t))
(let* ((fn (match-string 1))
- (type (cond ((string-match "error" fn)
- 'error)
+ (type (cond ((string-match "error" fn)
+ 'error)
+ ((string-match (rx bos
+ (regexp checkdoc--warning-function-re)
+ eos)
+ fn)
+ 'warning)
(t 'y-or-n-p))))
(if (string-match "checkdoc-autofix-ask-replace" fn)
(progn (forward-sexp 2)
@@ -2645,6 +2656,10 @@ Argument TYPE specifies the type of question, such as `error' or `y-or-n-p'."
(setq type
(cond ((looking-at "(error")
'error)
+ ((looking-at
+ (rx "(" (regexp checkdoc--warning-function-re)
+ (syntax whitespace)))
+ 'warning)
(t 'y-or-n-p)))))
(let ((case-fold-search nil))
(or