old-www/HOWTO/LinuxDoc+Emacs+Ispell-HOWTO...

185 lines
6.8 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: Configuring Emacs</TITLE>
<LINK HREF="LinuxDoc+Emacs+Ispell-HOWTO-5.html" REL=next>
<LINK HREF="LinuxDoc+Emacs+Ispell-HOWTO-3.html" REL=previous>
<LINK HREF="LinuxDoc+Emacs+Ispell-HOWTO.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-5.html">Next</A>
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-3.html">Previous</A>
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO.html#toc4">Contents</A>
<HR>
<H2><A NAME="s4">4. Configuring <CODE>Emacs</CODE></A> </H2>
<P>
<H2><A NAME="ss4.1">4.1 Accented Characters</A>
</H2>
<P>If you want to write documents in French or in any other western
European language, you will need 8-bit characters. This is how to set Emacs
up to tell it to accept such characters.
<P>
<H3>The displaying of 8-bit characters </H3>
<P>To let Emacs display 8-bit characters, you will need the following
lines in your <CODE>.emacs</CODE> file:
<PRE>
(standard-display-european 1)
(load-library "iso-syntax")
</PRE>
<P>If you are using Emacs on a terminal which has no 8-bit support, you
can use the <CODE>iso-ascii</CODE> library (<CODE>(load-library "iso-ascii")</CODE>),
which tells Emacs to display such characters to its best approximation.
<P>
<H3>The typing of 8-bit characters </H3>
<P>If your keyboard allows you to enter accented characters, no
problem. If not here are some remedies:
<P>
<H3>The <CODE>iso-acc</CODE> library </H3>
<P>The Emacs <CODE>iso-acc</CODE> library will let you type 8-bit
characters from a 7-bit keyboard.
<P>To use it, insert the following in your <CODE>.emacs</CODE> file:
<PRE>
(load-library "iso-acc")
</PRE>
<P>Then, upon running Emacs and opening the file you need to edit, type
<CODE>Meta-x iso-accents-mode</CODE>.
<P>You can then enter the <B>&eacute;</B> of the French word <EM>caf&eacute;</EM>
typing <B>'</B> then <CODE>e</CODE>. More generally, you will type an
accented character typing the accent first, then the letter to accent
(upper or lower case). The following are the accents you may use:
<P>
<LI><CODE>'</CODE>&nbsp;: Acute</LI>
<LI><CODE>`</CODE>&nbsp;: Grave</LI>
<LI><CODE>^</CODE>&nbsp;: Circumflex</LI>
<LI><CODE>"</CODE>&nbsp;: Dieresis</LI>
<LI><CODE>~</CODE>&nbsp;: Tilde, cedilla, and other particular
cases (cf iso-acc.el).</LI>
<LI><CODE>/</CODE>&nbsp;: To bar a letter, etc.</LI>
<P>If you need one of these characters and not an accented letter, type
a space next to it. For instance, to type
<I>l'&eacute;l&eacute;phant</I>, type <CODE>l ' spc ' e l ' e ...</CODE>
<P>You will find all the possible combinations in the
<CODE>iso-acc.el</CODE> file.
<P>
<H3>The Meta key </H3>
<P>Some terminals will let you type 8-bit characters with the
Meta (or Alt) key. For example, pressing
<B>Meta-i</B> will get you the <B>&eacute;</B> character.
<P>But Emacs reserved the Meta key for other uses, and I know
of no library which lets you use it for accented characters.
<P>This is a solution:
<P>
<PRE>
(global-set-key "\ei" '(lambda () (interactive) (insert ?\351)))
_ ___
</PRE>
<P>Such a line, if inserted in your
<CODE>.emacs</CODE> file, will let you type
<B>&eacute;</B> using the <B>Meta-i</B> keystroke.
You can redefine in such a way the combinations you need
if you replace <B>i</B> with the right key and
<B>351</B> with the right code (the code being taken from the
ISO-8859-1 character set).
<P><B>Warning!</B> Some local modes may redefine such key
combinations.
<P>
<H3>The displaying of 8-bit SGML characters </H3>
<P>Under SGML, you can type accented characters with macros. For
example, the <B>&eacute;</B> key is <B>&amp;eacute;</B>. Generally, the applications
that need to read SGML can read 8-bit characters and there is no need to
use these macros. But some may not be able to do so. Given that there is a
way to solve this problem, it would be a waste to let these crash.
<P>The <CODE>iso-sgml</CODE> library will let you type accented characters
under Emacs, like always, but upon saving your file to the disk, it will
turn these 8-bit characters into their SGML equivalent.
<P>It is therefore easy, thanks to this library, to type and reread
your document under Emacs, and you can be sure a non 8-bit clean
application will accept you document.
<P>To use this library, you just need to add the following lines to your
<CODE>.emacs</CODE> file:
<P>
<PRE>
(setq sgml-mode-hook
'(lambda () "Defaults for SGML mode."
(load-library "iso-sgml")))
</PRE>
<P>
<H2><A NAME="ss4.2">4.2 SGML mode</A>
</H2>
<P>Upon loading a file with the <B>.sgml</B> extension,
Emacs enters the <B>sgml mode</B> automatically. If it doesn't, you
can tell it to do so manually by typing <CODE>Meta-x sgml-mode</CODE>, or
automatically by adding the following lines to your <CODE>.emacs</CODE> file:
<P>
<PRE>
(setq auto-mode-alist
(append '(("\.sgml$" . sgml-mode))
auto-mode-alist))
</PRE>
<P>This mode will let you choose how to insert 8-bit characters for
example. With <CODE>Meta-x sgml-name-8bit-mode</CODE> (or the menu item
<I>SGML/Toggle 8-bit insertion</I>), you can choose to type 8-bit
characters as is, or in SGML form, i.e. in the form <B>&amp;...;</B>.
<P>It will as well let you hide or show SGML tags, with <CODE>Meta-x
sgml-tags-invisible</CODE> (or the menu item <I>SGML/Toggle Tag
Visibility</I>).
<P>
<P>
<H2><A NAME="ss4.3">4.3 PSGML mode</A>
</H2>
<P>PSGML mode helps a lot to edit SGML documents with Emacs.
<P>The
<A HREF="http://www.linux-france.com/article/psgml-linuxdoc">psgml-linuxdoc</A>
documentation explains how to install this mode and use it with
<I>LinuxDoc</I>.
<P>
<H2><A NAME="ss4.4">4.4 Miscellaneous</A>
</H2>
<P>
<H3>auto-fill mode </H3>
<P>In the normal mode, when you type a paragraph and get to the end of
the line, you must use the
Return key yourself to get to the next line, or else your line
goes on through the whole paragraph. When you use
Return to get to the next line, you get a paragraph
with ragged right margins.
<P>If you let some lines go beyond a
reasonable width, you won't be able to see them with some editors.
<P>The <B>auto-fill</B> mode automates this boring task: when you go
further than a certain column (the 70th by default), you are automatically
taken to the next line.
<P>This is how to use this mode, and set the width of your lines to 80:
<P>
<PRE>
(setq sgml-mode-hook
'(lambda () "Defaults for SGML mode."
(auto-fill-mode)
(setq fill-column 80)))
</PRE>
<P>
<HR>
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-5.html">Next</A>
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO-3.html">Previous</A>
<A HREF="LinuxDoc+Emacs+Ispell-HOWTO.html#toc4">Contents</A>
</BODY>
</HTML>