Function: ispell-highlight-spelling-error-generic
ispell-highlight-spelling-error-generic is a byte-compiled function
defined in ispell.el.gz.
Signature
(ispell-highlight-spelling-error-generic START END &optional HIGHLIGHT REFRESH)
Documentation
Highlight the word from START to END with a kludge using inverse-video.
When the optional third arg HIGHLIGHT is set, the word is highlighted;
otherwise it is displayed normally.
Uses block cursor to highlight one character.
Optional REFRESH will unhighlighted then highlight, using block cursor
highlighting when REFRESH is equal to block.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(setq start end)))))) ; else move start to next line of input
;; This function destroys the mark location if it is in the word being
;; highlighted.
(defun ispell-highlight-spelling-error-generic (start end &optional highlight
refresh)
"Highlight the word from START to END with a kludge using `inverse-video'.
When the optional third arg HIGHLIGHT is set, the word is highlighted;
otherwise it is displayed normally.
Uses block cursor to highlight one character.
Optional REFRESH will unhighlighted then highlight, using block cursor
highlighting when REFRESH is equal to `block'."
(and (eq 'block ispell-highlight-p)
(or (eq 'block refresh)
(setq start (1+ start)))) ; On block non-refresh, inc start.
(let ((modified (buffer-modified-p)) ; don't allow this fn to modify buffer
(buffer-read-only nil) ; Allow highlighting read-only buffers.
(text (buffer-substring-no-properties start end))
; Save highlight region.
(inhibit-quit t) ; inhibit interrupt processing here.
(buffer-undo-list t)) ; don't clutter the undo list.
(goto-char end)
(delete-region start end)
(insert-char ? (- end start)) ; minimize amount of redisplay
(sit-for 0) ; update display
(if highlight (setq inverse-video (not inverse-video))) ; toggle video
(delete-region start end) ; delete whitespace
(insert text) ; insert text in inverse video.
(sit-for 0) ; update display showing inverse video.
(if (not highlight)
(goto-char end)
(setq inverse-video (not inverse-video)) ; toggle video
(and (eq 'block ispell-highlight-p)
(goto-char (1- start)))) ; use block cursor to "highlight" char
(set-buffer-modified-p modified) ; don't modify if flag not set.
(and refresh ; re-highlight
(ispell-highlight-spelling-error-generic
(if (eq 'block refresh) start (- start 2)) end t))))