Function: flyspell-correct-word-before-point
flyspell-correct-word-before-point is an interactive and byte-compiled
function defined in flyspell.el.gz.
Signature
(flyspell-correct-word-before-point &optional EVENT OPOINT)
Documentation
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.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/flyspell.el.gz
(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)
;; use the correct dictionary
(flyspell-accept-buffer-local-defs)
(or opoint (setq opoint (point)))
(let ((cursor-location (point))
(word (flyspell-get-word)))
(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"))
(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)))))