diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2023-12-24 14:27:48 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2023-12-24 14:27:48 +0100 |
commit | 13e46e2c1d33a3a48ecdcb56b745dbc53a4a3831 (patch) | |
tree | c789464ff133bf049610a73f0ad5e1bea23abddb /lisp/emacs-lisp/checkdoc.el | |
parent | 2a1a7a8524c0307c09c91e89816b2b2b8bfb85bc (diff) | |
download | emacs-13e46e2c1d33a3a48ecdcb56b745dbc53a4a3831.tar.gz emacs-13e46e2c1d33a3a48ecdcb56b745dbc53a4a3831.tar.bz2 emacs-13e46e2c1d33a3a48ecdcb56b745dbc53a4a3831.zip |
checkdoc: Avoid false positive for keybinding in docstring
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Avoid false positive when a variable contains a keybinding (for
example, "C-g"). (Bug#68002)
* test/lisp/emacs-lisp/checkdoc-tests.el
(checkdoc-docstring-avoid-false-positive-ok): New test.
Diffstat (limited to 'lisp/emacs-lisp/checkdoc.el')
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 471a2fbdf48..dd7cfd82b1d 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1611,8 +1611,11 @@ may require more formatting") (let ((f nil) (m nil) (start (point)) ;; Ignore the "A-" modifier: it is uncommon in practice, ;; and leads to false positives in regexp ranges. - (re "[^`‘A-Za-z0-9_]\\([CMs]-[a-zA-Z]\\|\\(\\([CMs]-\\)?\ -mouse-[0-3]\\)\\)\\>")) + (re (rx (not (any "0-9A-Za-z_`‘-")) + (group (or (seq (any "CMs") "-" (any "A-Za-z")) + (group (opt (group (any "CMs") "-")) + "mouse-" (any "0-3")))) + eow))) ;; Find the first key sequence not in a sample (while (and (not f) (setq m (re-search-forward re e t))) (setq f (not (checkdoc-in-sample-code-p start e)))) |