diff options
| author | Richard M. Stallman | 1998-12-27 03:15:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-12-27 03:15:10 +0000 |
| commit | dd0ffc284b9cc0ca92ae50fb40840478d413640b (patch) | |
| tree | 5e8f0b55c7e3979dd805bec9c86f94b0c70ea127 /lisp/textmodes | |
| parent | 4db2a7dec96c66205dabe625f3e940781cdb5b44 (diff) | |
| download | emacs-dd0ffc284b9cc0ca92ae50fb40840478d413640b.tar.gz emacs-dd0ffc284b9cc0ca92ae50fb40840478d413640b.zip | |
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.
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/flyspell.el | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index ab6319d698e..56521877c7c 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -203,6 +203,10 @@ property of the major mode name.") | |||
| 203 | 'emacs)) | 203 | 'emacs)) |
| 204 | "The type of Emacs we are currently running.") | 204 | "The type of Emacs we are currently running.") |
| 205 | 205 | ||
| 206 | (defvar flyspell-use-local-map | ||
| 207 | (or (eq flyspell-emacs 'xemacs) | ||
| 208 | (not (string< emacs-version "20")))) | ||
| 209 | |||
| 206 | ;*---------------------------------------------------------------------*/ | 210 | ;*---------------------------------------------------------------------*/ |
| 207 | ;* The minor mode declaration. */ | 211 | ;* The minor mode declaration. */ |
| 208 | ;*---------------------------------------------------------------------*/ | 212 | ;*---------------------------------------------------------------------*/ |
| @@ -216,19 +220,22 @@ property of the major mode name.") | |||
| 216 | (setq minor-mode-alist | 220 | (setq minor-mode-alist |
| 217 | (cons '(flyspell-mode " Fly") minor-mode-alist))) | 221 | (cons '(flyspell-mode " Fly") minor-mode-alist))) |
| 218 | 222 | ||
| 219 | (or (assoc 'flyspell-mode minor-mode-map-alist) | 223 | ;; mouse or local-map bindings |
| 220 | (setq minor-mode-map-alist | ||
| 221 | (cons (cons 'flyspell-mode flyspell-mode-map) | ||
| 222 | minor-mode-map-alist))) | ||
| 223 | |||
| 224 | (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word) | ||
| 225 | |||
| 226 | ;; mouse bindings | ||
| 227 | (cond | 224 | (cond |
| 228 | ((eq flyspell-emacs 'xemacs) | 225 | ((eq flyspell-emacs 'xemacs) |
| 229 | (define-key flyspell-mouse-map [(button2)] | 226 | (define-key flyspell-mouse-map [(button2)] |
| 230 | (function flyspell-correct-word/mouse-keymap))) | 227 | (function flyspell-correct-word/mouse-keymap)) |
| 228 | (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word)) | ||
| 229 | (flyspell-use-local-map | ||
| 230 | (define-key flyspell-mouse-map [(mouse-2)] | ||
| 231 | (function flyspell-correct-word/mouse-keymap)) | ||
| 232 | (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word)) | ||
| 231 | (t | 233 | (t |
| 234 | (or (assoc 'flyspell-mode minor-mode-map-alist) | ||
| 235 | (setq minor-mode-map-alist | ||
| 236 | (cons (cons 'flyspell-mode flyspell-mode-map) | ||
| 237 | minor-mode-map-alist))) | ||
| 238 | (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word) | ||
| 232 | (define-key flyspell-mode-map [(mouse-2)] | 239 | (define-key flyspell-mode-map [(mouse-2)] |
| 233 | (function flyspell-correct-word/local-keymap)))) | 240 | (function flyspell-correct-word/local-keymap)))) |
| 234 | 241 | ||
| @@ -868,7 +875,7 @@ for the overlay." | |||
| 868 | (overlay-put flyspell-overlay 'face face) | 875 | (overlay-put flyspell-overlay 'face face) |
| 869 | (overlay-put flyspell-overlay 'mouse-face mouse-face) | 876 | (overlay-put flyspell-overlay 'mouse-face mouse-face) |
| 870 | (overlay-put flyspell-overlay 'flyspell-overlay t) | 877 | (overlay-put flyspell-overlay 'flyspell-overlay t) |
| 871 | (if (eq flyspell-emacs 'xemacs) | 878 | (if flyspell-use-local-map |
| 872 | (overlay-put flyspell-overlay | 879 | (overlay-put flyspell-overlay |
| 873 | flyspell-overlay-keymap-property-name | 880 | flyspell-overlay-keymap-property-name |
| 874 | flyspell-mouse-map)))) | 881 | flyspell-mouse-map)))) |
| @@ -1014,9 +1021,9 @@ Word syntax described by `ispell-dictionary-alist' (which see). | |||
| 1014 | This will check or reload the dictionary. Use \\[ispell-change-dictionary] | 1021 | This will check or reload the dictionary. Use \\[ispell-change-dictionary] |
| 1015 | or \\[ispell-region] to update the Ispell process." | 1022 | or \\[ispell-region] to update the Ispell process." |
| 1016 | (interactive "e") | 1023 | (interactive "e") |
| 1017 | (if (eq flyspell-emacs 'xemacs) | 1024 | (if flyspell-use-local-map |
| 1018 | (flyspell-correct-word/mouse-keymap event) | 1025 | (flyspell-correct-word/mouse-keymap event) |
| 1019 | (flyspell-correct-word/local-keymap event))) | 1026 | (flyspell-correct-word/local-keymap event))) |
| 1020 | 1027 | ||
| 1021 | ;*---------------------------------------------------------------------*/ | 1028 | ;*---------------------------------------------------------------------*/ |
| 1022 | ;* flyspell-correct-word/local-keymap ... */ | 1029 | ;* flyspell-correct-word/local-keymap ... */ |