Commit 007852e0 authored by Richard M. Stallman's avatar Richard M. Stallman

Initial revision

parent 2bd866cd
;;;;;;;;;;;;;;;;;;;;;;;;;;; -*- Mode: emacs-lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GNU EMACS interface for International Ispell Version 3.1 by Geoff Kuenning.
;;; Copyright (C) 1994 Free Software Foundation, Inc.
;;; Authors : Ken Stevens et. al.
;;; Last Modified By: Ken Stevens <>
;;; Last Modified On: Tue Feb 15 16:11:14 MST 1994
;;; Update Revision : 2.26
;;; Syntax : emacs-lisp
;;; Status : Release with 3.1.03 ispell.
;;; Version : International Ispell Version 3.1 by Geoff Kuenning.
;;; This file is part of GNU Emacs.
;;; GNU Emacs is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; GNU Emacs is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Emacs; see the file COPYING. If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;;; This code contains a section of user-settable variables that you should
;;; inspect prior to installation. Look past the end of the history list.
;;; Set them up for your locale and the preferences of the majority of the
;;; users. Otherwise the users may need to set a number of variables
;;; themselves.
;;; You particularly may want to change the default dictionary for your
;;; country and language.
;;; To fully install this, add this file to your GNU lisp directory and
;;; compile it with M-X byte-compile-file. Then add the following to the
;;; appropriate init file:
;;; (autoload 'ispell-word "ispell"
;;; "Check the spelling of word in buffer." t)
;;; (global-set-key "\e$" 'ispell-word)
;;; (autoload 'ispell-region "ispell"
;;; "Check the spelling of region." t)
;;; (autoload 'ispell-buffer "ispell"
;;; "Check the spelling of buffer." t)
;;; (autoload 'ispell-complete-word "ispell"
;;; "Look up current word in dictionary and try to complete it." t)
;;; (autoload 'ispell-change-dictionary "ispell"
;;; "Change ispell dictionary." t)
;;; (autoload 'ispell-message "ispell"
;;; "Check spelling of mail message or news post.")
;;; Depending on the mail system you use, you may want to include these:
;;; (add-hook 'news-inews-hook 'ispell-message)
;;; (add-hook 'mail-send-hook 'ispell-message)
;;; (add-hook 'mh-before-send-letter-hook 'ispell-message)
;;; Ispell has a TeX parser and a nroff parser (the default).
;;; The parsing is controlled by the variable ispell-parser. Currently
;;; it is just a "toggle" between TeX and nroff, but if more parsers are
;;; added it will be updated. See the variable description for more info.
;;; ispell-word
;;; ispell-region
;;; ispell-buffer
;;; ispell-message
;;; ispell-continue
;;; ispell-complete-word
;;; ispell-complete-word-interior-frag
;;; ispell-change-dictionary
;;; ispell-kill-ispell
;;; ispell-pdict-save
;;; Commands in ispell-region:
;;; Character replacement: Replace word with choice. May query-replace.
;;; ' ': Accept word this time.
;;; 'i': Accept word and insert into private dictionary.
;;; 'a': Accept word for this session.
;;; 'A': Accept word and place in buffer-local dictionary.
;;; 'r': Replace word with typed-in value. Rechecked.
;;; 'R': Replace word with typed-in value. Query-replaced in buffer. Rechecked.
;;; '?': Show these commands
;;; 'x': Exit spelling buffer. Move cursor to original point.
;;; 'X': Exit spelling buffer. Leave cursor at the current point.
;;; 'q': Quit spelling session (Kills ispell process).
;;; 'l': Look up typed-in replacement in alternate dictionary. Wildcards okay.
;;; 'u': Like 'i', but the word is lower-cased first.
;;; 'm': Like 'i', but allows one to include dictionary completion info.
;;; 'C-l': redraws screen
;;; 'C-r': recursive edit
;;; 'C-z': suspend emacs
;;; Buffer-Local features:
;;; There are a number of buffer-local features that can be used to customize
;;; ispell for the current buffer. This includes language dictionaries,
;;; personal dictionaries, parsing, and local word spellings. Each of these
;;; local customizations are done either through local variables, or by
;;; including the keyword and argument(s) at the end of the buffer (usually
;;; prefixed by the comment characters). See the end of this file for
;;; examples. The local keywords and variables are:
;;; ispell-dictionary-keyword language-dictionary
;;; uses local variable ispell-local-dictionary
;;; ispell-pdict-keyword personal-dictionary
;;; uses local variable ispell-local-pdict
;;; ispell-parsing-keyword mode-arg extended-char-arg
;;; ispell-words-keyword any number of local word spellings
;;; BUGS:
;;; Highlighting in version 19 still doesn't work on tty's.
;;; On some versions of emacs, growing the minibuffer fails.
;;; Revision 2.26
;;; name changes for copyright assignment. Added word-frags in complete-word.
;;; Horizontal scroll (John Conover) Query-replace matches words now. bugs.
;;; Revision 2.25
;;; minor mods, upgraded ispell-message
;;; Revision 2.24
;;; query-replace more robust, messages, defaults, ispell-change-dict.
;;; Revision 2.23 1993/11/22 23:47:03 stevens
;;; ispell-message, Fixed highlighting, added menu-bar, fixed ispell-help, ...
;;; Revision 2.22
;;; Added 'u' command. Fixed default in ispell-local-dictionary.
;;; fixed affix rules display. Tib skipping more robust. Contributions by
;;; Per Abraham (parser selection), Denis Howe, and Eberhard Mattes.
;;; Revision 2.21 1993/06/30 14:09:04 stevens
;;; minor bugs. (nroff word skipping fixed)
;;; Revision 2.20 1993/06/30 14:09:04 stevens
;;; Debugging and contributions by: Boris Aronov, Rik Faith, Chris Moore,
;;; Kevin Rodgers, Malcolm Davis.
;;; Particular thanks to Michael Lipp, Jamie Zawinski, Phil Queinnec
;;; and John Heidemann for suggestions and code.
;;; Major update including many tweaks.
;;; Many changes were integrations of suggestions.
;;; lookup-words rehacked to use call-process (Jamie).
;;; ispell-complete-word rehacked to be compatible with the rest of the
;;; system for word searching and to include multiple wildcards,
;;; and it's own dictionary.
;;; query-replace capability added. New options 'X', 'R', and 'A'.
;;; buffer-local modes for dictionary, word-spelling, and formatter-parsing.
;;; Many random bugs, like commented comments being skipped, fix to
;;; keep-choices-win, fix for math mode, added pipe mode choice,
;;; fixed 'q' command, ispell-word checks previous word and leave cursor
;;; in same location. Fixed tib code which could drop spelling regions.
;;; Cleaned up setq calls for efficiency. Gave more context on window overlays.
;;; Assure context on ispell-command-loop. Window lossage in look cmd fixed.
;;; Due to pervasive opinion, common-lisp package syntax removed. Display
;;; problem when not highlighting.
;;; Revision 2.19 1992/01/10 10:54:08 geoff
;;; Make another attempt at fixing the "Bogus, dude" problem. This one is
;;; less elegant, but has the advantage of working.
;;; Revision 2.18 1992/01/07 10:04:52 geoff
;;; Fix the "Bogus, Dude" problem in ispell-word.
;;; Revision 2.17 1991/09/12 00:01:42 geoff
;;; Add some changes to make ispell-complete-word work better, though
;;; still not perfectly.
;;; Revision 2.16 91/09/04 18:00:52 geoff
;;; More updates from Sebastian, to make the multiple-dictionary support
;;; more flexible.
;;; Revision 2.15 91/09/04 17:30:02 geoff
;;; Sebastian Kremer's tib support
;;; Revision 2.14 91/09/04 16:19:37 geoff
;;; Don't do set-window-start if the move-to-window-line moved us
;;; downward, rather than upward. This prevents getting the buffer all
;;; confused. Also, don't use the "not-modified" function to clear the
;;; modification flag; instead use set-buffer-modified-p. This prevents
;;; extra messages from flashing.
;;; Revision 2.13 91/09/04 14:35:41 geoff
;;; Fix a spelling error in a comment. Add code to handshake with the
;;; ispell process before sending anything to it.
;;; Revision 2.12 91/09/03 20:14:21 geoff
;;; Add Sebastian Kremer's multiple-language support.
;;; Walt Buehring
;;; Texas Instruments - Computer Science Center
;;; ARPA: Buehring%TI-CSL@CSNet-Relay
;;; UUCP: {smu, texsun, im4u, rice} ! ti-csl ! buehring
;;; ispell-region and associated routines added by
;;; Perry Smith
;;; pedz@bobkat
;;; Tue Jan 13 20:18:02 CST 1987
;;; extensively modified by Mark Davies and Andrew Vignaux
;;; {mark,andrew}@vuwcomp
;;; Sun May 10 11:45:04 NZST 1987
;;; Ken Stevens ARPA:
;;; Tue Jan 3 16:59:07 PST 1989
;;; This file has overgone a major overhaul to be compatible with ispell
;;; version 2.1. Most of the functions have been totally rewritten, and
;;; many user-accessible variables have been added. The syntax table has
;;; been removed since it didn't work properly anyway, and a filter is
;;; used rather than a buffer. Regular expressions are used based on
;;; ispell's internal definition of characters (see ispell(4)).
;;; Some new updates:
;;; - Updated to version 3.0 to include terse processing.
;;; - Added a variable for the look command.
;;; - Fixed a bug in ispell-word when cursor is far away from the word
;;; that is to be checked.
;;; - Ispell places the incorrect word or guess in the minibuffer now.
;;; - fixed a bug with 'l' option when multiple windows are on the screen.
;;; - lookup-words just didn't work with the process filter. Fixed.
;;; - Rewrote the process filter to make it cleaner and more robust
;;; in the event of a continued line not being completed.
;;; - Made ispell-init-process more robust in handling errors.
;;; - Fixed bug in continuation location after a region has been modified by
;;; correcting a misspelling.
;;; Mon 17 Sept 1990
;;; Sebastian Kremer <>
;;; Wed Aug 7 14:02:17 MET DST 1991
;;; - Ported ispell-complete-word from Ispell 2 to Ispell 3.
;;; - Added ispell-kill-ispell command.
;;; - Added ispell-dictionary and ispell-dictionary-alist variables to
;;; support other than default language. See their docstrings and
;;; command ispell-change-dictionary.
;;; - (ispelled it :-)
;;; - Added ispell-skip-tib variable to support the tib bibliography
;;; program.
;;; **********************************************************************
;;; The following variables should be set according to personal preference
;;; and location of binaries:
;;; **********************************************************************
;;; Code:
(defvar ispell-highlight-p t
"*When not nil, spelling errors will be highlighted.")
(defvar ispell-highlight-face 'highlight
"*The face used for ispell highlighting. For Emacses with overlays.
Common values for GNU emacs are highlight, modeline, secondary-selection,
region, and underline.
This variable can be set by the user to whatever face they desire.
It's most convenient if the cursor color and highlight color are
slightly different.")
(defvar ispell-check-comments nil
"*When true, the spelling of comments in region is checked.")
(defvar ispell-query-replace-choices nil
"*When true and spell checking a region, the correction will be made
throughout the buffer using \\[query-replace].")
(defvar ispell-skip-tib nil
"*If non-nil, the spelling of references for the tib(1) bibliography
program are skipped. Otherwise any text between strings matching the regexps
ispell-tib-ref-beginning and ispell-tib-ref-end is ignored.
TeX users beware: Any field starting with [. will skip until a .] -- even
your whole buffer -- unless you set ispell-skip-tib to nil. That includes
a [.5mm] type of number....")
(defvar ispell-tib-ref-beginning "[[<]\\."
"Regexp matching the beginning of a Tib reference.")
(defvar ispell-tib-ref-end "\\.[]>]"
"Regexp matching the end of a Tib reference.")
(defvar ispell-keep-choices-win t
"*When not nil, the *Choices* window remains for spelling session.
This minimizes redisplay thrashing.")
(defvar ispell-choices-win-default-height 2
"*The default size of the *Choices*, including status line.
Must be greater than 1.")
(defvar ispell-program-name "ispell"
"Program invoked by \\[ispell-word] and \\[ispell-region] commands.")
(defvar ispell-alternate-dictionary
(cond ((file-exists-p "/usr/dict/web2") "/usr/dict/web2")
((file-exists-p "/usr/dict/words") "/usr/dict/words")
((file-exists-p "/usr/lib/dict/words") "/usr/lib/dict/words")
((file-exists-p "/sys/dict") "/sys/dict")
(t "/usr/dict/words"))
"*Alternate dictionary for spelling help.")
(defvar ispell-complete-word-dict ispell-alternate-dictionary
"*Dictionary used for word completion.")
(defvar ispell-grep-command "/usr/bin/egrep"
"Name of the grep command for search processes.")
(defvar ispell-grep-options "-i"
"Options for ispell-grep-command.
Should probably be \"-i\" or \"-e\".
Some machines (like the NeXT) don't support \"-i\"")
(defvar ispell-look-command "/usr/bin/look"
"Name of the look command for search processes.
Must contain complete path!")
(defvar ispell-look-p (file-exists-p ispell-look-command)
"*Use look. Should be nil if your UNIX doesn't have this program.
Attempts to automatically reset if look not available")
(defvar ispell-have-new-look nil
"*Non-nil means use the `-r' option (regexp) when running `look'.")
(defvar ispell-look-options (if ispell-have-new-look "-dfr" "-df")
"Options for ispell-look-command")
(defvar ispell-use-ptys-p nil
"When t, emacs will use pty's to communicate with ispell.
When nil, emacs will use pipes.")
(defvar ispell-following-word nil
"*If non-nil the \\[ispell-word] command will check the spelling
of the word under or following \(rather than preceding\) the cursor
when called interactively.")
(defvar ispell-help-in-bufferp t
"*If non-nil, the \\[ispell-help] command will display its
message in a buffer. Otherwise the minibuffer will be used.")
(defvar ispell-quietly nil
"*If non-nil, the \\[ispell-word] command will suppress all
non-corrective messages when called interactively.")
(defvar ispell-format-word (function upcase)
"*The function called to format the word whose spelling is being checked,
in diagnostic messages to the user. The function must take one string
argument and return a string.")
(defvar ispell-personal-dictionary nil
"*A string or nil. If nil, the default directory, ~/.ispell_words is used.")
(defvar ispell-silently-savep nil
"*When non-nil, save the personal dictionary without user verification.")
;;; This variable contains the current dictionary being used if the ispell
;;; process is running. Otherwise it contains the global default.
(defvar ispell-dictionary nil
"If non-nil, a dictionary to use instead of the default one.
This is passed to the ispell process using the \"-d\" switch and is
used as key in ispell-dictionary-alist (which see).
You should set this variable before your first call to ispell (e.g. in
your .emacs), or use the \\[ispell-change-dictionary] command to
change it, as changing this variable only takes effect in a newly
started ispell process.")
(defvar ispell-dictionary-alist ; sk 9-Aug-1991 18:28
'((nil ; default (english.aff)
"[A-Za-z]" "[^A-Za-z]" "[---']" nil ("-B") nil)
("english" ; make english explicitly selectable
"[A-Za-z]" "[^A-Za-z]" "[---']" nil ("-B") nil)
("deutsch" ; deutsch.aff
"[a-zA-Z\"]" "[^a-zA-Z\"]" "[---']" t ("-C") nil)
"[---']" t ("-C" "-d" "deutsch") "~latin1")
("nederlands8" ; dutch8.aff
"[---']" t ("-C") nil)
("svenska" ;7 bit swedish mode
"[A-Za-z}{|\\133\\135\\\\]" "[^A-Za-z}{|\\133\\135\\\\]"
"[---']" nil ("-C") nil)
("svenska8" ;8 bit swedish mode
"[A-Za-z\345\344\366\305\304\366]" "[^A-Za-z\345\344\366\305\304\366]"
"[---']" nil ("-C" "-d" "svenska") "~list") ; Add `"-T" "list"' instead?
"[A-Za-z]" "[^A-Za-z]" "[---`'\^]" nil nil nil)
("dansk" ; dansk.aff
"[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]"
"[---]" nil ("-C") nil)
"An alist of dictionaries and their associated parameters.
Each element of this list is also a list:
DICTIONARY-NAME is a possible value of variable ispell-dictionary, nil
means the default dictionary.
CASECHARS is a regular expression of valid characters that comprise a
NOT-CASECHARS is the opposite regexp of CASECHARS.
OTHERCHARS is a regular expression of other characters that are valid
in word constructs. Otherchars cannot be adjacent to each other in a
word, nor can they begin or end a word. This implies we can't check
\"Stevens'\" as a correct possessive and other correct formations.
Hint: regexp syntax requires the hyphen to be declared first here.
MANY-OTHERCHARS-P is non-nil if many otherchars are to be allowed in a
word instead of only one.
ISPELL-ARGS is a list of additional arguments passed to the ispell
EXTENDED-CHARACTER-MODE should be used when dictionaries are used which
have been configured in ispell's parse.y. (For example, umlauts
can be encoded as \\\"a, a\\\", \"a, ...) Defaults are ~tex and ~nroff
in english. This has the same effect as the command-line `-T' option.
The buffer Major Mode controls ispell's parsing in tex or nroff mode,
but the dictionary can control the extended character mode.
Both defaults can be overruled in a buffer-local fashion. See
ispell-parsing-keyword for details on this.
Note that the CASECHARS and OTHERCHARS slots of the alist should
contain the same character set as casechars and otherchars in the
language.aff file \(e.g., english.aff\).")
;;; ispell-menu-map from menu-bar.el
(defvar ispell-menu-map nil)
(if (and (featurep 'menu-bar) ; GNU emacs
(string-match "^19\\." emacs-version))
(let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist)))
(setq ispell-menu-map (make-sparse-keymap "Spell"))
(while dicts
(setq name (car (car dicts))
dicts (cdr dicts))
(if (stringp name)
(define-key ispell-menu-map (vector (intern name))
(cons (concat "Select " (capitalize name))
(list 'lambda () '(interactive)
(list 'ispell-change-dictionary name))))))
;; Why do we need an alias here?
(defalias 'ispell-menu-map ispell-menu-map)
;; Define commands in opposite order you want them to appear in menu.
(define-key ispell-menu-map [ispell-change-dictionary]
'("Change Dictionary" . ispell-change-dictionary))
(define-key ispell-menu-map [ispell-kill-ispell]
'("Kill Process" . ispell-kill-ispell))
(define-key ispell-menu-map [ispell-pdict-save]
'("Save Dictionary" . (lambda () (interactive) (ispell-pdict-save t))))
(define-key ispell-menu-map [ispell-complete-word]
'("Complete Word" . ispell-complete-word))
(define-key ispell-menu-map [ispell-complete-word-interior-frag]
'("Complete Word Frag" . ispell-complete-word-interior-frag))
(define-key ispell-menu-map [ispell-continue]
'("Continue Check" . ispell-continue))
(define-key ispell-menu-map [ispell-region]
'("Check Region" . ispell-region))
(define-key ispell-menu-map [ispell-word]
'("Check Word" . ispell-word))
(define-key ispell-menu-map [ispell-buffer]
'("Check Buffer" . ispell-buffer))
(define-key ispell-menu-map [ispell-message]
'("Check Message" . ispell-message))
(define-key ispell-menu-map [ispell-help]
'("Help" . (lambda () (interactive) (describe-function 'ispell-help))))
;;; **********************************************************************
;;; The following are used by ispell, and should not be changed.
;;; **********************************************************************
;;; This doesn't match the LAST patch number -- this is for 3.1 or 3.0.09
(defconst ispell-required-versions '("3.1." "3.0.09")
"Ispell versions with which this version of ispell.el is known to work.")
(defun ispell-get-casechars ()
(nth 1 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-not-casechars ()
(nth 2 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-otherchars ()
(nth 3 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-many-otherchars-p ()
(nth 4 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-ispell-args ()
(nth 5 (assoc ispell-dictionary ispell-dictionary-alist)))
(defun ispell-get-extended-character-mode ()
(nth 6 (assoc ispell-dictionary ispell-dictionary-alist)))
(defvar ispell-process nil
"Holds the process object for 'ispell'")
(defvar ispell-pdict-modified-p nil
"T when the personal dictionary has modifications that need to be written.")
;;; If you want to save the dictionary when quitting, must do so explicitly.
(defvar ispell-quit nil
"Set to t or point when user wants to abort ispell session.")
(defvar ispell-filter nil
"Output filter from piped calls to ispell.")
(defvar ispell-filter-continue nil
"Control variable for ispell filter function.")
(defvar ispell-process-directory nil
"The directory where ispell-process was started.")
(defvar ispell-query-replace-marker (make-marker)
"Marker for query-replace processing.")
(defvar ispell-checking-message nil
"Non-nil when we're checking a mail message")
(defconst ispell-choices-buffer "*Choices*")
(defvar ispell-overlay nil "overlay variable for ispell")
;;; *** Buffer Local Definitions ***
;;; This is the local dictionary to use. When nil the default dictionary will
;;; be used. Do not redefine default value or it will override the global!
(defvar ispell-local-dictionary nil
"A buffer local variable. If non-nil, a dictionary to be used when running
an ispell-command in this buffer. Setting ispell-local-dictionary to a value
has the same effect as calling \\[ispell-change-dictionary] with that value.
This variable is automatically set when defined in the file with either
ispell-dictionary-keyword or the Local Variable syntax.
If using Local Variable syntax, the dictionary must be a string.")
(make-variable-buffer-local 'ispell-local-dictionary)
;; Use default directory, unless locally set.
(set-default 'ispell-local-dictionary nil)
(defconst ispell-words-keyword "LocalWords: "
"The keyword for local oddly-spelled words to accept.
The keyword will be followed by any number of local word spellings.
There can be multiple of these keywords in the file.")
(defconst ispell-dictionary-keyword "Local IspellDict: "
"The keyword for local dictionary definitions.
There should be only one dictionary keyword definition per file, and it
should be followed by a correct dictionary name in ispell-dictionary-alist.")
(defconst ispell-parsing-keyword "Local IspellParsing: "
"The keyword for overriding default ispell parsing as determined by
the buffer's major mode and extended-character mode as determined by the
default dictionary.
The above keyword string should be followed by `latex-mode' or
`nroff-mode' to put the current buffer into the desired parsing mode.
Extended character mode can be changed for this buffer by placing
a `~' followed by an extended-character mode -- such as `~.tex'.")
(defvar ispell-local-pdict ispell-personal-dictionary
"A buffer local variable. If a personal dictionary is specified for
the current buffer which is different from the current personal dictionary,
the effect will be similar to calling \\[ispell-change-dictionary].
This variable is automatically set when defined in the file with either
ispell-pdict-keyword or the local variable syntax.
If using Local variable syntax, the dictionary must be nil or a string.")
(make-variable-buffer-local 'ispell-local-pdict)
(defconst ispell-pdict-keyword "Local IspellPersDict: "
"The keyword for defining buffer local dictionaries.")
(defvar ispell-buffer-local-name nil
"Contains the buffer name if local word definitions were used.
Ispell is then restarted because the local words could conflict.")
(defvar ispell-parser 'use-mode-name
"*Indicates whether ispell should parse the current buffer as TeX Code.
Special value 'use-mode-name tries to guess using the name of major-mode.
Default parser is 'nroff.
Currently the only other valid parser is 'tex.
You can set this variable in hooks in your init file -- eg:
(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))")
(defvar ispell-region-end (make-marker)
"Marker that allows spelling continuations.")
;;; **********************************************************************
;;; **********************************************************************
(defun ispell-word (&optional following quietly)
"Check spelling of word under or before the cursor.
If word not found in dictionary, display possible corrections in a window
and let user select.
If optional argument FOLLOWING is non-nil or if ispell-following-word
is non-nil when called interactively, then the following word
\(rather than preceding\) will be checked when the cursor is not over a word.
When the optional argument QUIETLY is non-nil or ispell-quietly is non-nil
when called interactively, non-corrective messages are suppressed.
Word syntax described by ispell-dictionary-alist (which see).
This will check or reload the dictionary. Use \\[ispell-change-dictionary]
or \\[ispell-region] to update the ispell process."
(if (interactive-p)
(setq following ispell-following-word
quietly ispell-quietly))
(ispell-buffer-local-dict) ; use the correct dictionary
(let ((cursor-location (point)) ; retain cursor location
ispell-keep-choices-win ; override global to force creation
(word (ispell-get-word following))
start end poss replace)
;; destructure return word info list.
(setq start (car (cdr word))
end (car (cdr (cdr word)))
word (car word))
;; now check spelling of word.
(or quietly
(message "Checking spelling of %s..."
(funcall ispell-format-word word)))
(ispell-init-process) ; erases ispell output buffer
(process-send-string ispell-process "%\n") ;put in verbose mode
(process-send-string ispell-process (concat "^" word "\n"))