]> git.eshelyaron.com Git - emacs.git/commitdiff
checkdoc: Delete redundant check for wide docstrings
authorStefan Kangas <stefankangas@gmail.com>
Sun, 23 Mar 2025 16:22:51 +0000 (17:22 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Mar 2025 19:34:42 +0000 (20:34 +0100)
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.

(cherry picked from commit 408ad273eeadf72dea11b89ea2a44f36ea0e2295)

lisp/emacs-lisp/checkdoc.el

index 7dd0984b5413b72c37cd0c01da977bf7890ab533..1d01acf32a5b55ee772cdadc1fae8394e2922893 100644 (file)
@@ -1675,35 +1675,6 @@ function,command,variable,option or symbol." ms1))))))
              ;; TODO - add fix.
             (checkdoc-create-error ret mb me)
           nil)))
-     ;; * Format the documentation string so that it fits in an
-     ;;   Emacs window on an 80-column screen.  It is a good idea
-     ;;   for most lines to be no wider than 60 characters.  The
-     ;;   first line can be wider if necessary to fit the
-     ;;   information that ought to be there.
-     (save-excursion
-       (let* ((start (point))
-              (eol nil)
-              ;; Respect this file local variable.
-              (max-column (max 80 byte-compile-docstring-max-column))
-              ;; Allow the first line to be three characters longer, to
-              ;; fit the leading ` "' while still having a docstring
-              ;; shorter than e.g. 80 characters.
-              (first t)
-              (get-max-column (lambda () (+ max-column (if first 3 0)))))
-        (while (and (< (point) e)
-                    (or (progn (end-of-line) (setq eol (point))
-                                (< (current-column) (funcall get-max-column)))
-                        (progn (beginning-of-line)
-                               (re-search-forward "\\\\\\\\[[<{]"
-                                                  eol t))
-                         (checkdoc-in-sample-code-p start e)))
-           (setq first nil)
-          (forward-line 1))
-        (end-of-line)
-         (if (and (< (point) e) (> (current-column) (funcall get-max-column)))
-            (checkdoc-create-error
-              (format "Some lines are over %d columns wide" max-column)
-             s (save-excursion (goto-char s) (line-end-position))))))
      ;; Here we deviate to tests based on a variable or function.
      ;; We must do this before checking for symbols in quotes because there
      ;; is a chance that just such a symbol might really be an argument.