Function: byte-compile--wide-docstring-p

byte-compile--wide-docstring-p is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile--wide-docstring-p DOCSTRING MAX-WIDTH)

Documentation

Whether DOCSTRING contains a line wider than MAX-WIDTH.

Ignore all substitute-command-keys substitutions, except for the \\=[command] ones that are assumed to be of a fixed length. Also ignore URLs.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile--wide-docstring-p (docstring max-width)
  "Whether DOCSTRING contains a line wider than MAX-WIDTH.
Ignore all `substitute-command-keys' substitutions, except for
the `\\\\=[command]' ones that are assumed to be of a fixed length.
Also ignore URLs."
  (let ((string-len (length docstring))
        (start 0)
        (too-wide nil))
    (while (< start string-len)
      (let ((eol (or (string-search "\n" docstring start)
                     string-len)))
        ;; Since `bytecomp--docstring-line-width' is non-expansive,
        ;; we can safely assume that if the raw length is
        ;; within the allowed width, then so is the transformed width.
        ;; This allows us to avoid the very expensive transformation in
        ;; most cases.
        (if (and (> (- eol start) max-width)
                 (> (bytecomp--docstring-line-width
                     (substring docstring start eol))
                    max-width))
            (progn
              (setq too-wide t)
              (setq start string-len))
          (setq start (1+ eol)))))
    too-wide))