Emacs supports bidirectional display out of the box since version 24.1. Just type in text in a R2L script such as hebrew or arabic.
This page refers to outdated information for historical purposes only.
Work started on the m17n.org website (discontinued).
TAKAHASHI Naoto and HANDA Kenichi wrote code to display Arabic from Unicode and ISO-8859-6 correctly. Those encodings use only one character for the various glyphs (start, middle, end, isolated form), so the display code needs to know about some basic Arabic rules to get this right. This is done using font-lock to identify the region of interest and compose-region to compose any number of characters into another character.
This means that enabling auto-composition-mode will enable font-lock.
You can download the m17n fonts from the emacs-bidi page. You cannot just switch to that new font, however. If you do, your Frame sizes will all be messed up. Here is why, and what to do about it (thanks to TAKAHASHI Naoto for the explanation):
Emacs calculates the frame size based on the FONTBOUNDINGBOX of its ASCII font. If you request Emacs to use the m17n font, it will use the font not only for Arabic but for all characters, including ASCII characters. Since the m17n fonts are proportional fonts, some glyphs are very wide and some glyphs are very tall. Therefore its FONTBOUNDINGBOX is very big.
Specify your favorite ASCII font for the default. Then include the following lines in your ~/.emacs file.
(set-fontset-font "fontset-default" (cons (decode-char 'ucs #x0600) (decode-char 'ucs #x06ff)) ; arabic "-m17n-*--20-*-iso10646-1") (set-fontset-font "fontset-default" (cons (decode-char 'ucs #xfb50) (decode-char 'ucs #xfdff)) ; presentation A "-m17n-*--20-*-iso10646-1") (set-fontset-font "fontset-default" (cons (decode-char 'ucs #xfe70) (decode-char 'ucs #xfefc)) ; presentation B "-m17n-*--20-*-iso10646-1")
See also SupportBiDi