unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Buffer names with R2L characters
@ 2011-06-20 16:21 Eli Zaretskii
  2011-06-20 18:00 ` Stefan Monnier
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Eli Zaretskii @ 2011-06-20 16:21 UTC (permalink / raw)
  To: emacs-devel

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.



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2011-06-25 13:25 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-20 16:21 Buffer names with R2L characters Eli Zaretskii
2011-06-20 18:00 ` Stefan Monnier
2011-06-20 20:52   ` Eli Zaretskii
2011-06-20 20:13 ` James Cloos
2011-06-20 21:08   ` Eli Zaretskii
2011-06-21  4:26     ` Stephen J. Turnbull
2011-06-21  6:28       ` Eli Zaretskii
2011-06-21  8:44         ` Stephen J. Turnbull
2011-06-21 14:28           ` Eli Zaretskii
2011-06-21  4:33     ` Miles Bader
2011-06-21  6:30       ` Eli Zaretskii
2011-06-21  7:26       ` David Kastrup
2011-06-20 21:06 ` Kalle Olavi Niemitalo
2011-06-21  2:51   ` Eli Zaretskii
2011-06-21 16:52 ` Ehud Karni
2011-06-21 17:24   ` Eli Zaretskii
2011-06-21 17:59     ` Ehud Karni
2011-06-21 18:10       ` Eli Zaretskii
2011-06-22 22:27       ` Stefan Monnier
2011-06-23  9:16         ` Eli Zaretskii
2011-06-25 13:25           ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).