Mercurial > emacs
comparison lisp/textmodes/flyspell.el @ 63817:032f69088e2e
(flyspell-use-local-map): Variable deleted.
(flyspell-local-mouse-map): Declaration deleted.
(flyspell-mouse-map): Bind only mouse-2.
(flyspell-mode-map): Don't test flyspell-use-local-map.
(flyspell-overlay-keymap-property-name): Var deleted.
(flyspell-mode-on): Don't make local bindings for
flyspell-mouse-map and flyspell-mode-map.
(make-flyspell-overlay): Unconditionally put on `keymap' text prop.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 28 Jun 2005 19:07:45 +0000 |
parents | c603dad06977 |
children | a8fa7c632ee4 bb71c6cf2009 |
comparison
equal
deleted
inserted
replaced
63816:af4dc212b013 | 63817:032f69088e2e |
---|---|
63 ((string-match "XEmacs" emacs-version) | 63 ((string-match "XEmacs" emacs-version) |
64 'xemacs) | 64 'xemacs) |
65 (t | 65 (t |
66 'emacs)) | 66 'emacs)) |
67 "The type of Emacs we are currently running.") | 67 "The type of Emacs we are currently running.") |
68 | |
69 (defvar flyspell-use-local-map | |
70 (or (eq flyspell-emacs 'xemacs) | |
71 (not (string< emacs-version "20")))) | |
72 | 68 |
73 ;*---------------------------------------------------------------------*/ | 69 ;*---------------------------------------------------------------------*/ |
74 ;* User configuration ... */ | 70 ;* User configuration ... */ |
75 ;*---------------------------------------------------------------------*/ | 71 ;*---------------------------------------------------------------------*/ |
76 (defcustom flyspell-highlight-flag t | 72 (defcustom flyspell-highlight-flag t |
401 (autoload 'previous-overlay-change "overlay" "Overlay compatibility kit." t) | 397 (autoload 'previous-overlay-change "overlay" "Overlay compatibility kit." t) |
402 | 398 |
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 |
437 "*Non-nil means that the `-' char is considered as a word delimiter.") | 421 "*Non-nil means that the `-' char is considered as a word delimiter.") |
438 (make-variable-buffer-local 'flyspell-consider-dash-as-word-delimiter-flag) | 422 (make-variable-buffer-local 'flyspell-consider-dash-as-word-delimiter-flag) |
567 (cons 'flyspell-after-change-function after-change-functions)) | 551 (cons 'flyspell-after-change-function after-change-functions)) |
568 ;; set flyspell-generic-check-word-p based on the major mode | 552 ;; set flyspell-generic-check-word-p based on the major mode |
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 |
591 (interactive-p)) | 559 (interactive-p)) |
592 (let ((binding (where-is-internal 'flyspell-auto-correct-word | 560 (let ((binding (where-is-internal 'flyspell-auto-correct-word |
1568 (overlay-put flyspell-overlay 'face face) | 1536 (overlay-put flyspell-overlay 'face face) |
1569 (overlay-put flyspell-overlay 'mouse-face mouse-face) | 1537 (overlay-put flyspell-overlay 'mouse-face mouse-face) |
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 |
1580 flyspell-before-incorrect-word-string)) | 1545 flyspell-before-incorrect-word-string)) |
1581 (and (stringp flyspell-after-incorrect-word-string) | 1546 (and (stringp flyspell-after-incorrect-word-string) |