Function: checkdoc-ispell-docstring-engine

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

Signature

(checkdoc-ispell-docstring-engine END &optional TAKE-NOTES)

Documentation

Run the Ispell tools on the doc string between point and END.

Since Ispell isn't Lisp-smart, we must pre-process the doc string before using the Ispell engine on it.

With a non-nil TAKE-NOTES, store all errors found in a warnings buffer, otherwise stop after the first error.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/checkdoc.el.gz
(defun checkdoc-ispell-docstring-engine (end &optional take-notes)
  "Run the Ispell tools on the doc string between point and END.
Since Ispell isn't Lisp-smart, we must pre-process the doc string
before using the Ispell engine on it.

With a non-nil TAKE-NOTES, store all errors found in a warnings
buffer, otherwise stop after the first error."
  (when (and checkdoc-spellcheck-documentation-flag
             ;; If the user wants no questions or fixing, then we must
             ;; disable spell checking as not useful.
             (or take-notes
                 (and checkdoc-autofix-flag
                      (not (eq checkdoc-autofix-flag 'never)))))
    (checkdoc-ispell-init)
    (unless checkdoc-spellcheck-documentation-flag
      ;; this happens when (checkdoc-ispell-init) can't start `ispell-program-name'
      (user-error "No spellchecker installed: check the variable `ispell-program-name'"))
    (save-excursion
      (skip-chars-forward "^a-zA-Z")
      (let (word sym case-fold-search word-beginning word-end) ;; err
        (while (and (< (point) end)) ;; (not err)
          (if (save-excursion (forward-char -1) (looking-at "[('`]"))
              ;; Skip lists describing meta-syntax, or bound variables
              (forward-sexp 1)
            (setq word-beginning (point)
                  word-end (progn
                             (skip-chars-forward "a-zA-Z-")
                             (point))
                  word (buffer-substring-no-properties word-beginning word-end)
                  sym (intern-soft word))
            (unless (and sym (or (boundp sym) (fboundp sym)))
              ;; Find out how we spell-check this word.
              (unless (or
                       ;; All caps with option th, or s tacked on the
                       ;; end for pluralization or number.
                       (string-match "^[A-Z][A-Z]+\\(s\\|th\\)?$" word)
                       (looking-at "}") ; a keymap expression
                       )
                (save-excursion
                  (let ((lk last-input-event))
                    (if take-notes
                        (progn
                          (unless (ispell-correct-p)
                            (checkdoc-create-error
                             (ispell-error-checking-word word)
                             word-beginning word-end)))
                      (ispell-word nil t))
                    (if (not (equal last-input-event lk))
                        (progn
                          (sit-for 0)
                          (message "Continuing..."))))))))
          (skip-chars-forward "^a-zA-Z"))
        nil)))) ;; err