From: Chong Yidong Date: Sat, 6 Sep 2008 20:07:49 +0000 (+0000) Subject: (ispell-command-loop): Suspend ispell if the user enters a mouse event X-Git-Tag: emacs-pretest-23.0.90~2985 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=09144fdd27ea5d688ea6e9c15a3daee7499a5711;p=emacs.git (ispell-command-loop): Suspend ispell if the user enters a mouse event in another frame, or a special event. --- diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index b752f873d8c..d6a5da48d35 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -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