all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function	`string-mark-left-to-right' for handling LRMs.
Date: Fri, 12 Aug 2011 10:21:16 +0300	[thread overview]
Message-ID: <8362m3xfgz.fsf@gnu.org> (raw)
In-Reply-To: <87aabfojr7.fsf@stupidchicken.com>

> From: Chong Yidong <cyd@stupidchicken.com>
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Thu, 11 Aug 2011 15:01:16 -0400
> 
> OK, so basically we have to scan the entire string like this, right?

Yes.

Btw, is there a way to regex-search for a character by its bidi
category?  That would make the code more elegant, and probably quite
faster as well.

>   (let ((len (length str))
> 	(n 0)
> 	rtl-found)
>     (while (and (not rtl-found) (< n len))
>       (setq rtl-found (memq (get-char-code-property
> 			     (aref str n) 'bidi-class) '(R AL))
                                                       ^^^^^^^
Make that '(R AL RLO), since the RLO character overrides the
bidirectional properties of all the following characters with R.

> > And since buffer-menu.el was already modified to use this function, it
> > is easy to see how this algorithm fails: make a buffer whose name is
> > made of all R2L characters with the "<1>" tail appended, then type
> > "C-x C-b" and watch the messed-up display.  The original code treated
> > this case correctly.
> 
> Actually, it looks as though the <1> is not treated properly, even with
> the old code.  If I do
> 
>     (rename-buffer (concat "السّلام عليكم"
> 			   "<1>"))
> 
> then the buffer is displayed as 1>[some Arabic text]>, both in the
> mode-line and in the buffer menu.

I didn't mean the display of the buffer name itself; that is a
separate issue, as discussed here:

  https://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00712.html

I meant the buffer menu layout: with the current bzr tip, the buffer
size was displayed to the left of the buffer name, whereas the
previous code displayed it to the right of the name, as with buffer
names without R2L characters.

> For extra hilarity, get rid of the newline in this code fragment and
> watch as the redisplayed Emacs Lisp code turns into gibberish...

That's one of the problems that are not yet solved in Emacs: how to
display code with comments and strings in R2L languages without
messing up the display and without giving up the reordering of the
strings and comments.




  reply	other threads:[~2011-08-12  7:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1QrEHF-0003qX-I0@vcs.savannah.gnu.org>
2011-08-11  2:14 ` [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs Stefan Monnier
2011-08-11  3:02   ` Eli Zaretskii
2011-08-11  4:48     ` Eli Zaretskii
2011-08-11 19:01       ` Chong Yidong
2011-08-12  7:21         ` Eli Zaretskii [this message]
2011-08-12 15:47           ` Chong Yidong
2011-08-12 15:54             ` Eli Zaretskii
2011-08-12 16:00               ` Chong Yidong
2011-08-12 17:25                 ` Eli Zaretskii
2011-08-13  7:00           ` Kenichi Handa
2011-08-13  7:11             ` Eli Zaretskii
2011-08-13  7:42               ` Kenichi Handa
2011-08-13 13:53                 ` Stefan Monnier
2011-08-14 16:21                   ` Chong Yidong
2011-08-16  7:44                 ` Eli Zaretskii
2011-08-16 23:57                   ` Kenichi Handa
2011-08-17  5:49                     ` Eli Zaretskii
2011-08-17  7:21                       ` Kenichi Handa
2011-08-17  9:15                         ` Eli Zaretskii
2011-08-18  2:13                           ` Kenichi Handa
2011-08-17 21:12                         ` Chong Yidong
2011-08-18  7:09                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8362m3xfgz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.