emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: flyspell-correct-word does not work without windows system


From: Richard Stallman
Subject: Re: flyspell-correct-word does not work without windows system
Date: Mon, 16 Oct 2006 09:50:42 -0400

Does this change work properly?

*** flyspell.el 17 Sep 2006 11:31:26 -0400      1.106
--- flyspell.el 16 Oct 2006 07:55:17 -0400      
***************
*** 412,417 ****
--- 412,418 ----
      (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.")
  
***************
*** 1992,2043 ****
  ;;*---------------------------------------------------------------------*/
  ;;*    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)
!     (let ((cursor-location (point))
!         (word (flyspell-get-word nil)))
!       (if (consp word)
!         (let ((start (car (cdr word)))
!               (end (car (cdr (cdr word))))
!               (word (car word))
!               poss ispell-filter)
!           ;; now check spelling of word.
!           (ispell-send-string "%\n") ;put in verbose mode
!           (ispell-send-string (concat "^" word "\n"))
!           ;; wait until ispell has processed word
!             (while (progn
!                      (accept-process-output ispell-process)
!                      (not (string= "" (car ispell-filter)))))
!           ;; Remove leading empty element
!           (setq ispell-filter (cdr ispell-filter))
!           ;; ispell process should return something after word is sent.
!           ;; Tag word as valid (i.e., skip) otherwise
!           (or ispell-filter
!               (setq ispell-filter '(*)))
!           (if (consp ispell-filter)
!               (setq poss (ispell-parse-output (car ispell-filter))))
!           (cond
!            ((or (eq poss t) (stringp poss))
!             ;; don't correct word
!             t)
!            ((null poss)
!             ;; ispell error
!             (error "Ispell: error in Ispell process"))
!            ((featurep 'xemacs)
!             (flyspell-xemacs-popup
!                poss word cursor-location start end save))
!            (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))))))
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-do-correct ...                                      */
--- 1993,2051 ----
  ;;*---------------------------------------------------------------------*/
  ;;*    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")
    (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."
!   ;; use the correct dictionary
!   (flyspell-accept-buffer-local-defs)
!   (let ((cursor-location (point))
!       (word (flyspell-get-word nil)))
!     (if (consp word)
!       (let ((start (car (cdr word)))
!             (end (car (cdr (cdr word))))
!             (word (car word))
!             poss ispell-filter)
!         ;; now check spelling of word.
!         (ispell-send-string "%\n")    ;put in verbose mode
!         (ispell-send-string (concat "^" word "\n"))
!         ;; wait until ispell has processed word
!         (while (progn
!                  (accept-process-output ispell-process)
!                  (not (string= "" (car ispell-filter)))))
!         ;; Remove leading empty element
!         (setq ispell-filter (cdr ispell-filter))
!         ;; ispell process should return something after word is sent.
!         ;; Tag word as valid (i.e., skip) otherwise
!         (or ispell-filter
!             (setq ispell-filter '(*)))
!         (if (consp ispell-filter)
!             (setq poss (ispell-parse-output (car ispell-filter))))
!         (cond
!          ((or (eq poss t) (stringp poss))
!           ;; don't correct word
!           t)
!          ((null poss)
!           ;; ispell error
!           (error "Ispell: error in Ispell process"))
!          ((featurep 'xemacs)
!           (flyspell-xemacs-popup
!            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 opoint)))
!         (ispell-pdict-save t)))))
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-do-correct ...                                      */




reply via email to

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