emacs-bidi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-bidi] Getting started with Emacs BiDi


From: Ze'ev Clementson
Subject: [emacs-bidi] Getting started with Emacs BiDi
Date: Mon, 05 Jul 2010 12:35:28 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (darwin)

It took me a little while to figure out how to turn on bidi and use it
to input Hebrew in Emacs 24. It wasn't hard to figure it out, but it did
require some investigative work. I suspect others may also find that
there is a bit of a learning curve and might be put off from trying to
use it. I wrote the following elisp function to make it easier to switch
bidi/hebrew on/off: 

(defun zc-hebrew (&optional arg)
  "Switch to Hebrew input.
Without arg does RTL/LTR determination automatically (e.g. - via the rules
of the Unicode Bidirectional Algorithm). With arg forces RTL. Calling
again toggles off bidi and Hebrew input."
  (interactive "P")
  (if bidi-display-reordering
          (progn
                (setq bidi-display-reordering nil)
                (inactivate-input-method))
        (setq bidi-display-reordering t)
        (if arg
                (setq bidi-paragraph-direction 'right-to-left)
          (setq bidi-paragraph-direction nil))
        (set-input-method 'hebrew)))

And, I bound it to a key:

(global-set-key [(control c) (h)] 'zc-hebrew)
 
Now, when I want to type in Hebrew, I just press "C-c h" in a
buffer. When I want to switch back to English, I just press "C-c h" a
second time. If I want to force right-to-left orientation (rather than
letting the Unicode Bidirectional Algorithm decide), I press  "C-u C-c
h". Does anyone else have any elisp snippets that they've found useful
when working with bidi and/or hebrew? 

- Ze'ev




reply via email to

[Prev in Thread] Current Thread [Next in Thread]