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