(char-db-coded-charset-priority-list): Prefer JIS X 0208/0213 related
[chise/xemacs-chise.git-] / 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@iso
173     =>ucs@unicode
174     =>>ucs@unicode
175     =>>ucs@jis
176     =>>ucs@cns
177     =ucs@iso
178     =ucs@unicode
179     =>>big5-cdp
180     =>>gt-k
181     =>gt
182     =>big5-cdp
183     =>daikanwa
184     =big5
185     =big5-eten
186     =zinbun-oracle
187     =>zinbun-oracle
188     =ruimoku-v6
189     =jef-china3
190     =shinjigen))
191
192
193 ;;; @ char-db formatters
194 ;;;
195
196 (defun char-db-make-char-spec (char)
197   (let (ret char-spec)
198     (cond ((characterp char)
199            (cond ((and (setq ret (encode-char char '=ucs 'defined-only))
200                        (not (and (<= #xE000 ret)(<= ret #xF8FF))))
201                   (setq char-spec (list (cons '=ucs ret)))
202                   (cond ((setq ret (get-char-attribute char 'name))
203                          (setq char-spec (cons (cons 'name ret) char-spec))
204                          )
205                         ((setq ret (get-char-attribute char 'name*))
206                          (setq char-spec (cons (cons 'name* ret) char-spec))
207                          ))
208                   )
209                  ((setq ret
210                         (catch 'tag
211                           (let ((rest char-db-coded-charset-priority-list)
212                                 ccs)
213                             (while rest
214                               (setq ccs (charset-name
215                                          (find-charset (car rest))))
216                               (if (setq ret
217                                         (encode-char char ccs
218                                                      'defined-only))
219                                   (throw 'tag (cons ccs ret)))
220                               (setq rest (cdr rest))))))
221                   (setq char-spec (list ret))
222                   (dolist (ccs (delq (car ret) (charset-list)))
223                     (if (and (or (charset-iso-final-char ccs)
224                                  (memq ccs
225                                        '(=daikanwa
226                                          =daikanwa@rev2
227                                          ;; =gt-k
228                                          =jis-x0208@1997
229                                          ))
230                                  (string-match "=ucs@" (symbol-name ccs)))
231                              (setq ccs (charset-name ccs))
232                              (null (assq ccs char-spec))
233                              (setq ret (encode-char char ccs 'defined-only)))
234                         (setq char-spec (cons (cons ccs ret) char-spec))))
235                   (if (null char-spec)
236                       (setq char-spec (split-char char)))
237                   (cond ((setq ret (get-char-attribute char 'name))
238                          (setq char-spec (cons (cons 'name ret) char-spec))
239                          )
240                         ((setq ret (get-char-attribute char 'name*))
241                          (setq char-spec (cons (cons 'name* ret) char-spec))
242                          ))
243                   )
244                  ((setq ret (get-char-attribute
245                              char 'ideographic-combination))
246                   (setq char-spec
247                         (cons (cons 'ideographic-combination ret)
248                               char-spec))
249                   ))
250            char-spec)
251           ((consp char)
252            char))))
253     
254 (defun char-db-insert-char-spec (char &optional readable column
255                                       required-features)
256   (unless column
257     (setq column (current-column)))
258   (let (char-spec temp-char)
259     (setq char-spec (char-db-make-char-spec char))
260     (unless (or (characterp char) ; char
261                 (condition-case nil
262                     (setq char (find-char char-spec))
263                   (error nil)))
264       ;; define temporary character
265       ;;   Current implementation is dirty.
266       (setq temp-char (define-char (cons '(ideograph-daikanwa . 0)
267                                          char-spec)))
268       (remove-char-attribute temp-char 'ideograph-daikanwa)
269       (setq char temp-char))
270     (insert-char-attributes char
271                             readable
272                             (union (mapcar #'car char-spec)
273                                    required-features))
274     (when temp-char
275       ;; undefine temporary character
276       ;;   Current implementation is dirty.
277       (setq char-spec (char-attribute-alist temp-char))
278       (while char-spec
279         (remove-char-attribute temp-char (car (car char-spec)))
280         (setq char-spec (cdr char-spec))))))
281
282 (defun char-db-insert-alist (alist &optional readable column)
283   (unless column
284     (setq column (current-column)))
285   (let ((line-breaking
286          (concat "\n" (make-string (1+ column) ?\ )))
287         name value
288         ret al ; cal
289         key
290         lbs cell rest separator)
291     (insert "(")
292     (while alist
293       (setq name (car (car alist))
294             value (cdr (car alist)))
295       (cond ((eq name 'char)
296              (insert "(char . ")
297              (if (setq ret (condition-case nil
298                                (find-char value)
299                              (error nil)))
300                  (progn
301                    (setq al nil
302                          ;; cal nil
303                          )
304                    (while value
305                      (setq key (car (car value)))
306                      ;; (if (find-charset key)
307                      ;;     (setq cal (cons key cal))
308                      (setq al (cons key al))
309                      ;; )
310                      (setq value (cdr value)))
311                    (insert-char-attributes ret
312                                            readable
313                                            (or al 'none) ; cal
314                                            ))
315                (insert (prin1-to-string value)))
316              (insert ")")
317              (insert line-breaking))
318             ((consp value)
319              (insert (format "(%-18s " name))
320              (setq lbs (concat "\n" (make-string (current-column) ?\ )))
321              (while (consp value)
322                (setq cell (car value))
323                (if (and (consp cell)
324                         (consp (car cell))
325                         (setq ret (condition-case nil
326                                       (find-char cell)
327                                     (error nil)))
328                         )
329                    (progn
330                      (setq rest cell
331                            al nil
332                            ;; cal nil
333                            )
334                      (while rest
335                        (setq key (car (car rest)))
336                        ;; (if (find-charset key)
337                        ;;     (setq cal (cons key cal))
338                        (setq al (cons key al))
339                        ;; )
340                        (setq rest (cdr rest)))
341                      (if separator
342                          (insert lbs))
343                      (insert-char-attributes ret
344                                              readable
345                                              al ; cal
346                                              )
347                      (setq separator lbs))
348                  (if separator
349                      (insert separator))
350                  (insert (prin1-to-string cell))
351                  (setq separator " "))
352                (setq value (cdr value)))
353              (insert ")")
354              (insert line-breaking))
355             (t
356              (insert (format "(%-18s . %S)%s"
357                              name value
358                              line-breaking))))
359       (setq alist (cdr alist))))
360   (insert ")"))
361
362 (defun char-db-insert-char-reference (plist &optional readable column)
363   (unless column
364     (setq column (current-column)))
365   (let ((line-breaking
366          (concat "\n" (make-string (1+ column) ?\ )))
367         (separator "")
368         name value)
369     (insert "(")
370     (while plist
371       (setq name (pop plist))
372       (setq value (pop plist))
373       (cond ((eq name :char)
374              (insert separator)
375              (insert ":char\t")
376              (cond ((numberp value)
377                     (setq value (decode-char '=ucs value)))
378                    ;; ((consp value)
379                    ;;  (setq value (or (find-char value)
380                    ;;                  value)))
381                    )
382              (char-db-insert-char-spec value readable)
383              (insert line-breaking)
384              (setq separator ""))
385             ((eq name :radical)
386              (insert (format "%s%s\t%d ; %c%s"
387                              separator
388                              name value
389                              (ideographic-radical value)
390                              line-breaking))
391              (setq separator ""))
392             (t
393              (insert (format "%s%s\t%S" separator name value))
394              (setq separator line-breaking)))
395       ))
396   (insert ")"))
397
398 (defun char-db-decode-isolated-char (ccs code-point)
399   (let (ret)
400     (setq ret
401           (cond ((eq ccs 'arabic-iso8859-6)
402                  (decode-char ccs code-point))
403                 ((and (memq ccs '(=gt-pj-1
404                                   =gt-pj-2
405                                   =gt-pj-3
406                                   =gt-pj-4
407                                   =gt-pj-5
408                                   =gt-pj-6
409                                   =gt-pj-7
410                                   =gt-pj-8
411                                   =gt-pj-9
412                                   =gt-pj-10
413                                   =gt-pj-11))
414                       (setq ret (decode-char ccs code-point))
415                       (setq ret (encode-char ret '=gt 'defined-only)))
416                  (decode-builtin-char '=gt ret))
417                 (t
418                  (decode-builtin-char ccs code-point))))
419     (cond ((and (<= 0 (char-int ret))
420                 (<= (char-int ret) #x1F))
421            (decode-char '=ucs (+ #x2400 (char-int ret))))
422           ((= (char-int ret) #x7F)
423            ?\u2421)
424           (t ret))))
425
426 (defvar char-db-convert-obsolete-format t)
427
428 (defun char-db-insert-ccs-feature (name value line-breaking)
429   (insert
430    (format
431     (cond ((memq name '(=shinjigen
432                         =shinjigen@1ed
433                         =shinjigen@rev =shinjigen/+p@rev))
434            "(%-18s .  %04d)\t; %c")
435           ((eq name '=shinjigen@1ed/24pr)
436            "(%-18s . %04d)\t; %c")
437           ((or (memq name '(=daikanwa
438                             =daikanwa@rev1 =daikanwa@rev2
439                             =>daikanwa
440                             =gt =>>gt =>gt =gt-k =>>gt-k =cbeta
441                             =zinbun-oracle =>zinbun-oracle))
442                (string-match "^=adobe-" (symbol-name name)))
443            "(%-18s . %05d)\t; %c")
444           ((eq name 'mojikyo)
445            "(%-18s . %06d)\t; %c")
446           ((>= (charset-dimension name) 2)
447            "(%-18s . #x%04X)\t; %c")
448           (t
449            "(%-18s . #x%02X)\t; %c"))
450     name
451     (if (= (charset-iso-graphic-plane name) 1)
452         (logior value
453                 (cond ((= (charset-dimension name) 1)
454                        #x80)
455                       ((= (charset-dimension name) 2)
456                        #x8080)
457                       ((= (charset-dimension name) 3)
458                        #x808080)
459                       (t 0)))
460       value)
461     (char-db-decode-isolated-char name value)))
462   (if (and (= (charset-chars name) 94)
463            (= (charset-dimension name) 2))
464       (insert (format " [%02d-%02d]"
465                       (- (lsh value -8) 32)
466                       (- (logand value 255) 32))))
467   (insert line-breaking))
468
469 (defun char-db-insert-relation-feature (char name value line-breaking
470                                              ccss readable)
471   (insert (format "(%-18s%s " name line-breaking))
472   (let ((lbs (concat "\n" (make-string (current-column) ?\ )))
473         separator cell sources required-features
474         ret)
475     (while (consp value)
476       (setq cell (car value))
477       (if (integerp cell)
478           (setq cell (decode-char '=ucs cell)))
479       (cond
480        ((eq name '->subsumptive)
481         (when (or (not (some (lambda (atr)
482                                (get-char-attribute cell atr))
483                              char-db-ignored-attributes))
484                   (some (lambda (ccs)
485                           (encode-char cell ccs 'defined-only))
486                         ccss))
487           (if separator
488               (insert lbs))
489           (let ((char-db-ignored-attributes
490                  (cons '<-subsumptive
491                        char-db-ignored-attributes)))
492             (insert-char-attributes cell readable))
493           (setq separator lbs))
494         )
495        ((characterp cell)
496         (setq sources
497               (get-char-attribute
498                char (intern (format "%s*sources" name))))
499         (setq required-features nil)
500         (dolist (source sources)
501           (cond
502            ((memq source '(JP
503                            JP/Jouyou
504                            shinjigen shinjigen@1ed shinjigen@rev))
505             (setq required-features
506                   (union required-features
507                          '(=jis-x0208
508                            =jis-x0208@1990
509                            =jis-x0213-1-2000
510                            =jis-x0213-2-2000
511                            =jis-x0212
512                            =jis-x0208@1983
513                            =jis-x0208@1978
514                            =shinjigen))))
515            ((eq source 'CN)
516             (setq required-features
517                   (union required-features
518                          '(=gb2312
519                            =gb12345
520                            =iso-ir165)))))
521           (cond
522            ((find-charset (setq ret (intern (format "=%s" source))))
523             (setq required-features
524                   (cons ret required-features)))
525            (t (setq required-features
526                     (cons source required-features)))))
527         (cond ((string-match "@JP" (symbol-name name))
528                (setq required-features
529                      (union required-features
530                             '(=jis-x0208
531                               =jis-x0208@1990
532                               =jis-x0213-1-2000
533                               =jis-x0213-2-2000
534                               =jis-x0212
535                               =jis-x0208@1983
536                               =jis-x0208@1978))))
537               ((string-match "@CN" (symbol-name name))
538                (setq required-features
539                      (union required-features
540                             '(=gb2312
541                               =gb12345
542                               =iso-ir165)))))
543         (if separator
544             (insert lbs))
545         (if readable
546             (insert (format "%S" cell))
547           (char-db-insert-char-spec cell readable
548                                     nil
549                                     required-features))
550         (setq separator lbs))
551        ((consp cell)
552         (if separator
553             (insert lbs))
554         (if (consp (car cell))
555             (char-db-insert-char-spec cell readable)
556           (char-db-insert-char-reference cell readable))
557         (setq separator lbs))
558        (t
559         (if separator
560             (insert separator))
561         (insert (prin1-to-string cell))
562         (setq separator " ")))
563       (setq value (cdr value)))
564     (insert ")")
565     (insert line-breaking)))
566
567 (defun insert-char-attributes (char &optional readable attributes column)
568   (unless column
569     (setq column (current-column)))
570   (let (name value ; has-long-ccs-name
571         rest
572         radical strokes
573         (line-breaking
574          (concat "\n" (make-string (1+ column) ?\ )))
575         lbs cell separator ret
576         key al cal
577         dest-ccss ; sources required-features
578         ccss)
579     (let (atr-d)
580       (setq attributes
581             (sort (if attributes
582                       (if (consp attributes)
583                           (progn
584                             (dolist (name attributes)
585                               (unless (memq name char-db-ignored-attributes)
586                                 (if (find-charset name)
587                                     (push name ccss))
588                                 (push name atr-d)))
589                             atr-d))
590                     (dolist (name (char-attribute-list))
591                       (unless (memq name char-db-ignored-attributes)
592                         (if (find-charset name)
593                             (push name ccss))
594                         (push name atr-d)))
595                     atr-d)
596                   #'char-attribute-name<)))
597     (insert "(")
598     (when (memq '<-subsumptive attributes)
599       (when readable
600         (when (setq value (get-char-attribute char '<-subsumptive))
601           (char-db-insert-relation-feature char '<-subsumptive value
602                                            line-breaking
603                                            ccss readable)))
604       (setq attributes (delq '<-subsumptive attributes)))
605     (when (and (memq '<-denotational attributes)
606                (setq value (get-char-attribute char '<-denotational)))
607       (char-db-insert-relation-feature char '<-denotational value
608                                        line-breaking
609                                        ccss readable)
610       (setq attributes (delq '<-denotational attributes)))
611     (when (and (memq 'name attributes)
612                (setq value (get-char-attribute char 'name)))
613       (insert (format
614                (if (> (+ (current-column) (length value)) 48)
615                    "(name . %S)%s"
616                  "(name               . %S)%s")
617                value line-breaking))
618       (setq attributes (delq 'name attributes))
619       )
620     (when (and (memq 'name* attributes)
621                (setq value (get-char-attribute char 'name*)))
622       (insert (format
623                (if (> (+ (current-column) (length value)) 48)
624                    "(name* . %S)%s"
625                  "(name*              . %S)%s")
626                value line-breaking))
627       (setq attributes (delq 'name* attributes))
628       )
629     (when (and (memq 'script attributes)
630                (setq value (get-char-attribute char 'script)))
631       (insert (format "(script\t\t%s)%s"
632                       (mapconcat (function prin1-to-string)
633                                  value " ")
634                       line-breaking))
635       (setq attributes (delq 'script attributes))
636       )
637     (dolist (name '(=>ucs =>ucs*))
638       (when (and (memq name attributes)
639                  (setq value (get-char-attribute char name)))
640         (insert (format "(%-18s . #x%04X)\t; %c%s"
641                         name value (decode-char '=ucs value)
642                         line-breaking))
643         (setq attributes (delq name attributes))))
644     (dolist (name '(=>ucs@gb =>ucs@cns =>ucs@jis =>ucs@ks =>ucs@big5))
645       (when (and (memq name attributes)
646                  (setq value (get-char-attribute char name)))
647         (insert (format "(%-18s . #x%04X)\t; %c%s"
648                         name value
649                         (decode-char (intern
650                                       (concat "="
651                                               (substring
652                                                (symbol-name name) 2)))
653                                      value)
654                         line-breaking))
655         (setq attributes (delq name attributes))
656         ))
657     ;; (dolist (name '(=>daikanwa))
658     ;;   (when (and (memq name attributes)
659     ;;              (setq value (get-char-attribute char name)))
660     ;;     (insert
661     ;;      (if (integerp value)
662     ;;          (format "(%-18s . %05d)\t; %c%s"
663     ;;                  name value (decode-char '=daikanwa value)
664     ;;                  line-breaking)
665     ;;        (format "(%-18s %s)\t; %c%s"
666     ;;                name
667     ;;                (mapconcat (function prin1-to-string)
668     ;;                           value " ")
669     ;;                (char-representative-of-daikanwa char)
670     ;;                line-breaking)))
671     ;;     (setq attributes (delq name attributes))))
672     (when (and (memq 'general-category attributes)
673                (setq value (get-char-attribute char 'general-category)))
674       (insert (format
675                "(general-category\t%s) ; %s%s"
676                (mapconcat (lambda (cell)
677                             (format "%S" cell))
678                           value " ")
679                (cond ((rassoc value unidata-normative-category-alist)
680                       "Normative Category")
681                      ((rassoc value unidata-informative-category-alist)
682                       "Informative Category")
683                      (t
684                       "Unknown Category"))
685                line-breaking))
686       (setq attributes (delq 'general-category attributes))
687       )
688     (when (and (memq 'bidi-category attributes)
689                (setq value (get-char-attribute char 'bidi-category)))
690       (insert (format "(bidi-category\t. %S)%s"
691                       value
692                       line-breaking))
693       (setq attributes (delq 'bidi-category attributes))
694       )
695     (unless (or (not (memq 'mirrored attributes))
696                 (eq (setq value (get-char-attribute char 'mirrored 'empty))
697                     'empty))
698       (insert (format "(mirrored\t\t. %S)%s"
699                       value
700                       line-breaking))
701       (setq attributes (delq 'mirrored attributes))
702       )
703     (cond
704      ((and (memq 'decimal-digit-value attributes)
705            (setq value (get-char-attribute char 'decimal-digit-value)))
706       (insert (format "(decimal-digit-value . %S)%s"
707                       value
708                       line-breaking))
709       (setq attributes (delq 'decimal-digit-value attributes))
710       (when (and (memq 'digit-value attributes)
711                  (setq value (get-char-attribute char 'digit-value)))
712         (insert (format "(digit-value\t . %S)%s"
713                         value
714                         line-breaking))
715         (setq attributes (delq 'digit-value attributes))
716         )
717       (when (and (memq 'numeric-value attributes)
718                  (setq value (get-char-attribute char 'numeric-value)))
719         (insert (format "(numeric-value\t . %S)%s"
720                         value
721                         line-breaking))
722         (setq attributes (delq 'numeric-value attributes))
723         )
724       )
725      (t
726       (when (and (memq 'digit-value attributes)
727                  (setq value (get-char-attribute char 'digit-value)))
728         (insert (format "(digit-value\t. %S)%s"
729                         value
730                         line-breaking))
731         (setq attributes (delq 'digit-value attributes))
732         )
733       (when (and (memq 'numeric-value attributes)
734                  (setq value (get-char-attribute char 'numeric-value)))
735         (insert (format "(numeric-value\t. %S)%s"
736                         value
737                         line-breaking))
738         (setq attributes (delq 'numeric-value attributes))
739         )))
740     (when (and (memq 'iso-10646-comment attributes)
741                (setq value (get-char-attribute char 'iso-10646-comment)))
742       (insert (format "(iso-10646-comment\t. %S)%s"
743                       value
744                       line-breaking))
745       (setq attributes (delq 'iso-10646-comment attributes))
746       )
747     (when (and (memq 'morohashi-daikanwa attributes)
748                (setq value (get-char-attribute char 'morohashi-daikanwa)))
749       (insert (format "(morohashi-daikanwa\t%s)%s"
750                       (mapconcat (function prin1-to-string) value " ")
751                       line-breaking))
752       (setq attributes (delq 'morohashi-daikanwa attributes))
753       )
754     (setq radical nil
755           strokes nil)
756     (when (and (memq 'ideographic-radical attributes)
757                (setq value (get-char-attribute char 'ideographic-radical)))
758       (setq radical value)
759       (insert (format "(ideographic-radical . %S)\t; %c%s"
760                       radical
761                       (ideographic-radical radical)
762                       line-breaking))
763       (setq attributes (delq 'ideographic-radical attributes))
764       )
765     (when (and (memq 'shuowen-radical attributes)
766                (setq value (get-char-attribute char 'shuowen-radical)))
767       (insert (format "(shuowen-radical\t. %S)\t; %c%s"
768                       value
769                       (shuowen-radical value)
770                       line-breaking))
771       (setq attributes (delq 'shuowen-radical attributes))
772       )
773     (let (key)
774       (dolist (domain
775                (append
776                 char-db-feature-domains
777                 (let (dest domain)
778                   (dolist (feature (char-attribute-list))
779                     (setq feature (symbol-name feature))
780                     (when (string-match
781                            "\\(radical\\|strokes\\)@\\([^@*]+\\)\\(\\*\\|$\\)"
782                            feature)
783                       (setq domain (intern (match-string 2 feature)))
784                      (unless (memq domain dest)
785                        (setq dest (cons domain dest)))))
786                   (sort dest #'string<))))
787         (setq key (intern (format "%s@%s" 'ideographic-radical domain)))
788         (when (and (memq key attributes)
789                    (setq value (get-char-attribute char key)))
790           (setq radical value)
791           (insert (format "(%s . %S)\t; %c%s"
792                           key
793                           radical
794                           (ideographic-radical radical)
795                           line-breaking))
796           (setq attributes (delq key attributes))
797           )
798         (setq key (intern (format "%s@%s" 'ideographic-strokes domain)))
799         (when (and (memq key attributes)
800                    (setq value (get-char-attribute char key)))
801           (setq strokes value)
802           (insert (format "(%s . %S)%s"
803                           key
804                           strokes
805                           line-breaking))
806           (setq attributes (delq key attributes))
807           )
808         (setq key (intern (format "%s@%s" 'total-strokes domain)))
809         (when (and (memq key attributes)
810                    (setq value (get-char-attribute char key)))
811           (insert (format "(%s       . %S)%s"
812                           key
813                           value
814                           line-breaking))
815           (setq attributes (delq key attributes))
816           )
817         (dolist (feature '(ideographic-radical
818                            ideographic-strokes
819                            total-strokes))
820           (setq key (intern (format "%s@%s*sources" feature domain)))
821           (when (and (memq key attributes)
822                      (setq value (get-char-attribute char key)))
823             (insert (format "(%s%s" key line-breaking))
824             (dolist (cell value)
825               (insert (format " %s" cell)))
826             (insert ")")
827             (insert line-breaking)
828             (setq attributes (delq key attributes))
829             ))
830         ))
831     (when (and (memq 'ideographic-strokes attributes)
832                (setq value (get-char-attribute char 'ideographic-strokes)))
833       (setq strokes value)
834       (insert (format "(ideographic-strokes . %S)%s"
835                       strokes
836                       line-breaking))
837       (setq attributes (delq 'ideographic-strokes attributes))
838       )
839     (when (and (memq 'kangxi-radical attributes)
840                (setq value (get-char-attribute char 'kangxi-radical)))
841       (unless (eq value radical)
842         (insert (format "(kangxi-radical\t . %S)\t; %c%s"
843                         value
844                         (ideographic-radical value)
845                         line-breaking))
846         (or radical
847             (setq radical value)))
848       (setq attributes (delq 'kangxi-radical attributes))
849       )
850     (when (and (memq 'kangxi-strokes attributes)
851                (setq value (get-char-attribute char 'kangxi-strokes)))
852       (unless (eq value strokes)
853         (insert (format "(kangxi-strokes\t . %S)%s"
854                         value
855                         line-breaking))
856         (or strokes
857             (setq strokes value)))
858       (setq attributes (delq 'kangxi-strokes attributes))
859       )
860     (when (and (memq 'japanese-radical attributes)
861                (setq value (get-char-attribute char 'japanese-radical)))
862       (unless (eq value radical)
863         (insert (format "(japanese-radical\t . %S)\t; %c%s"
864                         value
865                         (ideographic-radical value)
866                         line-breaking))
867         (or radical
868             (setq radical value)))
869       (setq attributes (delq 'japanese-radical attributes))
870       )
871     (when (and (memq 'japanese-strokes attributes)
872                (setq value (get-char-attribute char 'japanese-strokes)))
873       (unless (eq value strokes)
874         (insert (format "(japanese-strokes\t . %S)%s"
875                         value
876                         line-breaking))
877         (or strokes
878             (setq strokes value)))
879       (setq attributes (delq 'japanese-strokes attributes))
880       )
881     (when (and (memq 'cns-radical attributes)
882                (setq value (get-char-attribute char 'cns-radical)))
883       (insert (format "(cns-radical\t . %S)\t; %c%s"
884                       value
885                       (ideographic-radical value)
886                       line-breaking))
887       (setq attributes (delq 'cns-radical attributes))
888       )
889     (when (and (memq 'cns-strokes attributes)
890                (setq value (get-char-attribute char 'cns-strokes)))
891       (unless (eq value strokes)
892         (insert (format "(cns-strokes\t . %S)%s"
893                         value
894                         line-breaking))
895         (or strokes
896             (setq strokes value)))
897       (setq attributes (delq 'cns-strokes attributes))
898       )
899     (when (and (memq 'shinjigen-1-radical attributes)
900                (setq value (get-char-attribute char 'shinjigen-1-radical)))
901       (unless (eq value radical)
902         (insert (format "(shinjigen-1-radical . %S)\t; %c%s"
903                         value
904                         (ideographic-radical value)
905                         line-breaking))
906         (or radical
907             (setq radical value)))
908       (setq attributes (delq 'shinjigen-1-radical attributes))
909       )
910     (when (and (memq 'ideographic- attributes)
911                (setq value (get-char-attribute char 'ideographic-)))
912       (insert "(ideographic-       ")
913       (setq lbs (concat "\n" (make-string (current-column) ?\ ))
914             separator nil)
915       (while (consp value)
916         (setq cell (car value))
917         (if (integerp cell)
918             (setq cell (decode-char '=ucs cell)))
919         (cond ((characterp cell)
920                (if separator
921                    (insert lbs))
922                (if readable
923                    (insert (format "%S" cell))
924                  (char-db-insert-char-spec cell readable))
925                (setq separator lbs))
926               ((consp cell)
927                (if separator
928                    (insert lbs))
929                (if (consp (car cell))
930                    (char-db-insert-char-spec cell readable)
931                  (char-db-insert-char-reference cell readable))
932                (setq separator lbs))
933               (t
934                (if separator
935                    (insert separator))
936                (insert (prin1-to-string cell))
937                (setq separator " ")))
938         (setq value (cdr value)))
939       (insert ")")
940       (insert line-breaking)
941       (setq attributes (delq 'ideographic- attributes)))
942     (when (and (memq 'total-strokes attributes)
943                (setq value (get-char-attribute char 'total-strokes)))
944       (insert (format "(total-strokes       . %S)%s"
945                       value
946                       line-breaking))
947       (setq attributes (delq 'total-strokes attributes))
948       )
949     (when (and (memq '->ideograph attributes)
950                (setq value (get-char-attribute char '->ideograph)))
951       (insert (format "(->ideograph\t%s)%s"
952                       (mapconcat (lambda (code)
953                                    (cond ((symbolp code)
954                                           (symbol-name code))
955                                          ((integerp code)
956                                           (format "#x%04X" code))
957                                          (t
958                                           (format "%s %S"
959                                                   line-breaking code))))
960                                  value " ")
961                       line-breaking))
962       (setq attributes (delq '->ideograph attributes))
963       )
964     ;; (when (and (memq '->decomposition attributes)
965     ;;            (setq value (get-char-attribute char '->decomposition)))
966     ;;   (insert (format "(->decomposition\t%s)%s"
967     ;;                   (mapconcat (lambda (code)
968     ;;                                (cond ((symbolp code)
969     ;;                                       (symbol-name code))
970     ;;                                      ((characterp code)
971     ;;                                       (if readable
972     ;;                                           (format "%S" code)
973     ;;                                         (format "#x%04X"
974     ;;                                                 (char-int code))
975     ;;                                         ))
976     ;;                                      ((integerp code)
977     ;;                                       (format "#x%04X" code))
978     ;;                                      (t
979     ;;                                       (format "%s%S" line-breaking code))))
980     ;;                              value " ")
981     ;;                   line-breaking))
982     ;;   (setq attributes (delq '->decomposition attributes))
983     ;;   )
984     (if (equal (get-char-attribute char '->titlecase)
985                (get-char-attribute char '->uppercase))
986         (setq attributes (delq '->titlecase attributes)))
987     (when (and (memq '->mojikyo attributes)
988                (setq value (get-char-attribute char '->mojikyo)))
989       (insert (format "(->mojikyo\t\t. %06d)\t; %c%s"
990                       value (decode-char 'mojikyo value)
991                       line-breaking))
992       (setq attributes (delq '->mojikyo attributes))
993       )
994     (when (and (memq 'hanyu-dazidian-vol attributes)
995                (setq value (get-char-attribute char 'hanyu-dazidian-vol)))
996       (insert (format "(hanyu-dazidian-vol  . %d)%s"
997                       value line-breaking))
998       (setq attributes (delq 'hanyu-dazidian-vol attributes))
999       )
1000     (when (and (memq 'hanyu-dazidian-page attributes)
1001                (setq value (get-char-attribute char 'hanyu-dazidian-page)))
1002       (insert (format "(hanyu-dazidian-page . %d)%s"
1003                       value line-breaking))
1004       (setq attributes (delq 'hanyu-dazidian-page attributes))
1005       )
1006     (when (and (memq 'hanyu-dazidian-char attributes)
1007                (setq value (get-char-attribute char 'hanyu-dazidian-char)))
1008       (insert (format "(hanyu-dazidian-char . %d)%s"
1009                       value line-breaking))
1010       (setq attributes (delq 'hanyu-dazidian-char attributes))
1011       )
1012     (unless readable
1013       (dolist (ignored '(composition
1014                          ->denotational <-subsumptive ->ucs-unified
1015                          ->ideographic-component-forms))
1016         (setq attributes (delq ignored attributes))))
1017     (while attributes
1018       (setq name (car attributes))
1019       (if (setq value (get-char-attribute char name))
1020           (cond ((setq ret (find-charset name))
1021                  (setq name (charset-name ret))
1022                  (if (and (not (memq name dest-ccss))
1023                           (prog1
1024                               (setq value (get-char-attribute char name))
1025                             (setq dest-ccss (cons name dest-ccss))))
1026                      (char-db-insert-ccs-feature name value line-breaking))
1027                  )
1028                 ((string-match "^=>ucs@" (symbol-name name))
1029                  (insert (format "(%-18s . #x%04X)\t; %c%s"
1030                                  name value (decode-char '=ucs value)
1031                                  line-breaking))
1032                  )
1033                 ((eq name 'jisx0208-1978/4X)
1034                  (insert (format "(%-18s . #x%04X)%s"
1035                                  name value
1036                                  line-breaking))
1037                  )
1038                 ((and
1039                   (not readable)
1040                   (not (eq name '->subsumptive))
1041                   (not (eq name '->uppercase))
1042                   (not (eq name '->lowercase))
1043                   (not (eq name '->titlecase))
1044                   (not (eq name '->canonical))
1045                   (not (eq name '->Bopomofo))
1046                   (not (eq name '->mistakable))
1047                   (not (eq name '->ideographic-variants))
1048                   (null (get-char-attribute
1049                          char (intern (format "%s*sources" name))))
1050                   (not (string-match "\\*sources$" (symbol-name name)))
1051                   (null (get-char-attribute
1052                          char (intern (format "%s*note" name))))
1053                   (not (string-match "\\*note$" (symbol-name name)))
1054                   (or (eq name '<-identical)
1055                       (eq name '<-uppercase)
1056                       (eq name '<-lowercase)
1057                       (eq name '<-titlecase)
1058                       (eq name '<-canonical)
1059                       (eq name '<-ideographic-variants)
1060                       ;; (eq name '<-synonyms)
1061                       (string-match "^<-synonyms" (symbol-name name))
1062                       (eq name '<-mistakable)
1063                       (when (string-match "^->" (symbol-name name))
1064                         (cond
1065                          ((string-match "^->fullwidth" (symbol-name name))
1066                           (not (and (consp value)
1067                                     (characterp (car value))
1068                                     (encode-char
1069                                      (car value) '=ucs 'defined-only)))
1070                           )
1071                          (t)))
1072                       ))
1073                  )
1074                 ((or (eq name 'ideographic-structure)
1075                      (eq name 'ideographic-combination)
1076                      (eq name 'ideographic-)
1077                      (eq name '=decomposition)
1078                      (string-match "^=>decomposition" (symbol-name name))
1079                      (string-match "^\\(->\\|<-\\)[^*]*$" (symbol-name name))
1080                      (string-match "^\\(->\\|<-\\)[^*]*\\*sources$"
1081                                    (symbol-name name))
1082                      )
1083                  (char-db-insert-relation-feature char name value
1084                                                   line-breaking
1085                                                   ccss readable))
1086                 ((memq name '(ideograph=
1087                               original-ideograph-of
1088                               ancient-ideograph-of
1089                               vulgar-ideograph-of
1090                               wrong-ideograph-of
1091                               ;; simplified-ideograph-of
1092                               ideographic-variants
1093                               ;; ideographic-different-form-of
1094                               ))
1095                  (insert (format "(%-18s%s " name line-breaking))
1096                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1097                        separator nil)
1098                  (while (consp value)
1099                    (setq cell (car value))
1100                    (if (and (consp cell)
1101                             (consp (car cell)))
1102                        (progn
1103                          (if separator
1104                              (insert lbs))
1105                          (char-db-insert-alist cell readable)
1106                          (setq separator lbs))
1107                      (if separator
1108                          (insert separator))
1109                      (insert (prin1-to-string cell))
1110                      (setq separator " "))
1111                    (setq value (cdr value)))
1112                  (insert ")")
1113                  (insert line-breaking))
1114                 ((consp value)
1115                  (insert (format "(%-18s " name))
1116                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1117                        separator nil)
1118                  (while (consp value)
1119                    (setq cell (car value))
1120                    (if (and (consp cell)
1121                             (consp (car cell))
1122                             (setq ret (condition-case nil
1123                                           (find-char cell)
1124                                         (error nil))))
1125                        (progn
1126                          (setq rest cell
1127                                al nil
1128                                cal nil)
1129                          (while rest
1130                            (setq key (car (car rest)))
1131                            (if (find-charset key)
1132                                (setq cal (cons key cal))
1133                              (setq al (cons key al)))
1134                            (setq rest (cdr rest)))
1135                          (if separator
1136                              (insert lbs))
1137                          (insert-char-attributes ret
1138                                                  readable
1139                                                  al cal)
1140                          (setq separator lbs))
1141                      (setq ret (prin1-to-string cell))
1142                      (if separator
1143                          (if (< (+ (current-column)
1144                                    (length ret)
1145                                    (length separator))
1146                                 76)
1147                              (insert separator)
1148                            (insert lbs)))
1149                      (insert ret)
1150                      (setq separator " "))
1151                    (setq value (cdr value)))
1152                  (insert ")")
1153                  (insert line-breaking))
1154                 (t
1155                  (insert (format "(%-18s" name))
1156                  (setq ret (prin1-to-string value))
1157                  (unless (< (+ (current-column)
1158                                (length ret)
1159                                3)
1160                             76)
1161                    (insert line-breaking))
1162                  (insert " . " ret ")" line-breaking)
1163                  ;; (insert (format "(%-18s . %S)%s"
1164                  ;;                 name value
1165                  ;;                 line-breaking))
1166                  )
1167                 ))
1168       (setq attributes (cdr attributes)))
1169     (insert ")")))
1170
1171 (defun insert-char-data (char &optional readable
1172                               attributes)
1173   (save-restriction
1174     (narrow-to-region (point)(point))
1175     (insert "(define-char
1176   '")
1177     (insert-char-attributes char readable attributes)
1178     (insert ")\n")
1179     (goto-char (point-min))
1180     (while (re-search-forward "[ \t]+$" nil t)
1181       (replace-match ""))
1182     ;; from tabify.
1183     (goto-char (point-min))
1184     (while (re-search-forward "[ \t][ \t][ \t]*" nil t)
1185       (let ((column (current-column))
1186             (indent-tabs-mode t))
1187         (delete-region (match-beginning 0) (point))
1188         (indent-to column)))
1189     (goto-char (point-max))
1190     ;; (tabify (point-min)(point-max))
1191     ))
1192
1193 (defun insert-char-data-with-variant (char &optional printable
1194                                            no-ucs-unified
1195                                            script excluded-script)
1196   (insert-char-data char printable)
1197   (let ((variants (char-variants char))
1198         rest
1199         variant vs ret)
1200     (setq variants (sort variants #'<))
1201     (setq rest variants)
1202     (setq variants (cons char variants))
1203     (while rest
1204       (setq variant (car rest))
1205       (unless (get-char-attribute variant '<-subsumptive)
1206         (if (and (or (null script)
1207                      (null (setq vs (get-char-attribute variant 'script)))
1208                      (memq script vs))
1209                  (or (null excluded-script)
1210                      (null (setq vs (get-char-attribute variant 'script)))
1211                      (not (memq excluded-script vs))))
1212             (unless (and no-ucs-unified (get-char-attribute variant '=ucs))
1213               (insert-char-data variant printable)
1214               (if (setq ret (char-variants variant))
1215                   (while ret
1216                     (or (memq (car ret) variants)
1217                         ;; (get-char-attribute (car ret) '<-subsumptive)
1218                         (setq rest (nconc rest (list (car ret)))))
1219                     (setq ret (cdr ret)))))))
1220       (setq rest (cdr rest)))))
1221
1222 (defun insert-char-range-data (min max &optional script excluded-script)
1223   (let ((code min)
1224         char)
1225     (while (<= code max)
1226       (setq char (decode-char '=ucs code))
1227       (if (encode-char char '=ucs 'defined-only)
1228           (insert-char-data-with-variant char nil 'no-ucs-unified
1229                                          script excluded-script))
1230       (setq code (1+ code)))))
1231
1232 (defun write-char-range-data-to-file (min max file
1233                                           &optional script excluded-script)
1234   (let ((coding-system-for-write char-db-file-coding-system))
1235     (with-temp-buffer
1236       (insert (format ";; -*- coding: %s -*-\n"
1237                       char-db-file-coding-system))
1238       (insert-char-range-data min max script excluded-script)
1239       (write-region (point-min)(point-max) file))))
1240
1241 (defvar what-character-original-window-configuration)
1242
1243 ;;;###autoload
1244 (defun what-char-definition (char)
1245   (interactive (list (char-after)))
1246   (let ((buf (get-buffer-create "*Character Description*"))
1247         (the-buf (current-buffer))
1248         (win-conf (current-window-configuration)))
1249     (pop-to-buffer buf)
1250     (make-local-variable 'what-character-original-window-configuration)
1251     (setq what-character-original-window-configuration win-conf)
1252     (setq buffer-read-only nil)
1253     (erase-buffer)
1254     (condition-case err
1255         (progn
1256           (insert-char-data-with-variant char 'printable)
1257           (unless (char-attribute-alist char)
1258             (insert (format ";; = %c\n"
1259                             (let* ((rest (split-char char))
1260                                    (ccs (pop rest))
1261                                    (code (pop rest)))
1262                               (while rest
1263                                 (setq code (logior (lsh code 8)
1264                                                    (pop rest))))
1265                               (decode-char ccs code)))))
1266           ;; (char-db-update-comment)
1267           (set-buffer-modified-p nil)
1268           (view-mode the-buf (lambda (buf)
1269                                (set-window-configuration
1270                                 what-character-original-window-configuration)
1271                                ))
1272           (goto-char (point-min)))
1273       (error (progn
1274                (set-window-configuration
1275                 what-character-original-window-configuration)
1276                (signal (car err) (cdr err)))))))
1277
1278
1279 ;;; @ end
1280 ;;;
1281
1282 (provide 'char-db-util)
1283
1284 ;;; char-db-util.el ends here