diff options
| author | Dave Love | 2000-02-20 19:03:33 +0000 |
|---|---|---|
| committer | Dave Love | 2000-02-20 19:03:33 +0000 |
| commit | 2be80b63e783039ddf68ec968ec7fab760a90b7c (patch) | |
| tree | bee20e86edc1ea5ba6b2f245de1dffdb4e49739b | |
| parent | 2505742bda6f24068d16e7cf02329e15049fd2ea (diff) | |
| download | emacs-2be80b63e783039ddf68ec968ec7fab760a90b7c.tar.gz emacs-2be80b63e783039ddf68ec968ec7fab760a90b7c.zip | |
(flyspell-mouse-map): Change definition
and assignments to it.
(flyspell-mode-on): Define flyspell-local-mouse-map, inheriting
current local map.
(make-flyspell-overlay): Use it.
(flyspell-correct-word/mouse-keymap): Change XEmacs test.
| -rw-r--r-- | lisp/ChangeLog | 18 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 59 |
2 files changed, 53 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ee7bef78505..f644d8f1569 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2000-02-20 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * textmodes/flyspell.el (flyspell-mouse-map): Change definition | ||
| 4 | and assignments to it. | ||
| 5 | (flyspell-mode-on): Define flyspell-local-mouse-map, inheriting | ||
| 6 | current local map. | ||
| 7 | (make-flyspell-overlay): Use it. | ||
| 8 | (flyspell-correct-word/mouse-keymap): Change XEmacs test. | ||
| 9 | |||
| 10 | * emacs-lisp/lisp-mnt.el: Don't require emacsbug at top level. | ||
| 11 | (lm-get-header-re): Defun, not defsubst. | ||
| 12 | (lm-get-package-name): Defun, not defsubst. Simplify. | ||
| 13 | (lm-version): Doc fix. Simplify. | ||
| 14 | (lm-header, lm-header-multiline, lm-header-multiline, lm-summary) | ||
| 15 | (lm-crack-address, lm-last-modified-date, lm-commentary) | ||
| 16 | (lm-verify, lm-synopsis): Simplify. | ||
| 17 | (lm-report-bug): Require emacsbug. Use compose-mail. | ||
| 18 | |||
| 1 | 2000-02-20 Gerd Moellmann <gerd@gnu.org> | 19 | 2000-02-20 Gerd Moellmann <gerd@gnu.org> |
| 2 | 20 | ||
| 3 | * dired.el (dired-mode): Call propertized-buffer-identification | 21 | * dired.el (dired-mode): Call propertized-buffer-identification |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 4e546e1ab91..2f3251f6d0d 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; flyspell.el --- On-the-fly spell checker | 1 | ;;; flyspell.el --- On-the-fly spell checker |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 2000 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Manuel Serrano <Manuel.Serrano@unice.fr> | 5 | ;; Author: Manuel Serrano <Manuel.Serrano@unice.fr> |
| 6 | ;; Keywords: convenience | 6 | ;; Keywords: convenience |
| @@ -213,31 +213,31 @@ property of the major mode name.") | |||
| 213 | (defvar flyspell-mode nil) | 213 | (defvar flyspell-mode nil) |
| 214 | (make-variable-buffer-local 'flyspell-mode) | 214 | (make-variable-buffer-local 'flyspell-mode) |
| 215 | 215 | ||
| 216 | (defvar flyspell-mouse-map | ||
| 217 | (let ((map (make-sparse-keymap))) | ||
| 218 | (cond | ||
| 219 | ((eq flyspell-emacs 'xemacs) | ||
| 220 | (define-key map [(button2)] | ||
| 221 | #'flyspell-correct-word/mouse-keymap) | ||
| 222 | (define-key flyspell-mouse-map "\M-\t" #'flyspell-auto-correct-word)) | ||
| 223 | (flyspell-use-local-map | ||
| 224 | (define-key map [(mouse-2)] #'flyspell-correct-word/mouse-keymap) | ||
| 225 | (define-key map "\M-\t" #'flyspell-auto-correct-word))) | ||
| 226 | map)) | ||
| 216 | (defvar flyspell-mode-map (make-sparse-keymap)) | 227 | (defvar flyspell-mode-map (make-sparse-keymap)) |
| 217 | (defvar flyspell-mouse-map (make-sparse-keymap)) | ||
| 218 | 228 | ||
| 219 | (or (assoc 'flyspell-mode minor-mode-alist) | 229 | (or (assoc 'flyspell-mode minor-mode-alist) |
| 220 | (setq minor-mode-alist | 230 | (setq minor-mode-alist |
| 221 | (cons '(flyspell-mode " Fly") minor-mode-alist))) | 231 | (cons '(flyspell-mode " Fly") minor-mode-alist))) |
| 222 | 232 | ||
| 223 | ;; mouse or local-map bindings | 233 | ;; mouse or local-map bindings |
| 224 | (cond | 234 | (when (or (assoc 'flyspell-mode minor-mode-map-alist) |
| 225 | ((eq flyspell-emacs 'xemacs) | 235 | (setq minor-mode-map-alist |
| 226 | (define-key flyspell-mouse-map [(button2)] | 236 | (cons (cons 'flyspell-mode flyspell-mode-map) |
| 227 | (function flyspell-correct-word/mouse-keymap)) | 237 | minor-mode-map-alist))) |
| 228 | (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word)) | 238 | (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word) |
| 229 | (flyspell-use-local-map | 239 | (define-key flyspell-mode-map [(mouse-2)] |
| 230 | (define-key flyspell-mouse-map [(mouse-2)] | 240 | (function flyspell-correct-word/local-keymap))) |
| 231 | (function flyspell-correct-word/mouse-keymap)) | ||
| 232 | (define-key flyspell-mouse-map "\M-\t" 'flyspell-auto-correct-word)) | ||
| 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) | ||
| 239 | (define-key flyspell-mode-map [(mouse-2)] | ||
| 240 | (function flyspell-correct-word/local-keymap)))) | ||
| 241 | 241 | ||
| 242 | ;; the name of the overlay property that defines the keymap | 242 | ;; the name of the overlay property that defines the keymap |
| 243 | (defvar flyspell-overlay-keymap-property-name | 243 | (defvar flyspell-overlay-keymap-property-name |
| @@ -311,6 +311,8 @@ flyspell-buffer checks the whole buffer." | |||
| 311 | ;*---------------------------------------------------------------------*/ | 311 | ;*---------------------------------------------------------------------*/ |
| 312 | ;* flyspell-mode-on ... */ | 312 | ;* flyspell-mode-on ... */ |
| 313 | ;*---------------------------------------------------------------------*/ | 313 | ;*---------------------------------------------------------------------*/ |
| 314 | (eval-when-compile (defvar flyspell-local-mouse-map)) | ||
| 315 | |||
| 314 | (defun flyspell-mode-on () | 316 | (defun flyspell-mode-on () |
| 315 | "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead." | 317 | "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead." |
| 316 | (setq ispell-highlight-face 'flyspell-incorrect-face) | 318 | (setq ispell-highlight-face 'flyspell-incorrect-face) |
| @@ -356,11 +358,20 @@ flyspell-buffer checks the whole buffer." | |||
| 356 | ;; (thanks to Jeff Miller and Roland Rosenfeld who sent me this | 358 | ;; (thanks to Jeff Miller and Roland Rosenfeld who sent me this |
| 357 | ;; improvement). | 359 | ;; improvement). |
| 358 | (add-hook 'kill-buffer-hook | 360 | (add-hook 'kill-buffer-hook |
| 359 | '(lambda () | 361 | (lambda () |
| 360 | (if (and flyspell-multi-language-p ispell-process) | 362 | (if (and flyspell-multi-language-p ispell-process) |
| 361 | (ispell-kill-ispell t)))) | 363 | (ispell-kill-ispell t)))) |
| 362 | (make-local-hook 'change-major-mode-hook) | 364 | (make-local-hook 'change-major-mode-hook) |
| 363 | (add-hook 'change-major-mode-hook 'flyspell-mode-off) | 365 | (add-hook 'change-major-mode-hook 'flyspell-mode-off) |
| 366 | ;; Use this so that we can still get major mode bindings at a | ||
| 367 | ;; misspelled word (unless they're overridden by | ||
| 368 | ;; `flyspell-mouse-map'). | ||
| 369 | (set (make-local-variable 'flyspell-local-mouse-map) | ||
| 370 | (let ((map (copy-keymap flyspell-mouse-map))) | ||
| 371 | (if (eq flyspell-emacs 'xemacs) | ||
| 372 | (set-keymap-parents (list (current-local-map))) | ||
| 373 | (set-keymap-parent map (current-local-map))) | ||
| 374 | map)) | ||
| 364 | ;; we end with the flyspell hooks | 375 | ;; we end with the flyspell hooks |
| 365 | (run-hooks 'flyspell-mode-hook)) | 376 | (run-hooks 'flyspell-mode-hook)) |
| 366 | 377 | ||
| @@ -884,7 +895,7 @@ for the overlay." | |||
| 884 | (if flyspell-use-local-map | 895 | (if flyspell-use-local-map |
| 885 | (overlay-put flyspell-overlay | 896 | (overlay-put flyspell-overlay |
| 886 | flyspell-overlay-keymap-property-name | 897 | flyspell-overlay-keymap-property-name |
| 887 | flyspell-mouse-map)))) | 898 | flyspell-local-mouse-map)))) |
| 888 | 899 | ||
| 889 | ;*---------------------------------------------------------------------*/ | 900 | ;*---------------------------------------------------------------------*/ |
| 890 | ;* flyspell-highlight-incorrect-region ... */ | 901 | ;* flyspell-highlight-incorrect-region ... */ |
| @@ -1125,7 +1136,7 @@ The word checked is the word at the mouse position." | |||
| 1125 | (progn | 1136 | (progn |
| 1126 | (delete-region start end) | 1137 | (delete-region start end) |
| 1127 | (insert word)))))) | 1138 | (insert word)))))) |
| 1128 | ((string-match "XEmacs" (emacs-version)) | 1139 | ((eq flyspell-emacs 'xemacs) |
| 1129 | (flyspell-xemacs-popup | 1140 | (flyspell-xemacs-popup |
| 1130 | event poss word cursor-location start end))) | 1141 | event poss word cursor-location start end))) |
| 1131 | (ispell-pdict-save t)) | 1142 | (ispell-pdict-save t)) |