Function: checkdoc-defun

checkdoc-defun is an autoloaded, interactive and byte-compiled function defined in checkdoc.el.gz.

Signature

(checkdoc-defun &optional NO-ERROR)

Documentation

Examine the doc string of the function or variable under point.

Call error if the doc string has problems. If NO-ERROR is non-nil, then do not call error, but call message instead. If the doc string passes the test, then check the function for rogue white space at the end of each line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
;;;###autoload
(defun checkdoc-defun (&optional no-error)
  "Examine the doc string of the function or variable under point.
Call `error' if the doc string has problems.  If NO-ERROR is
non-nil, then do not call error, but call `message' instead.
If the doc string passes the test, then check the function for rogue white
space at the end of each line."
  (interactive nil emacs-lisp-mode)
  (save-excursion
    (beginning-of-defun)
    (when (checkdoc--next-docstring)
      (let* ((checkdoc-spellcheck-documentation-flag
              (car (memq checkdoc-spellcheck-documentation-flag
                         '(defun t))))
             (beg (save-excursion (beginning-of-defun) (point)))
             (end (save-excursion (end-of-defun) (point))))
        (dolist (fun (list #'checkdoc-this-string-valid
                           (lambda () (checkdoc-message-text-search beg end))
                           (lambda () (checkdoc-rogue-space-check-engine beg end))))
          (let ((msg (funcall fun)))
            (if msg (if no-error
                        (message "%s" (checkdoc-error-text msg))
                      (user-error "%s" (checkdoc-error-text msg))))))
        (if (called-interactively-p 'interactive)
            (message "Checkdoc: done."))))))