# HG changeset patch # User Kenichi Handa # Date 1219996903 0 # Node ID 8dfd5f6c48e4e766339a1a5a80c4dc32b65cfe98 # Parent 10312e057a9734123268994519d4b824ea5a9138 (unicode-category-table): Setup unicode-category-table. diff -r 10312e057a97 -r 8dfd5f6c48e4 lisp/international/characters.el --- a/lisp/international/characters.el Fri Aug 29 08:01:22 2008 +0000 +++ b/lisp/international/characters.el Fri Aug 29 08:01:43 2008 +0000 @@ -1116,6 +1116,26 @@ 'tibetan) +;;; Setting unicode-category-table. + +;; This macro is to build unicode-category-table at compile time so +;; that C code can access the table efficiently. +(defmacro build-unicode-category-table () + (let ((table (make-char-table 'unicode-category-table nil))) + (dotimes (i #x110000) + (if (or (< i #xD800) + (and (> i #xF900) (< i #x30000)) + (and (> i #xE0000) (< i #xE0200))) + (aset table i (get-char-code-property i 'general-category)))) + (set-char-table-range table '(#xE000 . #xF8FF) 'Co) + (set-char-table-range table '(#xF0000 . #xFFFFD) 'Co) + (set-char-table-range table '(#x100000 . #x10FFFD) 'Co) + (optimize-char-table table 'eq) + table)) + +(setq unicode-category-table (build-unicode-category-table)) + + ;;; Setting word boundary. (defun next-word-boundary-han (pos limit)