157 lines
6.3 KiB
HTML
157 lines
6.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
<TITLE>LinuxDoc+Emacs+Ispell-HOWTO: Ispell</TITLE>
|
|
<LINK HREF="LinuxDoc+Emacs+Ispell-HOWTO-6.html" REL=next>
|
|
<LINK HREF="LinuxDoc+Emacs+Ispell-HOWTO-4.html" REL=previous>
|
|
<LINK HREF="LinuxDoc+Emacs+Ispell-HOWTO.html#toc5" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-6.html">Next</A>
|
|
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-4.html">Previous</A>
|
|
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO.html#toc5">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="s5">5. Ispell</A> </H2>
|
|
|
|
<P>If you want to spell-check your document from within Emacs, you may
|
|
use the <B>Ispell</B> package and its Emacs mode.
|
|
<P>
|
|
<H2><A NAME="ss5.1">5.1 Choosing your default dictionaries</A>
|
|
</H2>
|
|
|
|
<P>You can set up Emacs so that upon loading a file, it chooses
|
|
automatically which dictionaries to use (you can use several). The first
|
|
one, certainly the most important, is the main dictionary, distributed
|
|
with Ispell. You can choose among several languages. The second one is
|
|
your personal dictionary, where Ispell will insert words it couldn't
|
|
find in the main dictionary but you told it to remember.
|
|
<P>If you wish to use as a default dictionary the French dictionary
|
|
that comes with Ispell, and if you wish to use the file
|
|
<CODE>.ispell-dico-perso</CODE> in your home directory as a personal
|
|
dictionary, insert the following lines in your <CODE>.emacs</CODE> file:
|
|
<P>
|
|
<PRE>
|
|
(setq sgml-mode-hook
|
|
'(lambda () "Defauts for SGML mode."
|
|
(setq ispell-personal-dictionary "~/.ispell-dico-perso")
|
|
(ispell-change-dictionary "francais")
|
|
))
|
|
|
|
</PRE>
|
|
<P>
|
|
<H2><A NAME="ss5.2">5.2 Selecting special dictionaries for certain files </A>
|
|
</H2>
|
|
|
|
<P>You may have a little problem if you do not spell-check documents in
|
|
the same language at all times. If you translate documents, it is very
|
|
likely that you swap languages (and dictionaries) very often.
|
|
<P>
|
|
<P>I don't know of any Lisp way of selecting, either automatically, or
|
|
with a single mouse click, the main and personal dictionaries associated
|
|
to the language currently being used. (If you do, please tell me!)
|
|
<P>
|
|
<P>However, it is possible to indicate, at the end of the file, which
|
|
dictionaries you want to use for the current file (and only this one).
|
|
It suffices to add them as commentaries, so that Ispell can read them
|
|
upon launching a spell-check:
|
|
<P>
|
|
<PRE>
|
|
<!-- Local IspellDict: english -->
|
|
<!-- Local IspellPersDict: ~/emacs/.ispell-english -->
|
|
|
|
</PRE>
|
|
<P>If you have previously defined, in your <CODE>.emacs</CODE> file, that
|
|
your default dictionaries are the French dictionaries, then you can add
|
|
these lines in the end of any file written in English.
|
|
<P>
|
|
<H2><A NAME="ss5.3">5.3 Spell-checking your document</A>
|
|
</H2>
|
|
|
|
<P>To spell-check the whole of your document, use, from anywhere in
|
|
the document the <CODE>Meta-x ispell-buffer</CODE> command. You may as well
|
|
only run the checking on a region in your document:
|
|
<P>
|
|
<UL>
|
|
<LI> Mark the beginning of the region with <CODE>Ctrl-Spc</CODE>
|
|
(mark-set-command),</LI>
|
|
<LI> Go to the end of the region to check,</LI>
|
|
<LI> type <CODE>Meta-x ispell-region</CODE>.</LI>
|
|
</UL>
|
|
<P>Emacs then runs Ispell. Upon meeting an unknown word, this one
|
|
shows you said word (usually highlighted) and prompts you for a key:
|
|
<P>
|
|
<UL>
|
|
<LI><B>spc </B>accepts the word, this time only,</LI>
|
|
<LI><B>i </B>accepts the word and inserts it in your personal
|
|
dictionary, </LI>
|
|
<LI><B>a </B>accepts the word for this session,</LI>
|
|
<LI><B>A </B>accepts the word for this file, and inserts it
|
|
in the local file dictionary</LI>
|
|
<LI><B>r </B>allows you to correct the word by hand</LI>
|
|
<LI><B>R </B>allows you to correct all the occurrences of the
|
|
misspelled word,</LI>
|
|
<LI><B>x </B>stops the checking, and puts the cursor back in
|
|
place,</LI>
|
|
<LI><B>X </B>stops the checking and leaves the cursor where
|
|
it is, letting you correct your file; you will be able to continue the
|
|
spell-checking later if you type <CODE>Meta-x ispell-continue</CODE>,</LI>
|
|
<LI><B>? </B>gives you online help.</LI>
|
|
</UL>
|
|
<P>If ispell finds one or several words close to the unknown one, it
|
|
will show them in a little window, each one of them preceded by a digit.
|
|
Just type this digit to replace the misspelled word with the corresponding
|
|
word.
|
|
<P>
|
|
<H2><A NAME="ss5.4">5.4 Personal dictionary versus local file dictionary</A>
|
|
</H2>
|
|
|
|
<P>The <B>i</B> key will let you insert a word in your personal
|
|
dictionary, whereas <B>A</B> will let you insert a word in the local
|
|
file dictionary.
|
|
<P>
|
|
<P>The local file dictionary is a sequence of words inserted at the
|
|
end of the file, as comments, reread by Ispell each time it is run on
|
|
the file. This way, you can accept some words, acceptable in this file,
|
|
but not necessarily acceptable in other files.
|
|
<P>
|
|
<P>As far as I am concerned, I think it is better that the personal
|
|
dictionary be reserved for words the main dictionary doesn't know but
|
|
which belong to the language (like hyphenated words), plus some common
|
|
words like proper nouns or others (like <I>Linux</I>), if they don't
|
|
look too much like a real word of the main dictionary; adding too many
|
|
words in the personal dictionary, such as first names, may be dangerous,
|
|
because they may look like a word of the language (one can imagine
|
|
Ispell being mystified on the following:
|
|
`<I>When the going gets tof, the tof get going</I>
|
|
<BLOCKQUOTE><EM>Tof</EM> is a French abbreviation for the first name
|
|
<EM>Christophe</EM>.</BLOCKQUOTE>
|
|
'!).
|
|
<P>
|
|
<H2><A NAME="ss5.5">5.5 Typing spell-checking</A>
|
|
</H2>
|
|
|
|
<P>Ispell can spell-check your file while you're typing. You need to
|
|
use <B>ispell-minor-mode</B> for this. To start it or stop it, type
|
|
<CODE>Meta-x ispell-minor-mode</CODE>. Ispell will <EM>beep</EM> you each
|
|
time you type a word it doesn't know.
|
|
<P>
|
|
<P>If those <EM>beeps</EM> hassle you (or your roommate
|
|
is taking a nap), you can replace those annoying <EM>beeps</EM>
|
|
with a flash on the screen, with
|
|
the command <CODE>Meta-x set-variable RET visible-bell RET t RET</CODE>. You
|
|
can add the following line in your <CODE>.emacs</CODE> and silence Emacs
|
|
forever:
|
|
<P>
|
|
<PRE>
|
|
(setq visible-bell t)
|
|
|
|
</PRE>
|
|
<P>
|
|
<HR>
|
|
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-6.html">Next</A>
|
|
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-4.html">Previous</A>
|
|
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO.html#toc5">Contents</A>
|
|
</BODY>
|
|
</HTML>
|