Function: make-flyspell-overlay

make-flyspell-overlay is a byte-compiled function defined in flyspell.el.gz.

Signature

(make-flyspell-overlay BEG END FACE MOUSE-FACE)

Documentation

Allocate an overlay to highlight an incorrect word.

BEG and END specify the range in the buffer of that word. FACE and MOUSE-FACE specify the face and mouse-face properties for the overlay.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/flyspell.el.gz
;;*---------------------------------------------------------------------*/
;;*    make-flyspell-overlay ...                                        */
;;*---------------------------------------------------------------------*/
(defun make-flyspell-overlay (beg end face mouse-face)
  "Allocate an overlay to highlight an incorrect word.
BEG and END specify the range in the buffer of that word.
FACE and MOUSE-FACE specify the `face' and `mouse-face' properties
for the overlay."
  (let ((overlay (make-overlay beg end nil t nil)))
    (overlay-put overlay 'face face)
    (overlay-put overlay 'mouse-face mouse-face)
    (overlay-put overlay 'flyspell-overlay t)
    (overlay-put overlay 'evaporate t)
    (overlay-put overlay 'help-echo
                 (concat (if context-menu-mode "mouse-3" "mouse-2")
                         ": correct word at point"))
    (if context-menu-mode
        (overlay-put overlay 'context-menu-function 'flyspell-context-menu)
      ;; If misspelled text has a 'keymap' property, let that remain in
      ;; effect for the bindings that flyspell-mouse-map doesn't override.
      (set-keymap-parent flyspell-mouse-map (get-char-property beg 'keymap))
      (overlay-put overlay 'keymap flyspell-mouse-map))
    (when (eq face 'flyspell-incorrect)
      (and (stringp flyspell-before-incorrect-word-string)
           (overlay-put overlay 'before-string
                        flyspell-before-incorrect-word-string))
      (and (stringp flyspell-after-incorrect-word-string)
           (overlay-put overlay 'after-string
                        flyspell-after-incorrect-word-string)))
    overlay))