aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes/flyspell.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes/flyspell.el')
-rw-r--r--lisp/textmodes/flyspell.el51
1 files changed, 8 insertions, 43 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 8c2d0937a5a..fc74fc67041 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -66,10 +66,6 @@
66 'emacs)) 66 'emacs))
67 "The type of Emacs we are currently running.") 67 "The type of Emacs we are currently running.")
68 68
69(defvar flyspell-use-local-map
70 (or (eq flyspell-emacs 'xemacs)
71 (not (string< emacs-version "20"))))
72
73;*---------------------------------------------------------------------*/ 69;*---------------------------------------------------------------------*/
74;* User configuration ... */ 70;* User configuration ... */
75;*---------------------------------------------------------------------*/ 71;*---------------------------------------------------------------------*/
@@ -403,34 +399,22 @@ property of the major mode name.")
403;*---------------------------------------------------------------------*/ 399;*---------------------------------------------------------------------*/
404;* The minor mode declaration. */ 400;* The minor mode declaration. */
405;*---------------------------------------------------------------------*/ 401;*---------------------------------------------------------------------*/
406(eval-when-compile (defvar flyspell-local-mouse-map))
407
408(defvar flyspell-mouse-map 402(defvar flyspell-mouse-map
409 (let ((map (make-sparse-keymap))) 403 (let ((map (make-sparse-keymap)))
410 (if flyspell-use-meta-tab
411 (define-key map "\M-\t" #'flyspell-auto-correct-word))
412 (define-key map (if (featurep 'xemacs) [button2] [down-mouse-2]) 404 (define-key map (if (featurep 'xemacs) [button2] [down-mouse-2])
413 #'flyspell-correct-word) 405 #'flyspell-correct-word)
414 (define-key map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word) 406 map)
415 (define-key map [(control \,)] 'flyspell-goto-next-error) 407 "Keymap for Flyspell to put on erroneous words.")
416 (define-key map [(control \.)] 'flyspell-auto-correct-word)
417 map))
418 408
419(defvar flyspell-mode-map 409(defvar flyspell-mode-map
420 (let ((map (make-sparse-keymap))) 410 (let ((map (make-sparse-keymap)))
421 ;; mouse, keyboard bindings and misc definition
422 (if flyspell-use-meta-tab 411 (if flyspell-use-meta-tab
423 (define-key map "\M-\t" 'flyspell-auto-correct-word)) 412 (define-key map "\M-\t" 'flyspell-auto-correct-word))
424 (cond 413 (define-key map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word)
425 ;; I don't understand this test, so I left it as is. --Stef 414 (define-key map [(control ?\,)] 'flyspell-goto-next-error)
426 ((or (featurep 'xemacs) flyspell-use-local-map) 415 (define-key map [(control ?\.)] 'flyspell-auto-correct-word)
427 (define-key map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word) 416 map)
428 (define-key map [(control ?\,)] 'flyspell-goto-next-error) 417 "Minor mode keymap for Flyspell mode--for the whole buffer.")
429 (define-key map [(control ?\.)] 'flyspell-auto-correct-word)))
430 map))
431
432;; the name of the overlay property that defines the keymap
433(defvar flyspell-overlay-keymap-property-name 'keymap)
434 418
435;; dash character machinery 419;; dash character machinery
436(defvar flyspell-consider-dash-as-word-delimiter-flag nil 420(defvar flyspell-consider-dash-as-word-delimiter-flag nil
@@ -569,22 +553,6 @@ in your .emacs file.
569 (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) 553 (let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
570 (if mode-predicate 554 (if mode-predicate
571 (setq flyspell-generic-check-word-p mode-predicate))) 555 (setq flyspell-generic-check-word-p mode-predicate)))
572 ;; work around the fact that the `local-map' text-property replaces the
573 ;; buffer's local map rather than shadowing it.
574 (set (make-local-variable 'flyspell-mouse-map)
575 (let ((map (copy-keymap flyspell-mouse-map)))
576 (set-keymap-parent map (current-local-map))
577 (if (and (eq flyspell-emacs 'emacs)
578 (not (string< emacs-version "20")))
579 (define-key map '[tool-bar] nil))
580 map))
581 (set (make-local-variable 'flyspell-mode-map)
582 (let ((map (copy-keymap flyspell-mode-map)))
583 (set-keymap-parent map (current-local-map))
584 (if (and (eq flyspell-emacs 'emacs)
585 (not (string< emacs-version "20")))
586 (define-key map '[tool-bar] nil))
587 map))
588 ;; the welcome message 556 ;; the welcome message
589 (if (and flyspell-issue-message-flag 557 (if (and flyspell-issue-message-flag
590 flyspell-issue-welcome-flag 558 flyspell-issue-welcome-flag
@@ -1570,10 +1538,7 @@ for the overlay."
1570 (overlay-put flyspell-overlay 'flyspell-overlay t) 1538 (overlay-put flyspell-overlay 'flyspell-overlay t)
1571 (overlay-put flyspell-overlay 'evaporate t) 1539 (overlay-put flyspell-overlay 'evaporate t)
1572 (overlay-put flyspell-overlay 'help-echo "mouse-2: correct word at point") 1540 (overlay-put flyspell-overlay 'help-echo "mouse-2: correct word at point")
1573 (if flyspell-use-local-map 1541 (overlay-put flyspell-overlay 'keymap flyspell-mouse-map)
1574 (overlay-put flyspell-overlay
1575 flyspell-overlay-keymap-property-name
1576 flyspell-mouse-map))
1577 (when (eq face 'flyspell-incorrect) 1542 (when (eq face 'flyspell-incorrect)
1578 (and (stringp flyspell-before-incorrect-word-string) 1543 (and (stringp flyspell-before-incorrect-word-string)
1579 (overlay-put flyspell-overlay 'before-string 1544 (overlay-put flyspell-overlay 'before-string