# HG changeset patch # User Richard M. Stallman # Date 1005355222 0 # Node ID 0517a2e0f908bd1b6ecd67f8666a185e651ac9c5 # Parent bb2506ee2e9e1212bb191cc25aee8f53974a3018 Use the keymap property instead of local-map, and don't use a minor-mode map. (flyspell-mode-map): Variable deleted. Don't mess with minor-mode-map-alist. (calling add-minor-mode): Specify nil for keymap. And always use add-minor-mode, now that it exists. (flyspell-overlay-keymap-property-name): Set it to `keymap'. (flyspell-mode-on): Don't locally bind flyspell-mouse-map or flyspell-local-mouse-map. (make-flyspell-overlay): Use flyspell-mouse-map directly. (flyspell-mode): Doc fix. (flyspell-mode-on): Don't call make-local-hook. diff -r bb2506ee2e9e -r 0517a2e0f908 lisp/textmodes/flyspell.el --- a/lisp/textmodes/flyspell.el Sat Nov 10 01:20:05 2001 +0000 +++ b/lisp/textmodes/flyspell.el Sat Nov 10 01:20:22 2001 +0000 @@ -370,24 +370,8 @@ (define-key map "\M-\t" #'flyspell-auto-correct-word))) map)) -;;;###autoload -(defvar flyspell-mode-map (make-sparse-keymap)) - -;; mouse, keyboard bindings and misc definition -(when (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))) - - ;; the name of the overlay property that defines the keymap -(defvar flyspell-overlay-keymap-property-name - (if (string-match "19.*XEmacs" emacs-version) - 'keymap - 'local-map)) +(defvar flyspell-overlay-keymap-property-name 'keymap) ;; dash character machinery (defvar flyspell-consider-dash-as-word-delimiter-flag nil @@ -433,7 +417,7 @@ \\[flyspell-correct-word] (or mouse-2): popup correct words. Hooks: -flyspell-mode-hook is run after flyspell is entered. +This runs `flyspell-mode-hook' after flyspell is entered. Remark: `flyspell-mode' uses `ispell-mode'. Thus all Ispell options are @@ -445,9 +429,8 @@ \(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex)))) in your .emacs file. -flyspell-region checks all words inside a region. - -flyspell-buffer checks the whole buffer." +\\[flyspell-region] checks all words inside a region. +\\[flyspell-buffer] checks the whole buffer." (interactive "P") (let ((old-flyspell-mode flyspell-mode)) ;; Mark the mode as on or off. @@ -465,21 +448,11 @@ ;* Autoloading */ ;*---------------------------------------------------------------------*/ ;;;###autoload -(if (fboundp 'add-minor-mode) - (add-minor-mode 'flyspell-mode - 'flyspell-mode-line-string - flyspell-mode-map - nil - 'flyspell-mode) - (or (assoc 'flyspell-mode minor-mode-alist) - (setq minor-mode-alist - (cons '(flyspell-mode flyspell-mode-line-string) - 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)))) +(add-minor-mode 'flyspell-mode + 'flyspell-mode-line-string + nil + nil + 'flyspell-mode) ;*---------------------------------------------------------------------*/ ;* flyspell-buffers ... */ @@ -532,10 +505,8 @@ ;; we put the `flyspel-deplacement' property on some commands (flyspell-deplacement-commands) ;; we bound flyspell action to post-command hook - (make-local-hook 'post-command-hook) (add-hook 'post-command-hook (function flyspell-post-command-hook) t t) ;; we bound flyspell action to pre-command hook - (make-local-hook 'pre-command-hook) (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t) ;; we bound flyspell action to after-change hook (make-local-variable 'after-change-functions) @@ -545,12 +516,6 @@ (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) (if mode-predicate (setq flyspell-generic-check-word-p mode-predicate))) - ;; work around the fact that the `local-map' text-property replaces the - ;; buffer's local map rather than shadowing it. - (set (make-local-variable 'flyspell-mouse-map) - (let ((map (copy-keymap flyspell-mouse-map))) - (set-keymap-parent map (current-local-map)) - map)) ;; the welcome message (if (and flyspell-issue-welcome-flag (interactive-p)) (let ((binding (where-is-internal 'flyspell-auto-correct-word @@ -560,16 +525,6 @@ (format "Welcome to flyspell. Use %s or Mouse-2 to correct words." (key-description binding)) "Welcome to flyspell. Use Mouse-2 to correct words.")))) - - ;; Use this so that we can still get major mode bindings at a - ;; misspelled word (unless they're overridden by - ;; `flyspell-mouse-map'). - (set (make-local-variable 'flyspell-local-mouse-map) - (let ((map (copy-keymap flyspell-mouse-map))) - (if (eq flyspell-emacs 'xemacs) - (set-keymap-parents (list (current-local-map))) - (set-keymap-parent map (current-local-map))) - map)) ;; we end with the flyspell hooks (run-hooks 'flyspell-mode-hook)) @@ -1357,13 +1312,6 @@ (defun flyspell-region (beg end) "Flyspell text between BEG and END." (interactive "r") - (unless (boundp 'flyspell-local-mouse-map) - (set (make-local-variable 'flyspell-local-mouse-map) - (let ((map (copy-keymap flyspell-mouse-map))) - (if (eq flyspell-emacs 'xemacs) - (set-keymap-parents (list (current-local-map))) - (set-keymap-parent map (current-local-map))) - map))) (if (= beg end) () (save-excursion @@ -1495,7 +1443,7 @@ (if flyspell-use-local-map (overlay-put flyspell-overlay flyspell-overlay-keymap-property-name - flyspell-local-mouse-map)) + flyspell-mouse-map)) flyspell-overlay)) ;*---------------------------------------------------------------------*/