changeset 41874:1b93abfcbd87

Don't set word syntax (the default) explicitly. Add a diacritic category. Add info for Unicode equivalents of characters in various Mule charsets and for extra Unicode characters. Don't define specific categories for Indian/Devanagari, since they aren't used.
author Dave Love <fx@gnu.org>
date Fri, 07 Dec 2001 14:47:37 +0000
parents 16ee1ffbef65
children e31b7be17ab2
files lisp/international/characters.el
diffstat 1 files changed, 457 insertions(+), 97 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/characters.el	Fri Dec 07 14:26:02 2001 +0000
+++ b/lisp/international/characters.el	Fri Dec 07 14:47:37 2001 +0000
@@ -2,6 +2,7 @@
 
 ;; Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
+;; Copyright (C) 2001 Free Software Foundation, Inc.
 
 ;; Keywords: multibyte character, character set, syntax, category
 
@@ -90,6 +91,8 @@
 (define-category ?> "A character which can't be placed at beginning of line.")
 (define-category ?< "A character which can't be placed at end of line.")
 
+;; Combining
+(define-category ?^ "Combining diacritic or mark")
 
 ;;; Setting syntax and category.
 
@@ -108,13 +111,25 @@
 		  arabic-1-column
 		  arabic-2-column)))
   (while charsets
-    (modify-syntax-entry (make-char (car charsets)) "w")
+;;     (modify-syntax-entry (make-char (car charsets)) "w")
     (modify-category-entry (make-char (car charsets)) ?b)
     (setq charsets (cdr charsets))))
+(let ((ch #x600))
+  (while (<= ch #x6ff)
+    (modify-category-entry (decode-char 'ucs ch) ?b)
+    (setq ch (1+ ch)))
+  (setq ch #xfb50)
+  (while (<= ch #xfdff)
+    (modify-category-entry (decode-char 'ucs ch) ?b)
+    (setq ch (1+ ch)))
+  (setq ch #xfe70)
+  (while (<= ch #xfefe)
+    (modify-category-entry (decode-char 'ucs ch) ?b)
+    (setq ch (1+ ch))))
 
 ;; Chinese character set (GB2312)
 
-(modify-syntax-entry (make-char 'chinese-gb2312) "w")
+;; (modify-syntax-entry (make-char 'chinese-gb2312) "w")
 (modify-syntax-entry (make-char 'chinese-gb2312 33) "_")
 (modify-syntax-entry (make-char 'chinese-gb2312 34) "_")
 (modify-syntax-entry (make-char 'chinese-gb2312 41) "_")
@@ -132,6 +147,21 @@
 (modify-syntax-entry ?\$A!;(B ")$A!:(B")
 (modify-syntax-entry ?\$A!=(B ")$A!<(B")
 (modify-syntax-entry ?\$A!?(B ")$A!>(B")
+;; Unicode equivalents of above
+(modify-syntax-entry ?\$,2=T(B "($,2=U(B")
+(modify-syntax-entry ?\$,2=H(B "($,2=I(B")
+(modify-syntax-entry ?\$,2=J(B "($,2=K(B")
+(modify-syntax-entry ?\$,2=L(B "($,2=M(B")
+(modify-syntax-entry ?\$,2=N(B "($,2=O(B")
+(modify-syntax-entry ?\$,2=V(B "($,2=W(B")
+(modify-syntax-entry ?\$,2=P(B "($,2=Q(B")
+(modify-syntax-entry ?\$,2=U(B ")$,2=T(B")
+(modify-syntax-entry ?\$,2=I(B ")$,2=H(B")
+(modify-syntax-entry ?\$,2=K(B ")$,2=J(B")
+(modify-syntax-entry ?\$,2=M(B ")$,2=L(B")
+(modify-syntax-entry ?\$,2=O(B ")$,2=N(B")
+(modify-syntax-entry ?\$,2=W(B ")$,2=V(B")
+(modify-syntax-entry ?\$,2=Q(B ")$,2=P(B")
 
 (modify-category-entry (make-char 'chinese-gb2312) ?c)
 (modify-category-entry (make-char 'chinese-gb2312) ?\|)
@@ -149,8 +179,8 @@
 
 (let ((generic-big5-1-char (make-char 'chinese-big5-1))
       (generic-big5-2-char (make-char 'chinese-big5-2)))
-  (modify-syntax-entry generic-big5-1-char "w")
-  (modify-syntax-entry generic-big5-2-char "w")
+;;   (modify-syntax-entry generic-big5-1-char "w")
+;;   (modify-syntax-entry generic-big5-2-char "w")
 
   (modify-category-entry generic-big5-1-char ?c)
   (modify-category-entry generic-big5-2-char ?c)
@@ -174,7 +204,7 @@
       generic-char)
   (while cns-list
     (setq generic-char (make-char (car cns-list)))
-    (modify-syntax-entry generic-char "w")
+;;     (modify-syntax-entry generic-char "w")
     (modify-category-entry generic-char ?c)
     (modify-category-entry generic-char ?C)
     (modify-category-entry generic-char ?|)
@@ -234,44 +264,103 @@
   (set-case-syntax-pair ?,LL(B ?,Ll(B tbl)
   (set-case-syntax-pair ?,LM(B ?,Lm(B tbl)
   (set-case-syntax-pair ?,LN(B ?,Ln(B tbl)
-  (set-case-syntax-pair ?,LO(B ?,Lo(B tbl))
+  (set-case-syntax-pair ?,LO(B ?,Lo(B tbl)
+  (set-case-syntax-pair ?$,1(!(B ?$,1(q(B tbl)
+  (set-case-syntax-pair ?$,1("(B ?$,1(r(B tbl)
+  (set-case-syntax-pair ?$,1(#(B ?$,1(s(B tbl)
+  (set-case-syntax-pair ?$,1($(B ?$,1(t(B tbl)
+  (set-case-syntax-pair ?$,1(%(B ?$,1(u(B tbl)
+  (set-case-syntax-pair ?$,1(&(B ?$,1(v(B tbl)
+  (set-case-syntax-pair ?$,1('(B ?$,1(w(B tbl)
+  (set-case-syntax-pair ?$,1(((B ?$,1(x(B tbl)
+  (set-case-syntax-pair ?$,1()(B ?$,1(y(B tbl)
+  (set-case-syntax-pair ?$,1(*(B ?$,1(z(B tbl)
+  (set-case-syntax-pair ?$,1(+(B ?$,1({(B tbl)
+  (set-case-syntax-pair ?$,1(,(B ?$,1(|(B tbl)
+  (set-case-syntax-pair ?$,1(.(B ?$,1(~(B tbl)
+  (set-case-syntax-pair ?$,1(/(B ?$,1((B tbl)
+  (set-case-syntax-pair ?$,1(0(B ?$,1(P(B tbl)
+  (set-case-syntax-pair ?$,1(1(B ?$,1(Q(B tbl)
+  (set-case-syntax-pair ?$,1(2(B ?$,1(R(B tbl)
+  (set-case-syntax-pair ?$,1(3(B ?$,1(S(B tbl)
+  (set-case-syntax-pair ?$,1(4(B ?$,1(T(B tbl)
+  (set-case-syntax-pair ?$,1(5(B ?$,1(U(B tbl)
+  (set-case-syntax-pair ?$,1(6(B ?$,1(V(B tbl)
+  (set-case-syntax-pair ?$,1(7(B ?$,1(W(B tbl)
+  (set-case-syntax-pair ?$,1(8(B ?$,1(X(B tbl)
+  (set-case-syntax-pair ?$,1(9(B ?$,1(Y(B tbl)
+  (set-case-syntax-pair ?$,1(:(B ?$,1(Z(B tbl)
+  (set-case-syntax-pair ?$,1(;(B ?$,1([(B tbl)
+  (set-case-syntax-pair ?$,1(<(B ?$,1(\(B tbl)
+  (set-case-syntax-pair ?$,1(=(B ?$,1(](B tbl)
+  (set-case-syntax-pair ?$,1(>(B ?$,1(^(B tbl)
+  (set-case-syntax-pair ?$,1(?(B ?$,1(_(B tbl)
+  (set-case-syntax-pair ?$,1(@(B ?$,1(`(B tbl)
+  (set-case-syntax-pair ?$,1(A(B ?$,1(a(B tbl)
+  (set-case-syntax-pair ?$,1(B(B ?$,1(b(B tbl)
+  (set-case-syntax-pair ?$,1(C(B ?$,1(c(B tbl)
+  (set-case-syntax-pair ?$,1(D(B ?$,1(d(B tbl)
+  (set-case-syntax-pair ?$,1(E(B ?$,1(e(B tbl)
+  (set-case-syntax-pair ?$,1(F(B ?$,1(f(B tbl)
+  (set-case-syntax-pair ?$,1(G(B ?$,1(g(B tbl)
+  (set-case-syntax-pair ?$,1(H(B ?$,1(h(B tbl)
+  (set-case-syntax-pair ?$,1(I(B ?$,1(i(B tbl)
+  (set-case-syntax-pair ?$,1(J(B ?$,1(j(B tbl)
+  (set-case-syntax-pair ?$,1(K(B ?$,1(k(B tbl)
+  (set-case-syntax-pair ?$,1(L(B ?$,1(l(B tbl)
+  (set-case-syntax-pair ?$,1(M(B ?$,1(m(B tbl)
+  (set-case-syntax-pair ?$,1(N(B ?$,1(n(B tbl)
+  (set-case-syntax-pair ?$,1(O(B ?$,1(o(B tbl))
 
 ;; Devanagari character set
 
-(let ((deflist	'(;; chars	syntax	category
-		  ("$(5!!!"!#(B"	"w"	?7) ; vowel-modifying diacritical mark
-					    ; chandrabindu, anuswar, visarga
-		  ("$(5!$(B-$(5!2(B"	"w"	?1) ; independent vowel
-		  ("$(5!3(B-$(5!X(B"	"w"	?0) ; consonant
-		  ("$(5!Z(B-$(5!g(B"	"w"	?8) ; matra
-		  ("$(5!q(B-$(5!z(B"	"w"	?6) ; digit
-		  ))
-      elm chars len syntax category to ch i)
-  (while deflist
-    (setq elm (car deflist))
-    (setq chars (car elm)
-	  len (length chars)
-	  syntax (nth 1 elm)
-	  category (nth 2 elm)
-	  i 0)
-    (while (< i len)
-      (if (= (aref chars i) ?-)
-	  (setq i (1+ i)
-		to (aref chars i))
-	(setq ch (aref chars i)
-	      to ch))
-      (while (<= ch to)
-	(modify-syntax-entry ch syntax)
-	(modify-category-entry ch category)
-	(setq ch (1+ ch)))
-      (setq i (1+ i)))
-    (setq deflist (cdr deflist))))
+;;; Commented out since the categories appear not to be used anywhere
+;;; and word syntax is the default.
+;; (let ((deflist	'(;; chars	syntax	category
+;; 		  ("$(5!!!"!#(B"	"w"	?7) ; vowel-modifying diacritical mark
+;; 					    ; chandrabindu, anuswar, visarga
+;; 		  ("$(5!$(B-$(5!2(B"	"w"	?1) ; independent vowel
+;; 		  ("$(5!3(B-$(5!X(B"	"w"	?0) ; consonant
+;; 		  ("$(5!Z(B-$(5!g(B"	"w"	?8) ; matra
+;; 		  ("$(5!q(B-$(5!z(B"	"w"	?6) ; digit
+;; 		  ;; Unicode equivalents
+;; 		  ("$,15A5B5C(B"	"w"	?7) ; vowel-modifying diacritical mark
+;; 					    ; chandrabindu, anuswar, visarga
+;; 		  ("$,15E(B-$,15M(B"	"w"	?1) ; independent vowel
+;; 		  ("$,15U(B-$,15y(B"	"w"	?0) ; consonant
+;; 		  ("$,15~(B-$,16)(B"	"w"	?8) ; matra
+;; 		  ("$,16F(B-$,16O(B"	"w"	?6) ; digit
+;; 		  ))
+;;       elm chars len syntax category to ch i)
+;;   (while deflist
+;;     (setq elm (car deflist))
+;;     (setq chars (car elm)
+;; 	  len (length chars)
+;; 	  syntax (nth 1 elm)
+;; 	  category (nth 2 elm)
+;; 	  i 0)
+;;     (while (< i len)
+;;       (if (= (aref chars i) ?-)
+;; 	  (setq i (1+ i)
+;; 		to (aref chars i))
+;; 	(setq ch (aref chars i)
+;; 	      to ch))
+;;       (while (<= ch to)
+;; 	(modify-syntax-entry ch syntax)
+;; 	(modify-category-entry ch category)
+;; 	(setq ch (1+ ch)))
+;;       (setq i (1+ i)))
+;;     (setq deflist (cdr deflist))))
 
 ;; Ethiopic character set
 
 (modify-category-entry (make-char 'ethiopic) ?e)
-(modify-syntax-entry (make-char 'ethiopic) "w")
-(let ((chars '(?$(3$h(B ?$(3$i(B ?$(3$j(B ?$(3$k(B ?$(3$l(B ?$(3$m(B ?$(3$n(B ?$(3$o(B ?$(3%i(B ?$(3%t(B ?$(3%u(B ?$(3%v(B ?$(3%w(B ?$(3%x(B)))
+;; (modify-syntax-entry (make-char 'ethiopic) "w")
+(dotimes (i (1+ (- #x137c #x1200)))
+  (modify-category-entry (decode-char 'ucs (+ #x1200 i)) ?e))
+(let ((chars '(?$(3$h(B ?$(3$i(B ?$(3$j(B ?$(3$k(B ?$(3$l(B ?$(3$m(B ?$(3$n(B ?$(3$o(B ?$(3%i(B ?$(3%t(B ?$(3%u(B ?$(3%v(B ?$(3%w(B ?$(3%x(B
+	       ;; Unicode equivalents of the above:
+	       ?$,1Q!(B ?$,1Q"(B ?$,1Q#(B ?$,1Q$(B ?$,1Q%(B ?$,1Q&(B ?$,1Q'(B ?$,1Q((B ?$,3op(B ?$,3o{(B ?$,3o|(B ?$,3o}(B ?$,3o~(B ?$,3o(B)))
   (while chars
     (modify-syntax-entry (car chars) ".")
     (setq chars (cdr chars))))
@@ -279,16 +368,36 @@
 ;; Greek character set (ISO-8859-7)
 
 (modify-category-entry (make-char 'greek-iso8859-7) ?g)
+(let ((c #x370))
+  (while (<= c #x3ff)
+    (modify-category-entry (decode-char 'ucs c) ?g)
+    (setq c (1+ c))))
 
-(let ((c 182))
-  (while (< c 255)
-    (modify-syntax-entry (make-char 'greek-iso8859-7 c) "w")
-    (setq c (1+ c))))
-(modify-syntax-entry (make-char 'greek-iso8859-7 160) "w") ; NBSP
+;; (let ((c 182))
+;;   (while (< c 255)
+;;     (modify-syntax-entry (make-char 'greek-iso8859-7 c) "w")
+;;     (setq c (1+ c))))
+;; (modify-syntax-entry (make-char 'greek-iso8859-7 160) "w") ; NBSP
 (modify-syntax-entry ?,F7(B ".")
 (modify-syntax-entry ?,F;(B ".")
 (modify-syntax-entry ?,F=(B ".")
 (let ((tbl (standard-case-table)))
+  ;; Fixme: non-letter syntax copied from latin-1, but that's dubious
+  ;; in several cases.
+  (set-case-syntax ?,F!(B "." tbl)
+  (set-case-syntax ?,F"(B "." tbl)
+  (set-case-syntax ?,F&(B "." tbl)
+  (set-case-syntax ?,F&(B "_" tbl)
+  (set-case-syntax ?,F'(B "." tbl)
+  (set-case-syntax ?,F)(B "_" tbl)
+  (set-case-syntax ?,F+(B "." tbl)
+  (set-case-syntax ?,F,(B "_" tbl)
+  (set-case-syntax ?,F-(B "_" tbl)
+  (set-case-syntax ?,F/(B "." tbl)
+  (set-case-syntax ?,F0(B "_" tbl)
+  (set-case-syntax ?,F1(B "_" tbl)
+;;  (set-case-syntax ?,F7(B "_" tbl)
+;;  (set-case-syntax ?,F=(B "_" tbl)
   (set-case-syntax-pair ?,FA(B ?,Fa(B tbl)
   (set-case-syntax-pair ?,FB(B ?,Fb(B tbl)
   (set-case-syntax-pair ?,FC(B ?,Fc(B tbl)
@@ -321,53 +430,94 @@
   (set-case-syntax-pair ?,F6(B ?,F\(B tbl)
   (set-case-syntax-pair ?,F8(B ?,F](B tbl)
   (set-case-syntax-pair ?,F9(B ?,F^(B tbl)
-  (set-case-syntax-pair ?,F:(B ?,F_(B tbl))
+  (set-case-syntax-pair ?,F:(B ?,F_(B tbl)
+  ;; Unicode equivalents
+  (set-case-syntax-pair ?$,1&q(B ?$,1'1(B tbl)
+  (set-case-syntax-pair ?$,1&r(B ?$,1'2(B tbl)
+  (set-case-syntax-pair ?$,1&s(B ?$,1'3(B tbl)
+  (set-case-syntax-pair ?$,1&t(B ?$,1'4(B tbl)
+  (set-case-syntax-pair ?$,1&u(B ?$,1'5(B tbl)
+  (set-case-syntax-pair ?$,1&v(B ?$,1'6(B tbl)
+  (set-case-syntax-pair ?$,1&w(B ?$,1'7(B tbl)
+  (set-case-syntax-pair ?$,1&x(B ?$,1'8(B tbl)
+  (set-case-syntax-pair ?$,1&y(B ?$,1'9(B tbl)
+  (set-case-syntax-pair ?$,1&z(B ?$,1':(B tbl)
+  (set-case-syntax-pair ?$,1&{(B ?$,1';(B tbl)
+  (set-case-syntax-pair ?$,1&|(B ?$,1'<(B tbl)
+  (set-case-syntax-pair ?$,1&}(B ?$,1'=(B tbl)
+  (set-case-syntax-pair ?$,1&~(B ?$,1'>(B tbl)
+  (set-case-syntax-pair ?$,1&(B ?$,1'?(B tbl)
+  (set-case-syntax-pair ?$,1' (B ?$,1'@(B tbl)
+  (set-case-syntax-pair ?$,1'!(B ?$,1'A(B tbl)
+  (set-case-syntax-pair ?$,1'#(B ?$,1'C(B tbl)
+  (set-case-syntax-pair ?$,1'$(B ?$,1'D(B tbl)
+  (set-case-syntax-pair ?$,1'%(B ?$,1'E(B tbl)
+  (set-case-syntax-pair ?$,1'&(B ?$,1'F(B tbl)
+  (set-case-syntax-pair ?$,1''(B ?$,1'G(B tbl)
+  (set-case-syntax-pair ?$,1'((B ?$,1'H(B tbl)
+  (set-case-syntax-pair ?$,1')(B ?$,1'I(B tbl)
+  (set-case-syntax-pair ?$,1'*(B ?$,1'J(B tbl)
+  (set-case-syntax-pair ?$,1'+(B ?$,1'K(B tbl)
+  (set-case-syntax-pair ?$,1&o(B ?$,1'N(B tbl)
+  (set-case-syntax-pair ?$,1&n(B ?$,1'M(B tbl)
+  (set-case-syntax-pair ?$,1&l(B ?$,1'L(B tbl)
+  (set-case-syntax-pair ?$,1&f(B ?$,1',(B tbl)
+  (set-case-syntax-pair ?$,1&h(B ?$,1'-(B tbl)
+  (set-case-syntax-pair ?$,1&i(B ?$,1'.(B tbl)
+  (set-case-syntax-pair ?$,1&j(B ?$,1'/(B tbl))
 
 ;; Hebrew character set (ISO-8859-8)
 
-(modify-category-entry (make-char 'hebrew-iso8859-8) ?w)
+;; (modify-category-entry (make-char 'hebrew-iso8859-8) ?w)
 
-(let ((c 224))
-  (while (< c 251)
-    (modify-syntax-entry (make-char 'hebrew-iso8859-8 c) "w")
-    (setq c (1+ c))))
-(modify-syntax-entry (make-char 'hebrew-iso8859-8 160) "w") ; NBSP
+;; (let ((c 224))
+;;   (while (< c 251)
+;;     (modify-syntax-entry (make-char 'hebrew-iso8859-8 c) "w")
+;;     (setq c (1+ c))))
+;; (modify-syntax-entry (make-char 'hebrew-iso8859-8 160) "w") ; NBSP
 
 ;; Indian character set (IS 13194 and other Emacs original Indian charsets)
 
 (modify-category-entry (make-char 'indian-is13194) ?i)
 (modify-category-entry (make-char 'indian-2-column) ?I)
 (modify-category-entry (make-char 'indian-glyph) ?I)
+;; Unicode Devanagari block
+(let ((c #x901))
+  (while (<= c #x970)
+    (modify-category-entry (decode-char 'ucs c) ?i)
+    (setq c (1+ c))))
 
-(let ((deflist	
-	'(;; chars	syntax	category
-	  ("(5!"#(B"	"w"	?7) ; vowel-modifying diacritical mark
-				    ; chandrabindu, anuswar, visarga
-	  ("(5$(B-(52(B"	"w"	?1) ; base (independent) vowel
-	  ("(53(B-(5X(B"	"w"	?0) ; consonant
-	  ("(5Z(B-(5g(B"	"w"	?8) ; matra
-	  ("(5q(B-(5z(B"	"w"	?6) ; digit
-	  ))
-      elm chars len syntax category to ch i)
-  (while deflist
-    (setq elm (car deflist))
-    (setq chars (car elm)
-	  len (length chars)
-	  syntax (nth 1 elm)
-	  category (nth 2 elm)
-	  i 0)
-    (while (< i len)
-      (if (= (aref chars i) ?-)
-	  (setq i (1+ i)
-		to (aref chars i))
-	(setq ch (aref chars i)
-	      to ch))
-      (while (<= ch to)
-	(modify-syntax-entry ch syntax)
-	(modify-category-entry ch category)
-	(setq ch (1+ ch)))
-      (setq i (1+ i)))
-    (setq deflist (cdr deflist))))
+;;; Commented out since the categories appear not to be used anywhere
+;;; and word syntax is the default.
+;; (let ((deflist				;
+;; 	'(;; chars	syntax	category
+;; 	  ("(5!"#(B"	"w"	?7) ; vowel-modifying diacritical mark
+;; 				    ; chandrabindu, anuswar, visarga
+;; 	  ("(5$(B-(52(B"	"w"	?1) ; base (independent) vowel
+;; 	  ("(53(B-(5X(B"	"w"	?0) ; consonant
+;; 	  ("(5Z(B-(5g(B"	"w"	?8) ; matra
+;; 	  ("(5q(B-(5z(B"	"w"	?6) ; digit
+;; 	  ))
+;;       elm chars len syntax category to ch i)
+;;   (while deflist
+;;     (setq elm (car deflist))
+;;     (setq chars (car elm)
+;; 	  len (length chars)
+;; 	  syntax (nth 1 elm)
+;; 	  category (nth 2 elm)
+;; 	  i 0)
+;;     (while (< i len)
+;;       (if (= (aref chars i) ?-)
+;; 	  (setq i (1+ i)
+;; 		to (aref chars i))
+;; 	(setq ch (aref chars i)
+;; 	      to ch))
+;;       (while (<= ch to)
+;; 	(modify-syntax-entry ch syntax)
+;; 	(modify-category-entry ch category)
+;; 	(setq ch (1+ ch)))
+;;       (setq i (1+ i)))
+;;     (setq deflist (cdr deflist))))
 
 
 ;; Japanese character set (JISX0201-kana, JISX0201-roman, JISX0208, JISX0212)
@@ -381,15 +531,41 @@
 (modify-category-entry (make-char 'japanese-jisx0208) ?\|)
 (modify-category-entry (make-char 'japanese-jisx0212) ?\|)
 
+;; Unicode equivalents of JISX0201-kana
+(let ((c #xff61))
+  (while (<= c #xff9f)
+    (modify-category-entry (decode-char 'ucs c) ?k)
+    (modify-category-entry (decode-char 'ucs c) ?j)
+    (modify-category-entry (decode-char 'ucs c) ?\|)
+    (setq c (1+ c))))
+
+;; Katakana block
+(let ((c #x30a0))
+  (while (<= c #x30ff)
+    ;; ?K is double width, ?k isn't specified
+    (modify-category-entry (decode-char 'ucs c) ?k)
+    (modify-category-entry (decode-char 'ucs c) ?j)
+    (modify-category-entry (decode-char 'ucs c) ?\|) 
+    (setq c (1+ c))))
+
+;; Hiragana block
+(let ((c #x3040))
+  (while (<= c #x309f)
+    ;; ?H is actually defined to be double width
+    (modify-category-entry (decode-char 'ucs c) ?H)
+    ;;(modify-category-entry (decode-char 'ucs c) ?j)
+    (modify-category-entry (decode-char 'ucs c) ?\|) 
+    (setq c (1+ c))))
+
 ;; JISX0208
-(modify-syntax-entry (make-char 'japanese-jisx0208) "w")
+;; (modify-syntax-entry (make-char 'japanese-jisx0208) "w")
 (modify-syntax-entry (make-char 'japanese-jisx0208 33) "_")
 (modify-syntax-entry (make-char 'japanese-jisx0208 34) "_")
 (modify-syntax-entry (make-char 'japanese-jisx0208 40) "_")
-(let ((chars '(?$B!<(B ?$B!+(B ?$B!,(B ?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B)))
-  (while chars
-    (modify-syntax-entry (car chars) "w")
-    (setq chars (cdr chars))))
+;; (let ((chars '(?$B!<(B ?$B!+(B ?$B!,(B ?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B)))
+;;   (while chars
+;;     (modify-syntax-entry (car chars) "w")
+;;     (setq chars (cdr chars))))
 (modify-syntax-entry ?\$B!J(B "($B!K(B")
 (modify-syntax-entry ?\$B!N(B "($B!O(B")
 (modify-syntax-entry ?\$B!P(B "($B!Q(B")
@@ -422,7 +598,7 @@
     (setq chars (cdr chars))))
 
 ;; JISX0212
-(modify-syntax-entry (make-char 'japanese-jisx0212) "w")
+;; (modify-syntax-entry (make-char 'japanese-jisx0212) "w")
 (modify-syntax-entry (make-char 'japanese-jisx0212 33) "_")
 (modify-syntax-entry (make-char 'japanese-jisx0212 34) "_")
 (modify-syntax-entry (make-char 'japanese-jisx0212 35) "_")
@@ -430,8 +606,10 @@
 (modify-category-entry (make-char 'japanese-jisx0212 ) ?C)
 
 ;; JISX0201-Kana
-(modify-syntax-entry (make-char 'katakana-jisx0201) "w")
-(let ((chars '(?(I!(B ?(I$(B ?(I%(B)))
+;; (modify-syntax-entry (make-char 'katakana-jisx0201) "w")
+(let ((chars '(?(I!(B ?(I$(B ?(I%(B
+	       ;; Unicode:
+	       ?$,3sa(B ?$,3sd(B ?$,3se(B)))
   (while chars
     (modify-syntax-entry (car chars) ".")
     (setq chars (cdr chars))))
@@ -441,7 +619,7 @@
 
 ;; Korean character set (KSC5601)
 
-(modify-syntax-entry (make-char 'korean-ksc5601) "w")
+;; (modify-syntax-entry (make-char 'korean-ksc5601) "w")
 (modify-syntax-entry (make-char 'korean-ksc5601 33) "_")
 (modify-syntax-entry (make-char 'korean-ksc5601 34) "_")
 (modify-syntax-entry (make-char 'korean-ksc5601 38) "_")
@@ -477,6 +655,8 @@
 ;; Lao character set
 
 (modify-category-entry (make-char 'lao) ?o)
+(dotimes (i (1+ (- #xeff #xe80)))
+  (modify-category-entry (decode-char 'ucs (+ i #xe80)) ?o))
 
 (let ((deflist	'(;; chars	syntax	category
 		  ("(1!(B-(1N(B"	"w"	?0) ; consonant
@@ -487,6 +667,15 @@
 		  ("(1\(B"		"w"	?9) ; semivowel lower
 		  ("(1p(B-(1y(B"	"w"	?6) ; digit
 		  ("(1Of(B"		"_"	?5) ; symbol
+		  ;; Unicode equivalents
+		  ("$,1D!(B-$,1DN(B"	"w"	?0) ; consonant
+		  ("$,1DPDRDSD]D`(B-$,1Dd(B"	"w"	?1) ; vowel base
+		  ("$,1DQDT(B-$,1DWD[Dm(B"	"w"	?2) ; vowel upper
+		  ("$,1DXDY(B"	"w"	?3) ; vowel lower
+		  ("$,1Dh(B-$,1Dk(B"	"w"	?4) ; tone mark 
+		  ("$,1D\D](B"	"w"	?9) ; semivowel lower
+		  ("$,1Dp(B-$,1Dy(B"	"w"	?6) ; digit
+		  ("$,1DODf(B"	"_"	?5) ; symbol
 		  ))
       elm chars len syntax category to ch i)
   (while deflist
@@ -503,7 +692,8 @@
 	(setq ch (aref chars i)
 	      to ch))
       (while (<= ch to)
-	(modify-syntax-entry ch syntax)
+	(unless (string-equal syntax "w")
+	  (modify-syntax-entry ch syntax))
 	(modify-category-entry ch category)
 	(setq ch (1+ ch)))
       (setq i (1+ i)))
@@ -512,6 +702,8 @@
 ;; Thai character set (TIS620)
 
 (modify-category-entry (make-char 'thai-tis620) ?t)
+(dotimes (i (1+ (- #xe7f #xe00)))
+  (modify-category-entry (decode-char 'ucs (+ i #xe00)) ?t))
 
 (let ((deflist	'(;; chars	syntax	category
 		  (",T!(B-,TCEG(B-,TN(B"	"w"	?0) ; consonant
@@ -521,6 +713,14 @@
 		  (",Th(B-,Tm(B"	"w"	?4) ; tone mark 
 		  (",Tp(B-,Ty(B"	"w"	?6) ; digit
 		  (",TOf_oz{(B"	"_"	?5) ; symbol
+		  ;; Unicode equivalents
+		  ("$,1Ba(B-$,1C#C%C'(B-$,1C.(B"	"w"	?0) ; consonant
+		  ("$,1C$C&C0C2C3C@(B-$,1CE(B"	"w"	?1) ; vowel base
+		  ("$,1C1C4(B-$,1C7CGCN(B"	"w"	?2) ; vowel upper
+		  ("$,1C8(B-$,1C:(B"	"w"	?3) ; vowel lower
+		  ("$,1CH(B-$,1CM(B"	"w"	?4) ; tone mark 
+		  ("$,1CP(B-$,1CY(B"	"w"	?6) ; digit
+		  ("$,1C/CFC?COCZC[(B"	"_"	?5) ; symbol
 		  ))
       elm chars len syntax category to ch i)
   (while deflist
@@ -537,7 +737,8 @@
 	(setq ch (aref chars i)
 	      to ch))
       (while (<= ch to)
-	(modify-syntax-entry ch syntax)
+	(unless (string-equal syntax "w")
+	  (modify-syntax-entry ch syntax))
 	(modify-category-entry ch category)
 	(setq ch (1+ ch)))
       (setq i (1+ i)))
@@ -547,9 +748,11 @@
 
 (modify-category-entry (make-char 'tibetan) ?q)
 (modify-category-entry (make-char 'tibetan-1-column) ?q)
+(dotimes (i (1+ (- #xfff #xf00)))
+  (modify-category-entry (decode-char 'ucs (+ i #xf00)) ?q))
 
 (let ((deflist	'(;; chars             syntax category
-		  ("$(7"!(B-$(7"J"K(B"        	"w"	?0) ; consonant
+		  ("4$(7"!0"!1(B-4$(7"J0"J14"K0"K1(B"        	"w"	?0) ; consonant
 		  ("$(7#!(B-$(7#J#K#L#M!"!#(B"       "w"     ?0) ;
 		  ("$(7$!(B-$(7$e(B"              "w"     ?0) ;
 		  ("$(7%!(B-$(7%u(B"              "w"     ?0) ;
@@ -563,6 +766,18 @@
 		  ("$(8!;!=!?!@!A!D"`(B"            "."     ?>) ;
 		  ("$(7!0(B-$(7!:!l#R#S"f(B"      "."     ?<) ; prohibition
 		  ("$(7!C!E(B-$(7!H!J(B-$(7!O!f!h(B-$(7!k!n!o#O#P(B-$(7#`(B" "." ?q) ; others
+
+		  ;; Unicode version (not complete)
+		  ("$,1F (B-$,1FIFJ(B"        	"w"	?0) ; consonant
+		  ("$,1Fp(B-$,1G9G:G;G<(B"       "w"     ?0) ;
+		  ("$,1FRFZF[F\F]F`(B"       "w"	?2) ; upper vowel
+		  ("$,1F^FbFcFfFgFhFiFjFk(B" "w"	?2) ; upper modifier
+		  ("$,1EYFPFQFTFdEuEw(B"       "w"	?3) ; lowel vowel/modifier
+		  ("$,1E`(B-$,1EiEj(B-$,1Es(B"	        "w"	?6) ; digit
+		  ("$,1EKEM(B-$,1ERETF_(B"        "."     ?|) ; line-break char
+		  ("$,1EHEKEM(B-$,1ERETF_E}Et(B"  "."     ?>) ; prohibition
+		  ("$,1E@(B-$,1EJE|GAGBFe(B"      "."     ?<) ; prohibition
+		  ("$,1ESEU(B-$,1EXEZ(B-$,1E_EvEx(B-$,1E{E~EG>G?(B-$,1GO(B" "." ?q) ; others
 		  ))
       elm chars len syntax category to ch i)
   (while deflist
@@ -579,7 +794,8 @@
 	(setq ch (aref chars i)
 	      to ch))
       (while (<= ch to)
-	(modify-syntax-entry ch syntax)
+	(unless (string-equal syntax "w")
+	  (modify-syntax-entry ch syntax))
 	(modify-category-entry ch category)
 	(setq ch (1+ ch)))
       (setq i (1+ i)))
@@ -589,8 +805,8 @@
 
 (let ((lower (make-char 'vietnamese-viscii-lower))
       (upper (make-char 'vietnamese-viscii-upper)))
-  (modify-syntax-entry lower "w")
-  (modify-syntax-entry upper "w")
+;;   (modify-syntax-entry lower "w")
+;;   (modify-syntax-entry upper "w")
   (modify-category-entry lower ?v)
   (modify-category-entry upper ?v)
   (modify-category-entry lower ?l)	; To make a word with
@@ -615,8 +831,6 @@
 ;; Thus we have to check language-environment to handle casing
 ;; correctly.  Currently only I<->i is available.
 
-;; case-syntax-pair's are not yet given for Latin Extendet-B
-
   ;; Latin Extended-A, Latin Extended-B
   (setq c #x0100)
   (while (<= c #x0233)
@@ -640,6 +854,102 @@
   (set-case-syntax-pair ?$,1!;(B ?$,1!<(B tbl)
   (set-case-syntax-pair ?$,1!=(B ?$,1!>(B tbl)
 
+  ;; Latin Extended-B
+  (set-case-syntax-pair ?$,1!A(B ?$,1#S(B tbl)
+  (set-case-syntax-pair ?$,1!B(B ?$,1!C(B tbl)
+  (set-case-syntax-pair ?$,1!D(B ?$,1!E(B tbl)
+  (set-case-syntax-pair ?$,1!F(B ?$,1#T(B tbl)
+  (set-case-syntax-pair ?$,1!G(B ?$,1!H(B tbl)
+  (set-case-syntax-pair ?$,1!I(B ?$,1#V(B tbl)
+  (set-case-syntax-pair ?$,1!J(B ?$,1#W(B tbl)
+  (set-case-syntax-pair ?$,1!K(B ?$,1!L(B tbl)
+  (set-case-syntax-pair ?$,1!N(B ?$,1"=(B tbl)
+  (set-case-syntax-pair ?$,1!O(B ?$,1#Y(B tbl)
+  (set-case-syntax-pair ?$,1!P(B ?$,1#[(B tbl)
+  (set-case-syntax-pair ?$,1!Q(B ?$,1!R(B tbl)
+  (set-case-syntax-pair ?$,1!S(B ?$,1#`(B tbl)
+  (set-case-syntax-pair ?$,1!T(B ?$,1#c(B tbl)
+  (set-case-syntax-pair ?$,1!V(B ?$,1#i(B tbl)
+  (set-case-syntax-pair ?$,1!W(B ?$,1#h(B tbl)
+  (set-case-syntax-pair ?$,1!X(B ?$,1!Y(B tbl)
+  (set-case-syntax-pair ?$,1!\(B ?$,1#o(B tbl)
+  (set-case-syntax-pair ?$,1!](B ?$,1#r(B tbl)
+  (set-case-syntax-pair ?$,1!_(B ?$,1#u(B tbl)
+  (set-case-syntax-pair ?$,1!`(B ?$,1!a(B tbl)
+  (set-case-syntax-pair ?$,1!b(B ?$,1!c(B tbl)
+  (set-case-syntax-pair ?$,1!d(B ?$,1!e(B tbl)
+  (set-case-syntax-pair ?$,1!f(B ?$,1$ (B tbl)
+  (set-case-syntax-pair ?$,1!g(B ?$,1!h(B tbl)
+  (set-case-syntax-pair ?$,1!i(B ?$,1$#(B tbl)
+  (set-case-syntax-pair ?$,1!l(B ?$,1!m(B tbl)
+  (set-case-syntax-pair ?$,1!n(B ?$,1$((B tbl)
+  (set-case-syntax-pair ?$,1!o(B ?$,1!p(B tbl)
+  (set-case-syntax-pair ?$,1!q(B ?$,1$*(B tbl)
+  (set-case-syntax-pair ?$,1!r(B ?$,1$+(B tbl)
+  (set-case-syntax-pair ?$,1!s(B ?$,1!t(B tbl)
+  (set-case-syntax-pair ?$,1!u(B ?$,1!v(B tbl)
+  (set-case-syntax-pair ?$,1!w(B ?$,1$2(B tbl)
+  (set-case-syntax-pair ?$,1!x(B ?$,1!y(B tbl)
+  (set-case-syntax-pair ?$,1!|(B ?$,1!}(B tbl)
+  (set-case-syntax-pair ?$,1"$(B ?$,1"&(B tbl)
+  (set-case-syntax-pair ?$,1"%(B ?$,1"&(B tbl)
+  (set-case-syntax-pair ?$,1"'(B ?$,1")(B tbl)
+  (set-case-syntax-pair ?$,1"((B ?$,1")(B tbl)
+  (set-case-syntax-pair ?$,1"*(B ?$,1",(B tbl)
+  (set-case-syntax-pair ?$,1"+(B ?$,1",(B tbl)
+  (set-case-syntax-pair ?$,1"-(B ?$,1".(B tbl)
+  (set-case-syntax-pair ?$,1"/(B ?$,1"0(B tbl)
+  (set-case-syntax-pair ?$,1"1(B ?$,1"2(B tbl)
+  (set-case-syntax-pair ?$,1"3(B ?$,1"4(B tbl)
+  (set-case-syntax-pair ?$,1"5(B ?$,1"6(B tbl)
+  (set-case-syntax-pair ?$,1"7(B ?$,1"8(B tbl)
+  (set-case-syntax-pair ?$,1"9(B ?$,1":(B tbl)
+  (set-case-syntax-pair ?$,1";(B ?$,1"<(B tbl)
+  (set-case-syntax-pair ?$,1">(B ?$,1"?(B tbl)
+  (set-case-syntax-pair ?$,1"@(B ?$,1"A(B tbl)
+  (set-case-syntax-pair ?$,1"B(B ?$,1"C(B tbl)
+  (set-case-syntax-pair ?$,1"D(B ?$,1"E(B tbl)
+  (set-case-syntax-pair ?$,1"F(B ?$,1"G(B tbl)
+  (set-case-syntax-pair ?$,1"H(B ?$,1"I(B tbl)
+  (set-case-syntax-pair ?$,1"J(B ?$,1"K(B tbl)
+  (set-case-syntax-pair ?$,1"L(B ?$,1"M(B tbl)
+  (set-case-syntax-pair ?$,1"N(B ?$,1"O(B tbl)
+  ;; 01F0; F; 006A 030C; # LATIN SMALL LETTER J WITH CARON
+  (set-case-syntax-pair ?$,1"Q(B ?$,1"S(B tbl)
+  (set-case-syntax-pair ?$,1"R(B ?$,1"S(B tbl)
+  (set-case-syntax-pair ?$,1"T(B ?$,1"U(B tbl)
+  (set-case-syntax-pair ?$,1"V(B ?$,1!U(B tbl)
+  (set-case-syntax-pair ?$,1"W(B ?$,1!(B tbl)
+  (set-case-syntax-pair ?$,1"X(B ?$,1"Y(B tbl)
+  (set-case-syntax-pair ?$,1"Z(B ?$,1"[(B tbl)
+  (set-case-syntax-pair ?$,1"\(B ?$,1"](B tbl)
+  (set-case-syntax-pair ?$,1"^(B ?$,1"_(B tbl)
+  (set-case-syntax-pair ?$,1"`(B ?$,1"a(B tbl)
+  (set-case-syntax-pair ?$,1"b(B ?$,1"c(B tbl)
+  (set-case-syntax-pair ?$,1"d(B ?$,1"e(B tbl)
+  (set-case-syntax-pair ?$,1"f(B ?$,1"g(B tbl)
+  (set-case-syntax-pair ?$,1"h(B ?$,1"i(B tbl)
+  (set-case-syntax-pair ?$,1"j(B ?$,1"k(B tbl)
+  (set-case-syntax-pair ?$,1"l(B ?$,1"m(B tbl)
+  (set-case-syntax-pair ?$,1"n(B ?$,1"o(B tbl)
+  (set-case-syntax-pair ?$,1"p(B ?$,1"q(B tbl)
+  (set-case-syntax-pair ?$,1"r(B ?$,1"s(B tbl)
+  (set-case-syntax-pair ?$,1"t(B ?$,1"u(B tbl)
+  (set-case-syntax-pair ?$,1"v(B ?$,1"w(B tbl)
+  (set-case-syntax-pair ?$,1"x(B ?$,1"y(B tbl)
+  (set-case-syntax-pair ?$,1"z(B ?$,1"{(B tbl)
+  (set-case-syntax-pair ?$,1"|(B ?$,1"}(B tbl)
+  (set-case-syntax-pair ?$,1"~(B ?$,1"(B tbl)
+  (set-case-syntax-pair ?$,1#"(B ?$,1##(B tbl)
+  (set-case-syntax-pair ?$,1#$(B ?$,1#%(B tbl)
+  (set-case-syntax-pair ?$,1#&(B ?$,1#'(B tbl)
+  (set-case-syntax-pair ?$,1#((B ?$,1#)(B tbl)
+  (set-case-syntax-pair ?$,1#*(B ?$,1#+(B tbl)
+  (set-case-syntax-pair ?$,1#,(B ?$,1#-(B tbl)
+  (set-case-syntax-pair ?$,1#.(B ?$,1#/(B tbl)
+  (set-case-syntax-pair ?$,1#0(B ?$,1#1(B tbl)
+  (set-case-syntax-pair ?$,1#2(B ?$,1#3(B tbl)
+
   ;; Latin Extended Additional
   (setq c #x1e00)
   (while (<= c #x1ef9)
@@ -672,6 +982,13 @@
   (set-case-syntax-pair ?$,1&n(B ?$,1'M(B tbl)
   (set-case-syntax-pair ?$,1&o(B ?$,1'N(B tbl)
 
+  ;; Armenian
+  (setq c #x531)
+  (while (<= c #x556)
+    (set-case-syntax-pair (decode-char 'ucs c)
+			  (decode-char 'ucs (+ c #x30)) tbl)
+    (setq c (1+ c)))
+
   ;; Greek Extended
   (setq c #x1f00)
   (while (<= c #x1fff)
@@ -742,8 +1059,51 @@
   (while (<= c #x2027)
     (set-case-syntax c "_" tbl)
     (setq c (1+ c)))
+
+  ;; Roman numerals
+  (setq c #x2160)
+  (while (<= c #x216f)
+    (set-case-syntax-pair (decode-char 'ucs c)
+			  (decode-char 'ucs (+ c #x10)) tbl)
+    (setq c (1+ c)))
+
+  ;; Circled Latin
+  (setq c #x24b6)
+  (while (<= c #x24cf)
+    (set-case-syntax-pair (decode-char 'ucs c)
+			  (decode-char 'ucs (+ c 26)) tbl)
+    (modify-category-entry (decode-char 'ucs c) ?l)
+    (modify-category-entry (decode-char 'ucs (+ c 26)) ?l)
+    (setq c (1+ c)))
+
+  ;; Fullwidth Latin
+  (setq c #xff21)
+  (while (<= c #xff3a)
+    (set-case-syntax-pair (decode-char 'ucs c)
+			  (decode-char 'ucs (+ c #x20)) tbl)
+    (modify-category-entry (decode-char 'ucs c) ?l)
+    (modify-category-entry (decode-char 'ucs (+ c #x20)) ?l)
+    (setq c (1+ c)))
+
+  ;; Ohm, Kelvin, Angstrom
+  (set-case-syntax-pair ?$,1uf(B ?$,1'I(B tbl)
+  (set-case-syntax-pair ?$,1uj(B ?k tbl)
+  (set-case-syntax-pair ?$,1uk(B ?,Ae(B tbl)
+
+  ;; Combining diacritics
+  (setq c #x300)
+  (while (<= c #x362)
+    (modify-category-entry (decode-char 'ucs c) ?^)
+    (setq c (1+ c)))
+
+  ;; Combining marks
+  (setq c #x20d0)
+  (while (<= c #x20e3)
+    (modify-category-entry (decode-char 'ucs c) ?^)
+    (setq c (1+ c)))
+
+  ;; Fixme: syntax for symbols &c
   )
-
 
 ;;; Setting word boundary.
 
@@ -815,8 +1175,8 @@
 
 
 ;; Setup auto-fill-chars for charsets that should invoke auto-filling.
-;; SPACE and NEWLIE are already set.  Also put `nospace-between-words'
-;; property to the charsets.
+;; SPACE and NEWLINE are already set.  Also put `nospace-between-words'
+;; property on the charsets.
 (let ((l '(katakana-jisx0201
 	   japanese-jisx0208 japanese-jisx0212
 	   chinese-gb2312 chinese-big5-1 chinese-big5-2)))