1 ;;; characters.el --- set syntax and category for multibyte characters
3 ;; Copyright (C) 1997, 2000-2016 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5 ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
6 ;; National Institute of Advanced Industrial Science and Technology (AIST)
7 ;; Registration Number H14PRO021
9 ;; National Institute of Advanced Industrial Science and Technology (AIST)
10 ;; Registration Number H13PRO009
12 ;; Keywords: multibyte character, character set, syntax, category
14 ;; This file is part of GNU Emacs.
16 ;; GNU Emacs is free software: you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by
18 ;; the Free Software Foundation, either version 3 of the License, or
19 ;; (at your option) any later version.
21 ;; GNU Emacs is distributed in the hope that it will be useful,
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;; GNU General Public License for more details.
26 ;; You should have received a copy of the GNU General Public License
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
33 ;;; Predefined categories.
35 ;; For each character set.
37 (define-category ?a "ASCII
38 ASCII graphic characters 32-126 (ISO646 IRV:1983[4/0])")
39 (define-category ?l "Latin")
40 (define-category ?t "Thai")
41 (define-category ?g "Greek")
42 (define-category ?b "Arabic")
43 (define-category ?w "Hebrew")
44 (define-category ?y "Cyrillic")
45 (define-category ?k "Katakana
47 (define-category ?r "Roman
49 (define-category ?c "Chinese")
50 (define-category ?j "Japanese")
51 (define-category ?h "Korean")
52 (define-category ?e "Ethiopic
54 (define-category ?v "Viet
56 (define-category ?i "Indian")
57 (define-category ?o "Lao")
58 (define-category ?q "Tibetan")
60 ;; For each group (row) of 2-byte character sets.
62 (define-category ?A "2-byte alnum
63 Alpha-numeric characters of 2-byte character sets")
64 (define-category ?C "2-byte han
65 Chinese (Han) characters of 2-byte character sets")
66 (define-category ?G "2-byte Greek
67 Greek characters of 2-byte character sets")
68 (define-category ?H "2-byte Hiragana
69 Japanese Hiragana characters of 2-byte character sets")
70 (define-category ?K "2-byte Katakana
71 Japanese Katakana characters of 2-byte character sets")
72 (define-category ?N "2-byte Korean
73 Korean Hangul characters of 2-byte character sets")
74 (define-category ?Y "2-byte Cyrillic
75 Cyrillic characters of 2-byte character sets")
76 (define-category ?I "Indian Glyphs")
78 ;; For phonetic classifications.
80 (define-category ?0 "consonant")
81 (define-category ?1 "base vowel
82 Base (independent) vowel")
83 (define-category ?2 "upper diacritic
84 Upper diacritical mark (including upper vowel)")
85 (define-category ?3 "lower diacritic
86 Lower diacritical mark (including lower vowel)")
87 (define-category ?4 "combining tone
89 (define-category ?5 "symbol")
90 (define-category ?6 "digit")
91 (define-category ?7 "vowel diacritic
92 Vowel-modifying diacritical mark")
93 (define-category ?8 "vowel-signs")
94 (define-category ?9 "semivowel lower")
97 (define-category ?| "line breakable
98 While filling, we can break a line at this character.")
100 ;; For indentation calculation.
103 This character counts as a space for indentation purposes.")
105 ;; Keep the following for `kinsoku' processing. See comments in
107 (define-category ?> "Not at bol
108 A character which can't be placed at beginning of line.")
109 (define-category ?< "Not at eol
110 A character which can't be placed at end of line.")
112 ;; Base and Combining
113 (define-category ?. "Base
114 Base characters (Unicode General Category L,N,P,S,Zs)")
115 (define-category ?^ "Combining
116 Combining diacritic or mark (Unicode General Category M)")
119 (define-category ?R "Right-to-left (strong)
120 Characters with \"strong\" right-to-left directionality, i.e.
121 with R, AL, RLE, or RLO Unicode bidi character type.")
123 (define-category ?L "Left-to-right (strong)
124 Characters with \"strong\" left-to-right directionality, i.e.
125 with L, LRE, or LRO Unicode bidi character type.")
128 ;;; Setting syntax and category.
132 ;; All ASCII characters have the category `a' (ASCII) and `l' (Latin).
133 (modify-category-entry '(32 . 127) ?a)
134 (modify-category-entry '(32 . 127) ?l)
136 ;; Deal with the CJK charsets first. Since the syntax of blocks is
137 ;; defined per charset, and the charsets may contain e.g. Latin
138 ;; characters, we end up with the wrong syntax definitions if we're
141 ;; Chinese characters (Unicode)
142 (modify-category-entry '(#x2E80 . #x312F) ?|)
143 (modify-category-entry '(#x3190 . #x33FF) ?|)
144 (modify-category-entry '(#x3400 . #x4DBF) ?C)
145 (modify-category-entry '(#x4E00 . #x9FAF) ?C)
146 (modify-category-entry '(#x3400 . #x9FAF) ?c)
147 (modify-category-entry '(#x3400 . #x9FAF) ?|)
148 (modify-category-entry '(#xF900 . #xFAFF) ?C)
149 (modify-category-entry '(#xF900 . #xFAFF) ?c)
150 (modify-category-entry '(#xF900 . #xFAFF) ?|)
151 (modify-category-entry '(#x20000 . #x2FFFF) ?|)
152 (modify-category-entry '(#x20000 . #x2FFFF) ?C)
153 (modify-category-entry '(#x20000 . #x2FFFF) ?c)
156 ;; Chinese character set (GB2312)
158 (map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2121 #x217E)
159 (map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2221 #x227E)
160 (map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2921 #x297E)
162 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?c)
163 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2330 #x2339)
164 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2341 #x235A)
165 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2361 #x237A)
166 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?H #x2421 #x247E)
167 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?K #x2521 #x257E)
168 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?G #x2621 #x267E)
169 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?Y #x2721 #x277E)
170 (map-charset-chars #'modify-category-entry 'chinese-gb2312 ?C #x3021 #x7E7E)
172 ;; Chinese character set (BIG5)
174 (map-charset-chars #'modify-category-entry 'big5 ?c)
175 (map-charset-chars #'modify-category-entry 'big5 ?C #xA259 #xA261)
176 (map-charset-chars #'modify-category-entry 'big5 ?C #xA440 #xC67E)
177 (map-charset-chars #'modify-category-entry 'big5 ?C #xC940 #xF9DC)
179 ;; Chinese character set (CNS11643)
181 (dolist (c '(chinese-cns11643-1 chinese-cns11643-2 chinese-cns11643-3
182 chinese-cns11643-4 chinese-cns11643-5 chinese-cns11643-6
184 (map-charset-chars #'modify-category-entry c ?c)
185 (if (eq c 'chinese-cns11643-1)
186 (map-charset-chars #'modify-category-entry c ?C #x4421 #x7E7E)
187 (map-charset-chars #'modify-category-entry c ?C)))
189 ;; Japanese character set (JISX0201, JISX0208, JISX0212, JISX0213)
191 (map-charset-chars #'modify-category-entry 'katakana-jisx0201 ?k)
193 (map-charset-chars #'modify-category-entry 'latin-jisx0201 ?r)
195 (dolist (l '(katakana-jisx0201 japanese-jisx0208 japanese-jisx0212
196 japanese-jisx0213-1 japanese-jisx0213-2
197 japanese-jisx0213.2004-1
199 (map-charset-chars #'modify-category-entry l ?j))
201 ;; Fullwidth characters
202 (modify-category-entry '(#xff01 . #xff60) ?\|)
204 ;; Unicode equivalents of JISX0201-kana
205 (let ((range '(#xff61 . #xff9f)))
206 (modify-category-entry range ?k)
207 (modify-category-entry range ?j)
208 (modify-category-entry range ?\|))
211 (modify-category-entry '(#x3099 . #x309C) ?K)
212 (modify-category-entry '(#x30A0 . #x30FF) ?K)
213 (modify-category-entry '(#x31F0 . #x31FF) ?K)
214 (modify-category-entry '(#x30A0 . #x30FA) ?\|)
215 (modify-category-entry #x30FF ?\|)
218 (modify-category-entry '(#x3040 . #x309F) ?H)
219 (modify-category-entry '(#x3040 . #x3096) ?\|)
220 (modify-category-entry #x309F ?\|)
221 (modify-category-entry #x30A0 ?H)
222 (modify-category-entry #x30FC ?H)
226 (map-charset-chars #'modify-syntax-entry 'japanese-jisx0208 "_" #x2121 #x227E)
227 (map-charset-chars #'modify-syntax-entry 'japanese-jisx0208 "_" #x2821 #x287E)
228 (let ((chars '(?ー ?゛ ?゜ ?ヽ ?ヾ ?ゝ ?ゞ ?〃 ?仝 ?々 ?〆 ?〇)))
230 (modify-syntax-entry elt "w")))
232 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?A #x2321 #x237E)
233 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?H #x2421 #x247E)
234 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?K #x2521 #x257E)
235 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?G #x2621 #x267E)
236 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?Y #x2721 #x277E)
237 (map-charset-chars #'modify-category-entry 'japanese-jisx0208 ?C #x3021 #x7E7E)
238 (let ((chars '(?仝 ?々 ?〆 ?〇)))
240 (modify-category-entry (car chars) ?C)
241 (setq chars (cdr chars))))
245 (map-charset-chars #'modify-syntax-entry 'japanese-jisx0212 "_" #x2121 #x237E)
249 (let ((chars '(?。 ?、 ?・)))
251 (modify-syntax-entry (car chars) ".")
252 (setq chars (cdr chars))))
254 (modify-syntax-entry ?\「 "(」")
255 (modify-syntax-entry ?\」 "(「")
257 ;; Korean character set (KSC5601)
259 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?h)
261 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2121 #x227E)
262 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2621 #x277E)
263 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2830 #x287E)
264 (map-charset-chars #'modify-syntax-entry 'korean-ksc5601 "_" #x2930 #x297E)
265 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2330 #x2339)
266 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2341 #x235A)
267 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?A #x2361 #x237A)
268 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?G #x2521 #x257E)
269 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?H #x2A21 #x2A7E)
270 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?K #x2B21 #x2B7E)
271 (map-charset-chars #'modify-category-entry 'korean-ksc5601 ?Y #x2C21 #x2C7E)
273 ;; These are in more than one charset.
274 (let ((parens (concat "〈〉《》「」『』【】〔〕〖〗〘〙〚〛"
278 (dotimes (i (/ (length parens) 2))
279 (setq open (aref parens (* i 2))
280 close (aref parens (1+ (* i 2))))
281 (modify-syntax-entry open (format "(%c" close))
282 (modify-syntax-entry close (format ")%c" open))))
284 ;; Arabic character set
286 (let ((charsets '(arabic-iso8859-6
291 (map-charset-chars #'modify-category-entry (car charsets) ?b)
292 (setq charsets (cdr charsets))))
293 (modify-category-entry '(#x600 . #x6ff) ?b)
294 (modify-category-entry '(#x8a0 . #x8ff) ?b)
295 (modify-category-entry '(#xfb50 . #xfdff) ?b)
296 (modify-category-entry '(#xfe70 . #xfefe) ?b)
298 ;; Cyrillic character set (ISO-8859-5)
300 (modify-syntax-entry ?№ ".")
302 ;; Ethiopic character set
304 (modify-category-entry '(#x1200 . #x1399) ?e)
305 (modify-category-entry '(#x2d80 . #x2dde) ?e)
306 (let ((chars '(?፡ ?። ?፣ ?፤ ?፥ ?፦ ?፧ ?፨)))
308 (modify-syntax-entry (car chars) ".")
309 (setq chars (cdr chars))))
310 (map-charset-chars #'modify-category-entry 'ethiopic ?e)
312 ;; Hebrew character set (ISO-8859-8)
314 (modify-syntax-entry #x5be ".") ; MAQAF
315 (modify-syntax-entry #x5c0 ".") ; PASEQ
316 (modify-syntax-entry #x5c3 ".") ; SOF PASUQ
317 (modify-syntax-entry #x5f3 ".") ; GERESH
318 (modify-syntax-entry #x5f4 ".") ; GERSHAYIM
320 ;; Indian character set (IS 13194 and other Emacs original Indian charsets)
322 (modify-category-entry '(#x901 . #x970) ?i)
323 (map-charset-chars #'modify-category-entry 'indian-is13194 ?i)
324 (map-charset-chars #'modify-category-entry 'indian-2-column ?i)
328 (modify-category-entry '(#xe80 . #xeff) ?o)
329 (map-charset-chars #'modify-category-entry 'lao ?o)
331 (let ((deflist '(("ກ-ຮ" "w" ?0) ; consonant
332 ("ະາຳຽເ-ໄ" "w" ?1) ; vowel base
333 ("ັິ-ືົໍ" "w" ?2) ; vowel upper
334 ("ຸູ" "w" ?3) ; vowel lower
335 ("່-໋" "w" ?4) ; tone mark
336 ("ຼຽ" "w" ?9) ; semivowel lower
337 ("໐-໙" "w" ?6) ; digit
338 ("ຯໆ" "_" ?5) ; symbol
340 elm chars len syntax category to ch i)
342 (setq elm (car deflist))
343 (setq chars (car elm)
349 (if (= (aref chars i) ?-)
352 (setq ch (aref chars i)
355 (unless (string-equal syntax "w")
356 (modify-syntax-entry ch syntax))
357 (modify-category-entry ch category)
360 (setq deflist (cdr deflist))))
362 ;; Thai character set (TIS620)
364 (modify-category-entry '(#xe00 . #xe7f) ?t)
365 (map-charset-chars #'modify-category-entry 'thai-tis620 ?t)
367 (let ((deflist '(;; chars syntax category
368 ("ก-รลว-ฮ" "w" ?0) ; consonant
369 ("ฤฦะาำเ-ๅ" "w" ?1) ; vowel base
370 ("ัิ-ื็๎" "w" ?2) ; vowel upper
371 ("ุ-ฺ" "w" ?3) ; vowel lower
372 ("่-ํ" "w" ?4) ; tone mark
373 ("๐-๙" "w" ?6) ; digit
374 ("ฯๆ฿๏๚๛" "_" ?5) ; symbol
376 elm chars len syntax category to ch i)
378 (setq elm (car deflist))
379 (setq chars (car elm)
385 (if (= (aref chars i) ?-)
388 (setq ch (aref chars i)
391 (unless (string-equal syntax "w")
392 (modify-syntax-entry ch syntax))
393 (modify-category-entry ch category)
396 (setq deflist (cdr deflist))))
398 ;; Tibetan character set
400 (modify-category-entry '(#xf00 . #xfff) ?q)
401 (map-charset-chars #'modify-category-entry 'tibetan ?q)
402 (map-charset-chars #'modify-category-entry 'tibetan-1-column ?q)
404 (let ((deflist '(;; chars syntax category
405 ("ཀ-ཀྵཪ" "w" ?0) ; consonant
407 ("ིེཻོཽྀ" "w" ?2) ; upper vowel
408 ("ཾྂྃ྆྇ྈྉྊྋ" "w" ?2) ; upper modifier
409 ("྄ཱུ༙༵༷" "w" ?3) ; lower vowel/modifier
410 ("" "w" ?3) ; invisible vowel a
411 ("༠-༩༪-༳" "w" ?6) ; digit
412 ("་།-༒༔ཿ" "." ?|) ; line-break char
414 ("༈་།-༒༔ཿ༽༴" "." ?>) ; prohibition
416 ("ༀ-༊༼࿁࿂྅" "." ?<) ; prohibition
417 ("༓༕-༘༚-༟༶༸-༻༾༿྾྿-࿏" "." ?q) ; others
419 elm chars len syntax category to ch i)
421 (setq elm (car deflist))
422 (setq chars (car elm)
428 (if (= (aref chars i) ?-)
431 (setq ch (aref chars i)
434 (unless (string-equal syntax "w")
435 (modify-syntax-entry ch syntax))
436 (modify-category-entry ch category)
439 (setq deflist (cdr deflist))))
441 ;; Vietnamese character set
443 ;; To make a word with Latin characters
444 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-lower ?l)
445 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-lower ?v)
447 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-upper ?l)
448 (map-charset-chars #'modify-category-entry 'vietnamese-viscii-upper ?v)
450 (let ((tbl (standard-case-table))
453 (let* ((char (decode-char 'vietnamese-viscii-upper i))
454 (charl (decode-char 'vietnamese-viscii-lower i))
455 (uc (encode-char char 'ucs))
456 (lc (encode-char charl 'ucs)))
457 (set-case-syntax-pair char (decode-char 'vietnamese-viscii-lower i)
459 (if uc (modify-category-entry uc ?v))
460 (if lc (modify-category-entry lc ?v)))
464 (let ((deflist '(;; chars syntax category
465 ((?ꪀ. ?ꪯ) "w" ?0) ; consonant
466 ("ꪱꪵꪶ" "w" ?1) ; vowel base
467 ((?ꪹ . ?ꪽ) "w" ?1) ; vowel base
468 ("ꪰꪲꪳꪷꪸꪾ" "w" ?2) ; vowel upper
469 ("ꪴ" "w" ?3) ; vowel lower
470 ("ꫀꫂ" "w" ?1) ; non-combining tone-mark
471 ("꪿꫁" "w" ?4) ; combining tone-mark
472 ((?ꫛ . ?꫟) "_" ?5) ; symbol
474 (dolist (elm deflist)
475 (let ((chars (car elm))
477 (category (nth 2 elm)))
480 (modify-syntax-entry chars syntax)
481 (modify-category-entry chars category))
483 (modify-syntax-entry x syntax)
484 (modify-category-entry x category))
489 ;; If bootstrapping without generated uni-*.el files, table not defined.
490 (let ((table (unicode-property-table-internal 'bidi-class)))
492 (map-char-table (lambda (key val)
494 ((memq val '(R AL RLO RLE))
495 (modify-category-entry key ?R))
496 ((memq val '(L LRE LRO))
497 (modify-category-entry key ?L))))
500 ;; Load uni-mirrored.el and uni-brackets.el if available, so that they
501 ;; get dumped into Emacs. This allows starting Emacs with
502 ;; force-load-messages in ~/.emacs, and avoid infinite recursion in
503 ;; bidi_initialize, which needs to load uni-mirrored.el and
504 ;; uni-brackets.el in order to display the "Loading" messages.
505 (unicode-property-table-internal 'mirroring)
506 (unicode-property-table-internal 'bracket-type)
510 (modify-category-entry '(#x80 . #x024F) ?l)
512 (let ((tbl (standard-case-table)) c)
516 ;; Fixme: Some of the non-word syntaxes here perhaps should be
517 ;; reviewed. (Note that the following all implicitly have word
518 ;; syntax: ¢£¤¥¨ª¯²³´¶¸¹º.) There should be a well-defined way of
519 ;; relating Unicode categories to Emacs syntax codes.
521 ;; NBSP isn't semantically interchangeable with other whitespace chars,
522 ;; so it's more like punctuation.
523 (set-case-syntax ? "." tbl)
524 (set-case-syntax ?¡ "." tbl)
525 (set-case-syntax ?¦ "_" tbl)
526 (set-case-syntax ?§ "." tbl)
527 (set-case-syntax ?© "_" tbl)
529 ;; (set-case-syntax-delims ?« ?» tbl)
531 ;; (set-case-syntax-delims ?» ?« tbl)
532 ;; So let's stay neutral and let users set these up if/when they want to.
533 (set-case-syntax ?« "." tbl)
534 (set-case-syntax ?» "." tbl)
535 (set-case-syntax ?¬ "_" tbl)
536 (set-case-syntax ? "_" tbl)
537 (set-case-syntax ?® "_" tbl)
538 (set-case-syntax ?° "_" tbl)
539 (set-case-syntax ?± "_" tbl)
540 (set-case-syntax ?µ "_" tbl)
541 (set-case-syntax ?· "_" tbl)
542 (set-case-syntax ?¼ "_" tbl)
543 (set-case-syntax ?½ "_" tbl)
544 (set-case-syntax ?¾ "_" tbl)
545 (set-case-syntax ?¿ "." tbl)
548 (set-case-syntax-pair c (+ c 32) tbl)
550 (set-case-syntax ?× "_" tbl)
551 (set-case-syntax ?ß "w" tbl)
552 (set-case-syntax ?÷ "_" tbl)
555 ;; Latin Extended-A, Latin Extended-B
558 (modify-category-entry c ?l)
561 (let ((pair-ranges '((#x0100 . #x012F)
586 (dolist (elt pair-ranges)
587 (let ((from (car elt)) (to (cdr elt)))
589 (set-case-syntax-pair from (1+ from) tbl)
590 (setq from (+ from 2))))))
592 (set-case-syntax-pair ?Ÿ ?ÿ tbl)
594 ;; In some languages, such as Turkish, U+0049 LATIN CAPITAL LETTER I
595 ;; and U+0131 LATIN SMALL LETTER DOTLESS I make a case pair, and so
596 ;; do U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE and U+0069 LATIN
599 ;; We used to set up half of those correspondence unconditionally,
600 ;; but that makes searches slow. So now we don't set up either half
601 ;; of these correspondences by default.
603 ;; (set-downcase-syntax ?İ ?i tbl)
604 ;; (set-upcase-syntax ?I ?ı 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)
624 (set-case-syntax-pair ?Ʋ ?ʋ tbl)
625 (set-case-syntax-pair ?Ʒ ?ʒ tbl)
626 (set-case-syntax-pair ?DŽ ?dž tbl)
627 (set-case-syntax-pair ?Dž ?dž tbl)
628 (set-case-syntax-pair ?LJ ?lj tbl)
629 (set-case-syntax-pair ?Lj ?lj tbl)
630 (set-case-syntax-pair ?NJ ?nj tbl)
631 (set-case-syntax-pair ?Nj ?nj tbl)
633 ;; 01F0; F; 006A 030C; # LATIN SMALL LETTER J WITH CARON
634 (set-case-syntax-pair ?DZ ?dz tbl)
635 (set-case-syntax-pair ?Dz ?dz tbl)
636 (set-case-syntax-pair ?Ƕ ?ƕ tbl)
637 (set-case-syntax-pair ?Ƿ ?ƿ tbl)
638 (set-case-syntax-pair ?Ⱥ ?ⱥ tbl)
639 (set-case-syntax-pair ?Ƚ ?ƚ tbl)
640 (set-case-syntax-pair ?Ⱦ ?ⱦ tbl)
641 (set-case-syntax-pair ?Ƀ ?ƀ tbl)
642 (set-case-syntax-pair ?Ʉ ?ʉ tbl)
643 (set-case-syntax-pair ?Ʌ ?ʌ tbl)
645 ;; Latin Extended Additional
646 (modify-category-entry '(#x1e00 . #x1ef9) ?l)
650 (or (<= c #x1e94) (>= c #x1ea0))
651 (set-case-syntax-pair c (1+ c) tbl))
657 (modify-category-entry c ?l)
660 (let ((pair-ranges '((#x2C60 . #x2C61)
664 (dolist (elt pair-ranges)
665 (let ((from (car elt)) (to (cdr elt)))
667 (set-case-syntax-pair from (1+ from) tbl)
668 (setq from (+ from 2))))))
670 (set-case-syntax-pair ?Ɫ ?ɫ tbl)
671 (set-case-syntax-pair ?Ᵽ ?ᵽ tbl)
672 (set-case-syntax-pair ?Ɽ ?ɽ tbl)
673 (set-case-syntax-pair ?Ɑ ?ɑ tbl)
674 (set-case-syntax-pair ?Ɱ ?ɱ tbl)
675 (set-case-syntax-pair ?Ɐ ?ɐ tbl)
676 (set-case-syntax-pair ?Ɒ ?ɒ tbl)
677 (set-case-syntax-pair ?Ȿ ?ȿ tbl)
678 (set-case-syntax-pair ?Ɀ ?ɀ tbl)
683 (modify-category-entry c ?l)
686 (let ((pair-ranges '((#xA722 . #xA72F)
694 (dolist (elt pair-ranges)
695 (let ((from (car elt)) (to (cdr elt)))
697 (set-case-syntax-pair from (1+ from) tbl)
698 (setq from (+ from 2))))))
700 (set-case-syntax-pair ?Ᵹ ?ᵹ tbl)
701 (set-case-syntax-pair ?Ɦ ?ɦ tbl)
702 (set-case-syntax-pair ?Ɜ ?ɜ tbl)
703 (set-case-syntax-pair ?Ɡ ?ɡ tbl)
704 (set-case-syntax-pair ?Ɬ ?ɬ tbl)
705 (set-case-syntax-pair ?Ɪ ?ɪ tbl)
706 (set-case-syntax-pair ?Ʞ ?ʞ tbl)
707 (set-case-syntax-pair ?Ʇ ?ʇ tbl)
708 (set-case-syntax-pair ?Ʝ ?ʝ tbl)
709 (set-case-syntax-pair ?Ꭓ ?ꭓ tbl)
714 (modify-category-entry c ?l)
718 (modify-category-entry '(#x0370 . #x03ff) ?g)
721 (if (or (and (>= c #x0391) (<= c #x03a1))
722 (and (>= c #x03a3) (<= c #x03ab)))
723 (set-case-syntax-pair c (+ c 32) tbl))
727 (set-case-syntax-pair c (1+ c) tbl))
729 (set-case-syntax-pair ?Ά ?ά tbl)
730 (set-case-syntax-pair ?Έ ?έ tbl)
731 (set-case-syntax-pair ?Ή ?ή tbl)
732 (set-case-syntax-pair ?Ί ?ί tbl)
733 (set-case-syntax-pair ?Ό ?ό tbl)
734 (set-case-syntax-pair ?Ύ ?ύ tbl)
735 (set-case-syntax-pair ?Ώ ?ώ tbl)
740 (set-case-syntax-pair c (+ c #x30) tbl)
744 (modify-category-entry '(#x1f00 . #x1fff) ?g)
747 (and (<= (logand c #x000f) 7)
749 (not (memq c '(#x1f16 #x1f17 #x1f56 #x1f57
750 #x1f50 #x1f52 #x1f54 #x1f56)))
751 (/= (logand c #x00f0) #x70)
752 (set-case-syntax-pair (+ c 8) c tbl))
754 (set-case-syntax-pair ?Ᾰ ?ᾰ tbl)
755 (set-case-syntax-pair ?Ᾱ ?ᾱ tbl)
756 (set-case-syntax-pair ?Ὰ ?ὰ tbl)
757 (set-case-syntax-pair ?Ά ?ά tbl)
758 (set-case-syntax-pair ?ᾼ ?ᾳ tbl)
759 (set-case-syntax-pair ?Ὲ ?ὲ tbl)
760 (set-case-syntax-pair ?Έ ?έ tbl)
761 (set-case-syntax-pair ?Ὴ ?ὴ tbl)
762 (set-case-syntax-pair ?Ή ?ή tbl)
763 (set-case-syntax-pair ?ῌ ?ῃ tbl)
764 (set-case-syntax-pair ?Ῐ ?ῐ tbl)
765 (set-case-syntax-pair ?Ῑ ?ῑ tbl)
766 (set-case-syntax-pair ?Ὶ ?ὶ tbl)
767 (set-case-syntax-pair ?Ί ?ί tbl)
768 (set-case-syntax-pair ?Ῠ ?ῠ tbl)
769 (set-case-syntax-pair ?Ῡ ?ῡ tbl)
770 (set-case-syntax-pair ?Ὺ ?ὺ tbl)
771 (set-case-syntax-pair ?Ύ ?ύ tbl)
772 (set-case-syntax-pair ?Ῥ ?ῥ tbl)
773 (set-case-syntax-pair ?Ὸ ?ὸ tbl)
774 (set-case-syntax-pair ?Ό ?ό tbl)
775 (set-case-syntax-pair ?Ὼ ?ὼ tbl)
776 (set-case-syntax-pair ?Ώ ?ώ tbl)
777 (set-case-syntax-pair ?ῼ ?ῳ tbl)
780 (modify-category-entry '(#x0400 . #x04FF) ?y)
785 (set-case-syntax-pair c (+ c 80) tbl))
788 (set-case-syntax-pair c (+ c 32) tbl))
790 (or (and (>= c #x0460) (<= c #x0480))
791 (and (>= c #x048c) (<= c #x04be))
792 (and (>= c #x04d0) (<= c #x052e)))
793 (set-case-syntax-pair c (1+ c) tbl))
795 (set-case-syntax-pair ?Ӂ ?ӂ tbl)
796 (set-case-syntax-pair ?Ӄ ?ӄ tbl)
797 (set-case-syntax-pair ?Ӈ ?ӈ tbl)
798 (set-case-syntax-pair ?Ӌ ?ӌ tbl)
800 (modify-category-entry '(#xA640 . #xA69F) ?y)
803 (set-case-syntax-pair c (+ c 1) tbl)
807 (set-case-syntax-pair c (+ c 1) tbl)
813 (set-case-syntax-pair c (+ c #x1C60) tbl)
816 ;; Cyrillic Extended-C
817 (modify-category-entry '(#x1C80 . #x1C8F) ?y)
819 ;; general punctuation
822 (set-case-syntax c " " tbl)
825 (set-case-syntax c "." tbl)
827 ;; Fixme: These aren't all right:
830 (set-case-syntax c "_" tbl)
832 ;; Punctuation syntax for quotation marks (like `)
834 (set-case-syntax c "." tbl)
836 ;; Fixme: These aren't all right:
838 (set-case-syntax c "_" tbl)
841 (set-case-syntax c "." tbl)
847 (set-case-syntax-pair c (+ c #x10) tbl)
850 ;; Fixme: The following blocks might be better as symbol rather than
855 (set-case-syntax c "." tbl)
857 ;; Mathematical Operators
859 (set-case-syntax c "." tbl)
861 ;; Miscellaneous Technical
863 (set-case-syntax c "." tbl)
867 (set-case-syntax c "_" tbl)
873 (set-case-syntax-pair c (+ c 26) tbl)
874 (modify-category-entry c ?l)
875 (modify-category-entry (+ c 26) ?l)
881 (set-case-syntax-pair c (+ c 48) tbl)
885 (let ((pair-ranges '((#x2C80 . #x2CE2)
887 (dolist (elt pair-ranges)
888 (let ((from (car elt)) (to (cdr elt)))
890 (set-case-syntax-pair from (1+ from) tbl)
891 (setq from (+ from 2))))))
892 ;; There's no Coptic category. However, Coptic letters that are
893 ;; part of the Greek block above get the Greek category, and those
894 ;; in this block are derived from Greek letters, so let's be
895 ;; consistent about their category.
896 (modify-category-entry '(#x2C80 . #x2CFF) ?g)
901 (set-case-syntax-pair c (+ c #x20) tbl)
902 (modify-category-entry c ?l)
903 (modify-category-entry (+ c #x20) ?l)
908 (while (<= c #x10427)
909 (set-case-syntax-pair c (+ c 28) tbl)
914 (while (<= c #x104D3)
915 (set-case-syntax-pair c (+ c 40) tbl)
920 (while (<= c #x10cb2)
921 (set-case-syntax-pair c (+ c #x40) tbl)
926 (while (<= c #x118bf)
927 (set-case-syntax-pair c (+ c #x20) tbl)
932 (while (<= c #x1e921)
933 (set-case-syntax-pair c (+ c #x22) tbl)
936 ;; Combining diacritics
937 (modify-category-entry '(#x300 . #x362) ?^)
939 (modify-category-entry '(#x20d0 . #x20ff) ?^)
941 ;; Fixme: syntax for symbols &c
945 '("⁅⁆" ; U+2045 U+2046
999 (modify-syntax-entry (aref elt 0) (string ?\( (aref elt 1)))
1000 (modify-syntax-entry (aref elt 1) (string ?\) (aref elt 0)))))
1003 ;; For each character set, put the information of the most proper
1004 ;; coding system to encode it by `preferred-coding-system' property.
1006 ;; Fixme: should this be junked?
1007 (let ((l '((latin-iso8859-1 . iso-latin-1)
1008 (latin-iso8859-2 . iso-latin-2)
1009 (latin-iso8859-3 . iso-latin-3)
1010 (latin-iso8859-4 . iso-latin-4)
1011 (thai-tis620 . thai-tis620)
1012 (greek-iso8859-7 . greek-iso-8bit)
1013 (arabic-iso8859-6 . iso-2022-7bit)
1014 (hebrew-iso8859-8 . hebrew-iso-8bit)
1015 (katakana-jisx0201 . japanese-shift-jis)
1016 (latin-jisx0201 . japanese-shift-jis)
1017 (cyrillic-iso8859-5 . cyrillic-iso-8bit)
1018 (latin-iso8859-9 . iso-latin-5)
1019 (japanese-jisx0208-1978 . iso-2022-jp)
1020 (chinese-gb2312 . chinese-iso-8bit)
1021 (chinese-gbk . chinese-gbk)
1022 (gb18030-2-byte . chinese-gb18030)
1023 (gb18030-4-byte-bmp . chinese-gb18030)
1024 (gb18030-4-byte-smp . chinese-gb18030)
1025 (gb18030-4-byte-ext-1 . chinese-gb18030)
1026 (gb18030-4-byte-ext-2 . chinese-gb18030)
1027 (japanese-jisx0208 . iso-2022-jp)
1028 (korean-ksc5601 . iso-2022-kr)
1029 (japanese-jisx0212 . iso-2022-jp)
1030 (chinese-big5-1 . chinese-big5)
1031 (chinese-big5-2 . chinese-big5)
1032 (chinese-sisheng . iso-2022-7bit)
1033 (ipa . iso-2022-7bit)
1034 (vietnamese-viscii-lower . vietnamese-viscii)
1035 (vietnamese-viscii-upper . vietnamese-viscii)
1036 (arabic-digit . iso-2022-7bit)
1037 (arabic-1-column . iso-2022-7bit)
1039 (arabic-2-column . iso-2022-7bit)
1040 (indian-is13194 . devanagari)
1041 (indian-glyph . devanagari)
1042 (tibetan-1-column . tibetan)
1043 (ethiopic . iso-2022-7bit)
1044 (chinese-cns11643-1 . iso-2022-cn)
1045 (chinese-cns11643-2 . iso-2022-cn)
1046 (chinese-cns11643-3 . iso-2022-cn)
1047 (chinese-cns11643-4 . iso-2022-cn)
1048 (chinese-cns11643-5 . iso-2022-cn)
1049 (chinese-cns11643-6 . iso-2022-cn)
1050 (chinese-cns11643-7 . iso-2022-cn)
1051 (indian-2-column . devanagari)
1053 (latin-iso8859-14 . iso-latin-8)
1054 (latin-iso8859-15 . iso-latin-9))))
1056 (put-charset-property (car (car l)) 'preferred-coding-system (cdr (car l)))
1060 ;; Setup auto-fill-chars for charsets that should invoke auto-filling.
1061 ;; SPACE and NEWLINE are already set.
1063 (set-char-table-range auto-fill-chars '(#x3041 . #x30FF) t)
1064 (set-char-table-range auto-fill-chars '(#x3400 . #x4DB5) t)
1065 (set-char-table-range auto-fill-chars '(#x4e00 . #x9fbb) t)
1066 (set-char-table-range auto-fill-chars '(#xF900 . #xFAFF) t)
1067 (set-char-table-range auto-fill-chars '(#xFF00 . #xFF9F) t)
1068 (set-char-table-range auto-fill-chars '(#x20000 . #x2FFFF) t)
1071 ;;; Setting char-width-table. The default is 1.
1073 ;; 0: non-spacing, enclosing combining, formatting, Hangul Jamo medial
1074 ;; and final characters.
1075 (let ((l '((#x0300 . #x036F)
1198 (#xE0001 . #xE01EF))))
1200 (set-char-table-range char-width-table elt 0)))
1202 ;; 2: East Asian Wide and Full-width characters.
1203 (let ((l '((#x1100 . #x115F)
1286 (#x30000 . #x3FFFF))))
1288 (set-char-table-range char-width-table elt 2)))
1290 ;; Other double width
1291 ;;(map-charset-chars
1292 ;; (lambda (range ignore) (set-char-table-range char-width-table range 2))
1294 ;; (map-charset-chars
1295 ;; (lambda (range ignore) (set-char-table-range char-width-table range 2))
1298 (lambda (range _ignore) (set-char-table-range char-width-table range 2))
1301 (lambda (range _ignore) (set-char-table-range char-width-table range 2))
1304 ;; Internal use only.
1305 ;; Alist of locale symbol vs charsets. In a language environment
1306 ;; corresponding to the locale, width of characters in the charsets is
1307 ;; set to 2. Each element has the form:
1308 ;; (LOCALE TABLE (CHARSET (FROM-CODE . TO-CODE) ...) ...)
1309 ;; LOCALE: locale symbol
1310 ;; TABLE: char-table used for char-width-table, initially nil.
1311 ;; CHARSET: character set
1312 ;; FROM-CODE, TO-CODE: range of code-points in CHARSET
1314 (defvar cjk-char-width-table-list
1315 '((ja_JP nil (japanese-jisx0208 (#x2121 . #x287E))
1316 (cp932-2-byte (#x8140 . #x879F)))
1317 (zh_CN nil (chinese-gb2312 (#x2121 . #x297E)))
1318 (zh_HK nil (big5-hkscs (#xA140 . #xA3FE) (#xC6A0 . #xC8FE)))
1319 (zh_TW nil (big5 (#xA140 . #xA3FE))
1320 (chinese-cns11643-1 (#x2121 . #x427E)))
1321 (ko_KR nil (korean-ksc5601 (#x2121 . #x2C7E)))))
1323 ;; Internal use only.
1324 ;; Setup char-width-table appropriate for a language environment
1325 ;; corresponding to LOCALE-NAME (symbol).
1327 (defun use-cjk-char-width-table (locale-name)
1328 (while (char-table-parent char-width-table)
1329 (setq char-width-table (char-table-parent char-width-table)))
1330 (let ((slot (assq locale-name cjk-char-width-table-list)))
1331 (or slot (error "Unknown locale for CJK language environment: %s"
1333 (unless (nth 1 slot)
1334 (let ((table (make-char-table nil)))
1335 (dolist (charset-info (nthcdr 2 slot))
1336 (let ((charset (car charset-info)))
1337 (dolist (code-range (cdr charset-info))
1338 (map-charset-chars #'(lambda (range _arg)
1339 (set-char-table-range table range 2))
1341 (car code-range) (cdr code-range)))))
1342 (optimize-char-table table)
1343 (set-char-table-parent table char-width-table)
1344 (setcar (cdr slot) table)))
1345 (setq char-width-table (nth 1 slot))))
1347 (defun use-default-char-width-table ()
1349 Setup char-width-table appropriate for non-CJK language environment."
1350 (while (char-table-parent char-width-table)
1351 (setq char-width-table (char-table-parent char-width-table))))
1353 (optimize-char-table (standard-case-table))
1354 (optimize-char-table (standard-syntax-table))
1357 ;; Setting char-script-table.
1359 ;; While dumping, we can't use require, and international is not
1361 (load "international/charscript")
1362 (require 'charscript))
1365 #'(lambda (range _ignore)
1366 (set-char-table-range char-script-table range 'tibetan))
1370 ;;; Setting unicode-category-table.
1372 (when (setq unicode-category-table
1373 (unicode-property-table-internal 'general-category))
1374 (map-char-table #'(lambda (key val)
1376 (cond ((or (and (/= (aref (symbol-name val) 0) ?M)
1377 (/= (aref (symbol-name val) 0) ?C))
1379 (modify-category-entry key ?.))
1381 (modify-category-entry key ?^)))))
1382 unicode-category-table))
1384 (optimize-char-table (standard-category-table))
1387 ;; Display of glyphless characters.
1389 (defvar char-acronym-table
1390 (make-char-table 'char-acronym-table nil)
1391 "Char table of acronyms for non-graphic characters.")
1393 (let ((c0-acronyms '("NUL" "SOH" "STX" "ETX" "EOT" "ENQ" "ACK" "BEL"
1394 "BS" nil nil "VT" "FF" "CR" "SO" "SI"
1395 "DLE" "DC1" "DC2" "DC3" "DC4" "NAK" "SYN" "ETB"
1396 "CAN" "EM" "SUB" "ESC" "FC" "GS" "RS" "US")))
1398 (aset char-acronym-table i (car c0-acronyms))
1399 (setq c0-acronyms (cdr c0-acronyms))))
1401 (let ((c1-acronyms '("PAD" "HOP" "BPH" "NBH" "IND" "NEL" "SSA" "ESA"
1402 "HTS" "HTJ" "VTS" "PLD" "PLU" "R1" "SS2" "SS1"
1403 "DCS" "PU1" "PU2" "STS" "CCH" "MW" "SPA" "EPA"
1404 "SOS" "SGCI" "SC1" "CSI" "ST" "OSC" "PM" "APC")))
1406 (aset char-acronym-table (+ #x0080 i) (car c1-acronyms))
1407 (setq c1-acronyms (cdr c1-acronyms))))
1409 (aset char-acronym-table #x17B4 "KIVAQ") ; KHMER VOWEL INHERENT AQ
1410 (aset char-acronym-table #x17B5 "KIVAA") ; KHMER VOWEL INHERENT AA
1411 (aset char-acronym-table #x200B "ZWSP") ; ZERO WIDTH SPACE
1412 (aset char-acronym-table #x200C "ZWNJ") ; ZERO WIDTH NON-JOINER
1413 (aset char-acronym-table #x200D "ZWJ") ; ZERO WIDTH JOINER
1414 (aset char-acronym-table #x200E "LRM") ; LEFT-TO-RIGHT MARK
1415 (aset char-acronym-table #x200F "RLM") ; RIGHT-TO-LEFT MARK
1416 (aset char-acronym-table #x202A "LRE") ; LEFT-TO-RIGHT EMBEDDING
1417 (aset char-acronym-table #x202B "RLE") ; RIGHT-TO-LEFT EMBEDDING
1418 (aset char-acronym-table #x202C "PDF") ; POP DIRECTIONAL FORMATTING
1419 (aset char-acronym-table #x202D "LRO") ; LEFT-TO-RIGHT OVERRIDE
1420 (aset char-acronym-table #x202E "RLO") ; RIGHT-TO-LEFT OVERRIDE
1421 (aset char-acronym-table #x2060 "WJ") ; WORD JOINER
1422 (aset char-acronym-table #x206A "ISS") ; INHIBIT SYMMETRIC SWAPPING
1423 (aset char-acronym-table #x206B "ASS") ; ACTIVATE SYMMETRIC SWAPPING
1424 (aset char-acronym-table #x206C "IAFS") ; INHIBIT ARABIC FORM SHAPING
1425 (aset char-acronym-table #x206D "AAFS") ; ACTIVATE ARABIC FORM SHAPING
1426 (aset char-acronym-table #x206E "NADS") ; NATIONAL DIGIT SHAPES
1427 (aset char-acronym-table #x206F "NODS") ; NOMINAL DIGIT SHAPES
1428 (aset char-acronym-table #xFEFF "ZWNBSP") ; ZERO WIDTH NO-BREAK SPACE
1429 (aset char-acronym-table #xFFF9 "IAA") ; INTERLINEAR ANNOTATION ANCHOR
1430 (aset char-acronym-table #xFFFA "IAS") ; INTERLINEAR ANNOTATION SEPARATOR
1431 (aset char-acronym-table #xFFFB "IAT") ; INTERLINEAR ANNOTATION TERMINATOR
1432 (aset char-acronym-table #x1D173 "BEGBM") ; MUSICAL SYMBOL BEGIN BEAM
1433 (aset char-acronym-table #x1D174 "ENDBM") ; MUSICAL SYMBOL END BEAM
1434 (aset char-acronym-table #x1D175 "BEGTIE") ; MUSICAL SYMBOL BEGIN TIE
1435 (aset char-acronym-table #x1D176 "END") ; MUSICAL SYMBOL END TIE
1436 (aset char-acronym-table #x1D177 "BEGSLR") ; MUSICAL SYMBOL BEGIN SLUR
1437 (aset char-acronym-table #x1D178 "ENDSLR") ; MUSICAL SYMBOL END SLUR
1438 (aset char-acronym-table #x1D179 "BEGPHR") ; MUSICAL SYMBOL BEGIN PHRASE
1439 (aset char-acronym-table #x1D17A "ENDPHR") ; MUSICAL SYMBOL END PHRASE
1440 (aset char-acronym-table #xE0001 "|->TAG") ; LANGUAGE TAG
1441 (aset char-acronym-table #xE0020 "SP TAG") ; TAG SPACE
1443 (aset char-acronym-table (+ #xE0021 i) (format " %c TAG" (+ 33 i))))
1444 (aset char-acronym-table #xE007F "->|TAG") ; CANCEL TAG
1446 (defun update-glyphless-char-display (&optional variable value)
1447 "Make the setting of `glyphless-char-display-control' take effect.
1448 This function updates the char-table `glyphless-char-display'."
1450 (set-default variable value))
1452 (let ((target (car elt))
1454 (or (memq method '(zero-width thin-space empty-box acronym hex-code))
1455 (error "Invalid glyphless character display method: %s" method))
1456 (cond ((eq target 'c0-control)
1457 (glyphless-set-char-table-range glyphless-char-display
1459 ;; Users will not expect their newlines and TABs be
1460 ;; displayed as anything but themselves, so exempt those
1461 ;; two characters from c0-control.
1462 (set-char-table-range glyphless-char-display #x9 nil)
1463 (set-char-table-range glyphless-char-display #xa nil))
1464 ((eq target 'c1-control)
1465 (glyphless-set-char-table-range glyphless-char-display
1467 ((eq target 'format-control)
1468 (when unicode-category-table
1470 #'(lambda (char category)
1471 (if (eq category 'Cf)
1472 (let ((this-method method)
1475 (setq from (car char) to (cdr char))
1476 (setq from char to char))
1478 (when (/= from #xAD)
1479 (if (eq method 'acronym)
1481 (aref char-acronym-table from)))
1482 (set-char-table-range glyphless-char-display
1484 (setq from (1+ from))))))
1485 unicode-category-table)))
1486 ((eq target 'no-font)
1487 (set-char-table-extra-slot glyphless-char-display 0 method))
1489 (error "Invalid glyphless character group: %s" target))))))
1491 (defun glyphless-set-char-table-range (chartable from to method)
1492 (if (eq method 'acronym)
1495 (set-char-table-range chartable i (aref char-acronym-table i))
1497 (set-char-table-range chartable (cons from to) method)))
1499 ;;; Control of displaying glyphless characters.
1500 (defcustom glyphless-char-display-control
1501 '((format-control . thin-space)
1502 (no-font . hex-code))
1503 "List of directives to control display of glyphless characters.
1505 Each element has the form (GROUP . METHOD), where GROUP is a
1506 symbol specifying the character group, and METHOD is a symbol
1507 specifying the method of displaying characters belonging to that
1510 GROUP must be one of these symbols:
1511 `c0-control': U+0000..U+001F, but excluding newline and TAB.
1512 `c1-control': U+0080..U+009F.
1513 `format-control': Characters of Unicode General Category `Cf',
1514 such as U+200C (ZWNJ), U+200E (LRM), but
1515 excluding characters that have graphic images,
1516 such as U+00AD (SHY).
1517 `no-font': characters for which no suitable font is found.
1518 For character terminals, characters that cannot
1519 be encoded by `terminal-coding-system'.
1521 METHOD must be one of these symbols:
1522 `zero-width': don't display.
1523 `thin-space': display a thin (1-pixel width) space. On character
1524 terminals, display as 1-character space.
1525 `empty-box': display an empty box.
1526 `acronym': display an acronym of the character in a box. The
1527 acronym is taken from `char-acronym-table', which see.
1528 `hex-code': display the hexadecimal character code in a box.
1530 Do not set its value directly from Lisp; the value takes effect
1531 only via a custom `:set'
1532 function (`update-glyphless-char-display'), which updates
1533 `glyphless-char-display'."
1535 :type '(alist :key-type (symbol :tag "Character Group")
1536 :value-type (symbol :tag "Display Method"))
1537 :options '((c0-control
1538 (choice (const :tag "Don't display" zero-width)
1539 (const :tag "Display as thin space" thin-space)
1540 (const :tag "Display as empty box" empty-box)
1541 (const :tag "Display acronym" acronym)
1542 (const :tag "Display hex code in a box" hex-code)))
1544 (choice (const :tag "Don't display" zero-width)
1545 (const :tag "Display as thin space" thin-space)
1546 (const :tag "Display as empty box" empty-box)
1547 (const :tag "Display acronym" acronym)
1548 (const :tag "Display hex code in a box" hex-code)))
1550 (choice (const :tag "Don't display" zero-width)
1551 (const :tag "Display as thin space" thin-space)
1552 (const :tag "Display as empty box" empty-box)
1553 (const :tag "Display acronym" acronym)
1554 (const :tag "Display hex code in a box" hex-code)))
1556 (choice (const :tag "Don't display" zero-width)
1557 (const :tag "Display as thin space" thin-space)
1558 (const :tag "Display as empty box" empty-box)
1559 (const :tag "Display acronym" acronym)
1560 (const :tag "Display hex code in a box" hex-code))))
1561 :set 'update-glyphless-char-display
1565 ;;; Setting word boundary.
1567 (setq word-combining-categories
1573 (setq word-separating-categories ; (2-byte character sets)
1574 '((?H . ?K) ; Hiragana - Katakana
1581 ;;; characters.el ends here