1 ;;; char-db-util.el --- Character Database utility
3 ;; Copyright (C) 1998,1999,2000,2001 MORIOKA Tomohiko.
5 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
6 ;; Keywords: UTF-2000, ISO/IEC 10646, Unicode, UCS-4, MULE.
8 ;; This file is part of XEmacs UTF-2000.
10 ;; XEmacs UTF-2000 is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; XEmacs UTF-2000 is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs UTF-2000; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (defconst unidata-normative-category-alist
30 '(("Lu" letter uppercase)
31 ("Ll" letter lowercase)
32 ("Lt" letter titlecase)
33 ("Mn" mark non-spacing)
34 ("Mc" mark spacing-combining)
36 ("Nd" number decimal-digit)
39 ("Zs" separator space)
41 ("Zp" separator paragraph)
44 ("Cs" other surrogate)
45 ("Co" other private-use)
46 ("Cn" other not-assigned)))
48 (defconst unidata-informative-category-alist
49 '(("Lm" letter modifier)
51 ("Pc" punctuation connector)
52 ("Pd" punctuation dash)
53 ("Ps" punctuation open)
54 ("Pe" punctuation close)
55 ("Pi" punctuation initial-quote)
56 ("Pf" punctuation final-quote)
57 ("Po" punctuation other)
59 ("Sc" symbol currency)
60 ("Sk" symbol modifier)
64 (defconst ideographic-radicals
65 (let ((v (make-vector 215 nil))
68 (aset v i (int-char (+ #x2EFF i)))
70 (if (< (charset-iso-final-char (car (split-char (aref v 34)))) ?0)
71 (aset v 34 (make-char 'chinese-gb2312 #x62 #x3A)))
75 (defun char-ref-p (obj)
77 (keywordp (car obj))))
80 (defun char-ref= (cr1 cr2)
81 (cond ((char-ref-p cr1)
83 (char-spec= (plist-get cr1 :char)
84 (plist-get cr2 :char))
85 (char-spec= (plist-get cr1 :char) cr2)))
93 (defun char-spec= (cs1 cs2)
97 (eq cs1 (find-char cs2)))
99 (eq (find-char cs1) cs2)
100 (eq (find-char cs1) (find-char cs2)))))
102 (defun char-attribute-name< (ka kb)
108 ((= (charset-dimension ka)
109 (charset-dimension kb))
110 (cond ((= (charset-chars ka)(charset-chars kb))
112 ((>= (charset-iso-final-char ka) ?@)
113 (if (>= (charset-iso-final-char kb) ?@)
114 (< (charset-iso-final-char ka)
115 (charset-iso-final-char kb))
117 ((>= (charset-iso-final-char ka) ?0)
119 ((>= (charset-iso-final-char kb) ?@)
121 ((>= (charset-iso-final-char kb) ?0)
122 (< (charset-iso-final-char ka)
123 (charset-iso-final-char kb)))
125 (t (if (>= (charset-iso-final-char kb) ?0)
127 (> (charset-id ka)(charset-id kb))))))
128 ((<= (charset-chars ka)(charset-chars kb)))))
130 (< (charset-dimension ka)
131 (charset-dimension kb))
141 (string< (symbol-name ka)
147 (defvar char-db-coded-charset-priority-list
148 (let ((rest default-coded-charset-priority-list)
151 (when (symbolp (car rest))
152 (cond ((memq (car rest)
161 ((string-match "^ideograph-gt-pj-" (symbol-name (car rest)))
162 (unless (memq 'ideograph-gt dest)
163 (setq dest (cons 'ideograph-gt dest))))
165 (setq dest (cons (car rest) dest)))))
166 (setq rest (cdr rest)))
167 (sort dest #'char-attribute-name<)))
169 (defun char-db-insert-char-spec (char &optional readable column)
171 (setq column (current-column)))
172 (let (char-spec ret al cal key temp-char)
173 (cond ((characterp char)
174 (cond ((and (setq ret (get-char-attribute char 'ucs))
175 (not (and (<= #xE000 ret)(<= ret #xF8FF))))
176 (setq char-spec (list (cons 'ucs ret)))
177 (if (setq ret (get-char-attribute char 'name))
178 (setq char-spec (cons (cons 'name ret) char-spec)))
181 (let ((default-coded-charset-priority-list
182 char-db-coded-charset-priority-list))
184 (setq char-spec (list ret))
185 (dolist (ccs (delq (car ret) (charset-list)))
186 (if (or (and (>= (charset-iso-final-char ccs) ?0)
187 (setq ret (get-char-attribute char ccs)))
188 (eq ccs 'ideograph-daikanwa))
189 (setq char-spec (cons (cons ccs ret) char-spec))))
191 (setq char-spec (split-char char)))
192 (if (setq ret (get-char-attribute char 'name))
193 (setq char-spec (cons (cons 'name ret) char-spec)))
196 (setq char-spec char)
200 (setq char (find-char char-spec))
202 ;; define temporary character
203 ;; Current implementation is dirty.
204 (setq temp-char (define-char (cons '(ideograph-daikanwa . 0)
206 (remove-char-attribute temp-char 'ideograph-daikanwa)
207 (setq char temp-char))
211 (setq key (car (car char-spec)))
212 (if (find-charset key)
213 (setq cal (cons key cal))
214 (setq al (cons key al)))
215 (setq char-spec (cdr char-spec)))
216 (insert-char-attributes char
220 ;; undefine temporary character
221 ;; Current implementation is dirty.
222 (setq char-spec (char-attribute-alist temp-char))
224 (remove-char-attribute temp-char (car (car char-spec)))
225 (setq char-spec (cdr char-spec))))))
227 (defun char-db-insert-alist (alist &optional readable column)
229 (setq column (current-column)))
231 (concat "\n" (make-string (1+ column) ?\ )))
234 lbs cell rest separator)
237 (setq name (car (car alist))
238 value (cdr (car alist)))
239 (cond ((eq name 'char)
241 (if (setq ret (condition-case nil
248 (setq key (car (car value)))
249 (if (find-charset key)
250 (setq cal (cons key cal))
251 (setq al (cons key al)))
252 (setq value (cdr value)))
253 (insert-char-attributes ret
256 (insert (prin1-to-string value)))
258 (insert line-breaking))
260 (insert (format "(%-18s " name))
261 (setq lbs (concat "\n" (make-string (current-column) ?\ )))
263 (setq cell (car value))
264 (if (and (consp cell)
266 (setq ret (condition-case nil
275 (setq key (car (car rest)))
276 (if (find-charset key)
277 (setq cal (cons key cal))
278 (setq al (cons key al)))
279 (setq rest (cdr rest)))
282 (insert-char-attributes ret
285 (setq separator lbs))
288 (insert (prin1-to-string cell))
289 (setq separator " "))
290 (setq value (cdr value)))
292 (insert line-breaking))
294 (insert (format "(%-18s . %S)%s"
297 (setq alist (cdr alist))))
300 (defun char-db-insert-char-reference (plist &optional readable column)
302 (setq column (current-column)))
304 (concat "\n" (make-string (1+ column) ?\ )))
308 (setq name (pop plist))
309 (setq value (pop plist))
310 (cond ((eq name :char)
312 (cond ((numberp value)
313 (setq value (decode-char 'ucs value)))
315 ;; (setq value (or (find-char value)
318 (char-db-insert-char-spec value readable)
319 (insert line-breaking))
321 (insert (format "%s\t%S%s"
327 (defun char-db-decode-isolated-char (ccs code-point)
330 (cond ((eq ccs 'arabic-iso8859-6)
331 (decode-char ccs code-point))
332 ((and (memq ccs '(ideograph-gt-pj-1
343 (setq ret (decode-char ccs code-point))
344 (setq ret (get-char-attribute ret 'ideograph-gt)))
345 (decode-builtin-char 'ideograph-gt ret))
347 (decode-builtin-char ccs code-point))))
348 (cond ((and (<= 0 (char-int ret))
349 (<= (char-int ret) #x1F))
350 (decode-char 'ucs (+ #x2400 (char-int ret))))
351 ((= (char-int ret) #x7F)
355 (defvar char-db-convert-obsolete-format t)
357 (defun insert-char-attributes (char &optional readable
358 attributes ccs-attributes
362 (if (consp attributes)
363 (copy-sequence attributes))
364 (char-attribute-list))
365 #'char-attribute-name<))
367 (sort (if ccs-attributes
368 (copy-sequence ccs-attributes)
370 #'char-attribute-name<))
372 (setq column (current-column)))
373 (let (name value has-long-ccs-name rest
376 (concat "\n" (make-string (1+ column) ?\ )))
377 lbs cell separator ret
380 (when (and (memq 'name attributes)
381 (setq value (get-char-attribute char 'name)))
383 (if (> (+ (current-column) (length value)) 48)
386 value line-breaking))
387 (setq attributes (delq 'name attributes))
389 (when (and (memq 'script attributes)
390 (setq value (get-char-attribute char 'script)))
391 (insert (format "(script\t\t%s)%s"
392 (mapconcat (function prin1-to-string)
395 (setq attributes (delq 'script attributes))
397 (when (and (memq '=>ucs attributes)
398 (setq value (get-char-attribute char '=>ucs)))
399 (insert (format "(=>ucs\t\t. #x%04X)\t; %c%s"
400 value (decode-char 'ucs value)
402 (setq attributes (delq '=>ucs attributes))
404 (when (and (memq '->ucs attributes)
405 (setq value (get-char-attribute char '->ucs)))
406 (insert (format (if char-db-convert-obsolete-format
407 "(=>ucs\t\t. #x%04X)\t; %c%s"
408 "(->ucs\t\t. #x%04X)\t; %c%s")
409 value (decode-char 'ucs value)
411 (setq attributes (delq '->ucs attributes))
413 (when (and (memq 'general-category attributes)
414 (setq value (get-char-attribute char 'general-category)))
416 "(general-category\t%s) ; %s%s"
417 (mapconcat (lambda (cell)
420 (cond ((rassoc value unidata-normative-category-alist)
421 "Normative Category")
422 ((rassoc value unidata-informative-category-alist)
423 "Informative Category")
427 (setq attributes (delq 'general-category attributes))
429 (when (and (memq 'bidi-category attributes)
430 (setq value (get-char-attribute char 'bidi-category)))
431 (insert (format "(bidi-category\t. %S)%s"
434 (setq attributes (delq 'bidi-category attributes))
436 (unless (or (not (memq 'mirrored attributes))
437 (eq (setq value (get-char-attribute char 'mirrored 'empty))
439 (insert (format "(mirrored\t\t. %S)%s"
442 (setq attributes (delq 'mirrored attributes))
445 ((and (memq 'decimal-digit-value attributes)
446 (setq value (get-char-attribute char 'decimal-digit-value)))
447 (insert (format "(decimal-digit-value . %S)%s"
450 (setq attributes (delq 'decimal-digit-value attributes))
451 (when (and (memq 'digit-value attributes)
452 (setq value (get-char-attribute char 'digit-value)))
453 (insert (format "(digit-value\t . %S)%s"
456 (setq attributes (delq 'digit-value attributes))
458 (when (and (memq 'numeric-value attributes)
459 (setq value (get-char-attribute char 'numeric-value)))
460 (insert (format "(numeric-value\t . %S)%s"
463 (setq attributes (delq 'numeric-value attributes))
467 (when (and (memq 'digit-value attributes)
468 (setq value (get-char-attribute char 'digit-value)))
469 (insert (format "(digit-value\t. %S)%s"
472 (setq attributes (delq 'digit-value attributes))
474 (when (and (memq 'numeric-value attributes)
475 (setq value (get-char-attribute char 'numeric-value)))
476 (insert (format "(numeric-value\t. %S)%s"
479 (setq attributes (delq 'numeric-value attributes))
481 (when (and (memq 'iso-10646-comment attributes)
482 (setq value (get-char-attribute char 'iso-10646-comment)))
483 (insert (format "(iso-10646-comment\t. %S)%s"
486 (setq attributes (delq 'iso-10646-comment attributes))
488 (when (and (memq 'morohashi-daikanwa attributes)
489 (setq value (get-char-attribute char 'morohashi-daikanwa)))
490 (insert (format "(morohashi-daikanwa\t%s)%s"
491 (mapconcat (function prin1-to-string) value " ")
493 (setq attributes (delq 'morohashi-daikanwa attributes))
497 (when (and (memq 'ideographic-radical attributes)
498 (setq value (get-char-attribute char 'ideographic-radical)))
500 (insert (format "(ideographic-radical . %S)\t; %c%s"
502 (aref ideographic-radicals radical)
504 (setq attributes (delq 'ideographic-radical attributes))
506 (when (and (memq 'ideographic-strokes attributes)
507 (setq value (get-char-attribute char 'ideographic-strokes)))
509 (insert (format "(ideographic-strokes . %S)%s"
512 (setq attributes (delq 'ideographic-strokes attributes))
514 (when (and (memq 'kangxi-radical attributes)
515 (setq value (get-char-attribute char 'kangxi-radical)))
516 (unless (eq value radical)
517 (insert (format "(kangxi-radical\t . %S)\t; %c%s"
519 (aref ideographic-radicals value)
522 (setq radical value)))
523 (setq attributes (delq 'kangxi-radical attributes))
525 (when (and (memq 'kangxi-strokes attributes)
526 (setq value (get-char-attribute char 'kangxi-strokes)))
527 (unless (eq value strokes)
528 (insert (format "(kangxi-strokes\t . %S)%s"
532 (setq strokes value)))
533 (setq attributes (delq 'kangxi-strokes attributes))
535 (when (and (memq 'japanese-radical attributes)
536 (setq value (get-char-attribute char 'japanese-radical)))
537 (unless (eq value radical)
538 (insert (format "(japanese-radical\t . %S)\t; %c%s"
540 (aref ideographic-radicals value)
543 (setq radical value)))
544 (setq attributes (delq 'japanese-radical attributes))
546 (when (and (memq 'japanese-strokes attributes)
547 (setq value (get-char-attribute char 'japanese-strokes)))
548 (unless (eq value strokes)
549 (insert (format "(japanese-strokes\t . %S)%s"
553 (setq strokes value)))
554 (setq attributes (delq 'japanese-strokes attributes))
556 (when (and (memq 'cns-radical attributes)
557 (setq value (get-char-attribute char 'cns-radical)))
558 (insert (format "(cns-radical\t . %S)\t; %c%s"
560 (aref ideographic-radicals value)
562 (setq attributes (delq 'cns-radical attributes))
564 (when (and (memq 'cns-strokes attributes)
565 (setq value (get-char-attribute char 'cns-strokes)))
566 (unless (eq value strokes)
567 (insert (format "(cns-strokes\t . %S)%s"
571 (setq strokes value)))
572 (setq attributes (delq 'cns-strokes attributes))
574 (when (and (memq 'shinjigen-1-radical attributes)
575 (setq value (get-char-attribute char 'shinjigen-1-radical)))
576 (unless (eq value radical)
577 (insert (format "(shinjigen-1-radical . %S)\t; %c%s"
579 (aref ideographic-radicals value)
582 (setq radical value)))
583 (setq attributes (delq 'shinjigen-1-radical attributes))
585 (when (and (memq 'total-strokes attributes)
586 (setq value (get-char-attribute char 'total-strokes)))
587 (insert (format "(total-strokes . %S)%s"
590 (setq attributes (delq 'total-strokes attributes))
592 (when (and (memq '->ideograph attributes)
593 (setq value (get-char-attribute char '->ideograph)))
594 (insert (format "(->ideograph\t%s)%s"
595 (mapconcat (lambda (code)
596 (cond ((symbolp code)
599 (format "#x%04X" code))
602 line-breaking code))))
605 (setq attributes (delq '->ideograph attributes))
607 (when (and (memq '->decomposition attributes)
608 (setq value (get-char-attribute char '->decomposition)))
609 (insert (format "(->decomposition\t%s)%s"
610 (mapconcat (lambda (code)
611 (cond ((symbolp code)
620 (format "#x%04X" code))
622 (format "%s%S" line-breaking code))))
625 (setq attributes (delq '->decomposition attributes))
627 (if (equal (get-char-attribute char '->titlecase)
628 (get-char-attribute char '->uppercase))
629 (setq attributes (delq '->titlecase attributes)))
630 (when (and (memq '->mojikyo attributes)
631 (setq value (get-char-attribute char '->mojikyo)))
632 (insert (format "(->mojikyo\t\t. %06d)\t; %c%s"
633 value (decode-char 'mojikyo value)
635 (setq attributes (delq '->mojikyo attributes))
637 (when (and (memq 'hanyu-dazidian-vol attributes)
638 (setq value (get-char-attribute char 'hanyu-dazidian-vol)))
639 (insert (format "(hanyu-dazidian-vol . %d)%s"
640 value line-breaking))
641 (setq attributes (delq 'hanyu-dazidian-vol attributes))
643 (when (and (memq 'hanyu-dazidian-page attributes)
644 (setq value (get-char-attribute char 'hanyu-dazidian-page)))
645 (insert (format "(hanyu-dazidian-page . %d)%s"
646 value line-breaking))
647 (setq attributes (delq 'hanyu-dazidian-page attributes))
649 (when (and (memq 'hanyu-dazidian-char attributes)
650 (setq value (get-char-attribute char 'hanyu-dazidian-char)))
651 (insert (format "(hanyu-dazidian-char . %d)%s"
652 value line-breaking))
653 (setq attributes (delq 'hanyu-dazidian-char attributes))
655 (setq rest ccs-attributes)
658 (setq value (get-char-attribute char (car rest)))
660 (if (>= (length (symbol-name (car rest))) 19)
662 (setq has-long-ccs-name t)
666 (setq rest (cdr rest)))
668 (setq name (car attributes))
669 (if (setq value (get-char-attribute char name))
670 (cond ((eq name 'jisx0208-1978/4X)
671 (insert (format "(%-18s . #x%04X)%s"
674 ((memq name '(->lowercase
675 ->uppercase ->titlecase
676 ->fullwidth <-fullwidth
678 ->vulgar-ideograph <-vulgar-ideograph
679 ->ancient-ideograph <-ancient-ideograph
680 ->original-ideograph <-original-ideograph
681 ->simplified-ideograph <-simplified-ideograph
682 ->wrong-ideograph <-wrong-ideograph
684 ->ideographic-variants
687 ->bopomofo <-bopomofo
688 ->ideographic <-ideographic
689 ideographic-structure))
690 (insert (format "(%-18s%s " name line-breaking))
691 (setq lbs (concat "\n" (make-string (current-column) ?\ ))
694 (setq cell (car value))
696 (setq cell (decode-char 'ucs cell)))
697 (cond ((characterp cell)
700 (char-db-insert-char-spec cell readable)
701 (setq separator lbs))
705 (if (consp (car cell))
706 (char-db-insert-char-spec cell readable)
707 (char-db-insert-char-reference cell readable))
708 (setq separator lbs))
712 (insert (prin1-to-string cell))
713 (setq separator " ")))
714 (setq value (cdr value)))
716 (insert line-breaking))
717 ((memq name '(ideograph=
718 original-ideograph-of
722 simplified-ideograph-of
724 ideographic-different-form-of))
725 (insert (format "(%-18s%s " name line-breaking))
726 (setq lbs (concat "\n" (make-string (current-column) ?\ ))
729 (setq cell (car value))
730 (if (and (consp cell)
735 (char-db-insert-alist cell readable)
736 (setq separator lbs))
739 (insert (prin1-to-string cell))
740 (setq separator " "))
741 (setq value (cdr value)))
743 (insert line-breaking))
744 ((string-match "^->" (symbol-name name))
746 (format "(%-18s %s)%s"
748 (mapconcat (lambda (code)
749 (cond ((symbolp code)
752 (format "#x%04X" code))
755 line-breaking code))))
759 (insert (format "(%-18s " name))
760 (setq lbs (concat "\n" (make-string (current-column) ?\ ))
763 (setq cell (car value))
764 (if (and (consp cell)
766 (setq ret (condition-case nil
774 (setq key (car (car rest)))
775 (if (find-charset key)
776 (setq cal (cons key cal))
777 (setq al (cons key al)))
778 (setq rest (cdr rest)))
781 (insert-char-attributes ret
784 (setq separator lbs))
787 (insert (prin1-to-string cell))
788 (setq separator " "))
789 (setq value (cdr value)))
791 (insert line-breaking))
793 (insert (format "(%-18s . %S)%s"
797 (setq attributes (cdr attributes)))
798 (while ccs-attributes
799 (setq name (car ccs-attributes))
800 (if (and (eq name (charset-name name))
801 (setq value (get-char-attribute char name)))
804 (cond ((memq name '(ideograph-daikanwa ideograph-gt
806 (if has-long-ccs-name
807 "(%-26s . %05d)\t; %c%s"
808 "(%-18s . %05d)\t; %c%s"))
810 (if has-long-ccs-name
811 "(%-26s . %06d)\t; %c%s"
812 "(%-18s . %06d)\t; %c%s"))
814 (if has-long-ccs-name
815 "(%-26s . #x%04X)\t; %c%s"
816 "(%-18s . #x%04X)\t; %c%s"))
818 (if has-long-ccs-name
819 "(%-26s . #x%02X)\t; %c%s"
820 "(%-18s . #x%02X)\t; %c%s")))
822 (if (= (charset-iso-graphic-plane name) 1)
824 (cond ((= (charset-dimension name) 1)
826 ((= (charset-dimension name) 2)
828 ((= (charset-dimension name) 3)
832 (char-db-decode-isolated-char name value)
834 (setq ccs-attributes (cdr ccs-attributes)))
837 (defun insert-char-data (char &optional readable
838 attributes ccs-attributes)
840 (narrow-to-region (point)(point))
841 (insert "(define-char
843 (insert-char-attributes char readable
844 attributes ccs-attributes)
846 (goto-char (point-min))
847 (while (re-search-forward "[ \t]+$" nil t)
849 (goto-char (point-max))
850 (tabify (point-min)(point-max))
854 (defun char-db-update-comment ()
857 (goto-char (point-min))
858 (let (cdef table char)
859 (while (re-search-forward "^[ \t]*\\(([^.()]+)\\)" nil t)
860 (goto-char (match-beginning 1))
861 (setq cdef (read (current-buffer)))
862 (when (find-charset (car cdef))
863 (goto-char (match-end 0))
866 (not (eq (car cdef) 'ideograph-daikanwa))
867 (or (memq (car cdef) '(ascii latin-viscii-upper
871 japanese-jisx0213-2))
872 (= (char-int (charset-iso-final-char (car cdef)))
874 (apply (function make-char) cdef)
875 (if (setq table (charset-mapping-table (car cdef)))
876 (set-charset-mapping-table (car cdef) nil))
878 (apply (function make-char) cdef)
880 (set-charset-mapping-table (car cdef) table)))))
881 (when (not (or (< (char-int char) 32)
882 (and (<= 128 (char-int char))
883 (< (char-int char) 160))))
884 (delete-region (point) (point-at-eol))
885 (insert (format "\t; %c" char)))
888 (defun insert-char-data-with-variant (char &optional printable
890 script excluded-script)
891 (insert-char-data char printable)
892 (let ((variants (or (char-variants char)
893 (let ((ucs (get-char-attribute char '->ucs)))
895 (delete char (char-variants (int-char ucs)))))))
897 (setq variants (sort variants #'<))
899 (setq variant (car variants))
900 (if (and (or (null script)
901 (null (setq vs (get-char-attribute variant 'script)))
903 (or (null excluded-script)
904 (null (setq vs (get-char-attribute variant 'script)))
905 (not (memq excluded-script vs))))
906 (or (and no-ucs-variant (get-char-attribute variant 'ucs))
907 (insert-char-data variant printable)))
908 (setq variants (cdr variants))
911 (defun insert-char-range-data (min max &optional script excluded-script)
915 (setq char (decode-char 'ucs code))
916 (if (get-char-attribute char 'ucs)
917 (insert-char-data-with-variant char nil 'no-ucs-variant
918 script excluded-script))
919 (setq code (1+ code))
922 (defun write-char-range-data-to-file (min max file
923 &optional script excluded-script)
924 (let ((coding-system-for-write 'utf-8))
926 (insert-char-range-data min max script excluded-script)
927 (write-region (point-min)(point-max) file))))
929 (defvar what-character-original-window-configuration)
932 (defun what-char-definition (char)
933 (interactive (list (char-after)))
934 (let ((buf (get-buffer-create "*Character Description*"))
935 (the-buf (current-buffer))
936 (win-conf (current-window-configuration)))
938 (make-local-variable 'what-character-original-window-configuration)
939 (setq what-character-original-window-configuration win-conf)
940 (setq buffer-read-only nil)
944 (insert-char-data-with-variant char 'printable)
945 (unless (char-attribute-alist char)
946 (insert (format ";; = %c\n"
947 (apply #'make-char (split-char char)))))
948 ;; (char-db-update-comment)
949 (set-buffer-modified-p nil)
950 (view-mode the-buf (lambda (buf)
951 (set-window-configuration
952 what-character-original-window-configuration)
954 (goto-char (point-min)))
956 (set-window-configuration
957 what-character-original-window-configuration)
958 (signal (car err) (cdr err)))))))
960 (provide 'char-db-util)
962 ;;; char-db-util.el ends here