Function: flyspell-do-correct
flyspell-do-correct is a byte-compiled function defined in
flyspell.el.gz.
Signature
(flyspell-do-correct REPLACE POSS WORD CURSOR-LOCATION START END SAVE)
Documentation
The popup menu callback.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/flyspell.el.gz
;;*---------------------------------------------------------------------*/
;;* flyspell-do-correct ... */
;;*---------------------------------------------------------------------*/
(defun flyspell-do-correct (replace poss word cursor-location start end save)
"The popup menu callback."
(cond ((eq replace 'ignore)
(goto-char save)
nil)
((eq replace 'save)
(goto-char save)
(ispell-send-string (concat "*" word "\n"))
(ispell-send-string "#\n")
(flyspell-unhighlight-at cursor-location)
(setq ispell-pdict-modified-p '(t)))
((or (eq replace 'buffer) (eq replace 'session))
(ispell-send-string (concat "@" word "\n"))
(add-to-list 'ispell-buffer-session-localwords word)
(or ispell-buffer-local-name ; session localwords might conflict
(setq ispell-buffer-local-name (buffer-name)))
(flyspell-unhighlight-at cursor-location)
(if (null ispell-pdict-modified-p)
(setq ispell-pdict-modified-p
(list ispell-pdict-modified-p)))
(goto-char save)
(if (eq replace 'buffer)
(ispell-add-per-file-word-list word)))
(replace
(flyspell-unhighlight-at cursor-location)
(let ((old-max (point-max))
(new-word (if (atom replace)
replace
(car replace)))
(cursor-location (+ (- (length word) (- end start))
cursor-location)))
(unless (equal new-word (car poss))
(delete-region start end)
(goto-char start)
(funcall flyspell-insert-function new-word)
(if flyspell-abbrev-p
(flyspell-define-abbrev word new-word)))
(flyspell-adjust-cursor-point save cursor-location old-max)))
(t
(goto-char save)
nil)))