all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>,
	emacs-devel@gnu.org, Kenichi Handa <handa@m17n.org>
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New	function	`string-mark-left-to-right' for handling LRMs.
Date: Sun, 14 Aug 2011 12:21:03 -0400	[thread overview]
Message-ID: <87liuwhsls.fsf@stupidchicken.com> (raw)
In-Reply-To: <jwv62m15sj2.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 13 Aug 2011 09:53:24 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> We could also add a new special regexp construct, similar to \c but
> for Unicode properties.  The advantage being that it lets us use the
> Unicode tables without having to build a new category table that keeps
> another copy of it, and without having to use "(with-category-table
> special-category-table-for-bidi".

We can put it in the standard category table.  This works:

=== modified file 'lisp/international/characters.el'
*** lisp/international/characters.el	2011-07-06 22:43:48 +0000
--- lisp/international/characters.el	2011-08-14 02:21:19 +0000
***************
*** 114,119 ****
--- 114,123 ----
  Base characters (Unicode General Category L,N,P,S,Zs)")
  (define-category ?^ "Combining
  Combining diacritic or mark (Unicode General Category M)")
+ 
+ ;; RTL scripts
+ (define-category ?R "Right-to-left
+ Characters with R, AL, or RLO bidi type.")
  \f
  ;;; Setting syntax and category.
  
***************
*** 478,483 ****
--- 482,494 ----
  		  (modify-category-entry x category))
  	      chars)))))
  
+ ;; RTL scripts.
+ 
+ (map-char-table (lambda (key val)
+ 		  (if (memq val '(R AL RLO))
+ 		      (modify-category-entry key ?R)))
+ 		(unicode-property-table-internal 'bidi-class))
+ 
  ;; Latin
  
  (modify-category-entry '(#x80 . #x024F) ?l)

=== modified file 'lisp/subr.el'
*** lisp/subr.el	2011-08-12 15:43:30 +0000
--- lisp/subr.el	2011-08-13 15:42:16 +0000
***************
*** 3553,3568 ****
  If STR contains no RTL characters, return STR."
    (unless (stringp str)
      (signal 'wrong-type-argument (list 'stringp str)))
!   (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 RLO))
! 	    n (1+ n)))
!     (if rtl-found
! 	(concat str (propertize (string ?\x200e) 'invisible t))
!       str)))
  \f
  ;;;; invisibility specs
  
--- 3553,3561 ----
  If STR contains no RTL characters, return STR."
    (unless (stringp str)
      (signal 'wrong-type-argument (list 'stringp str)))
!   (if (string-match "\\cR" str)
!       (concat str (propertize (string ?\x200e) 'invisible t))
!     str))
  \f
  ;;;; invisibility specs
  




  reply	other threads:[~2011-08-14 16: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
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 [this message]
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=87liuwhsls.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=handa@m17n.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.