changeset 5400:dd2c5504bcc1

(ispell-highlight, ispell-dehighlight): New functions. (ispell-command-loop, ispell-next): Call them. (ispell-highlight, ispell-overlay): New variables.
author Richard M. Stallman <rms@gnu.org>
date Sat, 01 Jan 1994 10:22:02 +0000
parents 67aa88583b90
children fd65333a301e
files lisp/textmodes/=ispell4.el
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/=ispell4.el	Sat Jan 01 08:31:33 1994 +0000
+++ b/lisp/textmodes/=ispell4.el	Sat Jan 01 10:22:02 1994 +0000
@@ -342,6 +342,7 @@
 		(setq ispell-bad-words (cdr ispell-bad-words))
 		(set-marker next nil)))
 	    t)
+	(ispell-dehighlight)
 	(if ispell-window-configuration
 	    (set-window-configuration ispell-window-configuration))
 	(cond ((null ispell-bad-words)
@@ -536,6 +537,7 @@
     (if (null message)
 	(setq first-line (concat "No near misses for '" word "'"))
       (setq first-line (concat "Near misses for '" word "'")))
+    (ispell-highlight start end)
     (while flag
       (ispell-show-choices word message first-line)
       (message "Ispell command: ")
@@ -623,6 +625,28 @@
       (kill-emacs 1))
   (write-region (point-min) (point-max) "ispell.info"))
 
+(defvar ispell-highlight t
+  "*Non-nil means to highlight ispell words.")
+
+(defvar ispell-overlay nil)
+
+(defun ispell-dehighlight ()
+  (and ispell-overlay
+       (progn
+	 (delete-overlay ispell-overlay)
+	 (setq ispell-overlay nil))))
+
+(defun ispell-highlight (start end)
+  (and ispell-highlight 
+       (progn
+	 (or ispell-overlay
+	     (progn
+	       (setq ispell-overlay (make-overlay start end))
+	       (overlay-put ispell-overlay 'face
+			    (if (internal-find-face 'ispell)
+				'ispell 'region))))
+	 (move-overlay ispell-overlay start end (current-buffer)))))
+
 ;;;; ispell-complete-word
 
 ;;; Brief Description: