emacs-devel
[Top][All Lists]
Advanced

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

Buffer names with R2L characters


From: Eli Zaretskii
Subject: Buffer names with R2L characters
Date: Mon, 20 Jun 2011 19:21:00 +0300

I bumped into this annoyance while working on bidi reordering of
strings.  As some of you know, the mode line is constructed from C and
Lisp strings, and bidi.c can now reorder them (for now, only its
new and improved version in my local branch).

Once I had this half-working, the first thing I tested was visiting
files whose names include R2L characters.  It works, but there's one
problem: the "<N>" tails we attach to buffer names to make them
unique.  The problem is that the '<' and '>' characters are "other
neutral", or "ON", in the UAX#9 parlance, and so their directionality
depends on the surrounding characters.  As result, a buffer name typed
as ABCDEF<2> is displayed in the mode line like this:

  2>FEDCBA>

I verified this with the Unicode Reference Implementation, and there's
no bug in bidi.c: this is the correct reordering according to the
Unicode Bidirectional Algorithm.

I can fix this in most prominent use cases -- the mode line, the
buffer menu, and even in the prompt produced by read-buffer -- by
appending a suitable character to the end of the string (after the
numeric tail) and making it invisible with text properties.  But this
sounds kludgey, and of course sooner or later the "2>FEDCBA>" thingy
will show somewhere, e.g. if someone coughs up their own
mode-line-format and use buffer-name directly, or whatever.  However,
I don't see a better way out of this, and leaving it as it is would be
too ugly, IMO.  If someone has better ideas, I'm all ears.



reply via email to

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