Mercurial > emacs
comparison lisp/textmodes/flyspell.el @ 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 | 764497f1c6a0 |
children | 6236e60302e2 |
comparison
equal
deleted
inserted
replaced
23942:8fa87eee9ae5 | 23943:7555c77bc4f0 |
---|---|
201 'xemacs) | 201 'xemacs) |
202 (t | 202 (t |
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 ;*---------------------------------------------------------------------*/ |
209 (defvar flyspell-mode nil) | 213 (defvar flyspell-mode nil) |
210 (make-variable-buffer-local 'flyspell-mode) | 214 (make-variable-buffer-local 'flyspell-mode) |
214 | 218 |
215 (or (assoc 'flyspell-mode minor-mode-alist) | 219 (or (assoc 'flyspell-mode minor-mode-alist) |
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 |
235 ;; the name of the overlay property that defines the keymap | 242 ;; the name of the overlay property that defines the keymap |
236 (defvar flyspell-overlay-keymap-property-name | 243 (defvar flyspell-overlay-keymap-property-name |
866 for the overlay." | 873 for the overlay." |
867 (let ((flyspell-overlay (make-overlay beg end))) | 874 (let ((flyspell-overlay (make-overlay beg end))) |
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)))) |
875 | 882 |
876 ;*---------------------------------------------------------------------*/ | 883 ;*---------------------------------------------------------------------*/ |
1012 Word syntax described by `ispell-dictionary-alist' (which see). | 1019 Word syntax described by `ispell-dictionary-alist' (which see). |
1013 | 1020 |
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 ... */ |
1023 ;*---------------------------------------------------------------------*/ | 1030 ;*---------------------------------------------------------------------*/ |
1024 (defun flyspell-correct-word/local-keymap (event) | 1031 (defun flyspell-correct-word/local-keymap (event) |