songei2f
songei2f

Reputation: 659

Eshell for RTL File Names

By default, Emacs 24 can handle Arabic, Hebrew, and other right-to-left (RTL) languages. I have multilingual term emulators that handle this in X, but I would like to use eshell inside emacs to see the non-English character filenames (and boy do I have many). When I use eshell, the characters are not in the correct order and it spells out gibberish. (setq-default bidi-display-reordering t) (which is default) makes no difference obviously.

Is this possible?

Upvotes: 0

Views: 198

Answers (1)

Beni Cherniavsky-Paskin
Beni Cherniavsky-Paskin

Reputation: 10039

I believe you're getting double reordering by emacs + mlterm, and need to disable one.

Your screenshot shows in upper half mlterm successfully detects line-by-line base direction and reorders characters. And Emacs 24 by default reorders bidi in the terminal, assuming a non-bidi LTR termianl. Combining both results in double reordering ABC -> CBA -> ABC.

You have 2 options:

  1. Disable bidi in mlterm (at least while running emacs, not sure how to automate that).

  2. Disable bidi in emacs (at least when running under mlterm). I.e. set bidi-display-reordering to nil, not t.

I expect the first will work better. mlterm can only give you a dumb "bidi display" layer, which may be confusing on top of an editor; emacs gives you "bidi editing" where someone thought of how the whole interaction should work.

  • Specifically, side-by-side "windows" within emacs should work well when emacs is doing the bidi and break horribly when mlterm is.
  • OTOH, mouse copy-paste probably works better when mlterm is doing the bidi.
    If emacs sends reordered chars, that's what mlterm mouse selection will copy. Emacs can mostly take over mouse with xterm-mouse-mode but (untested speculation) it works on terminal coordinates and would need extra work to match them to logical-order text.

P.S. I'm not sure why the end result is right-aligned, as it seems there is a blank line before so Emacs should consider it a new paragraph, decide it's RTL and send right-aligned text to mlterm, and I'd expect mlterm to then reverse the line resulting in it left-aligned. I'm probably missing something.

Upvotes: 1

Related Questions