diff options
| author | Stefan Kangas | 2025-03-23 17:22:51 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-03-23 17:22:51 +0100 |
| commit | 408ad273eeadf72dea11b89ea2a44f36ea0e2295 (patch) | |
| tree | e6fdcaebff8e14910ca18f5e79d842c8fdc71a6e | |
| parent | 7d14e35498209e45290f5c1297ded6d7175bf1ea (diff) | |
| download | emacs-408ad273eeadf72dea11b89ea2a44f36ea0e2295.tar.gz emacs-408ad273eeadf72dea11b89ea2a44f36ea0e2295.zip | |
checkdoc: Delete redundant check for wide docstrings
With Emacs 28.1, wide docstrings are now flagged by the byte-compiler.
The logic in the byte-compiler for catching these issues is complex
and continuously evolving, particularly to avoid incorrectly flagging
`substitute-command-keys` substitutions. Unfortunately, the checkdoc
implementation incorrectly flags correct docstrings as overly wide.
Rather than duplicating the byte-compiler logic in checkdoc, which
would introduce unnecessary maintenance overhead, we acknowledge that
this check is now redundant and remove it. Users utilizing the
byte-compiler, whether manually or through `flymake`, will continue to
be warned about this issue.
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Remove check for overly wide docstrings; duplicates byte-compiler
logic.
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 29 |
2 files changed, 5 insertions, 29 deletions
| @@ -1025,6 +1025,11 @@ This change affects both 'M-x checkdoc' and the corresponding flymake | |||
| 1025 | backend. | 1025 | backend. |
| 1026 | 1026 | ||
| 1027 | --- | 1027 | --- |
| 1028 | *** Checkdoc no longer warns about wide docstrings. | ||
| 1029 | The Checkdoc warning for wide docstrings duplicates the byte-compiler | ||
| 1030 | warning added in Emacs 28.1. This redundancy is now removed. | ||
| 1031 | |||
| 1032 | --- | ||
| 1028 | *** New user option 'checkdoc-arguments-missing-flag'. | 1033 | *** New user option 'checkdoc-arguments-missing-flag'. |
| 1029 | Set this to nil to disable warnings for function arguments that are not | 1034 | Set this to nil to disable warnings for function arguments that are not |
| 1030 | documented in docstrings. | 1035 | documented in docstrings. |
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index c5f1e9a6ed5..355a0c5e98a 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el | |||
| @@ -1694,35 +1694,6 @@ function,command,variable,option or symbol." ms1)))))) | |||
| 1694 | (if ret | 1694 | (if ret |
| 1695 | (checkdoc-create-error ret mb me) | 1695 | (checkdoc-create-error ret mb me) |
| 1696 | nil))) | 1696 | nil))) |
| 1697 | ;; * Format the documentation string so that it fits in an | ||
| 1698 | ;; Emacs window on an 80-column screen. It is a good idea | ||
| 1699 | ;; for most lines to be no wider than 60 characters. The | ||
| 1700 | ;; first line can be wider if necessary to fit the | ||
| 1701 | ;; information that ought to be there. | ||
| 1702 | (save-excursion | ||
| 1703 | (let* ((start (point)) | ||
| 1704 | (eol nil) | ||
| 1705 | ;; Respect this file local variable. | ||
| 1706 | (max-column (max 80 byte-compile-docstring-max-column)) | ||
| 1707 | ;; Allow the first line to be three characters longer, to | ||
| 1708 | ;; fit the leading ` "' while still having a docstring | ||
| 1709 | ;; shorter than e.g. 80 characters. | ||
| 1710 | (first t) | ||
| 1711 | (get-max-column (lambda () (+ max-column (if first 3 0))))) | ||
| 1712 | (while (and (< (point) e) | ||
| 1713 | (or (progn (end-of-line) (setq eol (point)) | ||
| 1714 | (< (current-column) (funcall get-max-column))) | ||
| 1715 | (progn (beginning-of-line) | ||
| 1716 | (re-search-forward "\\\\\\\\[[<{]" | ||
| 1717 | eol t)) | ||
| 1718 | (checkdoc-in-sample-code-p start e))) | ||
| 1719 | (setq first nil) | ||
| 1720 | (forward-line 1)) | ||
| 1721 | (end-of-line) | ||
| 1722 | (if (and (< (point) e) (> (current-column) (funcall get-max-column))) | ||
| 1723 | (checkdoc-create-error | ||
| 1724 | (format "Some lines are over %d columns wide" max-column) | ||
| 1725 | s (save-excursion (goto-char s) (line-end-position)))))) | ||
| 1726 | ;; Here we deviate to tests based on a variable or function. | 1697 | ;; Here we deviate to tests based on a variable or function. |
| 1727 | ;; We must do this before checking for symbols in quotes because there | 1698 | ;; We must do this before checking for symbols in quotes because there |
| 1728 | ;; is a chance that just such a symbol might really be an argument. | 1699 | ;; is a chance that just such a symbol might really be an argument. |