From f3a6fe2c7d5943dcf241700aaf5c10c485217f60 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 24 Sep 2021 17:45:37 +0200 Subject: 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. --- lisp/emacs-lisp/bytecomp.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') 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 -- cgit v1.2.3