Function: flyspell-check-word-p

flyspell-check-word-p is a byte-compiled function defined in flyspell.el.gz.

Signature

(flyspell-check-word-p)

Documentation

Return t when the word at point has to be checked.

The answer depends of several criteria. Mostly we check word delimiters.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/flyspell.el.gz
;;*---------------------------------------------------------------------*/
;;*    flyspell-check-word-p ...                                        */
;;*---------------------------------------------------------------------*/
(defun flyspell-check-word-p ()
  "Return t when the word at `point' has to be checked.
The answer depends of several criteria.
Mostly we check word delimiters."
  (let ((ispell-otherchars (ispell-get-otherchars)))
    (cond
     ((<= (- (point-max) 1) (point-min))
      ;; The buffer is not filled enough.
      nil)
     ((and (and (> (current-column) 0)
		(not (eq (current-column) flyspell-pre-column)))
	   (save-excursion
	     (backward-char 1)
	     (and (looking-at (flyspell-get-not-casechars))
		  (or (string= "" ispell-otherchars)
		      (not (looking-at ispell-otherchars)))
		  (or flyspell-consider-dash-as-word-delimiter-flag
		      (not (looking-at "-"))))))
      ;; Yes because we have reached or typed a word delimiter.
      t)
     ((symbolp this-command)
      (cond
       ((get this-command 'flyspell-deplacement)
	(not (eq flyspell-previous-command this-command)))
       ((get this-command 'flyspell-delayed)
        ;; In case we're using `delete-selection-mode', make the
        ;; region be updated immediately.
        (deactivate-mark)
	;; The current command is not delayed, that
	;; is that we must check the word now.
	(and (not unread-command-events)
             (if (not flyspell-delay-use-timer)
                 (sit-for flyspell-delay)
               (setq flyspell--timer
                     (run-with-idle-timer
                      flyspell-delay nil
                      (lambda (buffer)
                        (when (eq (current-buffer) buffer) (flyspell-word)))
                      (current-buffer)))
               nil)))
       (t t)))
     (t t))))