1 ;;; characters.el --- set syntax and category for multibyte characters
3 ;; Copyright (C) 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 ;; Free Software Foundation, Inc.
5 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
8 ;; Registration Number H14PRO021
10 ;; National Institute of Advanced Industrial Science and Technology (AIST)
11 ;; Registration Number H13PRO009
13 ;; Keywords: multibyte character, character set, syntax, category
15 ;; This file is part of GNU Emacs.
17 ;; GNU Emacs is free software; you can redistribute it and/or modify
18 ;; it under the terms of the GNU General Public License as published by
19 ;; the Free Software Foundation; either version 3, or (at your option)
22 ;; GNU Emacs is distributed in the hope that it will be useful,
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;; GNU General Public License for more details.
27 ;; You should have received a copy of the GNU General Public License
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the
29 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
30 ;; Boston, MA 02110-1301, USA.
36 ;;; Predefined categories.
38 ;; For each character set.
40 (define-category ?a "ASCII graphic characters 32-126 (ISO646 IRV:1983[4/0])")
41 (define-category ?l "Latin")
42 (define-category ?t "Thai")
43 (define-category ?g "Greek")
44 (define-category ?b "Arabic")
45 (define-category ?w "Hebrew")
46 (define-category ?y "Cyrillic")
47 (define-category ?k "Japanese katakana")
48 (define-category ?r "Japanese roman")
49 (define-category ?c "Chinese")
50 (define-category ?j "Japanese")
51 (define-category ?h "Korean")
52 (define-category ?e "Ethiopic (Ge'ez)")
53 (define-category ?v "Vietnamese")
54 (define-category ?i "Indian")
55 (define-category ?o "Lao")
56 (define-category ?q "Tibetan")
58 ;; For each group (row) of 2-byte character sets.
60 (define-category ?A "Alpha-numeric characters of 2-byte character sets")
61 (define-category ?C "Chinese (Han) characters of 2-byte character sets")
62 (define-category ?G "Greek characters of 2-byte character sets")
63 (define-category ?H "Japanese Hiragana characters of 2-byte character sets")
64 (define-category ?K "Japanese Katakana characters of 2-byte character sets")
65 (define-category ?N "Korean Hangul characters of 2-byte character sets")
66 (define-category ?Y "Cyrillic characters of 2-byte character sets")
67 (define-category ?I "Indian Glyphs")
69 ;; For phonetic classifications.
71 (define-category ?0 "consonant")
72 (define-category ?1 "base (independent) vowel")
73 (define-category ?2 "upper diacritical mark (including upper vowel)")
74 (define-category ?3 "lower diacritical mark (including lower vowel)")
75 (define-category ?4 "combining tone mark")
76 (define-category ?5 "symbol")
77 (define-category ?6 "digit")
78 (define-category ?7 "vowel-modifying diacritical mark")
79 (define-category ?8 "vowel-signs")
80 (define-category ?9 "semivowel lower")
83 (define-category ?| "While filling, we can break a line at this character.")
85 ;; For indentation calculation.
87 "This character counts as a space for indentation purposes.")
89 ;; Keep the following for `kinsoku' processing. See comments in
91 (define-category ?> "A character which can't be placed at beginning of line.")
92 (define-category ?< "A character which can't be placed at end of line.")
95 (define-category ?^ "Combining diacritic or mark")
97 ;;; Setting syntax and category.
101 ;; All ASCII characters have the category `a' (ASCII) and `l' (Latin).
102 (modify-category-entry '(32 . 127) ?a)
103 (modify-category-entry '(32 . 127) ?l)
105 ;; Deal with the CJK charsets first. Since the syntax of blocks is
106 ;; defined per charset, and the charsets may contain e.g. Latin
107 ;; characters, we end up with the wrong syntax definitions if we're
110 ;; Chinese characters (Unicode)
111 (modify-category-entry '(#x2E80 . #x312F) ?|)
112 (modify-category-entry '(#x3190 . #x33FF) ?|)
113 (modify-category-entry '(#x3400 . #x9FAF) ?C)
114 (modify-category-entry '(#x3400 . #x9FAF) ?c)
115 (modify-category-entry '(#x3400 . #x9FAF) ?|)
116 (modify-category-entry '(#xF900 . #xFAFF) ?C)
117 (modify-category-entry '(#xF900 . #xFAFF) ?c)
118 (modify-category-entry '(#xF900 . #xFAFF) ?|)
119 (modify-category-entry '(#x20000 . #x2AFFF) ?|)
120 (modify-category-entry '(#x2F800 . #x2FFFF) ?|)
123 ;; Chinese character set (GB2312)
125 (map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2121 #x217E)
126 (map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2221 #x227E)
127 (map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2921 #x297E)
129 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?c)
130 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2330 #x2339)
131 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2341 #x235A)
132 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2361 #x237A)
133 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?H #x2421 #x247E)
134 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?K #x2521 #x257E)
135 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?G #x2621 #x267E)
136 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?Y #x2721 #x277E)
137 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?C #x3021 #x7E7E)
139 ;; Chinese character set (BIG5)
141 (map-charset-chars #'modify-category-entry 'big5 ?c)
142 (map-charset-chars #'modify-category-entry 'big5 ?C #xA259 #xA25F)
143 (map-charset-chars #'modify-category-entry 'big5 ?C #xA440 #xC67E)
144 (map-charset-chars #'modify-category-entry 'big5 ?C #xC940 #xF9DF)
146 ;; Chinese character set (CNS11643)
148 (dolist (c '(chinese-cns11643-1 chinese-cns11643-2 chinese-cns11643-3
149 chinese-cns11643-4 chinese-cns11643-5 chinese-cns11643-6
151 (map-charset-chars #'modify-category-entry c ?c)
152 (if (eq c 'chinese-cns11643-1)
153 (map-charset-chars #'modify-category-entry c ?C #x4421 #x7E7E)
154 (map-charset-chars #'modify-category-entry c ?C)))
156 ;; Japanese character set (JISX0201, JISX0208, JISX0212, JISX0213)
158 (map-charset-chars #'modify-category-entry 'katakana-jisx0201 ?k)
160 (map-charset-chars #'modify-category-entry 'latin-jisx0201 ?r)
162 (dolist (l '(katakana-jisx0201 japanese-jisx0208 japanese-jisx0212
163 japanese-jisx0213-1 japanese-jisx0213-2))
164 (map-charset-chars #'modify-category-entry l ?j))
166 ;; Unicode equivalents of JISX0201-kana
167 (let ((range '(#xff61 . #xff9f)))
168 (modify-category-entry range ?k)
169 (modify-category-entry range ?j)
170 (modify-category-entry range ?\|))
173 (let ((range '(#x30a0 . #x30ff)))
174 ;; ?K is double width, ?k isn't specified
175 (modify-category-entry range ?K)
176 (modify-category-entry range ?\|))
179 (let ((range '(#x3040 . #x309d)))
180 ;; ?H is actually defined to be double width
181 ;;(modify-category-entry range ?H)
182 (modify-category-entry range ?\|)
186 (map-charset-chars #'modify-syntax-entry 'japanese-jisx0208 "_" #x2121 #x227E)
187 (map-charset-chars #'modify-syntax-entry 'japanese-jisx0208 "_" #x2821 #x287E)
188 (let ((chars '(?ー ?゛ ?゜ ?ヽ ?ヾ ?ゝ ?ゞ ?〃 ?仝 ?々 ?〆 ?〇)))
190 (modify-syntax-entry (car chars) "w")))
192 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?A #x2321 #x237E)
193 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?H #x2421 #x247E)
194 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?K #x2521 #x257E)
195 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?G #x2621 #x267E)
196 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?Y #x2721 #x277E)
197 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?C #x3021 #x7E7E)
198 (modify-category-entry ?ー ?K)
199 (let ((chars '(?゛ ?゜)))
201 (modify-category-entry (car chars) ?K)
202 (modify-category-entry (car chars) ?H)
203 (setq chars (cdr chars))))
204 (let ((chars '(?ヽ ?ヾ ?ゝ ?ゞ ?〃 ?仝 ?々 ?〆 ?〇)))
206 (modify-category-entry (car chars) ?C)
207 (setq chars (cdr chars))))
211 (map-charset-chars #'modify-syntax-entry 'japanese-jisx0212 "_" #x2121 #x237E)
215 (let ((chars '(?。 ?、 ?・)))
217 (modify-syntax-entry (car chars) ".")
218 (setq chars (cdr chars))))
220 (modify-syntax-entry ?\「 "(」")
221 (modify-syntax-entry ?\」 "(「")
223 ;; Korean character set (KSC5601)
225 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?h)
227 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2121 #x227E)
228 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2621 #x277E)
229 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2830 #x287E)
230 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2930 #x297E)
231 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2330 #x2339)
232 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2341 #x235A)
233 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2361 #x237A)
234 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?G #x2521 #x257E)
235 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?H #x2A21 #x2A7E)
236 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?K #x2B21 #x2B7E)
237 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?Y #x2C21 #x2C7E)
239 ;; These are in more than one charset.
240 (let ((parens (concat "〈〉《》「」『』【】〔〕〖〗〘〙〚〛"
244 (dotimes (i (/ (length parens) 2))
245 (setq open (aref parens (* i 2))
246 close (aref parens (1+ (* i 2))))
247 (modify-syntax-entry open (format "(%c" close))
248 (modify-syntax-entry close (format ")%c" open))))
250 ;; Arabic character set
252 (let ((charsets '(arabic-iso8859-6
257 (map-charset-chars #'modify-category-entry (car charsets) ?b)
258 (setq charsets (cdr charsets))))
259 (modify-category-entry '(#x600 . #x6ff) ?b)
260 (modify-category-entry '(#xfb50 . #xfdff) ?b)
261 (modify-category-entry '(#xfe70 . #xfefe) ?b)
263 ;; Cyrillic character set (ISO-8859-5)
265 (modify-syntax-entry ?№ ".")
267 ;; Ethiopic character set
269 (modify-category-entry '(#x1200 . #x1399) ?e)
270 (modify-category-entry '(#x2d80 . #x2dde) ?e)
271 (let ((chars '(?፡ ?። ?፣ ?፤ ?፥ ?፦ ?፧ ?፨ ? ? ? ? ? ?)))
273 (modify-syntax-entry (car chars) ".")
274 (setq chars (cdr chars))))
275 (map-charset-chars #'modify-category-entry 'ethiopic ?e)
277 ;; Hebrew character set (ISO-8859-8)
279 (modify-syntax-entry #x5be ".") ; MAQAF
280 (modify-syntax-entry #x5c0 ".") ; PASEQ
281 (modify-syntax-entry #x5c3 ".") ; SOF PASUQ
282 (modify-syntax-entry #x5f3 ".") ; GERESH
283 (modify-syntax-entry #x5f4 ".") ; GERSHAYIM
285 ;; Indian character set (IS 13194 and other Emacs original Indian charsets)
287 (modify-category-entry '(#x901 . #x970) ?i)
288 (map-charset-chars #'modify-category-entry 'indian-is13194 ?i)
289 (map-charset-chars #'modify-category-entry 'indian-2-column ?i)
293 (modify-category-entry '(#xe80 . #xeff) ?o)
294 (map-charset-chars #'modify-category-entry 'lao ?o)
296 (let ((deflist '(("ກ-ຮ" "w" ?0) ; consonant
297 ("ະາຳຽເ-ໄ" "w" ?1) ; vowel base
298 ("ັິ-ືົໍ" "w" ?2) ; vowel upper
299 ("ຸູ" "w" ?3) ; vowel lower
300 ("່-໋" "w" ?4) ; tone mark
301 ("ຼຽ" "w" ?9) ; semivowel lower
302 ("໐-໙" "w" ?6) ; digit
303 ("ຯໆ" "_" ?5) ; symbol
305 elm chars len syntax category to ch i)
307 (setq elm (car deflist))
308 (setq chars (car elm)
314 (if (= (aref chars i) ?-)
317 (setq ch (aref chars i)
320 (unless (string-equal syntax "w")
321 (modify-syntax-entry ch syntax))
322 (modify-category-entry ch category)
325 (setq deflist (cdr deflist))))
327 ;; Thai character set (TIS620)
329 (modify-category-entry '(#xe00 . #xe7f) ?t)
330 (map-charset-chars #'modify-category-entry 'thai-tis620 ?t)
332 (let ((deflist '(;; chars syntax category
333 ("ก-รลว-ฮ" "w" ?0) ; consonant
334 ("ฤฦะาำเ-ๅ" "w" ?1) ; vowel base
335 ("ัิ-ื็๎" "w" ?2) ; vowel upper
336 ("ุ-ฺ" "w" ?3) ; vowel lower
337 ("่-ํ" "w" ?4) ; tone mark
338 ("๐-๙" "w" ?6) ; digit
339 ("ฯๆ฿๏๚๛" "_" ?5) ; symbol
341 elm chars len syntax category to ch i)
343 (setq elm (car deflist))
344 (setq chars (car elm)
350 (if (= (aref chars i) ?-)
353 (setq ch (aref chars i)
356 (unless (string-equal syntax "w")
357 (modify-syntax-entry ch syntax))
358 (modify-category-entry ch category)
361 (setq deflist (cdr deflist))))
363 ;; Tibetan character set
365 (modify-category-entry '(#xf00 . #xfff) ?q)
366 (map-charset-chars #'modify-category-entry 'tibetan ?q)
367 (map-charset-chars #'modify-category-entry 'tibetan-1-column ?q)
369 (let ((deflist '(;; chars syntax category
370 ("ཀ-ཀྵཪ" "w" ?0) ; consonant
374 ("ིེཻོཽྀ" "w" ?2) ; upper vowel
375 ("ཾྂྃ྆྇ྈྉྊྋ" "w" ?2) ; upper modifier
376 ("྄ཱུ༙༵༷" "w" ?3) ; lowel vowel/modifier
377 ("" "w" ?3) ; invisible vowel a
378 ("༠-༩༪-༳" "w" ?6) ; digit
379 ("་།-༒༔ཿ" "." ?|) ; line-break char
381 ("༈་།-༒༔ཿ༽༴" "." ?>) ; prohibition
383 ("ༀ-༊༼࿁࿂྅" "." ?<) ; prohibition
384 ("༓༕-༘༚-༟༶༸-༻༾༿྾྿-࿏" "." ?q) ; others
386 elm chars len syntax category to ch i)
388 (setq elm (car deflist))
389 (setq chars (car elm)
395 (if (= (aref chars i) ?-)
398 (setq ch (aref chars i)
401 (unless (string-equal syntax "w")
402 (modify-syntax-entry ch syntax))
403 (modify-category-entry ch category)
406 (setq deflist (cdr deflist))))
408 ;; Vietnamese character set
410 ;; To make a word with Latin characters
411 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-lower ?l)
412 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-lower ?v)
414 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-upper ?l)
415 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-upper ?v)
417 (let ((tbl (standard-case-table))
420 (let* ((char (decode-char 'vietnamese-viscii-upper i))
421 (charl (decode-char 'vietnamese-viscii-lower i))
422 (uc (encode-char char 'ucs))
423 (lc (encode-char charl 'ucs)))
424 (set-case-syntax-pair char (decode-char 'vietnamese-viscii-lower i)
426 (if uc (modify-category-entry uc ?v))
427 (if lc (modify-category-entry lc ?v)))
431 (let ((deflist '(;; chars syntax category
432 ((?ꪀ. ?ꪯ) "w" ?0) ; cosonant
433 ("ꪱꪵꪶ" "w" ?1) ; vowel base
434 ((?ꪹ . ?ꪽ) "w" ?1) ; vowel base
435 ("ꪰꪲꪳꪷꪸꪾ" "w" ?2) ; vowel upper
436 ("ꪴ" "w" ?3) ; vowel lower
437 ("ꫀꫂ" "w" ?1) ; non-combining tone-mark
438 ("꪿꫁" "w" ?4) ; combining tone-mark
439 ((?ꫛ . ?꫟) "_" ?5) ; symbol
441 (dolist (elm deflist)
442 (let ((chars (car elm))
444 (category (nth 2 elm)))
447 (modify-syntax-entry chars syntax)
448 (modify-category-entry chars category))
450 (modify-syntax-entry x syntax)
451 (modify-category-entry x category))
456 (modify-category-entry '(#x80 . #x024F) ?l)
458 (let ((tbl (standard-case-table)) c)
462 ;; Fixme: Some of the non-word syntaxes here perhaps should be
463 ;; reviewed. (Note that the following all implicitly have word
464 ;; syntax: ¢£¤¥¨ª¯²³´¶¸¹º.) There should be a well-defined way of
465 ;; relating Unicode categories to Emacs syntax codes.
467 ;; NBSP isn't semantically interchangeable with other whitespace chars,
468 ;; so it's more like punctation.
469 (set-case-syntax ? "." tbl)
470 (set-case-syntax ?¡ "." tbl)
471 (set-case-syntax ?¦ "_" tbl)
472 (set-case-syntax ?§ "." tbl)
473 (set-case-syntax ?© "_" tbl)
474 (set-case-syntax-delims 171 187 tbl) ; « »
475 (set-case-syntax ?¬ "_" tbl)
476 (set-case-syntax ? "_" tbl)
477 (set-case-syntax ?® "_" tbl)
478 (set-case-syntax ?° "_" tbl)
479 (set-case-syntax ?± "_" tbl)
480 (set-case-syntax ?µ "_" tbl)
481 (set-case-syntax ?· "_" tbl)
482 (set-case-syntax ?¼ "_" tbl)
483 (set-case-syntax ?½ "_" tbl)
484 (set-case-syntax ?¾ "_" tbl)
485 (set-case-syntax ?¿ "." tbl)
488 (set-case-syntax-pair c (+ c 32) tbl)
490 (set-case-syntax ?× "_" tbl)
491 (set-case-syntax ?ß "w" tbl)
492 (set-case-syntax ?÷ "_" tbl)
495 ;; Latin Extended-A, Latin Extended-B
498 (modify-category-entry c ?l)
501 (let ((pair-ranges '((#x0100 . #x012F)
524 (dolist (elt pair-ranges)
525 (let ((from (car elt)) (to (cdr elt)))
527 (set-case-syntax-pair from (1+ from) tbl)
528 (setq from (+ from 2))))))
530 ;; In some languages, such as Turkish, U+0049 LATIN CAPITAL LETTER I
531 ;; and U+0131 LATIN SMALL LETTER DOTLESS I make a case pair, and so
532 ;; do U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE and U+0069 LATIN
535 ;; We used to set up half of those correspondence unconditionally,
536 ;; but that makes searches slow. So now we don't set up either half
537 ;; of these correspondences by default.
539 ;; (set-downcase-syntax ?İ ?i tbl)
540 ;; (set-upcase-syntax ?I ?ı tbl)
542 (set-case-syntax-pair ?DŽ ?dž tbl)
543 (set-case-syntax-pair ?Dž ?dž tbl)
544 (set-case-syntax-pair ?LJ ?lj tbl)
545 (set-case-syntax-pair ?Lj ?lj tbl)
546 (set-case-syntax-pair ?NJ ?nj tbl)
547 (set-case-syntax-pair ?Nj ?nj tbl)
549 ;; 01F0; F; 006A 030C; # LATIN SMALL LETTER J WITH CARON
550 (set-case-syntax-pair ?DZ ?dz tbl)
551 (set-case-syntax-pair ?Dz ?dz tbl)
552 (set-case-syntax-pair ?Ƕ ?ƕ tbl)
553 (set-case-syntax-pair ?Ƿ ?ƿ tbl)
555 ;; Latin Extended Additional
556 (modify-category-entry '(#x1e00 . #x1ef9) ?l)
560 (or (<= c #x1e94) (>= c #x1ea0))
561 (set-case-syntax-pair c (1+ c) tbl))
565 (modify-category-entry '(#x0370 . #x03ff) ?g)
568 (if (or (and (>= c #x0391) (<= c #x03a1))
569 (and (>= c #x03a3) (<= c #x03ab)))
570 (set-case-syntax-pair c (+ c 32) tbl))
574 (set-case-syntax-pair c (1+ c) tbl))
576 (set-case-syntax-pair ?Ά ?ά tbl)
577 (set-case-syntax-pair ?Έ ?έ tbl)
578 (set-case-syntax-pair ?Ή ?ή tbl)
579 (set-case-syntax-pair ?Ί ?ί tbl)
580 (set-case-syntax-pair ?Ό ?ό tbl)
581 (set-case-syntax-pair ?Ύ ?ύ tbl)
582 (set-case-syntax-pair ?Ώ ?ώ tbl)
587 (set-case-syntax-pair c (+ c #x30) tbl)
591 (modify-category-entry '(#x1f00 . #x1fff) ?g)
594 (and (<= (logand c #x000f) 7)
596 (not (memq c '(#x1f50 #x1f52 #x1f54 #x1f56)))
597 (/= (logand c #x00f0) 7)
598 (set-case-syntax-pair (+ c 8) c tbl))
600 (set-case-syntax-pair ?Ᾰ ?ᾰ tbl)
601 (set-case-syntax-pair ?Ᾱ ?ᾱ tbl)
602 (set-case-syntax-pair ?Ὰ ?ὰ tbl)
603 (set-case-syntax-pair ?Ά ?ά tbl)
604 (set-case-syntax-pair ?ᾼ ?ᾳ tbl)
605 (set-case-syntax-pair ?Ὲ ?ὲ tbl)
606 (set-case-syntax-pair ?Έ ?έ tbl)
607 (set-case-syntax-pair ?Ὴ ?ὴ tbl)
608 (set-case-syntax-pair ?Ή ?ή tbl)
609 (set-case-syntax-pair ?ῌ ?ῃ tbl)
610 (set-case-syntax-pair ?Ῐ ?ῐ tbl)
611 (set-case-syntax-pair ?Ῑ ?ῑ tbl)
612 (set-case-syntax-pair ?Ὶ ?ὶ tbl)
613 (set-case-syntax-pair ?Ί ?ί tbl)
614 (set-case-syntax-pair ?Ῠ ?ῠ tbl)
615 (set-case-syntax-pair ?Ῡ ?ῡ tbl)
616 (set-case-syntax-pair ?Ὺ ?ὺ tbl)
617 (set-case-syntax-pair ?Ύ ?ύ tbl)
618 (set-case-syntax-pair ?Ῥ ?ῥ tbl)
619 (set-case-syntax-pair ?Ὸ ?ὸ tbl)
620 (set-case-syntax-pair ?Ό ?ό tbl)
621 (set-case-syntax-pair ?Ὼ ?ὼ tbl)
622 (set-case-syntax-pair ?Ώ ?ώ tbl)
623 (set-case-syntax-pair ?ῼ ?ῳ tbl)
626 (modify-category-entry '(#x0400 . #x04FF) ?y)
631 (set-case-syntax-pair c (+ c 80) tbl))
634 (set-case-syntax-pair c (+ c 32) tbl))
636 (or (and (>= c #x0460) (<= c #x0480))
637 (and (>= c #x048c) (<= c #x04be))
638 (and (>= c #x04d0) (<= c #x04f4)))
639 (set-case-syntax-pair c (1+ c) tbl))
641 (set-case-syntax-pair ?Ӂ ?ӂ tbl)
642 (set-case-syntax-pair ?Ӄ ?ӄ tbl)
643 (set-case-syntax-pair ?Ӈ ?ӈ tbl)
644 (set-case-syntax-pair ?Ӌ ?ӌ tbl)
645 (set-case-syntax-pair ?Ӹ ?ӹ tbl)
647 ;; general punctuation
650 (set-case-syntax c " " tbl)
653 (set-case-syntax c "." tbl)
655 ;; Fixme: These aren't all right:
658 (set-case-syntax c "_" tbl)
660 ;; Punctuation syntax for quotation marks (like `)
662 (set-case-syntax c "." tbl)
664 ;; Fixme: These aren't all right:
666 (set-case-syntax c "_" tbl)
669 (set-case-syntax c "." tbl)
675 (set-case-syntax-pair c (+ c #x10) tbl)
678 ;; Fixme: The following blocks might be better as symbol rather than
683 (set-case-syntax c "." tbl)
685 ;; Mathematical Operators
687 (set-case-syntax c "." tbl)
689 ;; Miscellaneous Technical
691 (set-case-syntax c "." tbl)
695 (set-case-syntax c "_" tbl)
701 (set-case-syntax-pair c (+ c 26) tbl)
702 (modify-category-entry c ?l)
703 (modify-category-entry (+ c 26) ?l)
709 (set-case-syntax-pair c (+ c #x20) tbl)
710 (modify-category-entry c ?l)
711 (modify-category-entry (+ c #x20) ?l)
714 ;; Combining diacritics
715 (modify-category-entry '(#x300 . #x362) ?^)
717 (modify-category-entry '(#x20d0 . #x20e3) ?^)
719 ;; Fixme: syntax for symbols &c
723 '("⁅⁆" ; U+2045 U+2046
777 (modify-syntax-entry (aref elt 0) (string ?\( (aref elt 1)))
778 (modify-syntax-entry (aref elt 1) (string ?\) (aref elt 0)))))
781 ;; For each character set, put the information of the most proper
782 ;; coding system to encode it by `preferred-coding-system' property.
784 ;; Fixme: should this be junked?
785 (let ((l '((latin-iso8859-1 . iso-latin-1)
786 (latin-iso8859-2 . iso-latin-2)
787 (latin-iso8859-3 . iso-latin-3)
788 (latin-iso8859-4 . iso-latin-4)
789 (thai-tis620 . thai-tis620)
790 (greek-iso8859-7 . greek-iso-8bit)
791 (arabic-iso8859-6 . iso-2022-7bit)
792 (hebrew-iso8859-8 . hebrew-iso-8bit)
793 (katakana-jisx0201 . japanese-shift-jis)
794 (latin-jisx0201 . japanese-shift-jis)
795 (cyrillic-iso8859-5 . cyrillic-iso-8bit)
796 (latin-iso8859-9 . iso-latin-5)
797 (japanese-jisx0208-1978 . iso-2022-jp)
798 (chinese-gb2312 . chinese-iso-8bit)
799 (chinese-gbk . chinese-gbk)
800 (gb18030-2-byte . chinese-gb18030)
801 (gb18030-4-byte-bmp . chinese-gb18030)
802 (gb18030-4-byte-smp . chinese-gb18030)
803 (gb18030-4-byte-ext-1 . chinese-gb18030)
804 (gb18030-4-byte-ext-2 . chinese-gb18030)
805 (japanese-jisx0208 . iso-2022-jp)
806 (korean-ksc5601 . iso-2022-kr)
807 (japanese-jisx0212 . iso-2022-jp)
808 (chinese-big5-1 . chinese-big5)
809 (chinese-big5-2 . chinese-big5)
810 (chinese-sisheng . iso-2022-7bit)
811 (ipa . iso-2022-7bit)
812 (vietnamese-viscii-lower . vietnamese-viscii)
813 (vietnamese-viscii-upper . vietnamese-viscii)
814 (arabic-digit . iso-2022-7bit)
815 (arabic-1-column . iso-2022-7bit)
817 (arabic-2-column . iso-2022-7bit)
818 (indian-is13194 . devanagari)
819 (indian-glyph . devanagari)
820 (tibetan-1-column . tibetan)
821 (ethiopic . iso-2022-7bit)
822 (chinese-cns11643-1 . iso-2022-cn)
823 (chinese-cns11643-2 . iso-2022-cn)
824 (chinese-cns11643-3 . iso-2022-cn)
825 (chinese-cns11643-4 . iso-2022-cn)
826 (chinese-cns11643-5 . iso-2022-cn)
827 (chinese-cns11643-6 . iso-2022-cn)
828 (chinese-cns11643-7 . iso-2022-cn)
829 (indian-2-column . devanagari)
831 (latin-iso8859-14 . iso-latin-8)
832 (latin-iso8859-15 . iso-latin-9))))
834 (put-charset-property (car (car l)) 'preferred-coding-system (cdr (car l)))
838 ;; Setup auto-fill-chars for charsets that should invoke auto-filling.
839 ;; SPACE and NEWLINE are already set.
841 (set-char-table-range auto-fill-chars '(#x3041 . #x30FF) t)
842 (set-char-table-range auto-fill-chars '(#x3400 . #x4DB5) t)
843 (set-char-table-range auto-fill-chars '(#x4e00 . #x9fbb) t)
844 (set-char-table-range auto-fill-chars '(#xF900 . #xFAFF) t)
845 (set-char-table-range auto-fill-chars '(#xFF00 . #xFF9F) t)
846 (set-char-table-range auto-fill-chars '(#x20000 . #x2FFFF) t)
849 ;;; Setting char-width-table. The default is 1.
851 ;; 0: non-spacing, enclosing combining, formatting, Hangul Jamo medial
852 ;; and final characters.
853 (let ((l '((#x00AD . #x00AD)
977 (#xE0001 . #xE01EF))))
979 (set-char-table-range char-width-table elt 0)))
981 ;; 2: East Asian Wide and Full-width characters.
982 (let ((l '((#x1100 . #x115F)
992 (#x30000 . #x3FFFF))))
994 (set-char-table-range char-width-table elt 2)))
996 ;; Other double width
998 ;; (lambda (range ignore) (set-char-table-range char-width-table range 2))
1000 ;; (map-charset-chars
1001 ;; (lambda (range ignore) (set-char-table-range char-width-table range 2))
1004 (lambda (range ignore) (set-char-table-range char-width-table range 2))
1007 (lambda (range ignore) (set-char-table-range char-width-table range 2))
1010 (optimize-char-table (standard-case-table))
1011 (optimize-char-table (standard-category-table))
1012 (optimize-char-table (standard-syntax-table))
1014 ;; The Unicode blocks actually extend past some of these ranges with
1015 ;; undefined codepoints.
1016 (let ((script-list nil))
1019 '((#x0000 #x007F latin)
1020 (#x00A0 #x036F latin)
1021 (#x0370 #x03E1 greek)
1022 (#x03E2 #x03EF coptic)
1023 (#x03F0 #x03F3 greek)
1024 (#x0400 #x04FF cyrillic)
1025 (#x0530 #x058F armenian)
1026 (#x0590 #x05FF hebrew)
1027 (#x0600 #x06FF arabic)
1028 (#x0700 #x074F syriac)
1030 (#x0780 #x07BF thaana)
1031 (#x0900 #x097F devanagari)
1032 (#x0980 #x09FF bengali)
1033 (#x0A00 #x0A7F gurmukhi)
1034 (#x0A80 #x0AFF gujarati)
1035 (#x0B00 #x0B7F oriya)
1036 (#x0B80 #x0BFF tamil)
1037 (#x0C00 #x0C7F telugu)
1038 (#x0C80 #x0CFF kannada)
1039 (#x0D00 #x0D7F malayalam)
1040 (#x0D80 #x0DFF sinhala)
1041 (#x0E00 #x0E5F thai)
1043 (#x0F00 #x0FFF tibetan)
1044 (#x1000 #x105F myanmar)
1045 (#x10A0 #x10FF georgian)
1046 (#x1100 #x11FF hangul)
1047 (#x1200 #x139F ethiopic)
1048 (#x13A0 #x13FF cherokee)
1049 (#x1400 #x167F canadian-aboriginal)
1050 (#x1680 #x169F ogham)
1051 (#x16A0 #x16FF runic)
1052 (#x1780 #x17FF khmer)
1053 (#x1800 #x18AF mongolian)
1054 (#x1E00 #x1EFF latin)
1055 (#x1F00 #x1FFF greek)
1056 (#x2000 #x27FF symbol)
1057 (#x2800 #x28FF braille)
1058 (#x2D80 #x2DDF ethiopic)
1060 (#x2FF0 #x2FFF ideographic-description)
1061 (#x3000 #x303F cjk-misc)
1062 (#x3040 #x30FF kana)
1063 (#x3100 #x312F bopomofo)
1064 (#x3130 #x318F hangul)
1065 (#x3190 #x319F kanbun)
1066 (#x31A0 #x31BF bopomofo)
1069 (#xAA80 #xAADF tai-viet)
1070 (#xAC00 #xD7AF hangul)
1072 (#xFB1D #xFB4F hebrew)
1073 (#xFB50 #xFDFF arabic)
1074 (#xFE70 #xFEFC arabic)
1075 (#xFF00 #xFF5F cjk-misc)
1076 (#xFF61 #xFF9F kana)
1077 (#xFFE0 #xFFE6 cjk-misc)
1078 (#x1D000 #x1D0FF byzantine-musical-symbol)
1079 (#x1D100 #x1D1FF musical-symbol)
1080 (#x1D400 #x1D7FF mathematical)
1081 (#x20000 #x2AFFF han)
1082 (#x2F800 #x2FFFF han)))
1083 (set-char-table-range char-script-table
1084 (cons (car elt) (nth 1 elt)) (nth 2 elt))
1085 (or (memq (nth 2 elt) script-list)
1086 (setq script-list (cons (nth 2 elt) script-list))))
1087 (set-char-table-extra-slot char-script-table 0 (nreverse script-list)))
1090 #'(lambda (range ignore)
1091 (set-char-table-range char-script-table range 'tibetan))
1095 ;;; Setting word boundary.
1097 (defun next-word-boundary-han (pos limit)
1101 (looking-at "\\cC+")
1102 (goto-char (match-end 0))
1103 (if (looking-at "\\cH+")
1104 (goto-char (match-end 0)))
1106 (while (and (> pos limit)
1107 (eq (aref char-script-table (char-after (1- pos))) 'han))
1108 (setq pos (1- pos)))
1111 (defun next-word-boundary-kana (pos limit)
1115 (if (looking-at "\\cK+")
1116 (goto-char (match-end 0)))
1117 (if (looking-at "\\cH+")
1118 (goto-char (match-end 0)))
1119 (if (looking-at "\\ck+")
1120 (goto-char (match-end 0)))
1122 (let ((category-set (char-category-set (char-after pos)))
1124 (if (or (aref category-set ?K) (aref category-set ?k))
1125 (while (and (> pos limit)
1127 (char-category-set (char-after (1- pos))))
1128 (or (aref category-set ?K) (aref category-set ?k)))
1129 (setq pos (1- pos)))
1130 (while (and (> pos limit)
1131 (aref (setq category-set
1132 (char-category-set (char-after (1- pos)))) ?H))
1133 (setq pos (1- pos)))
1134 (setq category (cond ((aref category-set ?C) ?C)
1135 ((aref category-set ?K) ?K)
1136 ((aref category-set ?A) ?A)))
1139 (while (and (> pos limit)
1140 (aref (char-category-set (char-after (1- pos)))
1142 (setq pos (1- pos)))))
1146 #'(lambda (char script)
1147 (cond ((eq script 'han)
1148 (set-char-table-range find-word-boundary-function-table
1149 char #'next-word-boundary-han))
1151 (set-char-table-range find-word-boundary-function-table
1152 char #'next-word-boundary-kana))))
1155 (setq word-combining-categories
1161 (setq word-separating-categories ; (2-byte character sets)
1162 '((?A . ?K) ; Alpha numeric - Katakana
1163 (?A . ?C) ; Alpha numeric - Chinese
1164 (?H . ?A) ; Hiragana - Alpha numeric
1165 (?H . ?K) ; Hiragana - Katakana
1166 (?H . ?C) ; Hiragana - Chinese
1167 (?K . ?A) ; Katakana - Alpha numeric
1168 (?K . ?C) ; Katakana - Chinese
1169 (?C . ?A) ; Chinese - Alpha numeric
1170 (?C . ?K) ; Chinese - Katakana
1177 ;; arch-tag: 85889c35-9f4d-4912-9bf5-82de31b0d42d
1178 ;;; characters.el ends here