annotate lisp/descr-text.el @ 5585:86d6adeb1cf4

Refactor check for Xaw3d.
author Stephen J. Turnbull <stephen@xemacs.org>
date Fri, 14 Oct 2011 03:54:46 +0900
parents 248176c74e6b
children bbe4146603db
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
12 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
13 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
14 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
15 ;; option) any later version.
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
16
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
19 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
20 ;; for more details.
4468
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5268
diff changeset
23 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
24
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
25 ;;; Commentary:
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 ;;; 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
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 ;;; Code:
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 (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
32
4480
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
33 (require 'hyper-apropos)
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
34
4468
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
4605
c786c3fd0740 Listen to the byte-compiler, core Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
59 ;; XEmacs change; pp is in packages, use cl-prettyprint
c786c3fd0740 Listen to the byte-compiler, core Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
60 ;; instead.
c786c3fd0740 Listen to the byte-compiler, core Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
61 (with-output-to-string (cl-prettyprint sexp))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
62 (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
63 (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
64 (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
65 (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
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 ((> (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
68 nil)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
69 (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
70 (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
71 (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
72 :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
73 (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
74 "*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
75 (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
76 :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
77 "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
78 "[Show]"))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
79
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
80 (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
81 "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
82 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
83 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
84 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
85 `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
86 ;; Sort the properties by the size of their value.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
87 (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
88 (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
89 (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
90 ret)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
91 (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
92 (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
93 (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
94 (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
95 ;; 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
96 (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
97 '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
98 (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
99 (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
100 '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
101 :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
102 (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
103 :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
104 (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
105 ((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
106 (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
107 '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
108 :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
109 ((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
110 (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
111 (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
112 :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
113 (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
114 ((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
115 (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
116 (t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
117 (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
118 (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
119
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
120 ;;; 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
121
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
122 (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
123 "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
124 (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
125 ; (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
126 (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
127 (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
128 (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
129 (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
130 (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
131 (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
132
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
133 ;;;###autoload
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
134 (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
135 "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
136 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
137 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
138 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
139 otherwise."
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
140 (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
141 (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
142 (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
143 (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
144 (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
145 (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
146 ;; 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
147 (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
148 (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
149 (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
150 (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
151 (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
152 (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
153 (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
154 (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
155 (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
156 (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
157 (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
158 (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
159 (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
160 (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
161
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
162 (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
163 (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
164 ;; 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
165 (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
166 (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
167 (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
168 (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
169 ;; 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
170 ;; 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
171 (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
172 (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
173 (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
174 (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
175 (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
176 (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
177 (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
178 ;; Widgets
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
179 (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
180 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
181 (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
182 (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
183 (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
184 (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
185 (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
186 (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
187 ;; Buttons
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
188 (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
189 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
190 (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
191 "' 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
192 ;; Overlays
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
193 (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
194 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
195 (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
196 (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
197 (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
198 " 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
199 (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
200 (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
201 " 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
202 (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
203 (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
204 ;; 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
205 (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
206 (newline)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
207 (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
208 (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
209
4617
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
210 (defcustom describe-char-unicodedata-file
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
211 ;; XEmacs change; initialise this by default, using Perl.
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
212 (let ((have-perl
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
213 (member-if
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
214 #'(lambda (path)
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
215 (file-exists-p (format "%s%cperl" path directory-sep-char)))
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
216 exec-path))
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
217 installprivlib res)
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
218 (when have-perl
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
219 (setq installprivlib
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
220 (with-string-as-buffer-contents ""
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
221 (shell-command "perl -V:installprivlib" t)
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
222 ;; 1+ because buffer offsets start at one.
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
223 (delete-region 1 (1+ (length "installprivlib='")))
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
224 ;; Delete the final newline, semicolon and quotation mark.
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
225 (delete-region (- (point-max) 3) (point-max))))
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
226 (cond
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
227 ((file-exists-p
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
228 (setq res
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
229 (format "%s%cunicore%cUnicodeData.txt"
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
230 installprivlib directory-sep-char directory-sep-char))))
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
231 ((file-exists-p
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
232 (setq res
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
233 (format "%s%cunicode%cUnicodeData.txt"
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
234 installprivlib directory-sep-char directory-sep-char)))))
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
235 res))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
236 "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
237 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
238 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
239 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
240 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
241
4617
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
242 This is a fairly large file, typically installed with Perl.
2d9ba8d925b2 Backed out changeset 16c9098dd3d2.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4572
diff changeset
243 At the time of writing it is at the URL
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
244 `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
245
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 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
247 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
248 `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
249
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
250 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
251 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
252
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
253 :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
254 :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
255 file))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
256
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
257 ;; 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
258 (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
259 "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
260 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
261 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
262 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
263 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
264 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
265
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
266 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
267 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
268 `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
269
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
270 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
271 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
272 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
273 :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
274 :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
275 file))
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 ;; 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
278 (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
279 (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
280 (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
281 "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
282
5166
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
283 (defcustom describe-char-use-cache (not (null unidata-database-format))
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
284 "Whether `describe-char' should use a DBM or Berkeley DB cache.
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
285 This speeds up navigation of `describe-char-unicodedata-file', and makes
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
286 navigation of `describe-char-unihan-file' reasonable."
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
287 :group 'mule
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
288 :type '(choice (const :tag "None" nil)
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
289 file))
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
290
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
291 (defvar describe-char-unihan-field-descriptions
4820
e6dec75ded0e Use keywords, not ordinary symbols, in the structure syntax for hash tables.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4618
diff changeset
292 #s(hash-table :test equal :data
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
293 ("kAccountingNumeric"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
294 "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
295 "kBigFive"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
296 "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
297 "kCCCII"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
298 "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
299 "kCNS1986"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
300 "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
301 "kCNS1992"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
302 "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
303 "kCangjie"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
304 "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
305 "kCantonese"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
306 "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
307 "kCheungBauer"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
308 "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
309 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
310 "kCheungBauerIndex"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
311 "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
312 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
313 "kCihaiT"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
314 "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
315 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
316 "kCompatibilityVariant"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
317 "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
318 "kCowles"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
319 "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
320 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
321 "kDaeJaweon"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
322 "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
323 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
324 "kDefinition"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
325 "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
326 "kEACC"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
327 "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
328 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
329 "kFenn"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
330 "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
331 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
332 "kFennIndex"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
333 "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
334 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
335 "kFourCornerCode"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
336 "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
337 "kFrequency"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
338 "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
339 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
340 "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
341 "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
342 "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
343 "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
344 "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
345 ;; 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
346 "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
347 "kGSR"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
348 "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
349 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
350 "kGradeLevel"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
351 "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
352 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
353 "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
354 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
355 "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
356 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
357 "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
358 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
359 "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
360 `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
361 "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
362 "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
363 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
364 "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
365 "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
366 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
367 "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
368 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
369 "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
370 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
371 "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
372 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
373 "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
374 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
375 "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
376 "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
377 "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
378 "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
379 "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
380 information"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
381 "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
382 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_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
384 "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
385 "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
386 "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
387 "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
388 "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
389 "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
390 "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
391 "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
392 "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
393 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
394 "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
395 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
396 "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
397 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
398 "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
399 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
400 "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
401 "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
402 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
403 "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
404 "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
405 "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
406 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
407 "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
408 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
409 ;; 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
410 "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
411 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
412 "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
413 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
414 "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
415 "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
416 "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
417 "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
418 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
419 "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
420 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
421 "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
422 "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
423 "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
424 "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
425 "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
426 "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
427 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
428 "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
429 "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
430 "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
431 "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
432 "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
433 "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
434 "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
435 "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
436 "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
437 "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
438 "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
439
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
440 (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
441 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
442 "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
443 (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
444 (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
445 (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
446 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
447
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
448 (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
449 "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
450
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
451 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
452 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
453 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
454 `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
455 (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
456 (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
457 (error 'unimplemented "No (non-SQL) DB support available"))
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
458 (with-fboundp '(open-database put-database close-database)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
459 (let* ((database-format unidata-database-format)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
460 (size (eighth (file-attributes unidata-file-name)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
461 (database-file-name
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
462 (unidata-generate-database-file-name unidata-file-name
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
463 size database-format))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
464 (database-handle (open-database database-file-name database-format
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
465 nil "rw+" #o644
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
466 'no-conversion-unix))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
467 (coding-system-for-read 'no-conversion-unix)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
468 (buffer-size 32768)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
469 (offset-start 0)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
470 (offset-end buffer-size)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
471 (range-information (make-range-table 'start-closed-end-closed))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
472 (range-staging (make-hash-table :test 'equal))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
473 (message "Initializing UnicodeData database cache: ")
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
474 (loop-count 1)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
475 range-startinfo)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
476 (with-temp-buffer
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
477 (progress-feedback-with-label 'describe-char-unicodedata-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
478 "%s" 0 message)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
479 (while (progn
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
480 (delete-region (point-min) (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
481 (insert-file-contents unidata-file-name nil
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
482 offset-start offset-end)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
483 ;; If we've reached the end of the data, pass nil back to
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
484 ;; the while loop test.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
485 (not (= (point-min) (point-max))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
486
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
487 (when (= buffer-size (- (point-max) (point-min)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
488 ;; If we're in the body of the file, and there's a trailing
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
489 ;; incomplete end-line, delete it, and adjust offset-end
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
490 ;; appropriately.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
491 (goto-char (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
492 (search-backward "\n")
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
493 (forward-char)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
494 (delete-region (point) (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
495 (setq offset-end (+ offset-start (- (point) (point-min)))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
496
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
497 (progress-feedback-with-label 'describe-char-unicodedata-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
498 "%s" (truncate
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
499 (* (/ offset-start size) 100))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
500 (concat message
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
501 (make-string
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
502 (mod loop-count 39) ?.)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
503 (incf loop-count)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
504 (goto-char (point-min))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
505 (while (re-search-forward
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
506 #r"^\([0-9A-F]\{4,6\}\);\([^;]*\);.*$" nil t)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
507 (cond
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
508 ((and (> (- (match-end 2) (match-beginning 2)) 7)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
509 (equal (substring (match-string 2) -7)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
510 " First>"))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
511 ;; Start of a range. Save the start info in range-staging.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
512 (puthash (substring (match-string 2) 0 -7)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
513 (list (string-to-int (match-string 1) 16)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
514 (+ offset-start (1- (match-beginning 0))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
515 range-staging))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
516 ((and (> (- (match-end 2) (match-beginning 2)) 7)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
517 (equal (substring (match-string 2) -6)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
518 " Last>"))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
519 ;; End of a range. Combine with the start info, save it to the
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
520 ;; range-information range table.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
521 (setq range-startinfo
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
522 (gethash (substring (match-string 2) 0 -6) range-staging))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
523 (assert range-startinfo nil
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
524 "Unexpected order for range information.")
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
525 (put-range-table
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
526 (first range-startinfo)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
527 (string-to-int (match-string 1) 16)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
528 (list (second range-startinfo)
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
529 (+ offset-start (1- (match-end 0))))
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
530 range-information)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
531 (remhash (substring (match-string 2) 0 -6) range-staging))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
532 (t
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
533 ;; Normal character. Save the associated information in the
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
534 ;; database directly.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
535 (put-database (match-string 1)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
536 (format "(%d %d)"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
537 (+ offset-start (1- (match-beginning 0)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
538 (+ offset-start (1- (match-end 0))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
539 database-handle))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
540 (goto-char (point-min))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
541 (setq offset-start offset-end
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
542 offset-end (+ buffer-size offset-end))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
543 ;; Save the range information as such in the database.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
544 (put-database "range-information"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
545 (let ((print-readably t))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
546 (prin1-to-string range-information))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
547 database-handle)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
548 (close-database database-handle)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
549 (progress-feedback-with-label 'describe-char-unicodedata-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
550 "%s" 100 message)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
551 database-file-name)))
4468
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 (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
554 "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
555
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
556 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
557 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
558 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
559 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
560 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
561 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
562 (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
563 (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
564 (error 'unimplemented "No (non-SQL) DB support available"))
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
565 (with-fboundp '(open-database put-database close-database)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
566 (let* ((database-format unidata-database-format)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
567 (size (eighth (file-attributes unihan-file-name)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
568 (database-file-name
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
569 (unidata-generate-database-file-name unihan-file-name
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
570 size database-format))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
571 (database-handle (open-database database-file-name database-format
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
572 nil "rw+" #o644
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
573 'no-conversion-unix))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
574 (coding-system-for-read 'no-conversion-unix)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
575 (buffer-size 65536)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
576 (offset-start 0)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
577 (offset-end buffer-size)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
578 (message "Initializing Unihan database cache: ")
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
579 (loop-count 1)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
580 trailing-unicode leading-unicode character-start character-end)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
581 (with-temp-buffer
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
582 (progress-feedback-with-label 'describe-char-unihan-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
583 "%s" 0 message)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
584 (while (progn
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
585 (delete-region (point-min) (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
586 (insert-file-contents unihan-file-name nil
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
587 offset-start offset-end)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
588 ;; If we've reached the end of the data, return nil to the
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
589 ;; while.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
590 (not (= (point-min) (point-max))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
591
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
592 (incf loop-count)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
593 (progress-feedback-with-label 'describe-char-unihan-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
594 "%s" (truncate
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
595 (* (/ offset-start size) 100))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
596 (concat message
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
597 (make-string
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
598 (mod loop-count 44) ?.)))
5342
174aed57a32a Require that NAME be an unquoted symbol, #'block, #'return-from
Aidan Kehoe <kehoea@parhasard.net>
parents: 5268
diff changeset
599 (block dealing-with-chars
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
600 (when (= buffer-size (- (point-max) (point-min)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
601 ;; If we're in the body of the file, we need to delete the
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
602 ;; character info for the last character, and set offset-end
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
603 ;; appropriately. Otherwise, we may not be able to pick where
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
604 ;; the actual description of a character ends and begins.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
605 ;;
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
606 ;; This breaks if any single Unihan character description is
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
607 ;; greater than the buffer size in length.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
608 (goto-char (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
609 (beginning-of-line)
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
610
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
611 (when (< (- (point-max) (point)) (eval-when-compile
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
612 (length "U+ABCDEF\t")))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
613 ;; If the character ID of the last line may have been cut off,
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
614 ;; we need to delete all of that line here.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
615 (delete-region (point) (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
616 (forward-line -1))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
617
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
618 (when (looking-at "^\\(U\\+[0-9A-F]\\{4,6\\}\\)\t")
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
619 (setq trailing-unicode (match-string 1)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
620 trailing-unicode
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
621 (format "^%s\t" (regexp-quote trailing-unicode)))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
622
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
623 (end-of-line)
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
624
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
625 ;; Go back until we hit a line that doesn't start with this
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
626 ;; character info.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
627 (while (re-search-backward trailing-unicode nil t))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
628
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
629 ;; The re-search-backward failed, so point is still at the end
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
630 ;; of the last match. Move to its beginning.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
631 (beginning-of-line)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
632 (delete-region (point) (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
633 (setq offset-end (+ offset-start (- (point) (point-min))))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
634 (goto-char (point-min))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
635 (while t
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
636 (when (= (point) (point-max))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
637 ;; We're at the end of this part of the file.
5342
174aed57a32a Require that NAME be an unquoted symbol, #'block, #'return-from
Aidan Kehoe <kehoea@parhasard.net>
parents: 5268
diff changeset
638 (return-from dealing-with-chars))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
639
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
640 (unless (re-search-forward "^\\(U\\+[0-9A-F]\\{4,6\\}\\)\t"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
641 nil t)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
642 ;; We're probably in the comments at the start of the
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
643 ;; file. No need to look for character info.
5342
174aed57a32a Require that NAME be an unquoted symbol, #'block, #'return-from
Aidan Kehoe <kehoea@parhasard.net>
parents: 5268
diff changeset
644 (return-from dealing-with-chars))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
645
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
646 ;; Store where the character started.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
647 (beginning-of-line)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
648 (setq character-start (point))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
649
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
650 (setq leading-unicode
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
651 (format "^%s\t" (regexp-quote (match-string 1))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
652
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
653 ;; Loop until we get past this entry.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
654 (while (re-search-forward leading-unicode nil t))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
655
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
656 ;; Now, store the information.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
657 (setq leading-unicode
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
658 (string-to-number (substring leading-unicode 3) 16)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
659 leading-unicode (format "%04X" leading-unicode)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
660 character-end (prog2 (end-of-line) (point)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
661 (put-database leading-unicode
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
662 (format "(%d %d)"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
663 (+ offset-start (1- character-start))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
664 (+ offset-start (1- character-end)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
665 database-handle)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
666 (forward-line)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
667 (setq offset-start offset-end
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
668 offset-end (+ buffer-size offset-end))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
669 (close-database database-handle)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
670 (progress-feedback-with-label 'describe-char-unihan-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
671 "%s" 100
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
672 message)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
673 database-file-name)))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
674 ;; 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
675
5400
aa78b0b0b289 Add various Common Lisp character functions, making porting CL code easier.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5368
diff changeset
676 ;;;###autoload
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
677 (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
678 "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
679 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
680 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
681 (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
682 (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
683 (error 'file-error
4481
f9c70d94f427 Correct syntax of #'error calls, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 4480
diff changeset
684 (format "`unicodedata-file' %s not found"
f9c70d94f427 Correct syntax of #'error calls, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 4480
diff changeset
685 describe-char-unicodedata-file)))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
686 ;; 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
687 ;; appropriate.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
688 (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
689 (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
690 (with-temp-buffer
5186
b36d089cbed5 Don't error if describe-char-use-cache t and database not readable, descr-text
Aidan Kehoe <kehoea@parhasard.net>
parents: 5166
diff changeset
691 (let ((coding-system-for-read coding-system-for-read)
b36d089cbed5 Don't error if describe-char-use-cache t and database not readable, descr-text
Aidan Kehoe <kehoea@parhasard.net>
parents: 5166
diff changeset
692 database-handle key lookup)
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
693 (with-fboundp '(open-database get-database close-database)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
694 (if (and describe-char-use-cache
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
695 (prog1
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
696 (setq database-handle
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
697 (open-database
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
698 (unidata-generate-database-file-name
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
699 describe-char-unicodedata-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
700 (eighth (file-attributes
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
701 describe-char-unicodedata-file))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
702 unidata-database-format)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
703 unidata-database-format
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
704 nil "r"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
705 #o644 'no-conversion-unix))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
706 (unless database-handle
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
707 (warn "Could not open %s as a %s database"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
708 (unidata-generate-database-file-name
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
709 describe-char-unicodedata-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
710 (eighth (file-attributes
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
711 describe-char-unicodedata-file))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
712 unidata-database-format)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
713 unidata-database-format))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
714 (progn
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
715 ;; Use the database info.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
716 (setq coding-system-for-read 'no-conversion-unix
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
717 key (format "%04X" char)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
718 lookup (get-database key database-handle))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
719 (if lookup
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
720 ;; Okay, we have information on that character in
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
721 ;; particular.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
722 (progn (setq lookup (read lookup))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
723 (insert-file-contents describe-char-unicodedata-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
724 nil (first lookup)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
725 (second lookup)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
726 ;; No information on that character in particular. Do we
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
727 ;; have range information? If so, load and check for our
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
728 ;; desired character.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
729 (setq lookup (get-database "range-information"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
730 database-handle)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
731 lookup (if lookup (read lookup))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
732 lookup (if lookup (get-range-table char lookup)))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
733 (when lookup
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
734 (insert-file-contents describe-char-unicodedata-file nil
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
735 (first lookup) (second lookup))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
736 (close-database database-handle))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
737 ;; Otherwise, insert the whole file (the FSF approach).
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
738 (set-buffer (get-buffer-create " *Unicode Data*"))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
739 (when (zerop (buffer-size))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
740 ;; Don't use -literally in case of DOS line endings.
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
741 (insert-file-contents describe-char-unicodedata-file)))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
742 (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
743 (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
744 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
745 (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
746 (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
747 (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
748 ;; 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
749 ;; 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
750 (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
751 (>= 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
752 (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
753 (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
754 (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
755 (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
756 (> char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
757 (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
758 (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
759 (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
760 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
761 (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
762 (if found
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
763 (let ((fields (cdr (nsubst nil "" (split-string
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
764 (buffer-substring
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
765 (line-beginning-position)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
766 (line-end-position)) ";")
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
767 :test 'equal))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
768 ;; The length depends on whether the last field was empty.
5366
f00192e1cd49 Examining the result of #'length: `eql', not `=', it's better style & cheaper
Aidan Kehoe <kehoea@parhasard.net>
parents: 5342
diff changeset
769 (unless (or (eql 13 (length fields))
f00192e1cd49 Examining the result of #'length: `eql', not `=', it's better style & cheaper
Aidan Kehoe <kehoea@parhasard.net>
parents: 5342
diff changeset
770 (eql 14 (length fields)))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
771 (error 'invalid-argument
4481
f9c70d94f427 Correct syntax of #'error calls, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 4480
diff changeset
772 (format "Invalid contents in %s"
f9c70d94f427 Correct syntax of #'error calls, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 4480
diff changeset
773 describe-char-unicodedata-file)))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
774 ;; 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
775 ;; 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
776 (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
777 (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
778 ;; 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
779 (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
780 (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
781 name)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
782 (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
783 (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
784 (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
785 '(("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
786 ("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
787 ("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
788 ("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
789 ("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
790 ("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
791 ("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
792 ("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
793 ("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
794 ("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
795 ("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
796 ("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
797 ("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
798 ("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
799 ("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
800 ("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
801 ("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
802 ("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
803 ("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
804 ("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
805 ("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
806 ("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
807 ("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
808 ("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
809 ("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
810 ("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
811 ("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
812 ("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
813 ("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
814 ("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
815 (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
816 (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
817 (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
818 '((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
819 (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
820 (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
821 (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
822 (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
823 (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
824 (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
825 (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
826 (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
827 (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
828 (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
829 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
830 (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
831 (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
832 (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
833 (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
834 (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
835 (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
836 (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
837 (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
838 character)")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
839 (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
840 (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
841 (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
842 (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
843 (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
844 (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
845 (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
846 (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
847 (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
848 (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
849 '(("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
850 ("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
851 ("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
852 ("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
853 ("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
854 ("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
855 ("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
856 ("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
857 ("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
858 ("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
859 ("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
860 ("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
861 ("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
862 ("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
863 ("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
864 ("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
865 ("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
866 ("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
867 ("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
868 (list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
869 "Decomposition"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
870 (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
871 (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
872 (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
873 (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
874 (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
875 (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
876 (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
877 ;; 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
878 ;; 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
879 (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
880 (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
881 (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
882 'ucs
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
883 (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
884 ??)))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
885 parts " "))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
886 (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
887 (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
888 (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
889 (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
890 (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
891 (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
892 (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
893 (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
894 (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
895 "yes"))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
896 (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
897 (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
898 (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
899 (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
900 'ucs
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-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
902 (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
903 ??))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
904 (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
905 (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
906 'ucs
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
907 (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
908 (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
909 ??))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
910 (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
911 (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
912 'ucs
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
913 (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
914 (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
915 ??))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
916
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
917 ;; 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
918 ;; 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
919 ;; 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
920 ;; available.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
921 (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
922 (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
923 (substring (nth 0 fields) 0 14)))
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
924 (with-fboundp '(open-database get-database close-database)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
925 (if (and describe-char-unihan-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
926 (setq unihan-database-handle
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
927 (open-database
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
928 (unidata-generate-database-file-name
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
929 describe-char-unihan-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
930 (eighth (file-attributes
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
931 describe-char-unihan-file))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
932 unidata-database-format)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
933 unidata-database-format
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
934 nil "r" #o644 'no-conversion-unix))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
935 (setq unihan-match
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
936 (get-database (format "%04X" char)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
937 unihan-database-handle)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
938 unihan-match
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
939 (and unihan-match (read unihan-match))))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
940 (with-temp-buffer
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
941 (insert-file-contents describe-char-unihan-file
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
942 nil (first unihan-match)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
943 (second unihan-match))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
944 (goto-char (point-min))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
945 (while (re-search-forward
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
946 "^U\\+[0-9A-F]+\t\\(k[^\t]+\\)\t\\(.*\\)$"
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
947 nil t)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
948 (push
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
949 (list
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
950 (or (gethash
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
951 (match-string 1)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
952 describe-char-unihan-field-descriptions)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
953 (match-string 1))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
954 (decode-coding-string (match-string 2) 'utf-8))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
955 unihan-info))
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
956 (close-database unihan-database-handle)
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
957 unihan-info)
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
958 ;; 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
959 ;; 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
960 (list
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
961 '("Unihan"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
962 "No Unihan information available; is \
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
963 `describe-char-unihan-file' set, and its cache initialized?"))))))))))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
964
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
965 ;; 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
966 ;; 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
967 ;; 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
968 ;; 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
969 (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
970 (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
971 (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
972 (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
973 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
974 (charset-property charset 'ccl-program)))
5166
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
975 (ccl-vector (make-vector 8 0))
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
976 font-instance)
4468
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 (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
978 (list
5166
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
979 (if (setq font-instance
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
980 (face-font-instance (or (get-char-property pos 'face)
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
981 'default)
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
982 (selected-window)
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
983 charset))
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
984 (font-instance-name font-instance)
b50624d3ae55 open-database.message
Aidan Kehoe <kehoea@parhasard.net>
parents: 4820
diff changeset
985 "[no font available]")
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
986 (cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
987 ((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
988 (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
989 (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
990 (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
991 (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
992 (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
993 (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
994 (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
995 (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
996 (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
997 (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
998 ;; #### 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
999 ;; 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
1000 ((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
1001 (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
1002 (prog2
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1003 (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
1004 (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
1005 (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
1006 (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
1007 ;; 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
1008 (t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1009 (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
1010 (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
1011 (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
1012 (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
1013 (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
1014 (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
1015 (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
1016
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1017
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1018 ;;;###autoload
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1019 (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
1020 "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
1021 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
1022 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
1023 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
1024 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
1025 (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
1026 (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
1027 (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
1028 (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
1029 (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
1030 (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
1031 (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
1032 (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
1033 (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
1034 (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
1035 (get-display-table char display-table)))
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
1036 (extents (mapcar #'extent-properties (extents-at pos)))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1037 (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
1038 (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
1039 (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
1040 (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
1041 (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1042 (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
1043 (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
1044 (kill-buffer tmp-buf))))
4480
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1045 item-list max-width unicode unicode-formatted unicode-error
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1046 unicodedata (max-unicode-description-width (- (window-width) 50)))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1047
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 (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
1050 ;; 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
1051 ;; 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
1052 (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
1053 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
1054 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
1055 (format
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1056 "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
1057 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
1058 (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
1059 (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
1060 "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
1061 unicode)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1062 ""))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1063 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
1064 `(("character"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1065 ,(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
1066 (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
1067 (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
1068 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
1069 char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1070 char
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1071 char))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1072 ("charset"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1073 ,(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
1074 ((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
1075 `(progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1076 (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
1077 :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
1078 (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
1079 (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
1080 (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
1081 (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
1082 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
1083 ,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
1084 (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
1085 ',charset))))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1086 ("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
1087 ,(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
1088 `(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
1089 ; :notify
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1090 ; ,(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
1091 ; (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
1092 ; 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
1093 ; (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
1094 ,(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
1095 (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
1096 (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
1097 (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
1098 ("syntax"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1099 ,(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
1100 (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
1101 (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
1102 (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
1103 ;; 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
1104 (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
1105 (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
1106 ;; 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
1107 ; ("category"
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 ((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
1109 ; (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
1110 ; '("-- none --")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1111 ; (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
1112 ; 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
1113 ; (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
1114 ; ,@(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
1115 ; ps)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1116 ; (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
1117 ; (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
1118 ; (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
1119 ; (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
1120 ; (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
1121 ("to input"
5368
ed74d2ca7082 Use ', not #', when a given symbol may not have a function binding at read time
Aidan Kehoe <kehoea@parhasard.net>
parents: 5366
diff changeset
1122 ,@(let ((key-list (and-fboundp 'quail-find-key
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1123 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
1124 (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
1125 (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
1126 (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
1127 (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
1128 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
1129 "with"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1130 `(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
1131 ,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
1132 '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
1133 '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
1134 ; ("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
1135 ; ,(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
1136 ; (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
1137 ("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
1138 ,@(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
1139 ;; ### 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
1140 ;; merged.
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1141 (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
1142 (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
1143 (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
1144 (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
1145 (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
1146 (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
1147 (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
1148 ("display"
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1149 ,(cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1150 (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
1151 ;; 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
1152 ;; 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
1153 ;; 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
1154 (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
1155 (composition
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1156 (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
1157 (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
1158 (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
1159 (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
1160 ch)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1161 (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
1162 (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
1163 (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
1164 (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
1165 (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
1166 (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
1167 (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
1168 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
1169 (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
1170 (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
1171 (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
1172 (t
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1173 (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
1174 (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
1175 (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
1176 (concat
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1177 "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
1178 (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
1179 (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
1180 "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
1181 (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
1182 (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
1183 "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
1184 ,@(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
1185 (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
1186 (cond
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1187 ;; 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
1188 ; ((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
1189 ; (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
1190 ; (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
1191 ; '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
1192 ; ((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
1193 ; '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
1194 ; ((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
1195 ; '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
1196 ((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
1197 '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
1198 (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
1199 `(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
1200 (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
1201 ,(symbol-name face)))))))
4480
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1202 ,@(progn
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1203 (setq unicodedata (and unicode
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1204 (describe-char-unicode-data unicode)))
4468
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 unicodedata
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1206 (cons (list "Unicode data" " ") unicodedata)))))
5268
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
1207 (setq max-width
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
1208 (reduce #'max (remove-if-not #'cadr item-list) :initial-value 0
09f8ed0933c7 Avoid byte compiler warnings, some needless consing, descr-text.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5186
diff changeset
1209 :key #'(lambda (object) (length (car object)))))
4480
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1210 (when (and unicodedata (> max-width max-unicode-description-width))
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1211 (setq max-width max-unicode-description-width)
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1212 (with-temp-buffer
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1213 (let ((fill-column max-unicode-description-width)
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1214 (indent-tabs-mode nil))
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1215 (dolist (unidata-line unicodedata)
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1216 (when (cadr unidata-line)
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1217 (setf (car unidata-line)
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1218 (progn (insert (car unidata-line))
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1219 (goto-char (point-min))
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1220 (fill-paragraph 'right)
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1221 (delete-region (1- (point-max))
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1222 (point-max))
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1223 (buffer-string)))
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1224 (delete-region (point-min) (point-max)))))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1225 ; (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
1226 (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
1227 (lambda ()
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1228 (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
1229 ; (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
1230 (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
1231 (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
1232 (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
1233 (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
1234 (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
1235 (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
1236 (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
1237 (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
1238 (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
1239 (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
1240 1)
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1241 (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
1242 (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
1243 (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
1244 (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
1245 (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
1246
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1247 (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
1248 (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
1249 (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
1250 (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
1251 (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
1252 (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
1253 (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
1254 (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
1255 (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
1256 (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
1257 extents))))
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1258
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1259 ;; 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
1260 ;; 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
1261 ;; 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
1262 ; (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
1263
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1264 ;; 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
1265 (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
1266 (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
1267 (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
1268 (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
1269 (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
1270 (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
1271 (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
1272 (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
1273 (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
1274 (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
1275 (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
1276 (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
1277 (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
1278 (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
1279 (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
1280 (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
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 ")")
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1283 (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
1284 ;; 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
1285 ;; 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
1286 (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
1287 (progn
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1288 (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
1289 (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
1290 (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
1291 (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
1292 (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
1293 (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
1294 "-- 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
1295 (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
1296 (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
1297 (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
1298 (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
1299 (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
1300 (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
1301 "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
1302
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1303 (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
1304 ; (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
1305 (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
1306 (print-help-return-message)))
4480
74caf140505b Wrap field descriptions, descr-text.el; name created buffer more uniquely.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4474
diff changeset
1307 (format "Describe %c <%d>" (char-after pos) pos))))
4468
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1308
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1309 (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
1310 (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
1311
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1312 (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
1313
a78d697ccd2c Import and extend GNU's descr-text.el, supporting prefix argument for C-x =
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1314 ;; 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
1315 ;;; descr-text.el ends here