diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-09-24 17:45:37 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-09-26 13:23:57 +0200 |
commit | f3a6fe2c7d5943dcf241700aaf5c10c485217f60 (patch) | |
tree | 27750f587c596bf9de0e2544342f78ee591655ba /lisp/emacs-lisp | |
parent | 44da8dd3e4a1e961eb7bbfdf9b1d2abad429ac3c (diff) | |
download | emacs-f3a6fe2c7d5943dcf241700aaf5c10c485217f60.tar.gz emacs-f3a6fe2c7d5943dcf241700aaf5c10c485217f60.tar.bz2 emacs-f3a6fe2c7d5943dcf241700aaf5c10c485217f60.zip |
Avoid false positives in bytecomp docstring width warning
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
Ignore more function argument lists.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests-byte-compile--wide-docstring-p): New test.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index d7da7a2149a..fc5b092f7dd 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1649,14 +1649,22 @@ URLs." (replace-regexp-in-string (rx (or ;; Ignore some URLs. - (seq "http" (? "s") "://" (* anychar)) + (seq "http" (? "s") "://" (* nonl)) ;; Ignore these `substitute-command-keys' substitutions. (seq "\\" (or "=" (seq "<" (* (not ">")) ">") (seq "{" (* (not "}")) "}"))) ;; Ignore the function signature that's stashed at the end of ;; the doc string (in some circumstances). - (seq bol "(fn (" (* nonl)))) + (seq bol "(" (+ (any word "-/:[]&")) + ;; One or more arguments. + (+ " " (or + ;; Arguments. + (+ (or (syntax symbol) + (any word "-/:[]&=().?^\\#'"))) + ;; Argument that is a list. + (seq "(" (* (not ")")) ")"))) + ")"))) "" ;; Heuristic: assume these substitutions are of some length N. (replace-regexp-in-string |