I know that emacs supports Arabic and I have seen many questions on Arabic support but my problem here is specifically with emacs in the terminal.

It can be seen in the image bellow in the left side that the text is shown correctly in the GUI mode. However the problems appear in the terminal in the middle and right frames of the screenshot.

In the middle one, it is just emacs running normally from the terminal. Here the letters are shown in the correct order from right to left but the problem is that the letters are separated.

A classical solution to problems with Arabic in the terminal is BiCon. It works pretty well with programs that are not aware of right to left languages.

In the right of the image emacs can be seen running under BiCon. The letters here are connected, which is good, but it is in the reversed order. I Believe that this is because emacs is already taking care of order and then BiCon is reversing it back.

One last thing to mention is that I tried some different terminals including xterm, gnome-terminal, konsole, and mlterm.

Any suggestions?



This is not really a solution but it's workaround.. Using python-arabic-reshaper save this as ar-reshaper.py:

import arabic_reshaper
import sys
for line in sys.stdin:


cat INPUTFILE | python3 ar-reshaper.py > OUTPUTFILE

The OUTPUTFILE will be the reshaped version of INPUTFILE with the connected Arabic letters and the result on emacs:

But still, an actual solution is needed...


Reported as bug and here's a little minor-mode if anyone is interested

  • Have you tried a variety of fonts?
    – Dan
    Aug 17, 2018 at 19:46
  • If BiCon is handling direction for you, then try using (setq-default bidi-display-reordering nil) to disable that in Emacs. See also C-h i g (emacs)Bidirectional Editing
    – phils
    Aug 18, 2018 at 5:43
  • @phils Thanks, that actually fixed the way it looks! But one more issue, even though bicon makes look as a right to left text, in the point of view of emacs it is left to right text. This means that if I write something in the right it goes to the left and vice versa. That is in addition to having the cursor moving in the wrong locations.
    – Naheel
    Aug 18, 2018 at 22:31
  • @Dan Yep, but I don't think that this is really related. It turned out that unicode has different characters for every letter depending on its location in addition to the normal Arabic table. What happens is that editors usually remap the normal character to the other characters depending on the location. I found couple of libraries that can do this transformation but they all where very slow. I actually have written my own in C and I think a little minor mode on emacs can get the job done. I'm just a little busy and I'll finish it soon..
    – Naheel
    Aug 18, 2018 at 22:38
  • 1
    @Naheel Yes, I suspected that it might end up being confusing. I'm not familiar with RTL languages, though, so I wasn't really sure. It sounds like you need the opposite approach -- leave bidi enabled in Emacs, and somehow disable it in BiCon. Perhaps your previous comment is describing something equivalent. Good luck, in any case. If you end up with a working solution, please consider M-x report-emacs-bug and describing the nature of the problem and how you fixed it?
    – phils
    Aug 19, 2018 at 0:50

2 Answers 2


The solution was simply to disable the bidi in bicon.

THIS fork can achieve that by:

bicon.bin --reshape-only emacs -nw
  • 1
    Cheers for following up in all the right places.
    – phils
    Aug 26, 2018 at 22:19
  • The fork has now been merged into the upstream.
    – HappyFace
    Apr 3, 2021 at 5:41

See here for an up-to-date version of this guide.

  • Install bicon (using the fork linked above, or the original)
  • Use these wrappers to open emacs:
function bicon-emc() {
  bicon.bin --reshape-only emacsclient -t "$@"

Take care not to run this from a shell that is itself running under bicon. You need to use this function if you want to do so:

biconm () {
    BICON_MODE=y bicon.bin "$@"
bicon-zsh () {
    biconm zsh
isBicon () {
    test -n "$BICON_MODE"
bicon-emc () {
    if isBicon
                emacsclient -t -e "(progn (setq-default bidi-display-reordering nil) (redraw-display))" "$@"
        } always {
            emacsclient -e "(setq-default bidi-display-reordering t)"
        return $?
    biconm --reshape-only emacsclient -t "$@"

And it will still not be good for editing RTL text, as Emacs is confused by the bidi reversal that bicon does.

Related projects:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.