annotate lisp/descr-text.el @ 4478:ec442dc06fe1

Merge.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 10 Jul 2008 23:37:52 +0200
parents 78738a40e31e
children 74caf140505b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1 ;;; descr-text.el --- describe text mode
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
2
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
3 ;; Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
5
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
6 ;; Author: Boris Goldowsky <boris@gnu.org>
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
7 ;; Maintainer: FSF
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
8 ;; Keywords: faces, i18n, Unicode, multilingual
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
9
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
10 ;; This file is part of XEmacs.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
11
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
15 ;; any later version.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
16
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
20 ;; GNU General Public License for more details.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
21
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
25 ;; Boston, MA 02110-1301, USA.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
26
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
27 ;;; Commentary:
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
28
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
29 ;;; Describe-Text Mode.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
30
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
31 ;;; Code:
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
32
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
33 (eval-when-compile (require 'wid-edit))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
34
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
35 ;;; Describe-Text Utilities.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
36
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
37 (defun describe-text-widget (widget)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
38 "Insert text to describe WIDGET in the current buffer."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
39 ;; XEmacs change; use the widget function.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
40 (widget-create 'push-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
41 :notify `(lambda (&rest ignore)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
42 (widget-browse ',widget))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
43 :help-echo
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
44 "mouse-2, RET: browse this widget"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
45 (symbol-name (if (symbolp widget)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
46 widget
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
47 (car widget))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
48 (widget-insert " ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
49 (widget-create 'info-link
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
50 :tag "Widget help"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
51 :help-echo
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
52 "Read widget documentation"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
53 "(widget)Top"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
54
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
55 (defun describe-text-sexp (sexp)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
56 "Insert a short description of SEXP in the current buffer."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
57 ;; XEmacs change; use the widget functions.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
58 (let ((pp (condition-case signal
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
59 (pp-to-string sexp)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
60 (error (prin1-to-string signal)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
61 (when (string-match "\n\\'" pp)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
62 (setq pp (substring pp 0 (1- (length pp)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
63 (if (cond ((string-match "\n" pp)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
64 nil)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
65 ((> (length pp) (- (window-width) (current-column)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
66 nil)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
67 (t t))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
68 (widget-insert pp)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
69 (widget-create 'push-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
70 :notify `(lambda (&rest ignore)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
71 (with-output-to-temp-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
72 "*Pp Eval Output*"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
73 (princ ',pp)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
74 :help-echo
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
75 "mouse-2, RET: pretty print value in another buffer"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
76 "[Show]"))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
77
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
78 (defun describe-property-list (properties)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
79 "Insert a description of PROPERTIES in the current buffer.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
80 PROPERTIES should be a list of overlay or text properties.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
81 The `category', `face' and `font-lock-face' properties are made
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
82 into help buttons that call `describe-text-category' or
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
83 `describe-face' when pushed."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
84 ;; Sort the properties by the size of their value.
4473
0204391fc17c #'require hyper-apropos in #'describe-property-list, for hyper-apropos-face
Aidan Kehoe <kehoea@parhasard.net>
parents: 4468
diff changeset
85 (require 'hyper-apropos)
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
86 (dolist (elt (sort (let (ret)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
87 (while properties
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
88 (push (list (pop properties) (pop properties)) ret))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
89 ret)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
90 (lambda (a b) (string< (prin1-to-string (nth 0 a) t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
91 (prin1-to-string (nth 0 b) t)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
92 (let ((key (nth 0 elt))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
93 (value (nth 1 elt)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
94 ;; XEmacs change; use #'widget-insert, #'widget-create
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
95 (widget-insert (propertize (format " %-20s " key)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
96 'face 'hyper-apropos-heading))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
97 (cond ((eq key 'category)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
98 (widget-create
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
99 'push-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
100 :notify `(lambda (&rest ignore)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
101 (describe-text-category ',value))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
102 :help-echo "mouse-2, RET: describe this category"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
103 (symbol-name value)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
104 ((memq key '(face font-lock-face mouse-face))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
105 (widget-create
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
106 'push-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
107 :notify (lexical-let
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
108 ((value-name (symbol-name value)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
109 (lambda (&rest ignore)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
110 (hyper-describe-face (intern value-name))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
111 :help-echo "mouse-2, RET: describe this face"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
112 (format "%S" value)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
113 ((widgetp value)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
114 (describe-text-widget value))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
115 (t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
116 (describe-text-sexp value))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
117 (insert "\n")))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
118
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
119 ;;; Describe-Text Commands.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
120
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
121 (defun describe-text-category (category)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
122 "Describe a text property category."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
123 (interactive "SCategory: ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
124 ; (help-setup-xref (list #'describe-text-category category) (interactive-p))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
125 (save-excursion
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
126 (with-output-to-temp-buffer "*Help*"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
127 (set-buffer standard-output)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
128 (insert "Category " (format "%S" category) ":\n\n")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
129 (describe-property-list (symbol-plist category))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
130 (goto-char (point-min)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
131
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
132 ;;;###autoload
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
133 (defun describe-text-properties (pos &optional output-buffer)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
134 "Describe widgets, buttons, overlays and text properties at POS.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
135 Interactively, describe them for the character after point.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
136 If optional second argument OUTPUT-BUFFER is non-nil,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
137 insert the output into that buffer, and don't initialize or clear it
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
138 otherwise."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
139 (interactive "d")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
140 (if (>= pos (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
141 (error "No character follows specified position"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
142 (if output-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
143 (describe-text-properties-1 pos output-buffer)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
144 (if (not (or (text-properties-at pos) ; (overlays-at pos)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
145 ;; XEmacs change.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
146 (extents-at pos)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
147 (message "This is plain text.")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
148 (let ((buffer (current-buffer))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
149 (target-buffer "*Help*"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
150 (when (eq buffer (get-buffer target-buffer))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
151 (setq target-buffer "*Help*<2>"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
152 (save-excursion
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
153 (with-output-to-temp-buffer target-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
154 (set-buffer standard-output)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
155 (setq output-buffer (current-buffer))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
156 (insert "Text content at position " (format "%d" pos) ":\n\n")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
157 (with-current-buffer buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
158 (describe-text-properties-1 pos output-buffer))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
159 (goto-char (point-min))))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
160
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
161 (defun describe-text-properties-1 (pos output-buffer)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
162 (let* ((properties (text-properties-at pos))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
163 ;; XEmacs change; extents, not overlays.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
164 (extents (extents-at pos))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
165 (wid-field (get-char-property pos 'field))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
166 (wid-button (get-char-property pos 'button))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
167 (wid-doc (get-char-property pos 'widget-doc))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
168 ;; If button.el is not loaded, we have no buttons in the text.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
169 ;; XEmacs change; use the #'and-fboundp, #'declare-fboundp macros.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
170 (button (and-fboundp 'button-at (button-at pos)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
171 (button-type (and button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
172 (declare-fboundp (button-type button))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
173 (button-label (and button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
174 (declare-fboundp (button-label button))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
175 (widget (or wid-field wid-button wid-doc)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
176 (with-current-buffer output-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
177 ;; Widgets
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
178 (when (widgetp widget)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
179 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
180 (insert (cond (wid-field "This is an editable text area")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
181 (wid-button "This is an active area")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
182 (wid-doc "This is documentation text")))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
183 (insert " of a ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
184 (describe-text-widget widget)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
185 (insert ".\n\n"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
186 ;; Buttons
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
187 (when (and button (not (widgetp wid-button)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
188 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
189 (insert "Here is a `" (format "%S" button-type)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
190 "' button labeled `" button-label "'.\n\n"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
191 ;; Overlays
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
192 (when extents
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
193 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
194 (if (eq (length extents) 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
195 (insert "There is an extent here:\n")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
196 (insert "There are " (format "%d" (length extents))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
197 " overlays here:\n"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
198 (dolist (extent extents)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
199 (insert " From " (format "%d" (extent-start-position extent))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
200 " to " (format "%d" (extent-end-position extent)) "\n")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
201 (describe-property-list (extent-properties extent)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
202 (insert "\n"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
203 ;; Text properties
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
204 (when properties
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
205 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
206 (insert "There are text properties here:\n")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
207 (describe-property-list properties)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
208
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
209 (defcustom describe-char-unicodedata-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
210 ;; XEmacs change; initialise this by default, using Perl.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
211 (let ((have-perl
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
212 (member-if
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
213 #'(lambda (path)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
214 (file-exists-p (format "%s%cperl" path directory-sep-char)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
215 exec-path))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
216 installprivlib res)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
217 (when have-perl
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
218 (setq installprivlib
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
219 (with-string-as-buffer-contents ""
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
220 (shell-command "perl -V:installprivlib" t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
221 ;; 1+ because buffer offsets start at one.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
222 (delete-region 1 (1+ (length "installprivlib='")))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
223 ;; Delete the final newline, semicolon and quotation mark.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
224 (delete-region (- (point-max) 3) (point-max))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
225 (cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
226 ((file-exists-p
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
227 (setq res
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
228 (format "%s%cunicore%cUnicodeData.txt"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
229 installprivlib directory-sep-char directory-sep-char))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
230 ((file-exists-p
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
231 (setq res
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
232 (format "%s%cunicode%cUnicodeData.txt"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
233 installprivlib directory-sep-char directory-sep-char)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
234 res))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
235 "Location of Unicode data file.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
236 This is the UnicodeData.txt file from the Unicode Consortium, used for
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
237 diagnostics. If it is non-nil `describe-char' will print data
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
238 looked up from it. This facility is mostly of use to people doing
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
239 multilingual development.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
240
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
241 This is a fairly large file, typically installed with Perl.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
242 At the time of writing it is at the URL
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
243 `http://www.unicode.org/Public/UNIDATA/UnicodeData.txt'.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
244
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
245 It is possible to build a DBM or Berkeley index cache for this file, so that
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
246 it is not necessary to parse the whole file at run time. See
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
247 `unidata-initialize-unicodedata-database'.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
248
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
249 See also `describe-char-unihan-file' for the complementary file describing
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
250 East Asian Han characters and their associated information."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
251
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
252 :group 'mule
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
253 :type '(choice (const :tag "None" nil)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
254 file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
255
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
256 ;; XEmacs additions, from here until `describe-char-unicode-data'
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
257 (defcustom describe-char-use-cache t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
258 "Whether `describe-char' should use a DBM or Berkeley DB cache.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
259 This speeds up navigation of `describe-char-unicodedata-file', and makes
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
260 navigation of `describe-char-unihan-file' reasonable."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
261 :group 'mule
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
262 :type '(choice (const :tag "None" nil)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
263 file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
264
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
265 (defcustom describe-char-unihan-file nil
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
266 "Location of Unihan file.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
267 This the Unihan.txt file from the Unicode Consortium, used for diagnostics.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
268 If it is non-nil `describe-char' can print data looked up from it. This
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
269 facility is of use to people doing multilingual development, to those
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
270 learning Chinese or Japanese, and to a lesser extent to those learning
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
271 Korean or Vietnamese.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
272
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
273 This is large file, typically not installed with the operating system. At
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
274 the time of writing it is at the URL
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
275 `http://www.unicode.org/Public/UNIDATA/UniHan.txt'.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
276
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
277 In contrast with `describe-char-unicodedata-file', `describe-char' will not
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
278 load this entire file and parse it if it is available. It requires a
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
279 pre-initialized cache; see `unidata-initialize-unihan-database'. "
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
280 :group 'mule
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
281 :type '(choice (const :tag "None" nil)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
282 file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
283
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
284 ;; XEmacs addition
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
285 (defvar unidata-database-format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
286 (or (and (featurep 'dbm) 'dbm)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
287 (and (featurep 'berkeley-db) 'berkeley-db))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
288 "The DB format to use for the `describe-char' cache, or nil if no cache.")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
289
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
290 (defvar describe-char-unihan-field-descriptions
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
291 #s(hash-table test equal data
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
292 ("kAccountingNumeric"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
293 "Value as an an accounting numeral"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
294 "kBigFive"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
295 "Big Five mapping (excluding ETEN, etc. extensions)"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
296 "kCCCII"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
297 "Hex CCCII code, for libraries in the Republic of China"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
298 "kCNS1986"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
299 "Hex CNS 11643-1986 mapping, for the Republic of China"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
300 "kCNS1992"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
301 "Hex CNS 11643-1986 mapping, for the Republic of China"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
302 "kCangjie"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
303 "Cangjie input code for the character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
304 "kCantonese"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
305 "Cantonese pronunciation, using jyutping"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
306 "kCheungBauer"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
307 "Radical-stroke index, cangjie input code, \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
308 and Cantonese readings"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
309 "kCheungBauerIndex"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
310 "Index of information about this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
311 in Cheung & Bauer, 2002"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
312 "kCihaiT"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
313 "Lookup information for this character in the \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
314 Cihai dictionary ISBN 962-231-005-2."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
315 "kCompatibilityVariant"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
316 "Compatibility decomposition for this character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
317 "kCowles"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
318 "Lookup information for this character in the \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
319 Cowles dictionary ISBN 962-231-005-2."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
320 "kDaeJaweon"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
321 "Lookup information for this character in the \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
322 Dae Jaweon (Korean) dictionary, 1988"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
323 "kDefinition"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
324 "Definition for this character in modern written Chinese"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
325 "kEACC"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
326 "The EACC (= CCCII, as used by the \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
327 US library of congress) code for this character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
328 "kFenn"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
329 "Frequency information for this character from \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
330 Fenn's Chinese-English dictionary, 1979"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
331 "kFennIndex"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
332 "Lookup information for this character in \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
333 Fenn's Chinese-English dictionary, 1979"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
334 "kFourCornerCode"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
335 "Four-corner lookup code for this character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
336 "kFrequency"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
337 "Frequency information from traditional \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
338 Chinese USENET postings"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
339 "kGB0" "GB 2312-80 mapping, ku/ten"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
340 "kGB1" "GB 12345-90 mapping, ku/ten"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
341 "kGB3" "GB 7589-87 mapping, ku/ten"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
342 "kGB5" "GB 7590-87 mapping, ku/ten"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
343 "kGB7" "GB 8565-89 mapping, ku/ten"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
344 ;; Identical to the previous information?!
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
345 "kGB8" "GB 8565-89 mapping, ku/ten"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
346 "kGSR"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
347 "Lookup information for this character in \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
348 Karlgern's Grammata Serica Recensa"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
349 "kGradeLevel"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
350 "The first grade in the HK school system \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
351 where knowledge of this character is expected"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
352 "kHDZRadBreak" "Whether Hanyu Da Zidian has a radical break \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
353 beginning with this character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
354 "kHKGlyph" "Lookup information for this character in the HK \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
355 glyph reference, ISBN 962-949-040-4"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
356 "kHKSCS" "Mapping to the HK Supplementary Character Set for \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
357 Big Five."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
358 "kHanYu" "Character lookup information for Hanyu Da Zidian, \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
359 `Great Chinese Character Dictionary'"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
360 "kHangul" "Korean pronunciation"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
361 "kHanyuPinlu" "Pronunciation and frequency info, from Xiandai\
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
362 Hanyu Pinlu Cidian"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
363 "kIBMJapan" "IBM Japanese mapping"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
364 "kIICore" "Is this character in the core East Asian \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
365 ideograph set from the IRG?"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
366 "kIRGDaeJaweon" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
367 in the Dae Jaweon (Korean) dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
368 "kIRGDaiKanwaZiten" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
369 in the Morohashi (Japanese) dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
370 "kIRGHanyuDaZidian" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
371 in the Hanyu Da Zidian (Chinese) dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
372 "kIRGKangXi" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
373 in the KangXi dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
374 "kIRG_GSource" "PRC character source information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
375 "kIRG_HSource" "Hong Kong character source information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
376 "kIRG_JSource" "Japanese character source information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
377 "kIRG_KPSource" "Korean character source information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
378 "kIRG_KSource" "Republic of Korean character source\
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
379 information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
380 "kIRG_TSource" "Republic of China character source \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
381 information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
382 "kIRG_USource" "Unicode (standards body) source information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
383 "kIRG_VSource" "Vietnamese character source information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
384 "kJIS0213" "JIS X 0213-2000 mapping in min,ku,ten form"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
385 "kJapaneseKun" "Native Japanese pronunciation"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
386 "kJapaneseOn" "Sino-Japanese pronunciation"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
387 "kJis0" "JIS X 0208-1990 mapping in ku/ten form"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
388 "kJis1" "JIS X 0212-1990 mapping in ku/ten form"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
389 "kKPS0" "KPS 9566-97 mapping in hexadecimal"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
390 "kKPS1" "KPS 10721-2000 mapping in hexadecimal"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
391 "kKSC0" "KS X 1001:1992 (KS C 5601-1989) mapping \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
392 in ku/ten form"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
393 "kKSC1" "KS X 1002:1991 (KS C 5657-1991) mapping \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
394 in ku/ten form"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
395 "kKangXi" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
396 in the KangXi (Chinese) dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
397 "kKarlgren" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
398 in Karlgren's dictionary, 1974"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
399 "kKorean" "Pronunciation in Korean"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
400 "kLau" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
401 in Lau's Cantonese-English dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
402 "kMainlandTelegraph" "PRC telegraph code"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
403 "kMandarin" "Mandarin pronunciation in Pinyin"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
404 "kMatthews" "Lookup information for Robert Mathews' \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
405 Chinese-English dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
406 "kMeyerWempe" "Lookup information for Bernard Meyer and \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
407 Theodore Wempe's dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
408 ;; Identical to kIRGDaiKanwaZiten?!?
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
409 "kMorohashi" "Lookup information for this character \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
410 in the Morohashi (Japanese) dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
411 "kNelson" "Lookup information for this character in \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
412 Nelson's Japanese-English dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
413 "kOtherNumeric" "Esoteric numeric value"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
414 "kPhonetic" "Phonetic index data"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
415 "kPrimaryNumeric" "Standard numeric value"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
416 "kPseudoGB1" "Fake GB 12345-90, for the purposes of \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
417 Unicode inclusion"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
418 "kRSAdobe_Japan1_6" "Adobe-Japan1-6 information for \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
419 the character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
420 "kRSJapanese" "Radical/stroke count for Japanese"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
421 "kRSKanWa" "Morohashi radical/stroke count"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
422 "kRSKangXi" "KangXi radical/stroke count"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
423 "kRSKorean" "Korean radical/stroke count"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
424 "kRSUnicode" "Unicode radical/stroke count"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
425 "kSBGY" "Lookup information for this character in the Song \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
426 Ben Guang Yun Chinese dictionary"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
427 "kSemanticVariant" "Semantic variant character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
428 "kSimplifiedVariant" "Simplified variant character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
429 "kSpecializedSemanticVariant" "Specialized semantic variant"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
430 "kTaiwanTelegraph" "Taiwanese telegraph code"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
431 "kTang" "Tang dynasty pronunciation"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
432 "kTotalStrokes" "Total number of strokes"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
433 "kTraditionalVariant" "Traditional variant character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
434 "kVietnamese" "Vietnamese pronunciation"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
435 "kXerox" "Xerox code"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
436 "kZVariant" "Z-variant code(s)"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
437 "A map from symbolic Unihan field names to English-language descriptions.")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
438
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
439 (defun unidata-generate-database-file-name (unidata-file-name size
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
440 database-format)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
441 "Return a filename suitable for storing the cache for UNIDATA-FILE-NAME."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
442 (expand-file-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
443 (format "~%c.xemacs%c%s-%s" directory-sep-char directory-sep-char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
444 (md5 (format "%s-%d" unidata-file-name size))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
445 database-format)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
446
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
447 (defun unidata-initialize-unicodedata-database (unidata-file-name)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
448 "Init the berkeley or gdbm lookup table for UNIDATA-FILE-NAME.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
449
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
450 The table is a (non-SQL) database with information on the file offset of
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
451 each Unicode code point described in UNIDATA-FILE-NAME. In the normal
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
452 course of events UNIDATA-FILE-NAME is the value of
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
453 `unidata-default-file-name', which see. "
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
454 (check-argument-type #'file-readable-p unidata-file-name)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
455 (unless unidata-database-format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
456 (error 'unimplemented "No (non-SQL) DB support available"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
457 (let* ((database-format unidata-database-format)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
458 (size (eighth (file-attributes unidata-file-name)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
459 (database-file-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
460 (unidata-generate-database-file-name unidata-file-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
461 size database-format))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
462 (database-handle (open-database database-file-name database-format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
463 nil "rw+" #o644 'no-conversion-unix))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
464 (coding-system-for-read 'no-conversion-unix)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
465 (buffer-size 32768)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
466 (offset-start 0)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
467 (offset-end buffer-size)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
468 (range-information (make-range-table 'start-closed-end-closed))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
469 (range-staging (make-hash-table :test 'equal))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
470 (message "Initializing UnicodeData database cache: ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
471 (loop-count 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
472 range-startinfo)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
473 (with-temp-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
474 (progress-feedback-with-label 'describe-char-unicodedata-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
475 "%s" 0 message)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
476 (while (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
477 (delete-region (point-min) (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
478 (insert-file-contents unidata-file-name nil
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
479 offset-start offset-end)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
480 ;; If we've reached the end of the data, pass nil back to
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
481 ;; the while loop test.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
482 (not (= (point-min) (point-max))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
483
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
484 (when (= buffer-size (- (point-max) (point-min)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
485 ;; If we're in the body of the file, and there's a trailing
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
486 ;; incomplete end-line, delete it, and adjust offset-end
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
487 ;; appropriately.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
488 (goto-char (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
489 (search-backward "\n")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
490 (forward-char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
491 (delete-region (point) (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
492 (setq offset-end (+ offset-start (- (point) (point-min)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
493
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
494 (progress-feedback-with-label 'describe-char-unicodedata-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
495 "%s" (truncate
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
496 (* (/ offset-start size) 100))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
497 (concat message
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
498 (make-string
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
499 (mod loop-count 39) ?.)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
500 (incf loop-count)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
501 (goto-char (point-min))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
502 (while (re-search-forward
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
503 #r"^\([0-9A-F]\{4,6\}\);\([^;]*\);.*$" nil t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
504 (cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
505 ((and (> (- (match-end 2) (match-beginning 2)) 7)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
506 (equal (substring (match-string 2) -7)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
507 " First>"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
508 ;; Start of a range. Save the start info in range-staging.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
509 (puthash (substring (match-string 2) 0 -7)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
510 (list (string-to-int (match-string 1) 16)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
511 (+ offset-start (1- (match-beginning 0))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
512 range-staging))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
513 ((and (> (- (match-end 2) (match-beginning 2)) 7)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
514 (equal (substring (match-string 2) -6)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
515 " Last>"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
516 ;; End of a range. Combine with the start info, save it to the
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
517 ;; range-information range table.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
518 (setq range-startinfo
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
519 (gethash (substring (match-string 2) 0 -6) range-staging))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
520 (assert range-startinfo nil
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
521 "Unexpected order for range information.")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
522 (put-range-table
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
523 (first range-startinfo)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
524 (string-to-int (match-string 1) 16)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
525 (list (second range-startinfo)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
526 (+ offset-start (1- (match-end 0))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
527 range-information)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
528 (remhash (substring (match-string 2) 0 -6) range-staging))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
529 (t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
530 ;; Normal character. Save the associated information in the
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
531 ;; database directly.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
532 (put-database (match-string 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
533 (format "(%d %d)"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
534 (+ offset-start (1- (match-beginning 0)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
535 (+ offset-start (1- (match-end 0))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
536 database-handle))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
537 (goto-char (point-min))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
538 (setq offset-start offset-end
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
539 offset-end (+ buffer-size offset-end))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
540 ;; Save the range information as such in the database.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
541 (put-database "range-information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
542 (let ((print-readably t))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
543 (prin1-to-string range-information))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
544 database-handle)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
545 (close-database database-handle)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
546 (progress-feedback-with-label 'describe-char-unicodedata-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
547 "%s" 100 message)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
548 database-file-name))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
549
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
550 (defun unidata-initialize-unihan-database (unihan-file-name)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
551 "Init the berkeley or gdbm lookup table for UNIHAN-FILE-NAME.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
552
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
553 The table is a (non-SQL) database with information on the file offset of
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
554 each Unicode code point described in Unicode.org's Han character repository.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
555 Unihan.txt (see `describe-char-unihan-file', the usual argument to this
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
556 function) is very large, and manipulating it directly can be tedious and
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
557 slow, so creating this cache makes it reasonable to display Unihan info in
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
558 the output of \\[universal-argument] \\[what-cursor-position] . "
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
559 (check-argument-type #'file-readable-p unihan-file-name)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
560 (unless unidata-database-format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
561 (error 'unimplemented "No (non-SQL) DB support available"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
562 (let* ((database-format unidata-database-format)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
563 (size (eighth (file-attributes unihan-file-name)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
564 (database-file-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
565 (unidata-generate-database-file-name unihan-file-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
566 size database-format))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
567 (database-handle (open-database database-file-name database-format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
568 nil "rw+" #o644 'no-conversion-unix))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
569 (coding-system-for-read 'no-conversion-unix)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
570 (buffer-size 65536)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
571 (offset-start 0)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
572 (offset-end buffer-size)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
573 (message "Initializing Unihan database cache: ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
574 (loop-count 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
575 trailing-unicode leading-unicode character-start character-end)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
576 (with-temp-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
577 (progress-feedback-with-label 'describe-char-unihan-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
578 "%s" 0 message)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
579 (while (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
580 (delete-region (point-min) (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
581 (insert-file-contents unihan-file-name nil
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
582 offset-start offset-end)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
583 ;; If we've reached the end of the data, return nil to the
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
584 ;; while.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
585 (not (= (point-min) (point-max))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
586
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
587 (incf loop-count)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
588 (progress-feedback-with-label 'describe-char-unihan-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
589 "%s" (truncate
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
590 (* (/ offset-start size) 100))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
591 (concat message
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
592 (make-string
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
593 (mod loop-count 44) ?.)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
594 (block 'dealing-with-chars
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
595 (when (= buffer-size (- (point-max) (point-min)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
596 ;; If we're in the body of the file, we need to delete the
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
597 ;; character info for the last character, and set offset-end
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
598 ;; appropriately. Otherwise, we may not be able to pick where
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
599 ;; the actual description of a character ends and
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
600 ;; begins.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
601 ;;
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
602 ;; This breaks if any single Unihan character description is
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
603 ;; greater than the buffer size in length.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
604 (goto-char (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
605 (beginning-of-line)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
606
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
607 (when (< (- (point-max) (point)) (eval-when-compile
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
608 (length "U+ABCDEF\t")))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
609 ;; If the character ID of the last line may have been cut off,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
610 ;; we need to delete all of that line here.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
611 (delete-region (point) (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
612 (forward-line -1))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
613
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
614 (when (looking-at "^\\(U\\+[0-9A-F]\\{4,6\\}\\)\t")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
615 (setq trailing-unicode (match-string 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
616 trailing-unicode
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
617 (format "^%s\t" (regexp-quote trailing-unicode)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
618
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
619 (end-of-line)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
620
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
621 ;; Go back until we hit a line that doesn't start with this
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
622 ;; character info.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
623 (while (re-search-backward trailing-unicode nil t))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
624
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
625 ;; The re-search-backward failed, so point is still at the end
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
626 ;; of the last match. Move to its beginning.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
627 (beginning-of-line)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
628 (delete-region (point) (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
629 (setq offset-end (+ offset-start (- (point) (point-min))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
630 (goto-char (point-min))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
631 (while t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
632 (when (= (point) (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
633 ;; We're at the end of this part of the file.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
634 (return-from 'dealing-with-chars))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
635
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
636 (unless (re-search-forward "^\\(U\\+[0-9A-F]\\{4,6\\}\\)\t"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
637 nil t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
638 ;; We're probably in the comments at the start of the file. No
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
639 ;; need to look for character info.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
640 (return-from 'dealing-with-chars))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
641
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
642 ;; Store where the character started.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
643 (beginning-of-line)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
644 (setq character-start (point))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
645
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
646 (setq leading-unicode
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
647 (format "^%s\t" (regexp-quote (match-string 1))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
648
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
649 ;; Loop until we get past this entry.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
650 (while (re-search-forward leading-unicode nil t))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
651
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
652 ;; Now, store the information.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
653 (setq leading-unicode
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
654 (string-to-number (substring leading-unicode 3) 16)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
655 leading-unicode (format "%04X" leading-unicode)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
656 character-end (prog2 (end-of-line) (point)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
657 (put-database leading-unicode
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
658 (format "(%d %d)"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
659 (+ offset-start (1- character-start))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
660 (+ offset-start (1- character-end)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
661 database-handle)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
662 (forward-line)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
663 (setq offset-start offset-end
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
664 offset-end (+ buffer-size offset-end))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
665 (close-database database-handle)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
666 (progress-feedback-with-label 'describe-char-unihan-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
667 "%s" 100
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
668 message)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
669 database-file-name))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
670 ;; End XEmacs additions.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
671
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
672 (defun describe-char-unicode-data (char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
673 "Return a list of Unicode data for unicode CHAR.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
674 Each element is a list of a property description and the property value.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
675 The list is null if CHAR isn't found in `describe-char-unicodedata-file'."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
676 (when describe-char-unicodedata-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
677 (unless (file-exists-p describe-char-unicodedata-file)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
678 (error 'file-error
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
679 "`unicodedata-file' %s not found" describe-char-unicodedata-file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
680 ;; XEmacs change; accept a character argument, use the cache if
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
681 ;; appropriate.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
682 (when (characterp char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
683 (setq char (encode-char char 'ucs)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
684 (with-temp-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
685 (if describe-char-use-cache
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
686 ;; Use the database info.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
687 (let ((database-handle (open-database
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
688 (unidata-generate-database-file-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
689 describe-char-unicodedata-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
690 (eighth (file-attributes
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
691 describe-char-unicodedata-file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
692 unidata-database-format)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
693 unidata-database-format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
694 nil "r"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
695 #o644 'no-conversion-unix))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
696 (coding-system-for-read 'no-conversion-unix)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
697 key lookup)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
698 (unless database-handle
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
699 (error 'io-error "Could not open %s as a %s database"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
700 (unidata-generate-database-file-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
701 describe-char-unicodedata-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
702 (eighth (file-attributes
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
703 describe-char-unicodedata-file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
704 unidata-database-format)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
705 unidata-database-format))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
706 (setq key (format "%04X" char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
707 lookup (get-database key database-handle))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
708 (if lookup
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
709 ;; Okay, we have information on that character in particular.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
710 (progn (setq lookup (read lookup))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
711 (insert-file-contents describe-char-unicodedata-file nil
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
712 (first lookup) (second lookup)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
713 ;; No information on that character in particular. Do we have
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
714 ;; range information? If so, load and check for our desired
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
715 ;; character.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
716 (setq lookup (get-database "range-information" database-handle)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
717 lookup (if lookup (read lookup))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
718 lookup (if lookup (get-range-table char lookup)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
719 (when lookup
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
720 (insert-file-contents describe-char-unicodedata-file nil
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
721 (first lookup) (second lookup))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
722 (close-database database-handle))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
723
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
724 ;; Otherwise, insert the whole file (the FSF approach).
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
725 (set-buffer (get-buffer-create " *Unicode Data*"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
726 (when (zerop (buffer-size))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
727 ;; Don't use -literally in case of DOS line endings.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
728 (insert-file-contents describe-char-unicodedata-file)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
729
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
730 (goto-char (point-min))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
731 (let ((hex (format "%04X" char))
4474
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
732 found first last unihan-match unihan-info unihan-database-handle
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
733 (coding-system-for-read 'no-conversion-unix))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
734 (if (re-search-forward (concat "^" hex) nil t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
735 (setq found t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
736 ;; It's not listed explicitly. Look for ranges, e.g. CJK
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
737 ;; ideographs, and check whether it's in one of them.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
738 (while (and (re-search-forward "^\\([^;]+\\);[^;]+First>;" nil t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
739 (>= char (setq first
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
740 (string-to-number (match-string 1) 16)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
741 (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
742 (forward-line 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
743 (looking-at "^\\([^;]+\\);[^;]+Last>;")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
744 (> char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
745 (setq last
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
746 (string-to-number (match-string 1) 16))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
747 (if (and first (>= char first)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
748 last (<= char last))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
749 (setq found t)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
750 (if found
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
751 (let ((fields (mapcar (lambda (elt)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
752 (if (> (length elt) 0)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
753 elt))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
754 (cdr (split-string
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
755 (buffer-substring
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
756 (line-beginning-position)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
757 (line-end-position))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
758 ";")))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
759 ;; The length depends on whether the last field was empty.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
760 (unless (or (= 13 (length fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
761 (= 14 (length fields)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
762 (error 'invalid-argument
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
763 "Invalid contents in %s" describe-char-unicodedata-file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
764 ;; The field names and values lists are slightly
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
765 ;; modified from Mule-UCS unidata.el.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
766 (apply #'list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
767 (list "Name" (let ((name (nth 0 fields)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
768 ;; Check for <..., First>, <..., Last>
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
769 (if (string-match "\\`\\(<[^,]+\\)," name)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
770 (concat (match-string 1 name) ">")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
771 name)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
772 (list "Category"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
773 (cdr (assoc
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
774 (nth 1 fields)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
775 '(("Lu" . "uppercase letter")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
776 ("Ll" . "lowercase letter")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
777 ("Lt" . "titlecase letter")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
778 ("Mn" . "non-spacing mark")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
779 ("Mc" . "spacing-combining mark")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
780 ("Me" . "enclosing mark")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
781 ("Nd" . "decimal digit")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
782 ("Nl" . "letter number")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
783 ("No" . "other number")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
784 ("Zs" . "space separator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
785 ("Zl" . "line separator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
786 ("Zp" . "paragraph separator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
787 ("Cc" . "other control")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
788 ("Cf" . "other format")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
789 ("Cs" . "surrogate")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
790 ("Co" . "private use")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
791 ("Cn" . "not assigned")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
792 ("Lm" . "modifier letter")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
793 ("Lo" . "other letter")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
794 ("Pc" . "connector punctuation")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
795 ("Pd" . "dash punctuation")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
796 ("Ps" . "open punctuation")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
797 ("Pe" . "close punctuation")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
798 ("Pi" . "initial-quotation punctuation")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
799 ("Pf" . "final-quotation punctuation")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
800 ("Po" . "other punctuation")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
801 ("Sm" . "math symbol")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
802 ("Sc" . "currency symbol")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
803 ("Sk" . "modifier symbol")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
804 ("So" . "other symbol")))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
805 (list "Combining class"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
806 (cdr (assoc
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
807 (string-to-number (nth 2 fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
808 '((0 . "Spacing")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
809 (1 . "Overlays and interior")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
810 (7 . "Nuktas")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
811 (8 . "Hiragana/Katakana voicing marks")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
812 (9 . "Viramas")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
813 (10 . "Start of fixed position classes")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
814 (199 . "End of fixed position classes")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
815 (200 . "Below left attached")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
816 (202 . "Below attached")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
817 (204 . "Below right attached")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
818 (208 . "Left attached (reordrant around \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
819 single base character)")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
820 (210 . "Right attached")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
821 (212 . "Above left attached")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
822 (214 . "Above attached")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
823 (216 . "Above right attached")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
824 (218 . "Below left")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
825 (220 . "Below")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
826 (222 . "Below right")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
827 (224 . "Left (reordrant around single base \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
828 character)")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
829 (226 . "Right")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
830 (228 . "Above left")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
831 (230 . "Above")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
832 (232 . "Above right")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
833 (233 . "Double below")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
834 (234 . "Double above")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
835 (240 . "Below (iota subscript)")))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
836 (list "Bidi category"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
837 (cdr (assoc
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
838 (nth 3 fields)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
839 '(("L" . "Left-to-Right")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
840 ("LRE" . "Left-to-Right Embedding")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
841 ("LRO" . "Left-to-Right Override")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
842 ("R" . "Right-to-Left")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
843 ("AL" . "Right-to-Left Arabic")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
844 ("RLE" . "Right-to-Left Embedding")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
845 ("RLO" . "Right-to-Left Override")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
846 ("PDF" . "Pop Directional Format")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
847 ("EN" . "European Number")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
848 ("ES" . "European Number Separator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
849 ("ET" . "European Number Terminator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
850 ("AN" . "Arabic Number")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
851 ("CS" . "Common Number Separator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
852 ("NSM" . "Non-Spacing Mark")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
853 ("BN" . "Boundary Neutral")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
854 ("B" . "Paragraph Separator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
855 ("S" . "Segment Separator")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
856 ("WS" . "Whitespace")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
857 ("ON" . "Other Neutrals")))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
858 (list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
859 "Decomposition"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
860 (if (nth 4 fields)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
861 (let* ((parts (split-string (nth 4 fields)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
862 (info (car parts)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
863 (if (string-match "\\`<\\(.+\\)>\\'" info)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
864 (setq info (match-string 1 info))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
865 (setq info nil))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
866 (if info (setq parts (cdr parts)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
867 ;; Maybe printing ? for unrepresentable unicodes
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
868 ;; here and below should be changed?
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
869 (setq parts (mapconcat
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
870 (lambda (arg)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
871 (string (or (decode-char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
872 'ucs
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
873 (string-to-number arg 16))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
874 ??)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
875 parts " "))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
876 (concat info parts))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
877 (list "Decimal digit value"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
878 (nth 5 fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
879 (list "Digit value"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
880 (nth 6 fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
881 (list "Numeric value"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
882 (nth 7 fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
883 (list "Mirrored"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
884 (if (equal "Y" (nth 8 fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
885 "yes"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
886 (list "Old name" (nth 9 fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
887 (list "ISO 10646 comment" (nth 10 fields))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
888 (list "Uppercase" (and (nth 11 fields)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
889 (string (or (decode-char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
890 'ucs
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
891 (string-to-number
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
892 (nth 11 fields) 16))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
893 ??))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
894 (list "Lowercase" (and (nth 12 fields)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
895 (string (or (decode-char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
896 'ucs
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
897 (string-to-number
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
898 (nth 12 fields) 16))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
899 ??))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
900 (list "Titlecase" (and (nth 13 fields)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
901 (string (or (decode-char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
902 'ucs
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
903 (string-to-number
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
904 (nth 13 fields) 16))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
905 ??))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
906
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
907 ;; XEmacs addition.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
908 ;; If we're aware the character is a Han character, provide
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
909 ;; the Unihan information, or tell the user that it's not
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
910 ;; available.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
911 (if (and (> (length (nth 0 fields)) 13)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
912 (equal "<CJK Ideograph"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
913 (substring (nth 0 fields) 0 14)))
4474
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
914 (if (and describe-char-unihan-file
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
915 (setq unihan-database-handle
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
916 (open-database
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
917 (unidata-generate-database-file-name
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
918 describe-char-unihan-file
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
919 (eighth (file-attributes
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
920 describe-char-unihan-file))
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
921 unidata-database-format)
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
922 unidata-database-format
78738a40e31e Don't leak the Unihan database handle when looking up non-Han characters.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4473
diff changeset
923 nil "r" #o644 'no-conversion-unix))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
924 (setq unihan-match
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
925 (get-database (format "%04X" char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
926 unihan-database-handle)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
927 unihan-match
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
928 (and unihan-match (read unihan-match))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
929 (with-temp-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
930 (insert-file-contents describe-char-unihan-file
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
931 nil (first unihan-match)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
932 (second unihan-match))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
933 (goto-char (point-min))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
934 (while (re-search-forward
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
935 "^U\\+[0-9A-F]+\t\\(k[^\t]+\\)\t\\(.*\\)$"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
936 nil t)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
937 (push
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
938 (list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
939 (or (gethash
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
940 (match-string 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
941 describe-char-unihan-field-descriptions)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
942 (match-string 1))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
943 (decode-coding-string (match-string 2) 'utf-8))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
944 unihan-info))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
945 (close-database unihan-database-handle)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
946 unihan-info)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
947 ;; It's a Han character, but Unihan.txt is not
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
948 ;; available. Tell the user.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
949 (list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
950 '("Unihan"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
951 "No Unihan information available; is \
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
952 `describe-char-unihan-file' set, and its cache initialized?")))))))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
953
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
954 ;; Return information about how CHAR is displayed at the buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
955 ;; position POS. If the selected frame is on a graphic display,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
956 ;; return a cons (FONTNAME . GLYPH-CODE). Otherwise, return a string
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
957 ;; describing the terminal codes for the character.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
958 (defun describe-char-display (pos char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
959 (let* ((frame (selected-frame))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
960 (charset (char-charset char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
961 (ccl (or (and (charset-property charset 'encode-as-utf-8)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
962 ccl-encode-to-ucs-2)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
963 (charset-property charset 'ccl-program)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
964 (ccl-vector (make-vector 8 0)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
965 (if (display-graphic-p (selected-frame))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
966 (list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
967 (font-instance-name
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
968 (face-font-instance (or (get-char-property pos 'face)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
969 'default)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
970 (selected-window)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
971 charset))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
972 (cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
973 ((and ccl (eq 'x (frame-type frame)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
974 (setq char (split-char char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
975 (aset ccl-vector 0 (charset-id charset))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
976 (aset ccl-vector 1 (second char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
977 (if (= 2 (charset-dimension charset))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
978 (aset ccl-vector 2 (third char)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
979 (ccl-execute ccl ccl-vector)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
980 (if (= 2 (charset-dimension charset))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
981 (logior (lsh (aref ccl-vector 1) 8)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
982 (aref ccl-vector 2))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
983 (aref ccl-vector 1)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
984 ;; #### We don't handle the X case where redisplay falls back to an
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
985 ;; ISO 10646-1 font at runtime.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
986 ((eq 'x (frame-type frame))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
987 (if (= 2 (charset-dimension charset))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
988 (prog2
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
989 (setq char (split-char char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
990 (logior (lsh (second char) 8)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
991 (third char)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
992 (second (split-char char))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
993 ;; Otherwise we assume we're using Unicode.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
994 (t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
995 (encode-char char 'ucs))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
996 (let* ((coding (console-tty-output-coding-system (device-console)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
997 (encoded (encode-coding-string char coding)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
998 (if encoded
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
999 (format "%s, coding system %s"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1000 (encoded-string-description encoded coding)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1001 (coding-system-name coding)))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1002
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1003
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1004 ;;;###autoload
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1005 (defun describe-char (pos)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1006 "Describe the character after POS (interactively, the character after point).
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1007 The information includes character code, charset and code points in it,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1008 syntax, category, how the character is encoded in a file,
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1009 character composition information (if relevant),
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1010 as well as widgets, buttons, overlays, and text properties."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1011 (interactive "d")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1012 (if (>= pos (point-max))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1013 (error "No character follows specified position"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1014 (let* ((char (char-after pos))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1015 (charset (char-charset char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1016 (composition (find-composition pos nil nil t))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1017 (component-chars nil)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1018 (display-table
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1019 (specifier-instance current-display-table (selected-window)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1020 (disp-table-entry (and display-table
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1021 (get-display-table char display-table)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1022 (extents (mapcar #'(lambda (o) (extent-properties o))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1023 (extents-at pos)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1024 (char-description (single-key-description char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1025 (text-props-desc
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1026 (let ((tmp-buf (generate-new-buffer " *text-props*")))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1027 (unwind-protect
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1028 (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1029 (describe-text-properties pos tmp-buf)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1030 (with-current-buffer tmp-buf (buffer-string)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1031 (kill-buffer tmp-buf))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1032 item-list max-width unicode unicode-formatted unicode-error)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1033
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1034
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1035 (setq unicode-error
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1036 ;; XEmacs change, check does the character represent a Unicode
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1037 ;; error sequence.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1038 (get-char-table char unicode-error-default-translation-table)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1039 unicode (and (not unicode-error) (encode-char char 'ucs))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1040 unicode-formatted (if unicode-error
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1041 (format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1042 "Invalid Unicode sequence, ?\x%02x on disk"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1043 unicode-error)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1044 (if (and unicode (natnump unicode))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1045 (format (if (> unicode #xFFFF)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1046 "U+%06X" "U+%04X")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1047 unicode)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1048 ""))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1049 item-list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1050 `(("character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1051 ,(format "%s (%s, %d, #o%o, #x%x)"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1052 (apply 'propertize char-description
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1053 (text-properties-at pos))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1054 unicode-formatted
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1055 char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1056 char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1057 char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1058 ("charset"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1059 ,(lexical-let
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1060 ((charset-name (symbol-name charset)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1061 `(progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1062 (widget-create 'push-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1063 :notify ,(lambda (&rest ignored-arg)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1064 (with-displaying-help-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1065 (lambda nil
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1066 (charset-description
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1067 (intern charset-name)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1068 charset-name))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1069 ,charset-name)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1070 (widget-insert (format " (%s)" (charset-description
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1071 ',charset))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1072 ("code point"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1073 ,(let ((split (split-char char)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1074 `(widget-create 'push-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1075 ; :notify
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1076 ; ,(lambda (&rest ignored-arg)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1077 ; (with-selected-wind
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1078 ; insert-gui-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1079 ; (make-gui-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1080 ,(if (= (charset-dimension charset) 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1081 (format "#x%02X" (nth 1 split))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1082 (format "#x%02X #x%02X" (nth 1 split)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1083 (nth 2 split))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1084 ("syntax"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1085 ,(let ((syntax
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1086 (syntax-string-to-code (string (syntax-after pos)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1087 (with-temp-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1088 (describe-syntax-code syntax (current-buffer))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1089 ;; Remove the newline.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1090 (delete-backward-char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1091 (buffer-string))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1092 ;; XEmacs; #### add category support.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1093 ; ("category"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1094 ; ,@(let ((category-set (char-category-set char)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1095 ; (if (not category-set)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1096 ; '("-- none --")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1097 ; (mapcar #'(lambda (x) (format "%c:%s"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1098 ; x (category-docstring x)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1099 ; (category-set-mnemonics category-set)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1100 ; ,@(let ((props (get-char-table char char-code-property-table))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1101 ; ps)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1102 ; (when props
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1103 ; (while props
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1104 ; (push (format "%s:" (pop props)) ps)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1105 ; (push (format "%s;" (pop props)) ps))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1106 ; (list (cons "Properties" (nreverse ps)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1107 ("to input"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1108 ,@(let ((key-list (and-fboundp #'quail-find-key
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1109 current-input-method
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1110 (quail-find-key char))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1111 (if (consp key-list)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1112 (list "type"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1113 (mapconcat #'(lambda (x) (concat "\"" x "\""))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1114 key-list " or ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1115 "with"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1116 `(insert-text-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1117 ,current-input-method
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1118 'type 'help-input-method
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1119 'help-args '(,current-input-method))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1120 ; ("buffer code"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1121 ; ,(encoded-string-description
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1122 ; (string-as-unibyte (char-to-string char) nil))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1123 ("file code"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1124 ,@(let* ((coding buffer-file-coding-system)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1125 ;; ### XEmacs; use encode-coding-char once
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1126 ;; merged.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1127 (encoded (encode-coding-string char coding)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1128 (if encoded
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1129 (list (encoded-string-description encoded coding)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1130 (format "(encoded by coding system %S)"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1131 (coding-system-name coding)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1132 (list "not encodable by coding system"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1133 (coding-system-name coding)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1134 ("display"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1135 ,(cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1136 (disp-table-entry
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1137 ;; XEmacs change; just use the print syntax of the display
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1138 ;; table entry. Might be possible to improve this, but
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1139 ;; nothing occurs to me right now.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1140 (format "by display table entry [%S] " disp-table-entry))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1141 (composition
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1142 (let ((from (car composition))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1143 (to (nth 1 composition))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1144 (next (1+ pos))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1145 (components (nth 2 composition))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1146 ch)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1147 (setcar composition
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1148 (and (< from pos) (buffer-substring from pos)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1149 (setcar (cdr composition)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1150 (and (< next to) (buffer-substring next to)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1151 (dotimes (i (length components))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1152 (if (integerp (setq ch (aref components i)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1153 (push (cons ch (describe-char-display pos ch))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1154 component-chars)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1155 (setq component-chars (nreverse component-chars))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1156 (format "composed to form \"%s\" (see below)"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1157 (buffer-substring from to))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1158 (t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1159 (let ((display (describe-char-display pos char)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1160 (if (display-graphic-p (selected-frame))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1161 (if display
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1162 (concat
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1163 "by this font (glyph code)\n"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1164 (format " %s (#x%02X)"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1165 (first display) (second display)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1166 "no font available")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1167 (if display
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1168 (format "terminal code %s" display)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1169 "not encodable for terminal"))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1170 ,@(let ((face
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1171 (if (not (or disp-table-entry composition))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1172 (cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1173 ;; XEmacs #### Implement this.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1174 ; ((and show-trailing-whitespace
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1175 ; (save-excursion (goto-char pos)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1176 ; (looking-at "[ \t]+$")))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1177 ; 'trailing-whitespace)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1178 ; ((and nobreak-char-display unicode (eq unicode '#xa0))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1179 ; 'nobreak-space)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1180 ; ((and nobreak-char-display unicode (eq unicode '#xad))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1181 ; 'escape-glyph)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1182 ((and (< char 32) (not (memq char '(9 10))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1183 'escape-glyph)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1184 (if face (list (list "hardcoded face"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1185 `(insert-gui-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1186 (make-gui-button
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1187 ,(symbol-name face)))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1188 ,@(let ((unicodedata (and unicode
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1189 (describe-char-unicode-data unicode))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1190 (if unicodedata
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1191 (cons (list "Unicode data" " ") unicodedata)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1192 (setq max-width (apply #'max (mapcar #'(lambda (x)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1193 (if (cadr x) (length (car x)) 0))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1194 item-list)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1195 ; (help-setup-xref nil (interactive-p))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1196 (with-displaying-help-buffer
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1197 (lambda ()
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1198 (with-current-buffer standard-output
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1199 ; (set-buffer-multibyte multibyte-p)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1200 (let ((formatter (format "%%%ds:" max-width)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1201 (dolist (elt item-list)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1202 (when (cadr elt)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1203 (insert (format formatter (car elt)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1204 (dolist (clm (cdr elt))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1205 (if (consp clm)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1206 (progn (insert " ") (eval clm))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1207 (when (>= (+ (current-column)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1208 (or (string-match "\n" clm)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1209 (string-width clm))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1210 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1211 (window-width))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1212 (insert "\n")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1213 (indent-to (1+ max-width)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1214 (insert " " clm)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1215 (insert "\n"))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1216
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1217 (when extents
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1218 (save-excursion
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1219 (goto-char (point-min))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1220 (re-search-forward "character:[ \t\n]+")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1221 (let* ((end (+ (point) (length char-description))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1222 (mapc #'(lambda (props)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1223 (let ((o (make-extent (point) end)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1224 (while props
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1225 (set-extent-property o (car props) (nth 1 props))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1226 (setq props (cddr props)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1227 extents))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1228
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1229 ;; XEmacs change; don't give GUI- or TTY-specific detail about the
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1230 ;; display table entry, the #'specifier-instance call above dealt
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1231 ;; with that.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1232 ; (when disp-table-entry ...)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1233
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1234 ;; XEmacs; this doesn't work now.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1235 (when composition
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1236 (insert "\nComposed")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1237 (if (car composition)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1238 (if (cadr composition)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1239 (insert " with the surrounding characters \""
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1240 (car composition) "\" and \""
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1241 (cadr composition) "\"")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1242 (insert " with the preceding character(s) \""
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1243 (car composition) "\""))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1244 (if (cadr composition)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1245 (insert " with the following character(s) \""
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1246 (cadr composition) "\"")))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1247 (insert " by the rule:\n\t("
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1248 (mapconcat (lambda (x)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1249 (format (if (consp x) "%S" "?%c") x))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1250 (nth 2 composition)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1251 " ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1252 ")")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1253 (insert "\nThe component character(s) are displayed by ")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1254 ;; XEmacs #### Once composition is in place, this should be
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1255 ;; a (font-instance-name (face-font-instance [...])) call.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1256 (if (display-graphic-p (selected-frame))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1257 (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1258 (insert "these fonts (glyph codes):")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1259 (dolist (elt component-chars)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1260 (insert "\n " (car elt) ?:
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1261 (propertize " " 'display '(space :align-to 5))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1262 (if (cdr elt)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1263 (format "%s (#x%02X)" (cadr elt) (cddr elt))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1264 "-- no font --"))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1265 (insert "these terminal codes:")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1266 (dolist (elt component-chars)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1267 (insert "\n " (car elt) ":"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1268 (propertize " " 'display '(space :align-to 5))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1269 (or (cdr elt) "-- not encodable --"))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1270 (insert "\nSee the variable `reference-point-alist' for "
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1271 "the meaning of the rule.\n"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1272
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1273 (if text-props-desc (insert text-props-desc))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1274 ; (setq help-xref-stack-item (list 'help-insert-string (buffer-string)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1275 (toggle-read-only 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1276 (print-help-return-message)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1277 (format "Describe %c" (char-after pos)))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1278
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1279 (defalias 'describe-char-after 'describe-char)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1280 (make-obsolete 'describe-char-after 'describe-char "22.1")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1281
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1282 (provide 'descr-text)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1283
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1284 ;; arch-tag: fc55a498-f3e9-4312-b5bd-98cc02480af1
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1285 ;;; descr-text.el ends here