1 ;;; characters.el --- set syntax and category for multibyte characters
3 ;; Copyright (C) 1997, 2000-2011 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
198 (map-charset-chars #'modify-category-entry l ?j
))
200 ;; Fullwidth characters
201 (modify-category-entry '(#xff01 .
#xff60
) ?\|
)
203 ;; Unicode equivalents of JISX0201-kana
204 (let ((range '(#xff61 .
#xff9f
)))
205 (modify-category-entry range ?k
)
206 (modify-category-entry range ?j
)
207 (modify-category-entry range ?\|
))
210 (modify-category-entry '(#x3099 .
#x309C
) ?K
)
211 (modify-category-entry '(#x30A0 .
#x30FF
) ?K
)
212 (modify-category-entry '(#x31F0 .
#x31FF
) ?K
)
213 (modify-category-entry '(#x30A0 .
#x30FA
) ?\|
)
214 (modify-category-entry #x30FF ?\|
)
217 (modify-category-entry '(#x3040 .
#x309F
) ?H
)
218 (modify-category-entry '(#x3040 .
#x3096
) ?\|
)
219 (modify-category-entry #x309F ?\|
)
220 (modify-category-entry #x30A0 ?H
)
221 (modify-category-entry #x30FC ?H
)
225 (map-charset-chars #'modify-syntax-entry
'japanese-jisx0208
"_" #x2121
#x227E
)
226 (map-charset-chars #'modify-syntax-entry
'japanese-jisx0208
"_" #x2821
#x287E
)
227 (let ((chars '(?ー ?゛ ?゜ ?ヽ ?ヾ ?ゝ ?ゞ ?〃 ?仝 ?々 ?〆 ?〇
)))
229 (modify-syntax-entry (car chars
) "w")))
231 (map-charset-chars #'modify-category-entry
'japanese-jisx0208 ?A
#x2321
#x237E
)
232 (map-charset-chars #'modify-category-entry
'japanese-jisx0208 ?H
#x2421
#x247E
)
233 (map-charset-chars #'modify-category-entry
'japanese-jisx0208 ?K
#x2521
#x257E
)
234 (map-charset-chars #'modify-category-entry
'japanese-jisx0208 ?G
#x2621
#x267E
)
235 (map-charset-chars #'modify-category-entry
'japanese-jisx0208 ?Y
#x2721
#x277E
)
236 (map-charset-chars #'modify-category-entry
'japanese-jisx0208 ?C
#x3021
#x7E7E
)
237 (modify-category-entry ?ー ?K
)
238 (let ((chars '(?゛ ?゜
)))
240 (modify-category-entry (car chars
) ?K
)
241 (modify-category-entry (car chars
) ?H
)
242 (setq chars
(cdr chars
))))
243 (let ((chars '(?仝 ?々 ?〆 ?〇
)))
245 (modify-category-entry (car chars
) ?C
)
246 (setq chars
(cdr chars
))))
250 (map-charset-chars #'modify-syntax-entry
'japanese-jisx0212
"_" #x2121
#x237E
)
254 (let ((chars '(?。 ?、 ?・
)))
256 (modify-syntax-entry (car chars
) ".")
257 (setq chars
(cdr chars
))))
259 (modify-syntax-entry ?\「
"(」")
260 (modify-syntax-entry ?\」
"(「")
262 ;; Korean character set (KSC5601)
264 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?h
)
266 (map-charset-chars #'modify-syntax-entry
'korean-ksc5601
"_" #x2121
#x227E
)
267 (map-charset-chars #'modify-syntax-entry
'korean-ksc5601
"_" #x2621
#x277E
)
268 (map-charset-chars #'modify-syntax-entry
'korean-ksc5601
"_" #x2830
#x287E
)
269 (map-charset-chars #'modify-syntax-entry
'korean-ksc5601
"_" #x2930
#x297E
)
270 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?A
#x2330
#x2339
)
271 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?A
#x2341
#x235A
)
272 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?A
#x2361
#x237A
)
273 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?G
#x2521
#x257E
)
274 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?H
#x2A21
#x2A7E
)
275 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?K
#x2B21
#x2B7E
)
276 (map-charset-chars #'modify-category-entry
'korean-ksc5601 ?Y
#x2C21
#x2C7E
)
278 ;; These are in more than one charset.
279 (let ((parens (concat "〈〉《》「」『』【】〔〕〖〗〘〙〚〛"
283 (dotimes (i (/ (length parens
) 2))
284 (setq open
(aref parens
(* i
2))
285 close
(aref parens
(1+ (* i
2))))
286 (modify-syntax-entry open
(format "(%c" close
))
287 (modify-syntax-entry close
(format ")%c" open
))))
289 ;; Arabic character set
291 (let ((charsets '(arabic-iso8859-6
296 (map-charset-chars #'modify-category-entry
(car charsets
) ?b
)
297 (setq charsets
(cdr charsets
))))
298 (modify-category-entry '(#x600 .
#x6ff
) ?b
)
299 (modify-category-entry '(#xfb50 .
#xfdff
) ?b
)
300 (modify-category-entry '(#xfe70 .
#xfefe
) ?b
)
302 ;; Cyrillic character set (ISO-8859-5)
304 (modify-syntax-entry ?№
".")
306 ;; Ethiopic character set
308 (modify-category-entry '(#x1200 .
#x1399
) ?e
)
309 (modify-category-entry '(#x2d80 .
#x2dde
) ?e
)
310 (let ((chars '(?፡ ?። ?፣ ?፤ ?፥ ?፦ ?፧ ?፨
)))
312 (modify-syntax-entry (car chars
) ".")
313 (setq chars
(cdr chars
))))
314 (map-charset-chars #'modify-category-entry
'ethiopic ?e
)
316 ;; Hebrew character set (ISO-8859-8)
318 (modify-syntax-entry #x5be
".") ; MAQAF
319 (modify-syntax-entry #x5c0
".") ; PASEQ
320 (modify-syntax-entry #x5c3
".") ; SOF PASUQ
321 (modify-syntax-entry #x5f3
".") ; GERESH
322 (modify-syntax-entry #x5f4
".") ; GERSHAYIM
324 ;; Indian character set (IS 13194 and other Emacs original Indian charsets)
326 (modify-category-entry '(#x901 .
#x970
) ?i
)
327 (map-charset-chars #'modify-category-entry
'indian-is13194 ?i
)
328 (map-charset-chars #'modify-category-entry
'indian-2-column ?i
)
332 (modify-category-entry '(#xe80 .
#xeff
) ?o
)
333 (map-charset-chars #'modify-category-entry
'lao ?o
)
335 (let ((deflist '(("ກ-ຮ" "w" ?
0) ; consonant
336 ("ະາຳຽເ-ໄ" "w" ?
1) ; vowel base
337 ("ັິ-ືົໍ" "w" ?
2) ; vowel upper
338 ("ຸູ" "w" ?
3) ; vowel lower
339 ("່-໋" "w" ?
4) ; tone mark
340 ("ຼຽ" "w" ?
9) ; semivowel lower
341 ("໐-໙" "w" ?
6) ; digit
342 ("ຯໆ" "_" ?
5) ; symbol
344 elm chars len syntax category to ch i
)
346 (setq elm
(car deflist
))
347 (setq chars
(car elm
)
353 (if (= (aref chars i
) ?-
)
356 (setq ch
(aref chars i
)
359 (unless (string-equal syntax
"w")
360 (modify-syntax-entry ch syntax
))
361 (modify-category-entry ch category
)
364 (setq deflist
(cdr deflist
))))
366 ;; Thai character set (TIS620)
368 (modify-category-entry '(#xe00 .
#xe7f
) ?t
)
369 (map-charset-chars #'modify-category-entry
'thai-tis620 ?t
)
371 (let ((deflist '(;; chars syntax category
372 ("ก-รลว-ฮ" "w" ?
0) ; consonant
373 ("ฤฦะาำเ-ๅ" "w" ?
1) ; vowel base
374 ("ัิ-ื็๎" "w" ?
2) ; vowel upper
375 ("ุ-ฺ" "w" ?
3) ; vowel lower
376 ("่-ํ" "w" ?
4) ; tone mark
377 ("๐-๙" "w" ?
6) ; digit
378 ("ฯๆ฿๏๚๛" "_" ?
5) ; symbol
380 elm chars len syntax category to ch i
)
382 (setq elm
(car deflist
))
383 (setq chars
(car elm
)
389 (if (= (aref chars i
) ?-
)
392 (setq ch
(aref chars i
)
395 (unless (string-equal syntax
"w")
396 (modify-syntax-entry ch syntax
))
397 (modify-category-entry ch category
)
400 (setq deflist
(cdr deflist
))))
402 ;; Tibetan character set
404 (modify-category-entry '(#xf00 .
#xfff
) ?q
)
405 (map-charset-chars #'modify-category-entry
'tibetan ?q
)
406 (map-charset-chars #'modify-category-entry
'tibetan-1-column ?q
)
408 (let ((deflist '(;; chars syntax category
409 ("ཀ-ཀྵཪ" "w" ?
0) ; consonant
411 ("ིེཻོཽྀ" "w" ?
2) ; upper vowel
412 ("ཾྂྃ྆྇ྈྉྊྋ" "w" ?
2) ; upper modifier
413 ("྄ཱུ༙༵༷" "w" ?
3) ; lowel vowel/modifier
414 ("" "w" ?
3) ; invisible vowel a
415 ("༠-༩༪-༳" "w" ?
6) ; digit
416 ("་།-༒༔ཿ" "." ?|
) ; line-break char
418 ("༈་།-༒༔ཿ༽༴" "." ?
>) ; prohibition
420 ("ༀ-༊༼࿁࿂྅" "." ?
<) ; prohibition
421 ("༓༕-༘༚-༟༶༸-༻༾༿྾྿-࿏" "." ?q
) ; others
423 elm chars len syntax category to ch i
)
425 (setq elm
(car deflist
))
426 (setq chars
(car elm
)
432 (if (= (aref chars i
) ?-
)
435 (setq ch
(aref chars i
)
438 (unless (string-equal syntax
"w")
439 (modify-syntax-entry ch syntax
))
440 (modify-category-entry ch category
)
443 (setq deflist
(cdr deflist
))))
445 ;; Vietnamese character set
447 ;; To make a word with Latin characters
448 (map-charset-chars #'modify-category-entry
'vietnamese-viscii-lower ?l
)
449 (map-charset-chars #'modify-category-entry
'vietnamese-viscii-lower ?v
)
451 (map-charset-chars #'modify-category-entry
'vietnamese-viscii-upper ?l
)
452 (map-charset-chars #'modify-category-entry
'vietnamese-viscii-upper ?v
)
454 (let ((tbl (standard-case-table))
457 (let* ((char (decode-char 'vietnamese-viscii-upper i
))
458 (charl (decode-char 'vietnamese-viscii-lower i
))
459 (uc (encode-char char
'ucs
))
460 (lc (encode-char charl
'ucs
)))
461 (set-case-syntax-pair char
(decode-char 'vietnamese-viscii-lower i
)
463 (if uc
(modify-category-entry uc ?v
))
464 (if lc
(modify-category-entry lc ?v
)))
468 (let ((deflist '(;; chars syntax category
469 ((?ꪀ. ?ꪯ
) "w" ?
0) ; cosonant
470 ("ꪱꪵꪶ" "w" ?
1) ; vowel base
471 ((?ꪹ . ?ꪽ
) "w" ?
1) ; vowel base
472 ("ꪰꪲꪳꪷꪸꪾ" "w" ?
2) ; vowel upper
473 ("ꪴ" "w" ?
3) ; vowel lower
474 ("ꫀꫂ" "w" ?
1) ; non-combining tone-mark
475 ("꪿꫁" "w" ?
4) ; combining tone-mark
476 ((?ꫛ . ?꫟
) "_" ?
5) ; symbol
478 (dolist (elm deflist
)
479 (let ((chars (car elm
))
481 (category (nth 2 elm
)))
484 (modify-syntax-entry chars syntax
)
485 (modify-category-entry chars category
))
487 (modify-syntax-entry x syntax
)
488 (modify-category-entry x category
))
493 (map-char-table (lambda (key val
)
495 ((memq val
'(R AL RLO RLE
))
496 (modify-category-entry key ?R
))
497 ((memq val
'(L LRE LRO
))
498 (modify-category-entry key ?L
))))
499 (unicode-property-table-internal 'bidi-class
))
503 (modify-category-entry '(#x80 .
#x024F
) ?l
)
505 (let ((tbl (standard-case-table)) c
)
509 ;; Fixme: Some of the non-word syntaxes here perhaps should be
510 ;; reviewed. (Note that the following all implicitly have word
511 ;; syntax: ¢£¤¥¨ª¯²³´¶¸¹º.) There should be a well-defined way of
512 ;; relating Unicode categories to Emacs syntax codes.
514 ;; NBSP isn't semantically interchangeable with other whitespace chars,
515 ;; so it's more like punctation.
516 (set-case-syntax ?
"." tbl
)
517 (set-case-syntax ?¡
"." tbl
)
518 (set-case-syntax ?¦
"_" tbl
)
519 (set-case-syntax ?§
"." tbl
)
520 (set-case-syntax ?©
"_" tbl
)
521 (set-case-syntax-delims 171 187 tbl
) ; « »
522 (set-case-syntax ?¬
"_" tbl
)
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
)
528 (set-case-syntax ?·
"_" tbl
)
529 (set-case-syntax ?¼
"_" tbl
)
530 (set-case-syntax ?½
"_" tbl
)
531 (set-case-syntax ?¾
"_" tbl
)
532 (set-case-syntax ?¿
"." tbl
)
535 (set-case-syntax-pair c
(+ c
32) tbl
)
537 (set-case-syntax ?×
"_" tbl
)
538 (set-case-syntax ?ß
"w" tbl
)
539 (set-case-syntax ?÷
"_" tbl
)
542 ;; Latin Extended-A, Latin Extended-B
545 (modify-category-entry c ?l
)
548 (let ((pair-ranges '((#x0100 .
#x012F
)
572 (dolist (elt pair-ranges
)
573 (let ((from (car elt
)) (to (cdr elt
)))
575 (set-case-syntax-pair from
(1+ from
) tbl
)
576 (setq from
(+ from
2))))))
578 (set-case-syntax-pair #x189
#x256 tbl
)
579 (set-case-syntax-pair #x18A
#x257 tbl
)
581 ;; In some languages, such as Turkish, U+0049 LATIN CAPITAL LETTER I
582 ;; and U+0131 LATIN SMALL LETTER DOTLESS I make a case pair, and so
583 ;; do U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE and U+0069 LATIN
586 ;; We used to set up half of those correspondence unconditionally,
587 ;; but that makes searches slow. So now we don't set up either half
588 ;; of these correspondences by default.
590 ;; (set-downcase-syntax ?İ ?i tbl)
591 ;; (set-upcase-syntax ?I ?ı tbl)
593 (set-case-syntax-pair ?DŽ ?dž tbl
)
594 (set-case-syntax-pair ?Dž ?dž tbl
)
595 (set-case-syntax-pair ?LJ ?lj tbl
)
596 (set-case-syntax-pair ?Lj ?lj tbl
)
597 (set-case-syntax-pair ?NJ ?nj tbl
)
598 (set-case-syntax-pair ?Nj ?nj tbl
)
600 ;; 01F0; F; 006A 030C; # LATIN SMALL LETTER J WITH CARON
601 (set-case-syntax-pair ?DZ ?dz tbl
)
602 (set-case-syntax-pair ?Dz ?dz tbl
)
603 (set-case-syntax-pair ?Ƕ ?ƕ tbl
)
604 (set-case-syntax-pair ?Ƿ ?ƿ tbl
)
606 ;; Latin Extended Additional
607 (modify-category-entry '(#x1e00 .
#x1ef9
) ?l
)
611 (or (<= c
#x1e94
) (>= c
#x1ea0
))
612 (set-case-syntax-pair c
(1+ c
) tbl
))
616 (modify-category-entry '(#x0370 .
#x03ff
) ?g
)
619 (if (or (and (>= c
#x0391
) (<= c
#x03a1
))
620 (and (>= c
#x03a3
) (<= c
#x03ab
)))
621 (set-case-syntax-pair c
(+ c
32) tbl
))
625 (set-case-syntax-pair c
(1+ c
) tbl
))
627 (set-case-syntax-pair ?Ά ?ά tbl
)
628 (set-case-syntax-pair ?Έ ?έ tbl
)
629 (set-case-syntax-pair ?Ή ?ή tbl
)
630 (set-case-syntax-pair ?Ί ?ί tbl
)
631 (set-case-syntax-pair ?Ό ?ό tbl
)
632 (set-case-syntax-pair ?Ύ ?ύ tbl
)
633 (set-case-syntax-pair ?Ώ ?ώ tbl
)
638 (set-case-syntax-pair c
(+ c
#x30
) tbl
)
642 (modify-category-entry '(#x1f00 .
#x1fff
) ?g
)
645 (and (<= (logand c
#x000f
) 7)
647 (not (memq c
'(#x1f16
#x1f17
#x1f56
#x1f57
648 #x1f50
#x1f52
#x1f54
#x1f56
)))
649 (/= (logand c
#x00f0
) #x70
)
650 (set-case-syntax-pair (+ c
8) c tbl
))
652 (set-case-syntax-pair ?Ᾰ ?ᾰ tbl
)
653 (set-case-syntax-pair ?Ᾱ ?ᾱ tbl
)
654 (set-case-syntax-pair ?Ὰ ?ὰ tbl
)
655 (set-case-syntax-pair ?Ά ?ά tbl
)
656 (set-case-syntax-pair ?ᾼ ?ᾳ tbl
)
657 (set-case-syntax-pair ?Ὲ ?ὲ tbl
)
658 (set-case-syntax-pair ?Έ ?έ tbl
)
659 (set-case-syntax-pair ?Ὴ ?ὴ tbl
)
660 (set-case-syntax-pair ?Ή ?ή tbl
)
661 (set-case-syntax-pair ?ῌ ?ῃ tbl
)
662 (set-case-syntax-pair ?Ῐ ?ῐ tbl
)
663 (set-case-syntax-pair ?Ῑ ?ῑ tbl
)
664 (set-case-syntax-pair ?Ὶ ?ὶ tbl
)
665 (set-case-syntax-pair ?Ί ?ί tbl
)
666 (set-case-syntax-pair ?Ῠ ?ῠ tbl
)
667 (set-case-syntax-pair ?Ῡ ?ῡ tbl
)
668 (set-case-syntax-pair ?Ὺ ?ὺ tbl
)
669 (set-case-syntax-pair ?Ύ ?ύ tbl
)
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
)
678 (modify-category-entry '(#x0400 .
#x04FF
) ?y
)
683 (set-case-syntax-pair c
(+ c
80) tbl
))
686 (set-case-syntax-pair c
(+ c
32) tbl
))
688 (or (and (>= c
#x0460
) (<= c
#x0480
))
689 (and (>= c
#x048c
) (<= c
#x04be
))
690 (and (>= c
#x04d0
) (<= c
#x04f4
)))
691 (set-case-syntax-pair c
(1+ c
) tbl
))
693 (set-case-syntax-pair ?Ӂ ?ӂ tbl
)
694 (set-case-syntax-pair ?Ӄ ?ӄ tbl
)
695 (set-case-syntax-pair ?Ӈ ?ӈ tbl
)
696 (set-case-syntax-pair ?Ӌ ?ӌ tbl
)
697 (set-case-syntax-pair ?Ӹ ?ӹ tbl
)
699 ;; general punctuation
702 (set-case-syntax c
" " tbl
)
705 (set-case-syntax c
"." tbl
)
707 ;; Fixme: These aren't all right:
710 (set-case-syntax c
"_" tbl
)
712 ;; Punctuation syntax for quotation marks (like `)
714 (set-case-syntax c
"." tbl
)
716 ;; Fixme: These aren't all right:
718 (set-case-syntax c
"_" tbl
)
721 (set-case-syntax c
"." tbl
)
727 (set-case-syntax-pair c
(+ c
#x10
) tbl
)
730 ;; Fixme: The following blocks might be better as symbol rather than
735 (set-case-syntax c
"." tbl
)
737 ;; Mathematical Operators
739 (set-case-syntax c
"." tbl
)
741 ;; Miscellaneous Technical
743 (set-case-syntax c
"." tbl
)
747 (set-case-syntax c
"_" tbl
)
753 (set-case-syntax-pair c
(+ c
26) tbl
)
754 (modify-category-entry c ?l
)
755 (modify-category-entry (+ c
26) ?l
)
761 (set-case-syntax-pair c
(+ c
#x20
) tbl
)
762 (modify-category-entry c ?l
)
763 (modify-category-entry (+ c
#x20
) ?l
)
766 ;; Combining diacritics
767 (modify-category-entry '(#x300 .
#x362
) ?^
)
769 (modify-category-entry '(#x20d0 .
#x20e3
) ?^
)
771 ;; Fixme: syntax for symbols &c
775 '("⁅⁆" ; U+2045 U+2046
829 (modify-syntax-entry (aref elt
0) (string ?\
( (aref elt
1)))
830 (modify-syntax-entry (aref elt
1) (string ?\
) (aref elt
0)))))
833 ;; For each character set, put the information of the most proper
834 ;; coding system to encode it by `preferred-coding-system' property.
836 ;; Fixme: should this be junked?
837 (let ((l '((latin-iso8859-1 . iso-latin-1
)
838 (latin-iso8859-2 . iso-latin-2
)
839 (latin-iso8859-3 . iso-latin-3
)
840 (latin-iso8859-4 . iso-latin-4
)
841 (thai-tis620 . thai-tis620
)
842 (greek-iso8859-7 . greek-iso-8bit
)
843 (arabic-iso8859-6 . iso-2022-7bit
)
844 (hebrew-iso8859-8 . hebrew-iso-8bit
)
845 (katakana-jisx0201 . japanese-shift-jis
)
846 (latin-jisx0201 . japanese-shift-jis
)
847 (cyrillic-iso8859-5 . cyrillic-iso-8bit
)
848 (latin-iso8859-9 . iso-latin-5
)
849 (japanese-jisx0208-1978 . iso-2022-jp
)
850 (chinese-gb2312 . chinese-iso-8bit
)
851 (chinese-gbk . chinese-gbk
)
852 (gb18030-2-byte . chinese-gb18030
)
853 (gb18030-4-byte-bmp . chinese-gb18030
)
854 (gb18030-4-byte-smp . chinese-gb18030
)
855 (gb18030-4-byte-ext-1 . chinese-gb18030
)
856 (gb18030-4-byte-ext-2 . chinese-gb18030
)
857 (japanese-jisx0208 . iso-2022-jp
)
858 (korean-ksc5601 . iso-2022-kr
)
859 (japanese-jisx0212 . iso-2022-jp
)
860 (chinese-big5-1 . chinese-big5
)
861 (chinese-big5-2 . chinese-big5
)
862 (chinese-sisheng . iso-2022-7bit
)
863 (ipa . iso-2022-7bit
)
864 (vietnamese-viscii-lower . vietnamese-viscii
)
865 (vietnamese-viscii-upper . vietnamese-viscii
)
866 (arabic-digit . iso-2022-7bit
)
867 (arabic-1-column . iso-2022-7bit
)
869 (arabic-2-column . iso-2022-7bit
)
870 (indian-is13194 . devanagari
)
871 (indian-glyph . devanagari
)
872 (tibetan-1-column . tibetan
)
873 (ethiopic . iso-2022-7bit
)
874 (chinese-cns11643-1 . iso-2022-cn
)
875 (chinese-cns11643-2 . iso-2022-cn
)
876 (chinese-cns11643-3 . iso-2022-cn
)
877 (chinese-cns11643-4 . iso-2022-cn
)
878 (chinese-cns11643-5 . iso-2022-cn
)
879 (chinese-cns11643-6 . iso-2022-cn
)
880 (chinese-cns11643-7 . iso-2022-cn
)
881 (indian-2-column . devanagari
)
883 (latin-iso8859-14 . iso-latin-8
)
884 (latin-iso8859-15 . iso-latin-9
))))
886 (put-charset-property (car (car l
)) 'preferred-coding-system
(cdr (car l
)))
890 ;; Setup auto-fill-chars for charsets that should invoke auto-filling.
891 ;; SPACE and NEWLINE are already set.
893 (set-char-table-range auto-fill-chars
'(#x3041 .
#x30FF
) t
)
894 (set-char-table-range auto-fill-chars
'(#x3400 .
#x4DB5
) t
)
895 (set-char-table-range auto-fill-chars
'(#x4e00 .
#x9fbb
) t
)
896 (set-char-table-range auto-fill-chars
'(#xF900 .
#xFAFF
) t
)
897 (set-char-table-range auto-fill-chars
'(#xFF00 .
#xFF9F
) t
)
898 (set-char-table-range auto-fill-chars
'(#x20000 .
#x2FFFF
) t
)
901 ;;; Setting char-width-table. The default is 1.
903 ;; 0: non-spacing, enclosing combining, formatting, Hangul Jamo medial
904 ;; and final characters.
905 (let ((l '((#x0300 .
#x036F
)
1028 (#xE0001 .
#xE01EF
))))
1030 (set-char-table-range char-width-table elt
0)))
1032 ;; 2: East Asian Wide and Full-width characters.
1033 (let ((l '((#x1100 .
#x115F
)
1043 (#x30000 .
#x3FFFF
))))
1045 (set-char-table-range char-width-table elt
2)))
1047 ;; Other double width
1048 ;;(map-charset-chars
1049 ;; (lambda (range ignore) (set-char-table-range char-width-table range 2))
1051 ;; (map-charset-chars
1052 ;; (lambda (range ignore) (set-char-table-range char-width-table range 2))
1055 (lambda (range ignore
) (set-char-table-range char-width-table range
2))
1058 (lambda (range ignore
) (set-char-table-range char-width-table range
2))
1061 ;; Internal use only.
1062 ;; Alist of locale symbol vs charsets. In a language environment
1063 ;; corresponding to the locale, width of characters in the charsets is
1064 ;; set to 2. Each element has the form:
1065 ;; (LOCALE TABLE (CHARSET (FROM-CODE . TO-CODE) ...) ...)
1066 ;; LOCALE: locale symbol
1067 ;; TABLE: char-table used for char-width-table, initially nil.
1068 ;; CAHRSET: character set
1069 ;; FROM-CODE, TO-CODE: range of code-points in CHARSET
1071 (defvar cjk-char-width-table-list
1072 '((ja_JP nil
(japanese-jisx0208 (#x2121 .
#x287E
))
1073 (cp932-2-byte (#x8140 .
#x879F
)))
1074 (zh_CN nil
(chinese-gb2312 (#x2121 .
#x297E
)))
1075 (zh_HK nil
(big5-hkscs (#xA140 .
#xA3FE
) (#xC6A0 .
#xC8FE
)))
1076 (zh_TW nil
(big5 (#xA140 .
#xA3FE
))
1077 (chinese-cns11643-1 (#x2121 .
#x427E
)))
1078 (ko_KR nil
(korean-ksc5601 (#x2121 .
#x2C7E
)))))
1080 ;; Internal use only.
1081 ;; Setup char-width-table appropriate for a language environment
1082 ;; corresponding to LOCALE-NAME (symbol).
1084 (defun use-cjk-char-width-table (locale-name)
1085 (while (char-table-parent char-width-table
)
1086 (setq char-width-table
(char-table-parent char-width-table
)))
1087 (let ((slot (assq locale-name cjk-char-width-table-list
))
1089 (or slot
(error "Unknown locale for CJK language environment: %s"
1091 (unless (nth 1 slot
)
1092 (let ((table (make-char-table nil
)))
1093 (dolist (charset-info (nthcdr 2 slot
))
1094 (let ((charset (car charset-info
)))
1095 (dolist (code-range (cdr charset-info
))
1096 (map-charset-chars #'(lambda (range arg
)
1097 (set-char-table-range table range
2))
1099 (car code-range
) (cdr code-range
)))))
1100 (optimize-char-table table
)
1101 (set-char-table-parent table char-width-table
)
1102 (setcar (cdr slot
) table
)))
1103 (setq char-width-table
(nth 1 slot
))))
1105 (defun use-default-char-width-table ()
1107 Setup char-width-table appropriate for non-CJK language environment."
1108 (while (char-table-parent char-width-table
)
1109 (setq char-width-table
(char-table-parent char-width-table
))))
1111 (optimize-char-table (standard-case-table))
1112 (optimize-char-table (standard-syntax-table))
1115 ;; Setting char-script-table.
1117 ;; The Unicode blocks actually extend past some of these ranges with
1118 ;; undefined codepoints.
1119 (let ((script-list nil
))
1122 '((#x0000
#x007F latin
)
1123 (#x00A0
#x024F latin
)
1124 (#x0250
#x02AF phonetic
)
1125 (#x02B0
#x036F latin
)
1126 (#x0370
#x03E1 greek
)
1127 (#x03E2
#x03EF coptic
)
1128 (#x03F0
#x03F3 greek
)
1129 (#x0400
#x04FF cyrillic
)
1130 (#x0530
#x058F armenian
)
1131 (#x0590
#x05FF hebrew
)
1132 (#x0600
#x06FF arabic
)
1133 (#x0700
#x074F syriac
)
1135 (#x0780
#x07BF thaana
)
1136 (#x0900
#x097F devanagari
)
1137 (#x0980
#x09FF bengali
)
1138 (#x0A00
#x0A7F gurmukhi
)
1139 (#x0A80
#x0AFF gujarati
)
1140 (#x0B00
#x0B7F oriya
)
1141 (#x0B80
#x0BFF tamil
)
1142 (#x0C00
#x0C7F telugu
)
1143 (#x0C80
#x0CFF kannada
)
1144 (#x0D00
#x0D7F malayalam
)
1145 (#x0D80
#x0DFF sinhala
)
1146 (#x0E00
#x0E5F thai
)
1148 (#x0F00
#x0FFF tibetan
)
1149 (#x1000
#x109F burmese
)
1150 (#x10A0
#x10FF georgian
)
1151 (#x1100
#x11FF hangul
)
1152 (#x1200
#x139F ethiopic
)
1153 (#x13A0
#x13FF cherokee
)
1154 (#x1400
#x167F canadian-aboriginal
)
1155 (#x1680
#x169F ogham
)
1156 (#x16A0
#x16FF runic
)
1157 (#x1780
#x17FF khmer
)
1158 (#x1800
#x18AF mongolian
)
1159 (#x1D00
#x1DFF phonetic
)
1160 (#x1E00
#x1EFF latin
)
1161 (#x1F00
#x1FFF greek
)
1162 (#x2000
#x27FF symbol
)
1163 (#x2800
#x28FF braille
)
1164 (#x2D80
#x2DDF ethiopic
)
1166 (#x2FF0
#x2FFF ideographic-description
)
1167 (#x3000
#x303F cjk-misc
)
1168 (#x3040
#x30FF kana
)
1169 (#x3100
#x312F bopomofo
)
1170 (#x3130
#x318F hangul
)
1171 (#x3190
#x319F kanbun
)
1172 (#x31A0
#x31BF bopomofo
)
1175 (#xAA00
#xAA5F cham
)
1176 (#xAA60
#xAA7B burmese
)
1177 (#xAA80
#xAADF tai-viet
)
1178 (#xAC00
#xD7AF hangul
)
1180 (#xFB1D
#xFB4F hebrew
)
1181 (#xFB50
#xFDFF arabic
)
1182 (#xFE70
#xFEFC arabic
)
1183 (#xFF00
#xFF5F cjk-misc
)
1184 (#xFF61
#xFF9F kana
)
1185 (#xFFE0
#xFFE6 cjk-misc
)
1186 (#x10000
#x100FF linear-b
)
1187 (#x10100
#x1013F aegean-number
)
1188 (#x10140
#x1018A ancient-greek-number
)
1189 (#x10190
#x1019B ancient-symbol
)
1190 (#x101D0
#x101FF phaistos-disc
)
1191 (#x10280
#x1029F lycian
)
1192 (#x102A0
#x102DF carian
)
1193 (#x10300
#x1032F olt-italic
)
1194 (#x10380
#x1039F ugaritic
)
1195 (#x103A0
#x103DF old-persian
)
1196 (#x10400
#x1044F deseret
)
1197 (#x10450
#x1047F shavian
)
1198 (#x10480
#x104AF osmanya
)
1199 (#x10800
#x1083F cypriot-syllabary
)
1200 (#x10900
#x1091F phoenician
)
1201 (#x10920
#x1093F lydian
)
1202 (#x10A00
#x10A5F kharoshthi
)
1203 (#x12000
#x123FF cuneiform
)
1204 (#x12400
#x1247F cuneiform-numbers-and-punctuation
)
1205 (#x1D000
#x1D0FF byzantine-musical-symbol
)
1206 (#x1D100
#x1D1FF musical-symbol
)
1207 (#x1D200
#x1D24F ancient-greek-musical-notation
)
1208 (#x1D300
#x1D35F tai-xuan-jing-symbol
)
1209 (#x1D360
#x1D37F counting-rod-numeral
)
1210 (#x1D400
#x1D7FF mathematical
)
1211 (#x1F000
#x1F02F mahjong-tile
)
1212 (#x1F030
#x1F09F domino-tile
)
1213 (#x20000
#x2AFFF han
)
1214 (#x2F800
#x2FFFF han
)))
1215 (set-char-table-range char-script-table
1216 (cons (car elt
) (nth 1 elt
)) (nth 2 elt
))
1217 (or (memq (nth 2 elt
) script-list
)
1218 (setq script-list
(cons (nth 2 elt
) script-list
))))
1219 (set-char-table-extra-slot char-script-table
0 (nreverse script-list
)))
1222 #'(lambda (range ignore
)
1223 (set-char-table-range char-script-table range
'tibetan
))
1227 ;;; Setting unicode-category-table.
1229 (setq unicode-category-table
1230 (unicode-property-table-internal 'general-category
))
1231 (map-char-table #'(lambda (key val
)
1233 (or (and (/= (aref (symbol-name val
) 0) ?M
)
1234 (/= (aref (symbol-name val
) 0) ?C
))
1236 (modify-category-entry key ?.
)))
1237 unicode-category-table
)
1239 (optimize-char-table (standard-category-table))
1242 ;; Display of glyphless characters.
1244 (defvar char-acronym-table
1245 (make-char-table 'char-acronym-table nil
)
1246 "Char table of acronyms for non-graphic characters.")
1248 (let ((c0-acronyms '("NUL" "SOH" "STX" "ETX" "EOT" "ENQ" "ACK" "BEL"
1249 "BS" nil nil
"VT" "FF" "CR" "SO" "SI"
1250 "DLE" "DC1" "DC2" "DC3" "DC4" "NAK" "SYN" "ETB"
1251 "CAN" "EM" "SUB" "ESC" "FC" "GS" "RS" "US")))
1253 (aset char-acronym-table i
(car c0-acronyms
))
1254 (setq c0-acronyms
(cdr c0-acronyms
))))
1256 (let ((c1-acronyms '("XXX" "XXX" "BPH" "NBH" "IND" "NEL" "SSA" "ESA"
1257 "HTS" "HTJ" "VTS" "PLD" "PLU" "R1" "SS2" "SS1"
1258 "DCS" "PU1" "PU2" "STS" "CCH" "MW" "SPA" "EPA"
1259 "SOS" "XXX" "SC1" "CSI" "ST" "OSC" "PM" "APC")))
1261 (aset char-acronym-table
(+ #x0080 i
) (car c1-acronyms
))
1262 (setq c1-acronyms
(cdr c1-acronyms
))))
1264 (aset char-acronym-table
#x17B4
"KIVAQ") ; KHMER VOWEL INHERENT AQ
1265 (aset char-acronym-table
#x17B5
"KIVAA") ; KHMER VOWEL INHERENT AA
1266 (aset char-acronym-table
#x200B
"ZWSP") ; ZERO WIDTH SPACE
1267 (aset char-acronym-table
#x200C
"ZWNJ") ; ZERO WIDTH NON-JOINER
1268 (aset char-acronym-table
#x200D
"ZWJ") ; ZERO WIDTH JOINER
1269 (aset char-acronym-table
#x200E
"LRM") ; LEFT-TO-RIGHT MARK
1270 (aset char-acronym-table
#x200F
"RLM") ; RIGHT-TO-LEFT MARK
1271 (aset char-acronym-table
#x202A
"LRE") ; LEFT-TO-RIGHT EMBEDDING
1272 (aset char-acronym-table
#x202B
"RLE") ; RIGHT-TO-LEFT EMBEDDING
1273 (aset char-acronym-table
#x202C
"PDF") ; POP DIRECTIONAL FORMATTING
1274 (aset char-acronym-table
#x202D
"LRO") ; LEFT-TO-RIGHT OVERRIDE
1275 (aset char-acronym-table
#x202E
"RLO") ; RIGHT-TO-LEFT OVERRIDE
1276 (aset char-acronym-table
#x2060
"WJ") ; WORD JOINER
1277 (aset char-acronym-table
#x206A
"ISS") ; INHIBIT SYMMETRIC SWAPPING
1278 (aset char-acronym-table
#x206B
"ASS") ; ACTIVATE SYMMETRIC SWAPPING
1279 (aset char-acronym-table
#x206C
"IAFS") ; INHIBIT ARABIC FORM SHAPING
1280 (aset char-acronym-table
#x206D
"AAFS") ; ACTIVATE ARABIC FORM SHAPING
1281 (aset char-acronym-table
#x206E
"NADS") ; NATIONAL DIGIT SHAPES
1282 (aset char-acronym-table
#x206F
"NODS") ; NOMINAL DIGIT SHAPES
1283 (aset char-acronym-table
#xFEFF
"ZWNBSP") ; ZERO WIDTH NO-BREAK SPACE
1284 (aset char-acronym-table
#xFFF9
"IAA") ; INTERLINEAR ANNOTATION ANCHOR
1285 (aset char-acronym-table
#xFFFA
"IAS") ; INTERLINEAR ANNOTATION SEPARATOR
1286 (aset char-acronym-table
#xFFFB
"IAT") ; INTERLINEAR ANNOTATION TERMINATOR
1287 (aset char-acronym-table
#x1D173
"BEGBM") ; MUSICAL SYMBOL BEGIN BEAM
1288 (aset char-acronym-table
#x1D174
"ENDBM") ; MUSICAL SYMBOL END BEAM
1289 (aset char-acronym-table
#x1D175
"BEGTIE") ; MUSICAL SYMBOL BEGIN TIE
1290 (aset char-acronym-table
#x1D176
"END") ; MUSICAL SYMBOL END TIE
1291 (aset char-acronym-table
#x1D177
"BEGSLR") ; MUSICAL SYMBOL BEGIN SLUR
1292 (aset char-acronym-table
#x1D178
"ENDSLR") ; MUSICAL SYMBOL END SLUR
1293 (aset char-acronym-table
#x1D179
"BEGPHR") ; MUSICAL SYMBOL BEGIN PHRASE
1294 (aset char-acronym-table
#x1D17A
"ENDPHR") ; MUSICAL SYMBOL END PHRASE
1295 (aset char-acronym-table
#xE0001
"|->TAG") ; LANGUAGE TAG
1296 (aset char-acronym-table
#xE0020
"SP TAG") ; TAG SPACE
1298 (aset char-acronym-table
(+ #xE0021 i
) (format " %c TAG" (+ 33 i
))))
1299 (aset char-acronym-table
#xE007F
"->|TAG") ; CANCEL TAG
1301 (defun update-glyphless-char-display (&optional variable value
)
1302 "Make the setting of `glyphless-char-display-control' take effect.
1303 This function updates the char-table `glyphless-char-display'."
1305 (set-default variable value
))
1307 (let ((target (car elt
))
1309 (or (memq method
'(zero-width thin-space empty-box acronym hex-code
))
1310 (error "Invalid glyphless character display method: %s" method
))
1311 (cond ((eq target
'c0-control
)
1312 (set-char-table-range glyphless-char-display
'(#x00 .
#x1F
)
1314 ;; Users will not expect their newlines and TABs be
1315 ;; displayed as anything but themselves, so exempt those
1316 ;; two characters from c0-control.
1317 (set-char-table-range glyphless-char-display
#x9 nil
)
1318 (set-char-table-range glyphless-char-display
#xa nil
))
1319 ((eq target
'c1-control
)
1320 (set-char-table-range glyphless-char-display
'(#x80 .
#x9F
)
1322 ((eq target
'format-control
)
1324 #'(lambda (char category
)
1325 (if (eq category
'Cf
)
1326 (let ((this-method method
)
1329 (setq from
(car char
) to
(cdr char
))
1330 (setq from char to char
))
1332 (when (/= from
#xAD
)
1333 (if (eq method
'acronym
)
1335 (aref char-acronym-table from
)))
1336 (set-char-table-range glyphless-char-display
1338 (setq from
(1+ from
))))))
1339 unicode-category-table
))
1340 ((eq target
'no-font
)
1341 (set-char-table-extra-slot glyphless-char-display
0 method
))
1343 (error "Invalid glyphless character group: %s" target
))))))
1345 ;;; Control of displaying glyphless characters.
1346 (defcustom glyphless-char-display-control
1347 '((format-control . thin-space
)
1348 (no-font . hex-code
))
1349 "List of directives to control display of glyphless characters.
1351 Each element has the form (GROUP . METHOD), where GROUP is a
1352 symbol specifying the character group, and METHOD is a symbol
1353 specifying the method of displaying characters belonging to that
1356 GROUP must be one of these symbols:
1357 `c0-control': U+0000..U+001F, but excluding newline and TAB.
1358 `c1-control': U+0080..U+009F.
1359 `format-control': Characters of Unicode General Category `Cf',
1360 such as U+200C (ZWNJ), U+200E (LRM), but
1361 excluding characters that have graphic images,
1362 such as U+00AD (SHY).
1363 `no-font': characters for which no suitable font is found.
1364 For character terminals, characters that cannot
1365 be encoded by `terminal-coding-system'.
1367 METHOD must be one of these symbols:
1368 `zero-width': don't display.
1369 `thin-space': display a thin (1-pixel width) space. On character
1370 terminals, display as 1-character space.
1371 `empty-box': display an empty box.
1372 `acronym': display an acronym of the character in a box. The
1373 acronym is taken from `char-acronym-table', which see.
1374 `hex-code': display the hexadecimal character code in a box."
1376 :type
'(alist :key-type
(symbol :tag
"Character Group")
1377 :value-type
(symbol :tag
"Display Method"))
1378 :options
'((c0-control
1379 (choice (const :tag
"Don't display" zero-width
)
1380 (const :tag
"Display as thin space" thin-space
)
1381 (const :tag
"Display as empty box" empty-box
)
1382 (const :tag
"Display acronym" acronym
)
1383 (const :tag
"Display hex code in a box" hex-code
)))
1385 (choice (const :tag
"Don't display" zero-width
)
1386 (const :tag
"Display as thin space" thin-space
)
1387 (const :tag
"Display as empty box" empty-box
)
1388 (const :tag
"Display acronym" acronym
)
1389 (const :tag
"Display hex code in a box" hex-code
)))
1391 (choice (const :tag
"Don't display" zero-width
)
1392 (const :tag
"Display as thin space" thin-space
)
1393 (const :tag
"Display as empty box" empty-box
)
1394 (const :tag
"Display acronym" acronym
)
1395 (const :tag
"Display hex code in a box" hex-code
)))
1397 (choice (const :tag
"Don't display" zero-width
)
1398 (const :tag
"Display as thin space" thin-space
)
1399 (const :tag
"Display as empty box" empty-box
)
1400 (const :tag
"Display acronym" acronym
)
1401 (const :tag
"Display hex code in a box" hex-code
))))
1402 :set
'update-glyphless-char-display
1406 ;;; Setting word boundary.
1408 (setq word-combining-categories
1414 (setq word-separating-categories
; (2-byte character sets)
1415 '((?H . ?K
) ; Hiragana - Katakana
1422 ;;; characters.el ends here