56291b605a0d0e1bd987017db5a39a46570c231a
[chise/xemacs-chise.git.1] / lisp / utf-2000 / char-db-util.el
1 ;;; char-db-util.el --- Character Database utility -*- coding: utf-8-er; -*-
2
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
4 ;;   2007, 2008, 2009, 2010 MORIOKA Tomohiko.
5
6 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
7 ;; Keywords: CHISE, Character Database, ISO/IEC 10646, UCS, Unicode, MULE.
8
9 ;; This file is part of XEmacs CHISE.
10
11 ;; XEmacs CHISE is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
15
16 ;; XEmacs CHISE is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs CHISE; see the file COPYING.  If not, write to
23 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Code:
27
28 (require 'chise-subr)
29 (require 'ideograph-subr)
30
31 (defconst unidata-normative-category-alist
32   '(("Lu" letter        uppercase)
33     ("Ll" letter        lowercase)
34     ("Lt" letter        titlecase)
35     ("Mn" mark          non-spacing)
36     ("Mc" mark          spacing-combining)
37     ("Me" mark          enclosing)
38     ("Nd" number        decimal-digit)
39     ("Nl" number        letter)
40     ("No" number        other)
41     ("Zs" separator     space)
42     ("Zl" separator     line)
43     ("Zp" separator     paragraph)
44     ("Cc" other         control)
45     ("Cf" other         format)
46     ("Cs" other         surrogate)
47     ("Co" other         private-use)
48     ("Cn" other         not-assigned)))
49
50 (defconst unidata-informative-category-alist
51   '(("Lm" letter        modifier)
52     ("Lo" letter        other)
53     ("Pc" punctuation   connector)
54     ("Pd" punctuation   dash)
55     ("Ps" punctuation   open)
56     ("Pe" punctuation   close)
57     ("Pi" punctuation   initial-quote)
58     ("Pf" punctuation   final-quote)
59     ("Po" punctuation   other)
60     ("Sm" symbol        math)
61     ("Sc" symbol        currency)
62     ("Sk" symbol        modifier)
63     ("So" symbol        other)
64     ))
65
66 (defconst shuowen-radicals
67   [?一 ?上 ?示 ?三 ?王 ?玉 ?玨 ?气 ?士 ?丨 ; 010
68    ?屮 ?艸 ?蓐 ?茻 ?小 ?八 ?釆 ?半 ?牛 ?犛 ; 020
69    ?告 ?口 ?凵 ?吅 ?哭 ?走 ?止 ?癶 ?步 ?此 ; 030
70    ?正 ?是 ?辵 ?彳 ?廴 ?㢟 ?行 ?齒 ?牙 ?足 ; 040
71    ?疋 ?品 ?龠 ?冊 ?㗊 ?舌 ?干 ?谷 ?只 ?㕯 ; 050
72    ?句 ?丩 ?古 ?十 ?卅 ?言 ?誩 ?音 ?䇂 ?丵 ; 060
73    ?菐 ?𠬞 ?廾 ?共 ?異 ?舁 ?𦥑 ?䢅 ?爨 ?革 ; 070
74    ?鬲 ?䰜 ?爪 ?𠃨 ?鬥 ?又 ?𠂇 ?㕜 ?支 ?𦘒 ; 080
75    ?聿 ?畫 ?隶 ?臤 ?臣 ?殳 ?殺 ?𠘧 ?寸 ?皮 ; 090
76    ?㼱 ?攴 ?敎 ?卜 ?用 ?爻 ?㸚 ?𥄎 ?目 ?䀠 ; 100
77    ?眉 ?盾 ?自 ?白 ?鼻 ?皕 ?習 ?羽 ?隹 ?奞 ; 110
78    ?萑 ?𦫳 ?苜 ?羊 ?羴 ?瞿 ?雔 ?雥 ?鳥 ?烏 ; 120
79    ?𠦒 ?冓 ?幺 ?𢆶 ?叀 ?玄 ?予 ?放 ?𠬪 ?𣦼 ; 130
80    ?歺 ?死 ?冎 ?骨 ?肉 ?筋 ?刀 ?刃 ?㓞 ?丰 ; 140
81    ?耒 ?𧢲 ?竹 ?箕 ?丌 ?左 ?工 ?㠭 ?巫 ?甘 ; 150
82    ?曰 ?乃 ?丂 ?可 ?兮 ?号 ?亏 ?旨 ?喜 ?壴 ; 160
83    ?鼓 ?豈 ?豆 ?豊 ?豐 ?䖒 ?虍 ?虎 ?虤 ?皿 ; 170
84    ?𠙴 ?去 ?血 ?丶 ?丹 ?青 ?井 ?皀 ?鬯 ?食 ; 180
85    ?亼 ?會 ?倉 ?入 ?缶 ?矢 ?高 ?冂 ?𩫏 ?京 ; 190
86    ?亯 ?𣆪 ?畗 ?㐭 ?嗇 ?來 ?麥 ?夊 ?舛 ?䑞 ; 200
87    ?韋 ?弟 ?夂 ?久 ?桀 ?木 ?東 ?林 ?才 ?叒 ; 210
88    ?之 ?帀 ?出 ?𣎵 ?生 ?乇 ?𠂹 ?𠌶 ?華 ?𥝌 ; 220
89    ?稽 ?巢 ?桼 ?束 ?㯻 ?囗 ?員 ?貝 ?邑 ?𨛜 ; 230
90    ?日 ?旦 ?倝 ?㫃 ?冥 ?晶 ?月 ?有 ?明 ?囧 ; 240
91    ?夕 ?多 ?毌 ?𢎘 ?𣐺 ?卣 ?齊 ?朿 ?片 ?鼎 ; 250
92    ?克 ?彔 ?禾 ?秝 ?黍 ?香 ?米 ?毇 ?臼 ?凶 ; 260
93    ?𣎳 ?林 ?麻 ?尗 ?耑 ?韭 ?瓜 ?瓠 ?宀 ?宮 ; 270
94    ?呂 ?穴 ?㝱 ?𤕫 ?冖 ?𠔼 ?冃 ?㒳 ?网 ?襾 ; 280
95    ?巾 ?巿 ?帛 ?白 ?㡀 ?黹 ?人 ?𠤎 ?匕 ?从 ; 290
96    ])
97
98 (defun shuowen-radical (number)
99   (aref shuowen-radicals (1- number)))
100
101 (defvar char-db-file-coding-system 'utf-8-mcs-er)
102
103 (defvar char-db-ignored-attributes '(ideographic-products))
104
105 (defvar char-db-coded-charset-priority-list
106   '(ascii
107     control-1
108     latin-iso8859-1
109     latin-iso8859-2
110     latin-iso8859-3
111     latin-iso8859-4
112     latin-iso8859-9
113     latin-jisx0201
114     cyrillic-iso8859-5
115     greek-iso8859-7
116     thai-tis620
117     =jis-x0208
118     =jis-x0208@1978
119     =jis-x0208@1983
120     japanese-jisx0212
121     chinese-gb2312
122     =jis-x0208@1990
123     chinese-cns11643-1
124     chinese-cns11643-2
125     chinese-cns11643-3
126     chinese-cns11643-4
127     chinese-cns11643-5
128     chinese-cns11643-6
129     chinese-cns11643-7
130     =jis-x0213-1
131     =jis-x0213-1@2000
132     =jis-x0213-1@2004
133     =jis-x0213-2
134     korean-ksc5601
135     chinese-isoir165
136     katakana-jisx0201
137     hebrew-iso8859-8
138     chinese-gb12345
139     latin-viscii
140     ethiopic-ucs
141     =big5-cdp
142     =gt
143     ideograph-daikanwa-2
144     ideograph-daikanwa
145     =cbeta
146     =gt-k
147     ideograph-hanziku-1
148     ideograph-hanziku-2
149     ideograph-hanziku-3
150     ideograph-hanziku-4
151     ideograph-hanziku-5
152     ideograph-hanziku-6
153     ideograph-hanziku-7
154     ideograph-hanziku-8
155     ideograph-hanziku-9
156     ideograph-hanziku-10
157     ideograph-hanziku-11
158     ideograph-hanziku-12
159     =>>jis-x0208
160     =>>jis-x0213-1
161     =>>jis-x0213-1@2000
162     =>>jis-x0213-1@2004
163     =>>jis-x0213-2
164     =>>jis-x0208@1978
165     =>>gt
166     =>jis-x0208
167     =>jis-x0208@1997
168     =>jis-x0213-1
169     =>jis-x0213-1@2000
170     =>jis-x0213-1@2004
171     =>jis-x0213-2
172     ==>ucs@bucs
173     =>ucs@iso
174     =>ucs@unicode
175     =>ucs@cns
176     =>>ucs@unicode
177     =>>ucs@jis
178     =>>ucs@cns
179     =ucs@iso
180     =ucs@unicode
181     =>>big5-cdp
182     =>>gt-k
183     =>gt
184     =>big5-cdp
185     =>daikanwa
186     =big5
187     =big5-eten
188     =zinbun-oracle
189     =>zinbun-oracle
190     =ruimoku-v6
191     =jef-china3
192     =shinjigen))
193
194
195 ;;; @ char-db formatters
196 ;;;
197
198 (defun char-db-make-char-spec (char)
199   (let (ret char-spec)
200     (cond ((characterp char)
201            (cond ((and (setq ret (encode-char char '=ucs 'defined-only))
202                        (not (and (<= #xE000 ret)(<= ret #xF8FF))))
203                   (setq char-spec (list (cons '=ucs ret)))
204                   (cond ((setq ret (get-char-attribute char 'name))
205                          (setq char-spec (cons (cons 'name ret) char-spec))
206                          )
207                         ((setq ret (get-char-attribute char 'name*))
208                          (setq char-spec (cons (cons 'name* ret) char-spec))
209                          ))
210                   )
211                  ((setq ret
212                         (catch 'tag
213                           (let ((rest char-db-coded-charset-priority-list)
214                                 ccs)
215                             (while rest
216                               (setq ccs (charset-name
217                                          (find-charset (car rest))))
218                               (if (setq ret
219                                         (encode-char char ccs
220                                                      'defined-only))
221                                   (throw 'tag (cons ccs ret)))
222                               (setq rest (cdr rest))))))
223                   (setq char-spec (list ret))
224                   (dolist (ccs (delq (car ret) (charset-list)))
225                     (if (and (or (charset-iso-final-char ccs)
226                                  (memq ccs
227                                        '(=daikanwa
228                                          =daikanwa@rev2
229                                          ;; =gt-k
230                                          =jis-x0208@1997
231                                          ))
232                                  (string-match "=ucs@" (symbol-name ccs)))
233                              (setq ccs (charset-name ccs))
234                              (null (assq ccs char-spec))
235                              (setq ret (encode-char char ccs 'defined-only)))
236                         (setq char-spec (cons (cons ccs ret) char-spec))))
237                   (if (null char-spec)
238                       (setq char-spec (split-char char)))
239                   (cond ((setq ret (get-char-attribute char 'name))
240                          (setq char-spec (cons (cons 'name ret) char-spec))
241                          )
242                         ((setq ret (get-char-attribute char 'name*))
243                          (setq char-spec (cons (cons 'name* ret) char-spec))
244                          ))
245                   )
246                  ((setq ret (get-char-attribute
247                              char 'ideographic-combination))
248                   (setq char-spec
249                         (cons (cons 'ideographic-combination ret)
250                               char-spec))
251                   ))
252            char-spec)
253           ((consp char)
254            char))))
255     
256 (defun char-db-insert-char-spec (char &optional readable column
257                                       required-features)
258   (unless column
259     (setq column (current-column)))
260   (let (char-spec temp-char)
261     (setq char-spec (char-db-make-char-spec char))
262     (unless (or (characterp char) ; char
263                 (condition-case nil
264                     (setq char (find-char char-spec))
265                   (error nil)))
266       ;; define temporary character
267       ;;   Current implementation is dirty.
268       (setq temp-char (define-char (cons '(ideograph-daikanwa . 0)
269                                          char-spec)))
270       (remove-char-attribute temp-char 'ideograph-daikanwa)
271       (setq char temp-char))
272     (insert-char-attributes char
273                             readable
274                             (union (mapcar #'car char-spec)
275                                    required-features))
276     (when temp-char
277       ;; undefine temporary character
278       ;;   Current implementation is dirty.
279       (setq char-spec (char-attribute-alist temp-char))
280       (while char-spec
281         (remove-char-attribute temp-char (car (car char-spec)))
282         (setq char-spec (cdr char-spec))))))
283
284 (defun char-db-insert-alist (alist &optional readable column)
285   (unless column
286     (setq column (current-column)))
287   (let ((line-breaking
288          (concat "\n" (make-string (1+ column) ?\ )))
289         name value
290         ret al ; cal
291         key
292         lbs cell rest separator)
293     (insert "(")
294     (while alist
295       (setq name (car (car alist))
296             value (cdr (car alist)))
297       (cond ((eq name 'char)
298              (insert "(char . ")
299              (if (setq ret (condition-case nil
300                                (find-char value)
301                              (error nil)))
302                  (progn
303                    (setq al nil
304                          ;; cal nil
305                          )
306                    (while value
307                      (setq key (car (car value)))
308                      ;; (if (find-charset key)
309                      ;;     (setq cal (cons key cal))
310                      (setq al (cons key al))
311                      ;; )
312                      (setq value (cdr value)))
313                    (insert-char-attributes ret
314                                            readable
315                                            (or al 'none) ; cal
316                                            ))
317                (insert (prin1-to-string value)))
318              (insert ")")
319              (insert line-breaking))
320             ((consp value)
321              (insert (format "(%-18s " name))
322              (setq lbs (concat "\n" (make-string (current-column) ?\ )))
323              (while (consp value)
324                (setq cell (car value))
325                (if (and (consp cell)
326                         (consp (car cell))
327                         (setq ret (condition-case nil
328                                       (find-char cell)
329                                     (error nil)))
330                         )
331                    (progn
332                      (setq rest cell
333                            al nil
334                            ;; cal nil
335                            )
336                      (while rest
337                        (setq key (car (car rest)))
338                        ;; (if (find-charset key)
339                        ;;     (setq cal (cons key cal))
340                        (setq al (cons key al))
341                        ;; )
342                        (setq rest (cdr rest)))
343                      (if separator
344                          (insert lbs))
345                      (insert-char-attributes ret
346                                              readable
347                                              al ; cal
348                                              )
349                      (setq separator lbs))
350                  (if separator
351                      (insert separator))
352                  (insert (prin1-to-string cell))
353                  (setq separator " "))
354                (setq value (cdr value)))
355              (insert ")")
356              (insert line-breaking))
357             (t
358              (insert (format "(%-18s . %S)%s"
359                              name value
360                              line-breaking))))
361       (setq alist (cdr alist))))
362   (insert ")"))
363
364 (defun char-db-insert-char-reference (plist &optional readable column)
365   (unless column
366     (setq column (current-column)))
367   (let ((line-breaking
368          (concat "\n" (make-string (1+ column) ?\ )))
369         (separator "")
370         name value)
371     (insert "(")
372     (while plist
373       (setq name (pop plist))
374       (setq value (pop plist))
375       (cond ((eq name :char)
376              (insert separator)
377              (insert ":char\t")
378              (cond ((numberp value)
379                     (setq value (decode-char '=ucs value)))
380                    ;; ((consp value)
381                    ;;  (setq value (or (find-char value)
382                    ;;                  value)))
383                    )
384              (char-db-insert-char-spec value readable)
385              (insert line-breaking)
386              (setq separator ""))
387             ((eq name :radical)
388              (insert (format "%s%s\t%d ; %c%s"
389                              separator
390                              name value
391                              (ideographic-radical value)
392                              line-breaking))
393              (setq separator ""))
394             (t
395              (insert (format "%s%s\t%S" separator name value))
396              (setq separator line-breaking)))
397       ))
398   (insert ")"))
399
400 (defun char-db-decode-isolated-char (ccs code-point)
401   (let (ret)
402     (setq ret
403           (cond ((eq ccs 'arabic-iso8859-6)
404                  (decode-char ccs code-point))
405                 ((and (memq ccs '(=gt-pj-1
406                                   =gt-pj-2
407                                   =gt-pj-3
408                                   =gt-pj-4
409                                   =gt-pj-5
410                                   =gt-pj-6
411                                   =gt-pj-7
412                                   =gt-pj-8
413                                   =gt-pj-9
414                                   =gt-pj-10
415                                   =gt-pj-11))
416                       (setq ret (decode-char ccs code-point))
417                       (setq ret (encode-char ret '=gt 'defined-only)))
418                  (decode-builtin-char '=gt ret))
419                 (t
420                  (decode-builtin-char ccs code-point))))
421     (cond ((and (<= 0 (char-int ret))
422                 (<= (char-int ret) #x1F))
423            (decode-char '=ucs (+ #x2400 (char-int ret))))
424           ((= (char-int ret) #x7F)
425            ?\u2421)
426           (t ret))))
427
428 (defvar char-db-convert-obsolete-format t)
429
430 (defun char-db-insert-ccs-feature (name value line-breaking)
431   (insert
432    (format
433     (cond ((memq name '(=shinjigen
434                         =shinjigen@1ed
435                         =shinjigen@rev =shinjigen/+p@rev))
436            "(%-18s .  %04d)\t; %c")
437           ((eq name '=shinjigen@1ed/24pr)
438            "(%-18s . %04d)\t; %c")
439           ((or (memq name '(=daikanwa
440                             =daikanwa@rev1 =daikanwa@rev2
441                             =>>daikanwa =>daikanwa
442                             =gt =>>gt =>gt =gt-k =>>gt-k =cbeta
443                             =zinbun-oracle =>zinbun-oracle))
444                (string-match "^=adobe-" (symbol-name name)))
445            "(%-18s . %05d)\t; %c")
446           ((eq name 'mojikyo)
447            "(%-18s . %06d)\t; %c")
448           ((>= (charset-dimension name) 2)
449            "(%-18s . #x%04X)\t; %c")
450           (t
451            "(%-18s . #x%02X)\t; %c"))
452     name
453     (if (= (charset-iso-graphic-plane name) 1)
454         (logior value
455                 (cond ((= (charset-dimension name) 1)
456                        #x80)
457                       ((= (charset-dimension name) 2)
458                        #x8080)
459                       ((= (charset-dimension name) 3)
460                        #x808080)
461                       (t 0)))
462       value)
463     (char-db-decode-isolated-char name value)))
464   (if (and (= (charset-chars name) 94)
465            (= (charset-dimension name) 2))
466       (insert (format " [%02d-%02d]"
467                       (- (lsh value -8) 32)
468                       (- (logand value 255) 32))))
469   (insert line-breaking))
470
471 (defun char-db-insert-relation-feature (char name value line-breaking
472                                              ccss readable)
473   (insert (format "(%-18s%s " name line-breaking))
474   (let ((lbs (concat "\n" (make-string (current-column) ?\ )))
475         separator cell sources required-features
476         ret)
477     (while (consp value)
478       (setq cell (car value))
479       (if (integerp cell)
480           (setq cell (decode-char '=ucs cell)))
481       (cond
482        ((eq name '->subsumptive)
483         (when (or (not (some (lambda (atr)
484                                (get-char-attribute cell atr))
485                              char-db-ignored-attributes))
486                   (some (lambda (ccs)
487                           (encode-char cell ccs 'defined-only))
488                         ccss))
489           (if separator
490               (insert lbs))
491           (let ((char-db-ignored-attributes
492                  (cons '<-subsumptive
493                        char-db-ignored-attributes)))
494             (insert-char-attributes cell readable))
495           (setq separator lbs))
496         )
497        ((characterp cell)
498         (setq sources
499               (get-char-attribute
500                char (intern (format "%s*sources" name))))
501         (setq required-features nil)
502         (dolist (source sources)
503           (cond
504            ((memq source '(JP
505                            JP/Jouyou
506                            shinjigen shinjigen@1ed shinjigen@rev))
507             (setq required-features
508                   (union required-features
509                          '(=jis-x0208
510                            =jis-x0208@1990
511                            =jis-x0213-1-2000
512                            =jis-x0213-2-2000
513                            =jis-x0212
514                            =jis-x0208@1983
515                            =jis-x0208@1978
516                            =shinjigen))))
517            ((eq source 'CN)
518             (setq required-features
519                   (union required-features
520                          '(=gb2312
521                            =gb12345
522                            =iso-ir165)))))
523           (cond
524            ((find-charset (setq ret (intern (format "=%s" source))))
525             (setq required-features
526                   (cons ret required-features)))
527            (t (setq required-features
528                     (cons source required-features)))))
529         (cond ((string-match "@JP" (symbol-name name))
530                (setq required-features
531                      (union required-features
532                             '(=jis-x0208
533                               =jis-x0208@1990
534                               =jis-x0213-1-2000
535                               =jis-x0213-2-2000
536                               =jis-x0212
537                               =jis-x0208@1983
538                               =jis-x0208@1978))))
539               ((string-match "@CN" (symbol-name name))
540                (setq required-features
541                      (union required-features
542                             '(=gb2312
543                               =gb12345
544                               =iso-ir165)))))
545         (if separator
546             (insert lbs))
547         (if readable
548             (insert (format "%S" cell))
549           (char-db-insert-char-spec cell readable
550                                     nil
551                                     required-features))
552         (setq separator lbs))
553        ((consp cell)
554         (if separator
555             (insert lbs))
556         (if (consp (car cell))
557             (char-db-insert-char-spec cell readable)
558           (char-db-insert-char-reference cell readable))
559         (setq separator lbs))
560        (t
561         (if separator
562             (insert separator))
563         (insert (prin1-to-string cell))
564         (setq separator " ")))
565       (setq value (cdr value)))
566     (insert ")")
567     (insert line-breaking)))
568
569 (defun insert-char-attributes (char &optional readable attributes column)
570   (unless column
571     (setq column (current-column)))
572   (let (name value ; has-long-ccs-name
573         rest
574         radical strokes
575         (line-breaking
576          (concat "\n" (make-string (1+ column) ?\ )))
577         lbs cell separator ret
578         key al cal
579         dest-ccss ; sources required-features
580         ccss)
581     (let (atr-d)
582       (setq attributes
583             (sort (if attributes
584                       (if (consp attributes)
585                           (progn
586                             (dolist (name attributes)
587                               (unless (memq name char-db-ignored-attributes)
588                                 (if (find-charset name)
589                                     (push name ccss))
590                                 (push name atr-d)))
591                             atr-d))
592                     (dolist (name (char-attribute-list))
593                       (unless (memq name char-db-ignored-attributes)
594                         (if (find-charset name)
595                             (push name ccss))
596                         (push name atr-d)))
597                     atr-d)
598                   #'char-attribute-name<)))
599     (insert "(")
600     (when (memq '<-subsumptive attributes)
601       (when readable
602         (when (setq value (get-char-attribute char '<-subsumptive))
603           (char-db-insert-relation-feature char '<-subsumptive value
604                                            line-breaking
605                                            ccss readable)))
606       (setq attributes (delq '<-subsumptive attributes)))
607     (when (and (memq '<-denotational attributes)
608                (setq value (get-char-attribute char '<-denotational)))
609       (char-db-insert-relation-feature char '<-denotational value
610                                        line-breaking
611                                        ccss readable)
612       (setq attributes (delq '<-denotational attributes)))
613     (when (and (memq 'name attributes)
614                (setq value (get-char-attribute char 'name)))
615       (insert (format
616                (if (> (+ (current-column) (length value)) 48)
617                    "(name . %S)%s"
618                  "(name               . %S)%s")
619                value line-breaking))
620       (setq attributes (delq 'name attributes))
621       )
622     (when (and (memq 'name* attributes)
623                (setq value (get-char-attribute char 'name*)))
624       (insert (format
625                (if (> (+ (current-column) (length value)) 48)
626                    "(name* . %S)%s"
627                  "(name*              . %S)%s")
628                value line-breaking))
629       (setq attributes (delq 'name* attributes))
630       )
631     (when (and (memq 'script attributes)
632                (setq value (get-char-attribute char 'script)))
633       (insert (format "(script\t\t%s)%s"
634                       (mapconcat (function prin1-to-string)
635                                  value " ")
636                       line-breaking))
637       (setq attributes (delq 'script attributes))
638       )
639     (dolist (name '(=>ucs =>ucs*))
640       (when (and (memq name attributes)
641                  (setq value (get-char-attribute char name)))
642         (insert (format "(%-18s . #x%04X)\t; %c%s"
643                         name value (decode-char '=ucs value)
644                         line-breaking))
645         (setq attributes (delq name attributes))))
646     (dolist (name '(=>ucs@gb =>ucs@jis =>ucs@ks =>ucs@big5))
647       (when (and (memq name attributes)
648                  (setq value (get-char-attribute char name)))
649         (insert (format "(%-18s . #x%04X)\t; %c%s"
650                         name value
651                         (decode-char (intern
652                                       (concat "="
653                                               (substring
654                                                (symbol-name name) 2)))
655                                      value)
656                         line-breaking))
657         (setq attributes (delq name attributes))
658         ))
659     ;; (dolist (name '(=>daikanwa))
660     ;;   (when (and (memq name attributes)
661     ;;              (setq value (get-char-attribute char name)))
662     ;;     (insert
663     ;;      (if (integerp value)
664     ;;          (format "(%-18s . %05d)\t; %c%s"
665     ;;                  name value (decode-char '=daikanwa value)
666     ;;                  line-breaking)
667     ;;        (format "(%-18s %s)\t; %c%s"
668     ;;                name
669     ;;                (mapconcat (function prin1-to-string)
670     ;;                           value " ")
671     ;;                (char-representative-of-daikanwa char)
672     ;;                line-breaking)))
673     ;;     (setq attributes (delq name attributes))))
674     (when (and (memq 'general-category attributes)
675                (setq value (get-char-attribute char 'general-category)))
676       (insert (format
677                "(general-category\t%s) ; %s%s"
678                (mapconcat (lambda (cell)
679                             (format "%S" cell))
680                           value " ")
681                (cond ((rassoc value unidata-normative-category-alist)
682                       "Normative Category")
683                      ((rassoc value unidata-informative-category-alist)
684                       "Informative Category")
685                      (t
686                       "Unknown Category"))
687                line-breaking))
688       (setq attributes (delq 'general-category attributes))
689       )
690     (when (and (memq 'bidi-category attributes)
691                (setq value (get-char-attribute char 'bidi-category)))
692       (insert (format "(bidi-category\t. %S)%s"
693                       value
694                       line-breaking))
695       (setq attributes (delq 'bidi-category attributes))
696       )
697     (unless (or (not (memq 'mirrored attributes))
698                 (eq (setq value (get-char-attribute char 'mirrored 'empty))
699                     'empty))
700       (insert (format "(mirrored\t\t. %S)%s"
701                       value
702                       line-breaking))
703       (setq attributes (delq 'mirrored attributes))
704       )
705     (cond
706      ((and (memq 'decimal-digit-value attributes)
707            (setq value (get-char-attribute char 'decimal-digit-value)))
708       (insert (format "(decimal-digit-value . %S)%s"
709                       value
710                       line-breaking))
711       (setq attributes (delq 'decimal-digit-value attributes))
712       (when (and (memq 'digit-value attributes)
713                  (setq value (get-char-attribute char 'digit-value)))
714         (insert (format "(digit-value\t . %S)%s"
715                         value
716                         line-breaking))
717         (setq attributes (delq 'digit-value attributes))
718         )
719       (when (and (memq 'numeric-value attributes)
720                  (setq value (get-char-attribute char 'numeric-value)))
721         (insert (format "(numeric-value\t . %S)%s"
722                         value
723                         line-breaking))
724         (setq attributes (delq 'numeric-value attributes))
725         )
726       )
727      (t
728       (when (and (memq 'digit-value attributes)
729                  (setq value (get-char-attribute char 'digit-value)))
730         (insert (format "(digit-value\t. %S)%s"
731                         value
732                         line-breaking))
733         (setq attributes (delq 'digit-value attributes))
734         )
735       (when (and (memq 'numeric-value attributes)
736                  (setq value (get-char-attribute char 'numeric-value)))
737         (insert (format "(numeric-value\t. %S)%s"
738                         value
739                         line-breaking))
740         (setq attributes (delq 'numeric-value attributes))
741         )))
742     (when (and (memq 'iso-10646-comment attributes)
743                (setq value (get-char-attribute char 'iso-10646-comment)))
744       (insert (format "(iso-10646-comment\t. %S)%s"
745                       value
746                       line-breaking))
747       (setq attributes (delq 'iso-10646-comment attributes))
748       )
749     (when (and (memq 'morohashi-daikanwa attributes)
750                (setq value (get-char-attribute char 'morohashi-daikanwa)))
751       (insert (format "(morohashi-daikanwa\t%s)%s"
752                       (mapconcat (function prin1-to-string) value " ")
753                       line-breaking))
754       (setq attributes (delq 'morohashi-daikanwa attributes))
755       )
756     (setq radical nil
757           strokes nil)
758     (when (and (memq 'ideographic-radical attributes)
759                (setq value (get-char-attribute char 'ideographic-radical)))
760       (setq radical value)
761       (insert (format "(ideographic-radical . %S)\t; %c%s"
762                       radical
763                       (ideographic-radical radical)
764                       line-breaking))
765       (setq attributes (delq 'ideographic-radical attributes))
766       )
767     (when (and (memq 'shuowen-radical attributes)
768                (setq value (get-char-attribute char 'shuowen-radical)))
769       (insert (format "(shuowen-radical\t. %S)\t; %c%s"
770                       value
771                       (shuowen-radical value)
772                       line-breaking))
773       (setq attributes (delq 'shuowen-radical attributes))
774       )
775     (let (key)
776       (dolist (domain
777                (append
778                 char-db-feature-domains
779                 (let (dest domain)
780                   (dolist (feature (char-attribute-list))
781                     (setq feature (symbol-name feature))
782                     (when (string-match
783                            "\\(radical\\|strokes\\)@\\([^@*]+\\)\\(\\*\\|$\\)"
784                            feature)
785                       (setq domain (intern (match-string 2 feature)))
786                      (unless (memq domain dest)
787                        (setq dest (cons domain dest)))))
788                   (sort dest #'string<))))
789         (setq key (intern (format "%s@%s" 'ideographic-radical domain)))
790         (when (and (memq key attributes)
791                    (setq value (get-char-attribute char key)))
792           (setq radical value)
793           (insert (format "(%s . %S)\t; %c%s"
794                           key
795                           radical
796                           (ideographic-radical radical)
797                           line-breaking))
798           (setq attributes (delq key attributes))
799           )
800         (setq key (intern (format "%s@%s" 'ideographic-strokes domain)))
801         (when (and (memq key attributes)
802                    (setq value (get-char-attribute char key)))
803           (setq strokes value)
804           (insert (format "(%s . %S)%s"
805                           key
806                           strokes
807                           line-breaking))
808           (setq attributes (delq key attributes))
809           )
810         (setq key (intern (format "%s@%s" 'total-strokes domain)))
811         (when (and (memq key attributes)
812                    (setq value (get-char-attribute char key)))
813           (insert (format "(%s       . %S)%s"
814                           key
815                           value
816                           line-breaking))
817           (setq attributes (delq key attributes))
818           )
819         (dolist (feature '(ideographic-radical
820                            ideographic-strokes
821                            total-strokes))
822           (setq key (intern (format "%s@%s*sources" feature domain)))
823           (when (and (memq key attributes)
824                      (setq value (get-char-attribute char key)))
825             (insert (format "(%s%s" key line-breaking))
826             (dolist (cell value)
827               (insert (format " %s" cell)))
828             (insert ")")
829             (insert line-breaking)
830             (setq attributes (delq key attributes))
831             ))
832         ))
833     (when (and (memq 'ideographic-strokes attributes)
834                (setq value (get-char-attribute char 'ideographic-strokes)))
835       (setq strokes value)
836       (insert (format "(ideographic-strokes . %S)%s"
837                       strokes
838                       line-breaking))
839       (setq attributes (delq 'ideographic-strokes attributes))
840       )
841     (when (and (memq 'kangxi-radical attributes)
842                (setq value (get-char-attribute char 'kangxi-radical)))
843       (unless (eq value radical)
844         (insert (format "(kangxi-radical\t . %S)\t; %c%s"
845                         value
846                         (ideographic-radical value)
847                         line-breaking))
848         (or radical
849             (setq radical value)))
850       (setq attributes (delq 'kangxi-radical attributes))
851       )
852     (when (and (memq 'kangxi-strokes attributes)
853                (setq value (get-char-attribute char 'kangxi-strokes)))
854       (unless (eq value strokes)
855         (insert (format "(kangxi-strokes\t . %S)%s"
856                         value
857                         line-breaking))
858         (or strokes
859             (setq strokes value)))
860       (setq attributes (delq 'kangxi-strokes attributes))
861       )
862     (when (and (memq 'japanese-radical attributes)
863                (setq value (get-char-attribute char 'japanese-radical)))
864       (unless (eq value radical)
865         (insert (format "(japanese-radical\t . %S)\t; %c%s"
866                         value
867                         (ideographic-radical value)
868                         line-breaking))
869         (or radical
870             (setq radical value)))
871       (setq attributes (delq 'japanese-radical attributes))
872       )
873     (when (and (memq 'japanese-strokes attributes)
874                (setq value (get-char-attribute char 'japanese-strokes)))
875       (unless (eq value strokes)
876         (insert (format "(japanese-strokes\t . %S)%s"
877                         value
878                         line-breaking))
879         (or strokes
880             (setq strokes value)))
881       (setq attributes (delq 'japanese-strokes attributes))
882       )
883     (when (and (memq 'cns-radical attributes)
884                (setq value (get-char-attribute char 'cns-radical)))
885       (insert (format "(cns-radical\t . %S)\t; %c%s"
886                       value
887                       (ideographic-radical value)
888                       line-breaking))
889       (setq attributes (delq 'cns-radical attributes))
890       )
891     (when (and (memq 'cns-strokes attributes)
892                (setq value (get-char-attribute char 'cns-strokes)))
893       (unless (eq value strokes)
894         (insert (format "(cns-strokes\t . %S)%s"
895                         value
896                         line-breaking))
897         (or strokes
898             (setq strokes value)))
899       (setq attributes (delq 'cns-strokes attributes))
900       )
901     (when (and (memq 'shinjigen-1-radical attributes)
902                (setq value (get-char-attribute char 'shinjigen-1-radical)))
903       (unless (eq value radical)
904         (insert (format "(shinjigen-1-radical . %S)\t; %c%s"
905                         value
906                         (ideographic-radical value)
907                         line-breaking))
908         (or radical
909             (setq radical value)))
910       (setq attributes (delq 'shinjigen-1-radical attributes))
911       )
912     (when (and (memq 'ideographic- attributes)
913                (setq value (get-char-attribute char 'ideographic-)))
914       (insert "(ideographic-       ")
915       (setq lbs (concat "\n" (make-string (current-column) ?\ ))
916             separator nil)
917       (while (consp value)
918         (setq cell (car value))
919         (if (integerp cell)
920             (setq cell (decode-char '=ucs cell)))
921         (cond ((characterp cell)
922                (if separator
923                    (insert lbs))
924                (if readable
925                    (insert (format "%S" cell))
926                  (char-db-insert-char-spec cell readable))
927                (setq separator lbs))
928               ((consp cell)
929                (if separator
930                    (insert lbs))
931                (if (consp (car cell))
932                    (char-db-insert-char-spec cell readable)
933                  (char-db-insert-char-reference cell readable))
934                (setq separator lbs))
935               (t
936                (if separator
937                    (insert separator))
938                (insert (prin1-to-string cell))
939                (setq separator " ")))
940         (setq value (cdr value)))
941       (insert ")")
942       (insert line-breaking)
943       (setq attributes (delq 'ideographic- attributes)))
944     (when (and (memq 'total-strokes attributes)
945                (setq value (get-char-attribute char 'total-strokes)))
946       (insert (format "(total-strokes       . %S)%s"
947                       value
948                       line-breaking))
949       (setq attributes (delq 'total-strokes attributes))
950       )
951     (when (and (memq '->ideograph attributes)
952                (setq value (get-char-attribute char '->ideograph)))
953       (insert (format "(->ideograph\t%s)%s"
954                       (mapconcat (lambda (code)
955                                    (cond ((symbolp code)
956                                           (symbol-name code))
957                                          ((integerp code)
958                                           (format "#x%04X" code))
959                                          (t
960                                           (format "%s %S"
961                                                   line-breaking code))))
962                                  value " ")
963                       line-breaking))
964       (setq attributes (delq '->ideograph attributes))
965       )
966     ;; (when (and (memq '->decomposition attributes)
967     ;;            (setq value (get-char-attribute char '->decomposition)))
968     ;;   (insert (format "(->decomposition\t%s)%s"
969     ;;                   (mapconcat (lambda (code)
970     ;;                                (cond ((symbolp code)
971     ;;                                       (symbol-name code))
972     ;;                                      ((characterp code)
973     ;;                                       (if readable
974     ;;                                           (format "%S" code)
975     ;;                                         (format "#x%04X"
976     ;;                                                 (char-int code))
977     ;;                                         ))
978     ;;                                      ((integerp code)
979     ;;                                       (format "#x%04X" code))
980     ;;                                      (t
981     ;;                                       (format "%s%S" line-breaking code))))
982     ;;                              value " ")
983     ;;                   line-breaking))
984     ;;   (setq attributes (delq '->decomposition attributes))
985     ;;   )
986     (if (equal (get-char-attribute char '->titlecase)
987                (get-char-attribute char '->uppercase))
988         (setq attributes (delq '->titlecase attributes)))
989     (when (and (memq '->mojikyo attributes)
990                (setq value (get-char-attribute char '->mojikyo)))
991       (insert (format "(->mojikyo\t\t. %06d)\t; %c%s"
992                       value (decode-char 'mojikyo value)
993                       line-breaking))
994       (setq attributes (delq '->mojikyo attributes))
995       )
996     (when (and (memq 'hanyu-dazidian-vol attributes)
997                (setq value (get-char-attribute char 'hanyu-dazidian-vol)))
998       (insert (format "(hanyu-dazidian-vol  . %d)%s"
999                       value line-breaking))
1000       (setq attributes (delq 'hanyu-dazidian-vol attributes))
1001       )
1002     (when (and (memq 'hanyu-dazidian-page attributes)
1003                (setq value (get-char-attribute char 'hanyu-dazidian-page)))
1004       (insert (format "(hanyu-dazidian-page . %d)%s"
1005                       value line-breaking))
1006       (setq attributes (delq 'hanyu-dazidian-page attributes))
1007       )
1008     (when (and (memq 'hanyu-dazidian-char attributes)
1009                (setq value (get-char-attribute char 'hanyu-dazidian-char)))
1010       (insert (format "(hanyu-dazidian-char . %d)%s"
1011                       value line-breaking))
1012       (setq attributes (delq 'hanyu-dazidian-char attributes))
1013       )
1014     (unless readable
1015       (dolist (ignored '(composition
1016                          ->denotational <-subsumptive ->ucs-unified
1017                          ->ideographic-component-forms))
1018         (setq attributes (delq ignored attributes))))
1019     (while attributes
1020       (setq name (car attributes))
1021       (if (setq value (get-char-attribute char name))
1022           (cond ((setq ret (find-charset name))
1023                  (setq name (charset-name ret))
1024                  (if (and (not (memq name dest-ccss))
1025                           (prog1
1026                               (setq value (get-char-attribute char name))
1027                             (setq dest-ccss (cons name dest-ccss))))
1028                      (char-db-insert-ccs-feature name value line-breaking))
1029                  )
1030                 ((string-match "^=>ucs@" (symbol-name name))
1031                  (insert (format "(%-18s . #x%04X)\t; %c%s"
1032                                  name value (decode-char '=ucs value)
1033                                  line-breaking))
1034                  )
1035                 ((eq name 'jisx0208-1978/4X)
1036                  (insert (format "(%-18s . #x%04X)%s"
1037                                  name value
1038                                  line-breaking))
1039                  )
1040                 ((and
1041                   (not readable)
1042                   (not (eq name '->subsumptive))
1043                   (not (eq name '->uppercase))
1044                   (not (eq name '->lowercase))
1045                   (not (eq name '->titlecase))
1046                   (not (eq name '->canonical))
1047                   (not (eq name '->Bopomofo))
1048                   (not (eq name '->mistakable))
1049                   (not (eq name '->ideographic-variants))
1050                   (null (get-char-attribute
1051                          char (intern (format "%s*sources" name))))
1052                   (not (string-match "\\*sources$" (symbol-name name)))
1053                   (null (get-char-attribute
1054                          char (intern (format "%s*note" name))))
1055                   (not (string-match "\\*note$" (symbol-name name)))
1056                   (or (eq name '<-identical)
1057                       (eq name '<-uppercase)
1058                       (eq name '<-lowercase)
1059                       (eq name '<-titlecase)
1060                       (eq name '<-canonical)
1061                       (eq name '<-ideographic-variants)
1062                       ;; (eq name '<-synonyms)
1063                       (string-match "^<-synonyms" (symbol-name name))
1064                       (eq name '<-mistakable)
1065                       (when (string-match "^->" (symbol-name name))
1066                         (cond
1067                          ((string-match "^->fullwidth" (symbol-name name))
1068                           (not (and (consp value)
1069                                     (characterp (car value))
1070                                     (encode-char
1071                                      (car value) '=ucs 'defined-only)))
1072                           )
1073                          (t)))
1074                       ))
1075                  )
1076                 ((or (eq name 'ideographic-structure)
1077                      (eq name 'ideographic-combination)
1078                      (eq name 'ideographic-)
1079                      (eq name '=decomposition)
1080                      (string-match "^=>decomposition" (symbol-name name))
1081                      (string-match "^\\(->\\|<-\\)[^*]*$" (symbol-name name))
1082                      (string-match "^\\(->\\|<-\\)[^*]*\\*sources$"
1083                                    (symbol-name name))
1084                      )
1085                  (char-db-insert-relation-feature char name value
1086                                                   line-breaking
1087                                                   ccss readable))
1088                 ((memq name '(ideograph=
1089                               original-ideograph-of
1090                               ancient-ideograph-of
1091                               vulgar-ideograph-of
1092                               wrong-ideograph-of
1093                               ;; simplified-ideograph-of
1094                               ideographic-variants
1095                               ;; ideographic-different-form-of
1096                               ))
1097                  (insert (format "(%-18s%s " name line-breaking))
1098                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1099                        separator nil)
1100                  (while (consp value)
1101                    (setq cell (car value))
1102                    (if (and (consp cell)
1103                             (consp (car cell)))
1104                        (progn
1105                          (if separator
1106                              (insert lbs))
1107                          (char-db-insert-alist cell readable)
1108                          (setq separator lbs))
1109                      (if separator
1110                          (insert separator))
1111                      (insert (prin1-to-string cell))
1112                      (setq separator " "))
1113                    (setq value (cdr value)))
1114                  (insert ")")
1115                  (insert line-breaking))
1116                 ((consp value)
1117                  (insert (format "(%-18s " name))
1118                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1119                        separator nil)
1120                  (while (consp value)
1121                    (setq cell (car value))
1122                    (if (and (consp cell)
1123                             (consp (car cell))
1124                             (setq ret (condition-case nil
1125                                           (find-char cell)
1126                                         (error nil))))
1127                        (progn
1128                          (setq rest cell
1129                                al nil
1130                                cal nil)
1131                          (while rest
1132                            (setq key (car (car rest)))
1133                            (if (find-charset key)
1134                                (setq cal (cons key cal))
1135                              (setq al (cons key al)))
1136                            (setq rest (cdr rest)))
1137                          (if separator
1138                              (insert lbs))
1139                          (insert-char-attributes ret
1140                                                  readable
1141                                                  al cal)
1142                          (setq separator lbs))
1143                      (setq ret (prin1-to-string cell))
1144                      (if separator
1145                          (if (< (+ (current-column)
1146                                    (length ret)
1147                                    (length separator))
1148                                 76)
1149                              (insert separator)
1150                            (insert lbs)))
1151                      (insert ret)
1152                      (setq separator " "))
1153                    (setq value (cdr value)))
1154                  (insert ")")
1155                  (insert line-breaking))
1156                 (t
1157                  (insert (format "(%-18s" name))
1158                  (setq ret (prin1-to-string value))
1159                  (unless (< (+ (current-column)
1160                                (length ret)
1161                                3)
1162                             76)
1163                    (insert line-breaking))
1164                  (insert " . " ret ")" line-breaking)
1165                  ;; (insert (format "(%-18s . %S)%s"
1166                  ;;                 name value
1167                  ;;                 line-breaking))
1168                  )
1169                 ))
1170       (setq attributes (cdr attributes)))
1171     (insert ")")))
1172
1173 (defun insert-char-data (char &optional readable
1174                               attributes)
1175   (save-restriction
1176     (narrow-to-region (point)(point))
1177     (insert "(define-char
1178   '")
1179     (insert-char-attributes char readable attributes)
1180     (insert ")\n")
1181     (goto-char (point-min))
1182     (while (re-search-forward "[ \t]+$" nil t)
1183       (replace-match ""))
1184     ;; from tabify.
1185     (goto-char (point-min))
1186     (while (re-search-forward "[ \t][ \t][ \t]*" nil t)
1187       (let ((column (current-column))
1188             (indent-tabs-mode t))
1189         (delete-region (match-beginning 0) (point))
1190         (indent-to column)))
1191     (goto-char (point-max))
1192     ;; (tabify (point-min)(point-max))
1193     ))
1194
1195 (defun insert-char-data-with-variant (char &optional printable
1196                                            no-ucs-unified
1197                                            script excluded-script)
1198   (insert-char-data char printable)
1199   (let ((variants (char-variants char))
1200         rest
1201         variant vs ret)
1202     (setq variants (sort variants #'<))
1203     (setq rest variants)
1204     (setq variants (cons char variants))
1205     (while rest
1206       (setq variant (car rest))
1207       (unless (get-char-attribute variant '<-subsumptive)
1208         (if (and (or (null script)
1209                      (null (setq vs (get-char-attribute variant 'script)))
1210                      (memq script vs))
1211                  (or (null excluded-script)
1212                      (null (setq vs (get-char-attribute variant 'script)))
1213                      (not (memq excluded-script vs))))
1214             (unless (and no-ucs-unified (get-char-attribute variant '=ucs))
1215               (insert-char-data variant printable)
1216               (if (setq ret (char-variants variant))
1217                   (while ret
1218                     (or (memq (car ret) variants)
1219                         ;; (get-char-attribute (car ret) '<-subsumptive)
1220                         (setq rest (nconc rest (list (car ret)))))
1221                     (setq ret (cdr ret)))))))
1222       (setq rest (cdr rest)))))
1223
1224 (defun insert-char-range-data (min max &optional script excluded-script)
1225   (let ((code min)
1226         char)
1227     (while (<= code max)
1228       (setq char (decode-char '=ucs code))
1229       (if (encode-char char '=ucs 'defined-only)
1230           (insert-char-data-with-variant char nil 'no-ucs-unified
1231                                          script excluded-script))
1232       (setq code (1+ code)))))
1233
1234 (defun write-char-range-data-to-file (min max file
1235                                           &optional script excluded-script)
1236   (let ((coding-system-for-write char-db-file-coding-system))
1237     (with-temp-buffer
1238       (insert (format ";; -*- coding: %s -*-\n"
1239                       char-db-file-coding-system))
1240       (insert-char-range-data min max script excluded-script)
1241       (write-region (point-min)(point-max) file))))
1242
1243 (defvar what-character-original-window-configuration)
1244
1245 ;;;###autoload
1246 (defun what-char-definition (char)
1247   (interactive (list (char-after)))
1248   (let ((buf (get-buffer-create "*Character Description*"))
1249         (the-buf (current-buffer))
1250         (win-conf (current-window-configuration)))
1251     (pop-to-buffer buf)
1252     (make-local-variable 'what-character-original-window-configuration)
1253     (setq what-character-original-window-configuration win-conf)
1254     (setq buffer-read-only nil)
1255     (erase-buffer)
1256     (condition-case err
1257         (progn
1258           (insert-char-data-with-variant char 'printable)
1259           (unless (char-attribute-alist char)
1260             (insert (format ";; = %c\n"
1261                             (let* ((rest (split-char char))
1262                                    (ccs (pop rest))
1263                                    (code (pop rest)))
1264                               (while rest
1265                                 (setq code (logior (lsh code 8)
1266                                                    (pop rest))))
1267                               (decode-char ccs code)))))
1268           ;; (char-db-update-comment)
1269           (set-buffer-modified-p nil)
1270           (view-mode the-buf (lambda (buf)
1271                                (set-window-configuration
1272                                 what-character-original-window-configuration)
1273                                ))
1274           (goto-char (point-min)))
1275       (error (progn
1276                (set-window-configuration
1277                 what-character-original-window-configuration)
1278                (signal (car err) (cdr err)))))))
1279
1280
1281 ;;; @ end
1282 ;;;
1283
1284 (provide 'char-db-util)
1285
1286 ;;; char-db-util.el ends here