]> git.eshelyaron.com Git - emacs.git/commitdiff
(ispell-command-loop): Suspend ispell if the user enters a mouse event
authorChong Yidong <cyd@stupidchicken.com>
Sat, 6 Sep 2008 20:07:49 +0000 (20:07 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sat, 6 Sep 2008 20:07:49 +0000 (20:07 +0000)
in another frame, or a special event.

lisp/textmodes/ispell.el

index b752f873d8cd178efc125648bf3037f1c9cd348c..d6a5da48d35340013fde60b96f361190578ce4d7 100644 (file)
@@ -1858,14 +1858,23 @@ Global `ispell-quit' set to start location to continue spell session."
                  (let (message-log-max)
                    (message (concat "C-h or ? for more options; SPC to leave "
                                     "unchanged, Character to replace word")))
-                 (let ((inhibit-quit t))
-                   (setq char (if (fboundp 'read-char-exclusive)
-                                  (read-char-exclusive)
-                                (read-char))
-                         skipped 0)
-                   (if (or quit-flag (= char ?\C-g)) ; C-g is like typing X
-                       (setq char ?X
-                             quit-flag nil)))
+                 (let ((inhibit-quit t)
+                       (input-valid t))
+                   (setq char nil skipped 0)
+                   ;; If the user types C-g, or generates some other
+                   ;; non-character event (such as a frame switch
+                   ;; event), stop ispell.  As a special exception,
+                   ;; ignore mouse events occuring in the same frame.
+                   (while (and input-valid (not (characterp char)))
+                     (setq char (read-event))
+                     (setq input-valid
+                           (or (characterp char)
+                               (and (mouse-event-p char)
+                                    (eq (selected-frame)
+                                        (window-frame
+                                         (posn-window (event-start char))))))))
+                   (when (or quit-flag (not input-valid) (= char ?\C-g))
+                     (setq char ?X quit-flag nil)))
                  ;; Adjust num to array offset skipping command characters.
                  (let ((com-chars command-characters))
                    (while com-chars