emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el,v
Date: Mon, 06 Nov 2006 16:06:12 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       06/11/06 16:06:11

Index: flyspell.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/flyspell.el,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- flyspell.el 3 Nov 2006 15:11:44 -0000       1.110
+++ flyspell.el 6 Nov 2006 16:06:11 -0000       1.111
@@ -412,6 +412,7 @@
     (define-key map flyspell-auto-correct-binding 
'flyspell-auto-correct-previous-word)
     (define-key map [(control ?\,)] 'flyspell-goto-next-error)
     (define-key map [(control ?\.)] 'flyspell-auto-correct-word)
+    (define-key map [(meta ?\^m)] 'flyspell-correct-word-before-point)
     map)
   "Minor mode keymap for Flyspell mode--for the whole buffer.")
 
@@ -1999,15 +2000,25 @@
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-correct-word ...                                        */
 ;;*---------------------------------------------------------------------*/
+
 (defun flyspell-correct-word (event)
   "Pop up a menu of possible corrections for a misspelled word.
 The word checked is the word at the mouse position."
   (interactive "e")
-  ;; use the correct dictionary
-  (flyspell-accept-buffer-local-defs)
-  ;; retain cursor location (I don't know why but save-excursion here fails).
   (let ((save (point)))
     (mouse-set-point event)
+    (flyspell-correct-word-before-point event save)))
+
+(defun flyspell-correct-word-before-point (&optional event opoint)
+  "Pop up a menu of possible corrections for misspelled word before point.
+If EVENT is non-nil, it is the mouse event that invoked this operation;
+that controls where to put the menu.
+If OPOINT is non-nil, restore point there after adjusting it for replacement."
+  (interactive)
+  (unless (mouse-position)
+    (error "Pop-up menus do not work on this terminal"))
+  ;; use the correct dictionary
+  (flyspell-accept-buffer-local-defs)
     (let ((cursor-location (point))
          (word (flyspell-get-word nil)))
       (if (consp word)
@@ -2039,12 +2050,12 @@
              (error "Ispell: error in Ispell process"))
             ((featurep 'xemacs)
              (flyspell-xemacs-popup
-               poss word cursor-location start end save))
+            poss word cursor-location start end opoint))
             (t
              ;; The word is incorrect, we have to propose a replacement.
               (flyspell-do-correct (flyspell-emacs-popup event poss word)
-                                   poss word cursor-location start end save)))
-           (ispell-pdict-save t))))))
+                                poss word cursor-location start end opoint)))
+         (ispell-pdict-save t)))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-do-correct ...                                      */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]