Next Previous Contents

4. Configuring Emacs

4.1 Accented Characters

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.

The displaying of 8-bit characters

To let Emacs display 8-bit characters, you will need the following lines in your .emacs file:

       (standard-display-european 1)
       (load-library "iso-syntax")
       

If you are using Emacs on a terminal which has no 8-bit support, you can use the iso-ascii library ((load-library "iso-ascii")), which tells Emacs to display such characters to its best approximation.

The typing of 8-bit characters

If your keyboard allows you to enter accented characters, no problem. If not here are some remedies:

The iso-acc library

The Emacs iso-acc library will let you type 8-bit characters from a 7-bit keyboard.

To use it, insert the following in your .emacs file:

      (load-library "iso-acc")
      

Then, upon running Emacs and opening the file you need to edit, type Meta-x iso-accents-mode.

You can then enter the é of the French word café typing ' then e. 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:

  • ' : Acute
  • ` : Grave
  • ^ : Circumflex
  • " : Dieresis
  • ~ : Tilde, cedilla, and other particular cases (cf iso-acc.el).
  • / : To bar a letter, etc.
  • If you need one of these characters and not an accented letter, type a space next to it. For instance, to type l'éléphant, type l ' spc ' e l ' e ...

    You will find all the possible combinations in the iso-acc.el file.

    The Meta key

    Some terminals will let you type 8-bit characters with the Meta (or Alt) key. For example, pressing Meta-i will get you the é character.

    But Emacs reserved the Meta key for other uses, and I know of no library which lets you use it for accented characters.

    This is a solution:

          (global-set-key "\ei" '(lambda () (interactive) (insert ?\351)))
                             _                                      ___
          
    

    Such a line, if inserted in your .emacs file, will let you type é using the Meta-i keystroke. You can redefine in such a way the combinations you need if you replace i with the right key and 351 with the right code (the code being taken from the ISO-8859-1 character set).

    Warning! Some local modes may redefine such key combinations.

    The displaying of 8-bit SGML characters

    Under SGML, you can type accented characters with macros. For example, the é key is é. 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.

    The iso-sgml 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.

    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.

    To use this library, you just need to add the following lines to your .emacs file:

          (setq sgml-mode-hook
          '(lambda () "Defaults for SGML mode."
           (load-library "iso-sgml")))
          
    

    4.2 SGML mode

    Upon loading a file with the .sgml extension, Emacs enters the sgml mode automatically. If it doesn't, you can tell it to do so manually by typing Meta-x sgml-mode, or automatically by adding the following lines to your .emacs file:

          (setq auto-mode-alist
          (append '(("\.sgml$"  . sgml-mode))
                    auto-mode-alist))
         
    

    This mode will let you choose how to insert 8-bit characters for example. With Meta-x sgml-name-8bit-mode (or the menu item SGML/Toggle 8-bit insertion), you can choose to type 8-bit characters as is, or in SGML form, i.e. in the form &...;.

    It will as well let you hide or show SGML tags, with Meta-x sgml-tags-invisible (or the menu item SGML/Toggle Tag Visibility).

    4.3 PSGML mode

    PSGML mode helps a lot to edit SGML documents with Emacs.

    The psgml-linuxdoc documentation explains how to install this mode and use it with LinuxDoc.

    4.4 Miscellaneous

    auto-fill mode

    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.

    If you let some lines go beyond a reasonable width, you won't be able to see them with some editors.

    The auto-fill 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.

    This is how to use this mode, and set the width of your lines to 80:

           (setq sgml-mode-hook
                 '(lambda () "Defaults for SGML mode."
                     (auto-fill-mode)       
                     (setq fill-column 80)))
           
    


    Next Previous Contents

    Hosting by: Hurra Communications Ltd.
    Generated: 2007-01-26 17:58:14