comparison lisp/textmodes/flyspell.el @ 40898:a69946fb84de

(flyspell-correct-word/local-keymap): Function deleted. (flyspell-correct-word): Old definition deleted. (flyspell-correct-word/mouse-keymap): Renamed to flyspell-correct-word. All references renamed too.
author Richard M. Stallman <rms@gnu.org>
date Sat, 10 Nov 2001 18:36:26 +0000
parents 0517a2e0f908
children 29830f44be6a
comparison
equal deleted inserted replaced
40897:152bed165d14 40898:a69946fb84de
361 361
362 (defvar flyspell-mouse-map 362 (defvar flyspell-mouse-map
363 (let ((map (make-sparse-keymap))) 363 (let ((map (make-sparse-keymap)))
364 (cond 364 (cond
365 ((eq flyspell-emacs 'xemacs) 365 ((eq flyspell-emacs 'xemacs)
366 (define-key map [(button2)] #'flyspell-correct-word/mouse-keymap) 366 (define-key map [(button2)] #'flyspell-correct-word)
367 (define-key map "\M-\t" #'flyspell-auto-correct-word)) 367 (define-key map "\M-\t" #'flyspell-auto-correct-word))
368 (flyspell-use-local-map 368 (flyspell-use-local-map
369 (define-key map [(mouse-2)] #'flyspell-correct-word/mouse-keymap) 369 (define-key map [(mouse-2)] #'flyspell-correct-word)
370 (define-key map "\M-\t" #'flyspell-auto-correct-word))) 370 (define-key map "\M-\t" #'flyspell-auto-correct-word)))
371 map)) 371 map))
372 372
373 ;; the name of the overlay property that defines the keymap 373 ;; the name of the overlay property that defines the keymap
374 (defvar flyspell-overlay-keymap-property-name 'keymap) 374 (defvar flyspell-overlay-keymap-property-name 'keymap)
1662 (flyspell-ajust-cursor-point pos 1662 (flyspell-ajust-cursor-point pos
1663 (point) 1663 (point)
1664 old-max)))))))))) 1664 old-max))))))))))
1665 (setq flyspell-auto-correct-pos (point)) 1665 (setq flyspell-auto-correct-pos (point))
1666 (ispell-pdict-save t))))) 1666 (ispell-pdict-save t)))))
1667 1667
1668 ;*---------------------------------------------------------------------*/ 1668 ;*---------------------------------------------------------------------*/
1669 ;* flyspell-correct-word ... */ 1669 ;* flyspell-correct-word ... */
1670 ;*---------------------------------------------------------------------*/ 1670 ;*---------------------------------------------------------------------*/
1671 (defun flyspell-correct-word (event) 1671 (defun flyspell-correct-word (event)
1672 "Check spelling of word under or before the cursor.
1673 If the word is not found in dictionary, display possible corrections
1674 in a popup menu allowing you to choose one.
1675
1676 Word syntax described by `ispell-dictionary-alist' (which see).
1677
1678 This will check or reload the dictionary. Use \\[ispell-change-dictionary]
1679 or \\[ispell-region] to update the Ispell process."
1680 (interactive "e")
1681 (if (eq flyspell-emacs 'xemacs)
1682 (flyspell-correct-word/mouse-keymap event)
1683 (flyspell-correct-word/local-keymap event)))
1684
1685 ;*---------------------------------------------------------------------*/
1686 ;* flyspell-correct-word/local-keymap ... */
1687 ;*---------------------------------------------------------------------*/
1688 (defun flyspell-correct-word/local-keymap (event)
1689 "emacs 19.xx seems to be buggous. Overlay keymap does not seems
1690 to work correctly with local map. That is, if a key is not
1691 defined for the overlay keymap, the current local map, is not
1692 checked. The binding is resolved with the global map. The
1693 consequence is that we can not use overlay map with flyspell."
1694 (interactive "e")
1695 (save-window-excursion
1696 (let ((save (point)))
1697 (mouse-set-point event)
1698 ;; we look for a flyspell overlay here
1699 (let ((overlays (overlays-at (point)))
1700 (overlay nil))
1701 (while (consp overlays)
1702 (if (flyspell-overlay-p (car overlays))
1703 (progn
1704 (setq overlay (car overlays))
1705 (setq overlays nil))
1706 (setq overlays (cdr overlays))))
1707 ;; we return to the correct location
1708 (goto-char save)
1709 ;; we check to see if button2 has been used overlay a
1710 ;; flyspell overlay
1711 (if overlay
1712 ;; yes, so we use the flyspell function
1713 (flyspell-correct-word/mouse-keymap event)
1714 ;; no so we have to use the non flyspell binding
1715 (let ((flyspell-mode nil))
1716 (if (key-binding (this-command-keys))
1717 (command-execute (key-binding (this-command-keys))))))))))
1718
1719 ;*---------------------------------------------------------------------*/
1720 ;* flyspell-correct-word/mouse-keymap ... */
1721 ;*---------------------------------------------------------------------*/
1722 (defun flyspell-correct-word/mouse-keymap (event)
1723 "Pop up a menu of possible corrections for a misspelled word. 1672 "Pop up a menu of possible corrections for a misspelled word.
1724 The word checked is the word at the mouse position." 1673 The word checked is the word at the mouse position."
1725 (interactive "e") 1674 (interactive "e")
1726 ;; use the correct dictionary 1675 ;; use the correct dictionary
1727 (flyspell-accept-buffer-local-defs) 1676 (flyspell-accept-buffer-local-defs)