]> git.eshelyaron.com Git - emacs.git/commitdiff
If local-maps work, don't put
authorRichard M. Stallman <rms@gnu.org>
Sun, 27 Dec 1998 03:15:10 +0000 (03:15 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 27 Dec 1998 03:15:10 +0000 (03:15 +0000)
flyspell-mode-map in minor-mode-map-alist; bind mouse-2 and M-TAB
in flyspell-mouse-map (only).
(flyspell-use-local-map): New variable.
Use a different mouse-2 binding in that case,
and don't add to minor-mode-map-alist.
(make-flyspell-overlay, flyspell-correct-word):
Test flyspell-use-local-map.

lisp/textmodes/flyspell.el

index ab6319d698e966381b85c9231c1e03eb32b1b6cd..56521877c7ccd994ff3c748cd6f33de6b2140c40 100644 (file)
@@ -203,6 +203,10 @@ property of the major mode name.")
     'emacs))
   "The type of Emacs we are currently running.")
 
+(defvar flyspell-use-local-map
+  (or (eq flyspell-emacs 'xemacs)
+      (not (string< emacs-version "20"))))
+
 ;*---------------------------------------------------------------------*/
 ;*    The minor mode declaration.                                      */
 ;*---------------------------------------------------------------------*/
@@ -216,19 +220,22 @@ property of the major mode name.")
     (setq minor-mode-alist
          (cons '(flyspell-mode " Fly") minor-mode-alist)))
 
-(or (assoc 'flyspell-mode minor-mode-map-alist)
-    (setq minor-mode-map-alist
-         (cons (cons 'flyspell-mode flyspell-mode-map)
-               minor-mode-map-alist)))
-
-(define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word)
-
-;; mouse bindings
+;; mouse or local-map bindings
 (cond
  ((eq flyspell-emacs 'xemacs)
   (define-key flyspell-mouse-map [(button2)]
-    (function flyspell-correct-word/mouse-keymap)))
+    (function flyspell-correct-word/mouse-keymap))
+  (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word))
+ (flyspell-use-local-map
+  (define-key flyspell-mouse-map [(mouse-2)]
+    (function flyspell-correct-word/mouse-keymap))
+  (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word))
  (t
+  (or (assoc 'flyspell-mode minor-mode-map-alist)
+      (setq minor-mode-map-alist
+         (cons (cons 'flyspell-mode flyspell-mode-map)
+               minor-mode-map-alist)))
+  (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word)
   (define-key flyspell-mode-map [(mouse-2)]
     (function flyspell-correct-word/local-keymap))))
 
@@ -868,7 +875,7 @@ for the overlay."
     (overlay-put flyspell-overlay 'face face)
     (overlay-put flyspell-overlay 'mouse-face mouse-face)
     (overlay-put flyspell-overlay 'flyspell-overlay t)
-    (if (eq flyspell-emacs 'xemacs)
+    (if flyspell-use-local-map
        (overlay-put flyspell-overlay
                     flyspell-overlay-keymap-property-name
                     flyspell-mouse-map))))
@@ -1014,9 +1021,9 @@ Word syntax described by `ispell-dictionary-alist' (which see).
 This will check or reload the dictionary.  Use \\[ispell-change-dictionary]
 or \\[ispell-region] to update the Ispell process."
   (interactive "e")
-  (if (eq flyspell-emacs 'xemacs)
+  (if flyspell-use-local-map
       (flyspell-correct-word/mouse-keymap event)
-      (flyspell-correct-word/local-keymap event)))
+    (flyspell-correct-word/local-keymap event)))
     
 ;*---------------------------------------------------------------------*/
 ;*    flyspell-correct-word/local-keymap ...                           */