Function: flyspell-highlight-incorrect-region
flyspell-highlight-incorrect-region is a byte-compiled function
defined in flyspell.el.gz.
Signature
(flyspell-highlight-incorrect-region BEG END POSS)
Documentation
Set up an overlay on a misspelled word, in the buffer from BEG to END.
POSS is usually a list of possible spelling/correction lists,
as returned by ispell-parse-output.
It can also be the symbol doublon, in the case where the word
is itself incorrect, but suspiciously repeated.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/flyspell.el.gz
;;*---------------------------------------------------------------------*/
;;* flyspell-highlight-incorrect-region ... */
;;*---------------------------------------------------------------------*/
(defun flyspell-highlight-incorrect-region (beg end poss)
"Set up an overlay on a misspelled word, in the buffer from BEG to END.
POSS is usually a list of possible spelling/correction lists,
as returned by `ispell-parse-output'.
It can also be the symbol `doublon', in the case where the word
is itself incorrect, but suspiciously repeated."
(let ((inhibit-read-only t))
(unless (run-hook-with-args-until-success
'flyspell-incorrect-hook beg end poss)
(if (or flyspell-highlight-properties
(not (flyspell-properties-at-p beg)))
(progn
;; we cleanup all the overlay that are in the region, not
;; beginning at the word start position
(if (< (1+ beg) end)
(let ((os (overlays-in (1+ beg) end)))
(while (consp os)
(if (flyspell-overlay-p (car os))
(delete-overlay (car os)))
(setq os (cdr os)))))
;; we cleanup current overlay at the same position
(flyspell-unhighlight-at beg)
;; now we can use a new overlay
(setq flyspell-overlay
(make-flyspell-overlay
beg end
(if (eq poss 'doublon) 'flyspell-duplicate 'flyspell-incorrect)
'highlight)))))))