157 |
|
|
158 |
;; Chinese character set (BIG5) |
;; Chinese character set (BIG5) |
159 |
|
|
160 |
(map-charset-chars #'modify-category-entry 'chinese-big5-1 ?c) |
(map-charset-chars #'modify-category-entry 'big5 ?c) |
161 |
(map-charset-chars #'modify-category-entry 'chinese-big5-2 ?c) |
(map-charset-chars #'modify-category-entry 'big5 ?C) |
162 |
(map-charset-chars #'modify-category-entry 'chinese-big5-1 ?C) |
(map-charset-chars #'modify-category-entry 'big5 ?|) |
163 |
(map-charset-chars #'modify-category-entry 'chinese-big5-2 ?C) |
|
|
(map-charset-chars #'modify-category-entry 'chinese-big5-1 ?|) |
|
|
(map-charset-chars #'modify-category-entry 'chinese-big5-2 ?|) |
|
164 |
|
|
165 |
;; Chinese character set (CNS11643) |
;; Chinese character set (CNS11643) |
166 |
|
|
772 |
;; Fixme: syntax for symbols &c |
;; Fixme: syntax for symbols &c |
773 |
) |
) |
774 |
|
|
|
;;; Setting word boundary. |
|
|
|
|
|
(setq word-combining-categories |
|
|
'((?l . ?l))) |
|
|
|
|
|
(setq word-separating-categories ; (2-byte character sets) |
|
|
'((?A . ?K) ; Alpha numeric - Katakana |
|
|
(?A . ?C) ; Alpha numeric - Chinese |
|
|
(?H . ?A) ; Hiragana - Alpha numeric |
|
|
(?H . ?K) ; Hiragana - Katakana |
|
|
(?H . ?C) ; Hiragana - Chinese |
|
|
(?K . ?A) ; Katakana - Alpha numeric |
|
|
(?K . ?C) ; Katakana - Chinese |
|
|
(?C . ?A) ; Chinese - Alpha numeric |
|
|
(?C . ?K) ; Chinese - Katakana |
|
|
)) |
|
|
|
|
|
|
|
775 |
;; For each character set, put the information of the most proper |
;; For each character set, put the information of the most proper |
776 |
;; coding system to encode it by `preferred-coding-system' property. |
;; coding system to encode it by `preferred-coding-system' property. |
777 |
|
|
924 |
(#x1800 #x18AF mongolian) |
(#x1800 #x18AF mongolian) |
925 |
(#x1E00 #x1EFF latin) |
(#x1E00 #x1EFF latin) |
926 |
(#x1F00 #x1FFF greek) |
(#x1F00 #x1FFF greek) |
|
(#x20000 #x2AFFF han) |
|
927 |
(#x20A0 #x20AF currency) |
(#x20A0 #x20AF currency) |
928 |
(#x2800 #x28FF braille) |
(#x2800 #x28FF braille) |
929 |
(#x2E80 #x2FDF han) |
(#x2E80 #x2FDF han) |
944 |
(#xFF00 #xFF5F cjk-misc) |
(#xFF00 #xFF5F cjk-misc) |
945 |
(#xFF61 #xFF9F kana) |
(#xFF61 #xFF9F kana) |
946 |
(#xFFE0 #xFFE6 cjk-misc) |
(#xFFE0 #xFFE6 cjk-misc) |
947 |
|
(#x20000 #x2AFFF han) |
948 |
(#x2F800 #x2FFFF han))) |
(#x2F800 #x2FFFF han))) |
949 |
(set-char-table-range char-script-table |
(set-char-table-range char-script-table |
950 |
(cons (car elt) (nth 1 elt)) (nth 2 elt)) |
(cons (car elt) (nth 1 elt)) (nth 2 elt)) |
952 |
(setq script-list (cons (nth 2 elt) script-list)))) |
(setq script-list (cons (nth 2 elt) script-list)))) |
953 |
(set-char-table-extra-slot char-script-table 0 (nreverse script-list))) |
(set-char-table-extra-slot char-script-table 0 (nreverse script-list))) |
954 |
|
|
955 |
|
|
956 |
|
;;; Setting word boundary. |
957 |
|
|
958 |
|
(defun next-word-boundary-han (pos limit) |
959 |
|
(if (<= pos limit) |
960 |
|
(save-excursion |
961 |
|
(goto-char pos) |
962 |
|
(looking-at "\\cC+") |
963 |
|
(goto-char (match-end 0)) |
964 |
|
(if (looking-at "\\cK+\\|\\cH+") |
965 |
|
(goto-char (match-end 0))) |
966 |
|
(point)) |
967 |
|
(while (and (> pos limit) |
968 |
|
(eq (aref char-script-table (char-after (1- pos))) 'han)) |
969 |
|
(setq pos (1- pos))) |
970 |
|
pos)) |
971 |
|
|
972 |
|
(defun next-word-boundary-kana (pos limit) |
973 |
|
(if (<= pos limit) |
974 |
|
(save-excursion |
975 |
|
(goto-char pos) |
976 |
|
(if (looking-at "\\cK+") |
977 |
|
(goto-char (match-end 0))) |
978 |
|
(if (looking-at "\\cH+") |
979 |
|
(goto-char (match-end 0))) |
980 |
|
(point)) |
981 |
|
(let ((category-set (char-category-set (char-after pos))) |
982 |
|
category) |
983 |
|
(if (aref category-set ?K) |
984 |
|
(while (and (> pos limit) |
985 |
|
(aref (char-category-set (char-after (1- pos))) ?K)) |
986 |
|
(setq pos (1- pos))) |
987 |
|
(while (and (> pos limit) |
988 |
|
(aref (setq category-set |
989 |
|
(char-category-set (char-after (1- pos)))) ?H)) |
990 |
|
(setq pos (1- pos))) |
991 |
|
(setq category (cond ((aref category-set ?C) ?C) |
992 |
|
((aref category-set ?K) ?K) |
993 |
|
((aref category-set ?A) ?A))) |
994 |
|
(when category |
995 |
|
(setq pos (1- pos)) |
996 |
|
(while (and (> pos limit) |
997 |
|
(aref (char-category-set (char-after (1- pos))) |
998 |
|
category)) |
999 |
|
(setq pos (1- pos))))) |
1000 |
|
pos))) |
1001 |
|
|
1002 |
|
(map-char-table |
1003 |
|
#'(lambda (char script) |
1004 |
|
(cond ((eq script 'han) |
1005 |
|
(set-char-table-range next-word-boundary-function-table |
1006 |
|
char #'next-word-boundary-han)) |
1007 |
|
((eq script 'kana) |
1008 |
|
(set-char-table-range next-word-boundary-function-table |
1009 |
|
char #'next-word-boundary-kana)))) |
1010 |
|
char-script-table) |
1011 |
|
|
1012 |
|
(setq word-combining-categories |
1013 |
|
'((?l . ?l))) |
1014 |
|
|
1015 |
|
(setq word-separating-categories ; (2-byte character sets) |
1016 |
|
'((?A . ?K) ; Alpha numeric - Katakana |
1017 |
|
(?A . ?C) ; Alpha numeric - Chinese |
1018 |
|
(?H . ?A) ; Hiragana - Alpha numeric |
1019 |
|
(?H . ?K) ; Hiragana - Katakana |
1020 |
|
(?H . ?C) ; Hiragana - Chinese |
1021 |
|
(?K . ?A) ; Katakana - Alpha numeric |
1022 |
|
(?K . ?C) ; Katakana - Chinese |
1023 |
|
(?C . ?A) ; Chinese - Alpha numeric |
1024 |
|
(?C . ?K) ; Chinese - Katakana |
1025 |
|
)) |
1026 |
|
|
1027 |
;;; Local Variables: |
;;; Local Variables: |
1028 |
;;; coding: utf-8-emacs |
;;; coding: utf-8-emacs |
1029 |
;;; End: |
;;; End: |