Function: byte-compile-docstring-length-warn

byte-compile-docstring-length-warn is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile-docstring-length-warn FORM)

Documentation

Warn if documentation string of FORM is too wide.

It is too wide if it has any lines longer than the largest of fill-column and byte-compile-docstring-max-column.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-docstring-length-warn (form)
  "Warn if documentation string of FORM is too wide.
It is too wide if it has any lines longer than the largest of
`fill-column' and `byte-compile-docstring-max-column'."
  (when (byte-compile-warning-enabled-p 'docstrings)
    (let ((col (max byte-compile-docstring-max-column fill-column))
          kind name docs)
      (pcase (car form)
        ((or 'autoload 'custom-declare-variable 'defalias
             'defconst 'define-abbrev-table
             'defvar 'defvaralias)
         (setq kind (nth 0 form))
         (setq name (nth 1 form))
         (setq docs (nth 3 form)))
        ('lambda
          (setq kind "")          ; can't be "function", unfortunately
          (setq docs (and (stringp (nth 2 form))
                          (nth 2 form)))))
      (when (and (consp name) (eq (car name) 'quote))
        (setq name (cadr name)))
      (setq name (if name (format " `%s'" name) ""))
      (when (and kind docs (stringp docs)
                 (byte-compile--wide-docstring-p docs col))
        (byte-compile-warn "%s%s docstring wider than %s characters"
                           kind name col))))
  form)