Function: ispell-complete-word
ispell-complete-word is an autoloaded, interactive and byte-compiled
function defined in ispell.el.gz.
Signature
(ispell-complete-word &optional INTERIOR-FRAG)
Documentation
Try to complete the word before or at point.
If optional INTERIOR-FRAG is non-nil, then the word may be a character sequence inside of a word.
Standard ispell choices are then available.
This command uses a word-list file specified
by ispell-alternate-dictionary or by ispell-complete-word-dict;
if none of those name an existing word-list file, this command
signals an error.
Probably introduced at or before Emacs version 19.20.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
;;; Interactive word completion.
;; Forces "previous-word" processing. Do we want to make this selectable?
;;;###autoload
(defun ispell-complete-word (&optional interior-frag)
"Try to complete the word before or at point.
If optional INTERIOR-FRAG is non-nil, then the word may be a character
sequence inside of a word.
Standard ispell choices are then available.
This command uses a word-list file specified
by `ispell-alternate-dictionary' or by `ispell-complete-word-dict';
if none of those name an existing word-list file, this command
signals an error."
(interactive "P")
(let ((case-fold-search-val case-fold-search)
(word (ispell-get-word nil "\\*")) ; force "previous-word" processing.
start end possibilities replacement)
(setq start (car (cdr word))
end (car (cdr (cdr word)))
word (car word)
possibilities
(or (string= word "") ; Will give you every word
(ispell-lookup-words
(concat (and interior-frag "*") word
(and interior-frag "*"))
(or ispell-complete-word-dict
ispell-alternate-dictionary))))
(cond ((eq possibilities t)
(message "No word to complete"))
((null possibilities)
(message "No match for \"%s\"" word))
(t ; There is a modification...
(setq case-fold-search nil) ; Try and respect case of word.
(cond
((string-equal (upcase word) word)
(setq possibilities (mapcar #'upcase possibilities)))
((eq (upcase (aref word 0)) (aref word 0))
(setq possibilities (mapcar (lambda (pos)
(if (eq (aref word 0) (aref pos 0))
pos
(capitalize pos)))
possibilities))))
(setq case-fold-search case-fold-search-val)
(save-window-excursion
(setq replacement
(ispell-command-loop possibilities nil word start end)))
(cond
((equal 0 replacement) ; BUFFER-LOCAL ADDITION
(ispell-add-per-file-word-list word))
(replacement ; REPLACEMENT WORD
(delete-region start end)
(insert (if (atom replacement) replacement (car replacement)))
(unless (atom replacement) ; recheck spelling of replacement.
(ispell-word nil t))))
(if (get-buffer ispell-choices-buffer)
(kill-buffer ispell-choices-buffer))))
(ispell-pdict-save ispell-silently-savep)))