changeset 23943:7555c77bc4f0

If local-maps work, don't put 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.
author Richard M. Stallman <rms@gnu.org>
date Sun, 27 Dec 1998 03:15:10 +0000
parents 8fa87eee9ae5
children b5617ede97a8
files lisp/textmodes/flyspell.el
diffstat 1 files changed, 19 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/flyspell.el	Sat Dec 26 05:14:48 1998 +0000
+++ b/lisp/textmodes/flyspell.el	Sun Dec 27 03:15:10 1998 +0000
@@ -203,6 +203,10 @@
     '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 @@
     (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 @@
     (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 @@
 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 ...                           */