363 |
(let ((map (make-sparse-keymap))) |
(let ((map (make-sparse-keymap))) |
364 |
(cond |
(cond |
365 |
((eq flyspell-emacs 'xemacs) |
((eq flyspell-emacs 'xemacs) |
366 |
(define-key map [(button2)] #'flyspell-correct-word/mouse-keymap) |
(define-key map [(button2)] #'flyspell-correct-word) |
367 |
(define-key map "\M-\t" #'flyspell-auto-correct-word)) |
(define-key map "\M-\t" #'flyspell-auto-correct-word)) |
368 |
(flyspell-use-local-map |
(flyspell-use-local-map |
369 |
(define-key map [(mouse-2)] #'flyspell-correct-word/mouse-keymap) |
(define-key map [(mouse-2)] #'flyspell-correct-word) |
370 |
(define-key map "\M-\t" #'flyspell-auto-correct-word))) |
(define-key map "\M-\t" #'flyspell-auto-correct-word))) |
371 |
map)) |
map)) |
372 |
|
|
1664 |
old-max)))))))))) |
old-max)))))))))) |
1665 |
(setq flyspell-auto-correct-pos (point)) |
(setq flyspell-auto-correct-pos (point)) |
1666 |
(ispell-pdict-save t))))) |
(ispell-pdict-save t))))) |
1667 |
|
|
1668 |
;*---------------------------------------------------------------------*/ |
;*---------------------------------------------------------------------*/ |
1669 |
;* flyspell-correct-word ... */ |
;* flyspell-correct-word ... */ |
1670 |
;*---------------------------------------------------------------------*/ |
;*---------------------------------------------------------------------*/ |
1671 |
(defun flyspell-correct-word (event) |
(defun flyspell-correct-word (event) |
|
"Check spelling of word under or before the cursor. |
|
|
If the word is not found in dictionary, display possible corrections |
|
|
in a popup menu allowing you to choose one. |
|
|
|
|
|
Word syntax described by `ispell-dictionary-alist' (which see). |
|
|
|
|
|
This will check or reload the dictionary. Use \\[ispell-change-dictionary] |
|
|
or \\[ispell-region] to update the Ispell process." |
|
|
(interactive "e") |
|
|
(if (eq flyspell-emacs 'xemacs) |
|
|
(flyspell-correct-word/mouse-keymap event) |
|
|
(flyspell-correct-word/local-keymap event))) |
|
|
|
|
|
;*---------------------------------------------------------------------*/ |
|
|
;* flyspell-correct-word/local-keymap ... */ |
|
|
;*---------------------------------------------------------------------*/ |
|
|
(defun flyspell-correct-word/local-keymap (event) |
|
|
"emacs 19.xx seems to be buggous. Overlay keymap does not seems |
|
|
to work correctly with local map. That is, if a key is not |
|
|
defined for the overlay keymap, the current local map, is not |
|
|
checked. The binding is resolved with the global map. The |
|
|
consequence is that we can not use overlay map with flyspell." |
|
|
(interactive "e") |
|
|
(save-window-excursion |
|
|
(let ((save (point))) |
|
|
(mouse-set-point event) |
|
|
;; we look for a flyspell overlay here |
|
|
(let ((overlays (overlays-at (point))) |
|
|
(overlay nil)) |
|
|
(while (consp overlays) |
|
|
(if (flyspell-overlay-p (car overlays)) |
|
|
(progn |
|
|
(setq overlay (car overlays)) |
|
|
(setq overlays nil)) |
|
|
(setq overlays (cdr overlays)))) |
|
|
;; we return to the correct location |
|
|
(goto-char save) |
|
|
;; we check to see if button2 has been used overlay a |
|
|
;; flyspell overlay |
|
|
(if overlay |
|
|
;; yes, so we use the flyspell function |
|
|
(flyspell-correct-word/mouse-keymap event) |
|
|
;; no so we have to use the non flyspell binding |
|
|
(let ((flyspell-mode nil)) |
|
|
(if (key-binding (this-command-keys)) |
|
|
(command-execute (key-binding (this-command-keys)))))))))) |
|
|
|
|
|
;*---------------------------------------------------------------------*/ |
|
|
;* flyspell-correct-word/mouse-keymap ... */ |
|
|
;*---------------------------------------------------------------------*/ |
|
|
(defun flyspell-correct-word/mouse-keymap (event) |
|
1672 |
"Pop up a menu of possible corrections for a misspelled word. |
"Pop up a menu of possible corrections for a misspelled word. |
1673 |
The word checked is the word at the mouse position." |
The word checked is the word at the mouse position." |
1674 |
(interactive "e") |
(interactive "e") |