[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mar
From: |
Chong Yidong |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> 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.")
;;; 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)))
;;;; 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))
;;;; invisibility specs
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., (continued)
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Chong Yidong, 2011/08/11
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/12
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Chong Yidong, 2011/08/12
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/12
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Chong Yidong, 2011/08/12
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/12
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Kenichi Handa, 2011/08/13
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/13
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Kenichi Handa, 2011/08/13
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Stefan Monnier, 2011/08/13
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs.,
Chong Yidong <=
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/16
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Kenichi Handa, 2011/08/16
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/17
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Kenichi Handa, 2011/08/17
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/17
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Kenichi Handa, 2011/08/17
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Chong Yidong, 2011/08/17
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r105429: New function `string-mark-left-to-right' for handling LRMs., Eli Zaretskii, 2011/08/18