]> git.eshelyaron.com Git - emacs.git/commitdiff
(ispell-highlight, ispell-dehighlight): New functions.
authorRichard M. Stallman <rms@gnu.org>
Sat, 1 Jan 1994 10:22:02 +0000 (10:22 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 1 Jan 1994 10:22:02 +0000 (10:22 +0000)
(ispell-command-loop, ispell-next): Call them.
(ispell-highlight, ispell-overlay): New variables.

lisp/textmodes/ispell4.el

index d0402ec78cbc7ca1fb59db92a6be3ffca369180d..c47db01a2300a5430866b99c6865b07d59f33e48 100644 (file)
@@ -342,6 +342,7 @@ Return value is t unless exit is due to typing `q'."
                (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 @@ L lookup; Q quit\n")
     (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 @@ L lookup; Q quit\n")
       (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: