From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: 44858@debbugs.gnu.org, larsi@gnus.org
Subject: bug#44858: [PATCH] Make byte-compiler warn about wide docstrings
Date: Fri, 11 Dec 2020 09:53:27 +0200 [thread overview]
Message-ID: <83lfe43hjc.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkm=pXm4PDHGXgHY+xX1BT0DGESar1EWZBcSZsA2c3gF9Mg@mail.gmail.com> (message from Stefan Kangas on Thu, 10 Dec 2020 14:59:16 -0600)
> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 10 Dec 2020 14:59:16 -0600
> Cc: 44858@debbugs.gnu.org
>
> +** byte compiler
Please capitalize "Byte".
> +*** The byte-compiler now warns about too wide documentation strings.
> +By default, it will warn if a documentation string is wider than the
> +largest of 80 characters or 'fill-column'. See the new user
> +option 'byte-compile-docstring-max-column'.
The last sentence will be more useful if you make it more informative,
e.g.
This is controlled by the new user option
'byte-compile-docstring-max-column'.
> +(defvar byte-compile--wide-docstring-substitution-len 3
> + "Substitution width used in `byte-compile--wide-docstring-p'.")
The doc string should be more detailed. Let's at least explain what
hides behind "substitution", and say that the value is a heuristic.
> +(defcustom byte-compile-docstring-max-column 80
> + "Length that a doc string can be before the byte-compiler reports a warning."
I suggest "width", not "length", since you both use the former
elsewhere, and because "column" goes better with "width".
Also, "can be before" is not the clearest way of saying this. I
suggest
Recommended maximum width of doc string lines.
The byte-compiler will emit a warning for doc-string lines
wider than this. If `fill-column' has a larger value, it will
override this variable.
> +(defun byte-compile-docstring-length-warn (form)
> + "Warn if documentation string of FORM is too wide.
> +It is too wide if it is longer than the largest of `fill-column'
> +and `byte-compile-docstring-max-column'."
"It is too wide if it is longer" is inaccurate, I think, because we
actually test each _line_ of the doc string against the limit, while
the above seems to imply the overall length of the doc string (which
could be multi-line) is tested. So:
It is too wide if some of its lines is wider than the largest of...
> --- /dev/null
> +++ b/test/lisp/emacs-lisp/bytecomp-resources/warn-long-docstring-autoload.el
> @@ -0,0 +1,3 @@
> +;;; -*- lexical-binding: t -*-
> +(autoload 'foox "foo"
> + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
I see that none of the tests use multi-line doc strings, is that
right? If so, I think it would be good to have at least a couple, one
where the first line is too wide, and another where some line other
than the first is too wide. Also, what about testing the fact that
fill-column overrides the value of the new option?
Thanks.
next prev parent reply other threads:[~2020-12-11 7:53 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 1:36 bug#44858: [PATCH] Make byte-compiler warn about wide docstrings Stefan Kangas
2020-11-26 10:49 ` Lars Ingebrigtsen
2020-11-26 12:46 ` Stefan Kangas
2020-11-26 12:53 ` Lars Ingebrigtsen
2020-12-10 20:59 ` Stefan Kangas
2020-12-10 21:53 ` Stefan Kangas
2020-12-11 8:16 ` Eli Zaretskii
2020-12-11 20:03 ` Stefan Kangas
2020-12-11 7:33 ` Eli Zaretskii
2020-12-11 20:36 ` Stefan Kangas
2020-12-19 11:22 ` Eli Zaretskii
2020-12-19 16:50 ` Stefan Kangas
2020-12-19 17:14 ` Eli Zaretskii
2020-12-29 1:27 ` Basil L. Contovounesios
2020-12-29 2:16 ` Lars Ingebrigtsen
2020-12-19 17:18 ` Lars Ingebrigtsen
2020-12-19 23:48 ` Stefan Kangas
2020-12-11 7:53 ` Eli Zaretskii [this message]
2020-12-19 23:55 ` Stefan Kangas
2020-12-20 17:53 ` Lars Ingebrigtsen
2020-12-28 5:18 ` Stefan Kangas
2020-12-11 15:13 ` Lars Ingebrigtsen
2020-12-30 12:07 ` Stefan Kangas
2020-12-31 4:42 ` Lars Ingebrigtsen
2020-11-26 14:19 ` Eli Zaretskii
2020-11-27 8:37 ` Lars Ingebrigtsen
2020-11-27 11:15 ` Stefan Kangas
2020-11-27 12:44 ` Eli Zaretskii
2020-12-06 11:09 ` Stefan Kangas
2020-12-06 11:19 ` Eli Zaretskii
2020-12-06 16:54 ` Drew Adams
2020-11-27 18:36 ` Drew Adams
2020-11-27 18:55 ` Drew Adams
2020-12-03 20:18 ` Tomas Nordin
2020-12-11 20:14 ` Stefan Kangas
2021-09-24 17:25 ` Stefan Kangas
2021-09-25 1:07 ` Lars Ingebrigtsen
2021-09-26 11:38 ` Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83lfe43hjc.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=44858@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=stefan@marxist.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.