Function: checkdoc--next-docstring

checkdoc--next-docstring is a byte-compiled function defined in checkdoc.el.gz.

Signature

(checkdoc--next-docstring)

Documentation

When looking at a definition with a doc string, find it.

Move to the next doc string after point, and return t. When not looking at a definition containing a doc string, return nil and don't move point.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
(defun checkdoc--next-docstring ()
  "When looking at a definition with a doc string, find it.
Move to the next doc string after point, and return t.  When not
looking at a definition containing a doc string, return nil and
don't move point."
  (pcase (save-excursion (condition-case nil
                             (read (current-buffer))
                           ;; Conservatively skip syntax errors.
                           (invalid-read-syntax)
                           ;; Don't bug out if the file is empty (or a
                           ;; definition ends prematurely.
                           (end-of-file)))
    (`(,(and (pred symbolp) def
             (let (and doc (guard doc)) (function-get def 'doc-string-elt)))
       ,(pred symbolp)
       ;; Require an initializer, i.e. ignore single-argument `defvar'
       ;; forms, which never have a doc string.
       ,_ . ,_)
     (down-list)
     ;; Skip over function or macro name.
     (forward-sexp 1)
     ;; And now skip until the docstring.
     (forward-sexp (1- ; We already skipped the function or macro name.
                    (cond
                     ((numberp doc) doc)
                     ((functionp doc) (funcall doc)))))
     (skip-chars-forward " \n\t")
     t)))