mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 14:30:43 -08:00
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.
This commit is contained in:
parent
1883603dfc
commit
e738c387da
2 changed files with 22 additions and 2 deletions
5
etc/NEWS
5
etc/NEWS
|
|
@ -90,6 +90,11 @@ those versions can't install packages where that line is missing.
|
||||||
This change affects both 'M-x checkdoc' and the corresponding flymake
|
This change affects both 'M-x checkdoc' and the corresponding flymake
|
||||||
backend.
|
backend.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** Checkdoc will now flag incorrect formatting in warnings.
|
||||||
|
This affects calls to 'warn', 'lwarn', 'display-warning', and
|
||||||
|
'message-box'.
|
||||||
|
|
||||||
|
|
||||||
* New Modes and Packages in Emacs 31.1
|
* New Modes and Packages in Emacs 31.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2547,6 +2547,11 @@ The default boundary is the entire buffer."
|
||||||
(setq e (checkdoc-message-text-engine type)))
|
(setq e (checkdoc-message-text-engine type)))
|
||||||
e))
|
e))
|
||||||
|
|
||||||
|
(defvar checkdoc--warning-function-re
|
||||||
|
(rx (or "display-warning" "org-display-warning"
|
||||||
|
"warn" "lwarn"
|
||||||
|
"message-box")))
|
||||||
|
|
||||||
(defun checkdoc-message-text-next-string (end)
|
(defun checkdoc-message-text-next-string (end)
|
||||||
"Move cursor to the next checkable message string after point.
|
"Move cursor to the next checkable message string after point.
|
||||||
Return the message classification.
|
Return the message classification.
|
||||||
|
|
@ -2559,6 +2564,7 @@ Argument END is the maximum bounds to search in."
|
||||||
(group
|
(group
|
||||||
(or (seq (* (or wordchar (syntax symbol)))
|
(or (seq (* (or wordchar (syntax symbol)))
|
||||||
"error")
|
"error")
|
||||||
|
(regexp checkdoc--warning-function-re)
|
||||||
(seq (* (or wordchar (syntax symbol)))
|
(seq (* (or wordchar (syntax symbol)))
|
||||||
(or "y-or-n-p" "yes-or-no-p")
|
(or "y-or-n-p" "yes-or-no-p")
|
||||||
(? "-with-timeout"))
|
(? "-with-timeout"))
|
||||||
|
|
@ -2566,8 +2572,13 @@ Argument END is the maximum bounds to search in."
|
||||||
(+ (any "\n\t ")))
|
(+ (any "\n\t ")))
|
||||||
end t))
|
end t))
|
||||||
(let* ((fn (match-string 1))
|
(let* ((fn (match-string 1))
|
||||||
(type (cond ((string-match "error" fn)
|
(type (cond ((string-match "error" fn)
|
||||||
'error)
|
'error)
|
||||||
|
((string-match (rx bos
|
||||||
|
(regexp checkdoc--warning-function-re)
|
||||||
|
eos)
|
||||||
|
fn)
|
||||||
|
'warning)
|
||||||
(t 'y-or-n-p))))
|
(t 'y-or-n-p))))
|
||||||
(if (string-match "checkdoc-autofix-ask-replace" fn)
|
(if (string-match "checkdoc-autofix-ask-replace" fn)
|
||||||
(progn (forward-sexp 2)
|
(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
|
(setq type
|
||||||
(cond ((looking-at "(error")
|
(cond ((looking-at "(error")
|
||||||
'error)
|
'error)
|
||||||
|
((looking-at
|
||||||
|
(rx "(" (regexp checkdoc--warning-function-re)
|
||||||
|
(syntax whitespace)))
|
||||||
|
'warning)
|
||||||
(t 'y-or-n-p)))))
|
(t 'y-or-n-p)))))
|
||||||
(let ((case-fold-search nil))
|
(let ((case-fold-search nil))
|
||||||
(or
|
(or
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue