aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2005-01-30 11:24:10 +0000
committerKenichi Handa2005-01-30 11:24:10 +0000
commitf1f194de15999d983e7d34df8bc0677512da4fd5 (patch)
tree4b048bf161cc4c994658314bef86d229e4a41cc9
parentf600cf3af9d9c3606e46e6a5bd045e92fd987c3d (diff)
downloademacs-f1f194de15999d983e7d34df8bc0677512da4fd5.tar.gz
emacs-f1f194de15999d983e7d34df8bc0677512da4fd5.zip
(describe-char-unidata-list): New variable.
(describe-char-unicode-data): Use char-code-property-description. (describe-char): Add lines for describing Unicode-based character properties.
-rw-r--r--lisp/descr-text.el172
1 files changed, 60 insertions, 112 deletions
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index d7079bcf44c..c7c5dc43bf3 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -214,6 +214,27 @@ otherwise."
214 (widget-insert "There are text properties here:\n") 214 (widget-insert "There are text properties here:\n")
215 (describe-property-list properties))))) 215 (describe-property-list properties)))))
216 216
217(defcustom describe-char-unidata-list nil
218 "List of Unicode-based character property names shown by `describe-char'."
219 :group 'mule
220 :version "22.1"
221 :type '(set
222 (const :tag "Unicode Name" name)
223 (const :tag "Unicode general category " general-category)
224 (const :tag "Unicode canonical combining class"
225 canonical-combining-class)
226 (const :tag "Unicode bidi class" bidi-class)
227 (const :tag "Unicode decomposition mapping" decomposition)
228 (const :tag "Unicode decimal digit value" decimal-digit-value)
229 (const :tag "Unicode digit value" digit-value)
230 (const :tag "Unicode numeric value" numeric-value)
231 (const :tag "Unicode mirrored" mirrored)
232 (const :tag "Unicode old name" old-name)
233 (const :tag "Unicode ISO 10646 comment" iso-10646-comment)
234 (const :tag "Unicode simple uppercase mapping" uppercase)
235 (const :tag "Unicode simple lowercase mapping" lowercase)
236 (const :tag "Unicode simple titlecase mapping" titlecase)))
237
217(defcustom describe-char-unicodedata-file nil 238(defcustom describe-char-unicodedata-file nil
218 "Location of Unicode data file. 239 "Location of Unicode data file.
219This is the UnicodeData.txt file from the Unicode consortium, used for 240This is the UnicodeData.txt file from the Unicode consortium, used for
@@ -239,7 +260,8 @@ the time of writing it is at
239(defun describe-char-unicode-data (char) 260(defun describe-char-unicode-data (char)
240 "Return a list of Unicode data for unicode CHAR. 261 "Return a list of Unicode data for unicode CHAR.
241Each element is a list of a property description and the property value. 262Each element is a list of a property description and the property value.
242The list is null if CHAR isn't found in `describe-char-unicodedata-file'." 263The list is null if CHAR isn't found in `describe-char-unicodedata-file'.
264This function is semi-obsolete. Use `get-char-code-property'."
243 (when describe-char-unicodedata-file 265 (when describe-char-unicodedata-file
244 (unless (file-exists-p describe-char-unicodedata-file) 266 (unless (file-exists-p describe-char-unicodedata-file)
245 (error "`unicodedata-file' %s not found" describe-char-unicodedata-file)) 267 (error "`unicodedata-file' %s not found" describe-char-unicodedata-file))
@@ -289,91 +311,20 @@ The list is null if CHAR isn't found in `describe-char-unicodedata-file'."
289 (concat (match-string 1 name) ">") 311 (concat (match-string 1 name) ">")
290 name))) 312 name)))
291 (list "Category" 313 (list "Category"
292 (cdr (assoc 314 (let ((val (nth 1 fields)))
293 (nth 1 fields) 315 (or (char-code-property-description
294 '(("Lu" . "uppercase letter") 316 'general-category (intern val))
295 ("Ll" . "lowercase letter") 317 val)))
296 ("Lt" . "titlecase letter")
297 ("Mn" . "non-spacing mark")
298 ("Mc" . "spacing-combining mark")
299 ("Me" . "enclosing mark")
300 ("Nd" . "decimal digit")
301 ("Nl" . "letter number")
302 ("No" . "other number")
303 ("Zs" . "space separator")
304 ("Zl" . "line separator")
305 ("Zp" . "paragraph separator")
306 ("Cc" . "other control")
307 ("Cf" . "other format")
308 ("Cs" . "surrogate")
309 ("Co" . "private use")
310 ("Cn" . "not assigned")
311 ("Lm" . "modifier letter")
312 ("Lo" . "other letter")
313 ("Pc" . "connector punctuation")
314 ("Pd" . "dash punctuation")
315 ("Ps" . "open punctuation")
316 ("Pe" . "close punctuation")
317 ("Pi" . "initial-quotation punctuation")
318 ("Pf" . "final-quotation punctuation")
319 ("Po" . "other punctuation")
320 ("Sm" . "math symbol")
321 ("Sc" . "currency symbol")
322 ("Sk" . "modifier symbol")
323 ("So" . "other symbol")))))
324 (list "Combining class" 318 (list "Combining class"
325 (cdr (assoc 319 (let ((val (nth 1 fields)))
326 (string-to-number (nth 2 fields)) 320 (or (char-code-property-description
327 '((0 . "Spacing") 321 'canonical-combining-class (intern val))
328 (1 . "Overlays and interior") 322 val)))
329 (7 . "Nuktas")
330 (8 . "Hiragana/Katakana voicing marks")
331 (9 . "Viramas")
332 (10 . "Start of fixed position classes")
333 (199 . "End of fixed position classes")
334 (200 . "Below left attached")
335 (202 . "Below attached")
336 (204 . "Below right attached")
337 (208 . "Left attached (reordrant around \
338single base character)")
339 (210 . "Right attached")
340 (212 . "Above left attached")
341 (214 . "Above attached")
342 (216 . "Above right attached")
343 (218 . "Below left")
344 (220 . "Below")
345 (222 . "Below right")
346 (224 . "Left (reordrant around single base \
347character)")
348 (226 . "Right")
349 (228 . "Above left")
350 (230 . "Above")
351 (232 . "Above right")
352 (233 . "Double below")
353 (234 . "Double above")
354 (240 . "Below (iota subscript)")))))
355 (list "Bidi category" 323 (list "Bidi category"
356 (cdr (assoc 324 (let ((val (nth 1 fields)))
357 (nth 3 fields) 325 (or (char-code-property-description
358 '(("L" . "Left-to-Right") 326 'bidi-class (intern val))
359 ("LRE" . "Left-to-Right Embedding") 327 val)))
360 ("LRO" . "Left-to-Right Override")
361 ("R" . "Right-to-Left")
362 ("AL" . "Right-to-Left Arabic")
363 ("RLE" . "Right-to-Left Embedding")
364 ("RLO" . "Right-to-Left Override")
365 ("PDF" . "Pop Directional Format")
366 ("EN" . "European Number")
367 ("ES" . "European Number Separator")
368 ("ET" . "European Number Terminator")
369 ("AN" . "Arabic Number")
370 ("CS" . "Common Number Separator")
371 ("NSM" . "Non-Spacing Mark")
372 ("BN" . "Boundary Neutral")
373 ("B" . "Paragraph Separator")
374 ("S" . "Segment Separator")
375 ("WS" . "Whitespace")
376 ("ON" . "Other Neutrals")))))
377 (list 328 (list
378 "Decomposition" 329 "Decomposition"
379 (if (nth 4 fields) 330 (if (nth 4 fields)
@@ -383,14 +334,9 @@ character)")
383 (setq info (match-string 1 info)) 334 (setq info (match-string 1 info))
384 (setq info nil)) 335 (setq info nil))
385 (if info (setq parts (cdr parts))) 336 (if info (setq parts (cdr parts)))
386 ;; Maybe printing ? for unrepresentable unicodes
387 ;; here and below should be changed?
388 (setq parts (mapconcat 337 (setq parts (mapconcat
389 (lambda (arg) 338 (lambda (arg)
390 (string (or (decode-char 339 (string (string-to-number arg 16)))
391 'ucs
392 (string-to-number arg 16))
393 ??)))
394 parts " ")) 340 parts " "))
395 (concat info parts)))) 341 (concat info parts))))
396 (list "Decimal digit value" 342 (list "Decimal digit value"
@@ -405,23 +351,14 @@ character)")
405 (list "Old name" (nth 9 fields)) 351 (list "Old name" (nth 9 fields))
406 (list "ISO 10646 comment" (nth 10 fields)) 352 (list "ISO 10646 comment" (nth 10 fields))
407 (list "Uppercase" (and (nth 11 fields) 353 (list "Uppercase" (and (nth 11 fields)
408 (string (or (decode-char 354 (string (string-to-number
409 'ucs 355 (nth 11 fields) 16))))
410 (string-to-number
411 (nth 11 fields) 16))
412 ??))))
413 (list "Lowercase" (and (nth 12 fields) 356 (list "Lowercase" (and (nth 12 fields)
414 (string (or (decode-char 357 (string (string-to-number
415 'ucs 358 (nth 12 fields) 16))))
416 (string-to-number
417 (nth 12 fields) 16))
418 ??))))
419 (list "Titlecase" (and (nth 13 fields) 359 (list "Titlecase" (and (nth 13 fields)
420 (string (or (decode-char 360 (string (string-to-number
421 'ucs 361 (nth 13 fields) 16)))))))))))
422 (string-to-number
423 (nth 13 fields) 16))
424 ??)))))))))))
425 362
426;; Return information about how CHAR is displayed at the buffer 363;; Return information about how CHAR is displayed at the buffer
427;; position POS. If the selected frame is on a graphic display, 364;; position POS. If the selected frame is on a graphic display,
@@ -490,13 +427,6 @@ as well as widgets, buttons, overlays, and text properties."
490 (mapcar #'(lambda (x) (format "%c:%s " 427 (mapcar #'(lambda (x) (format "%c:%s "
491 x (category-docstring x))) 428 x (category-docstring x)))
492 (category-set-mnemonics category-set))))) 429 (category-set-mnemonics category-set)))))
493 ,@(let ((props (aref char-code-property-table char))
494 ps)
495 (when props
496 (while props
497 (push (format "%s:" (pop props)) ps)
498 (push (format "%s;" (pop props)) ps))
499 (list (cons "Properties" (nreverse ps)))))
500 ("to input" 430 ("to input"
501 ,@(let ((key-list (and (eq input-method-function 431 ,@(let ((key-list (and (eq input-method-function
502 'quail-input-method) 432 'quail-input-method)
@@ -654,6 +584,24 @@ as well as widgets, buttons, overlays, and text properties."
654 (insert "\nSee the variable `reference-point-alist' for " 584 (insert "\nSee the variable `reference-point-alist' for "
655 "the meaning of the rule.\n")) 585 "the meaning of the rule.\n"))
656 586
587 (if (not describe-char-unidata-list)
588 (insert "\nCharacter code properties are not shown: ")
589 (insert "\nCharacter code properties: "))
590 (widget-create 'link
591 :notify (lambda (&rest ignore)
592 (customize-variable
593 'describe-char-unidata-list))
594 "customize what to show")
595 (insert "\n")
596 (dolist (elt describe-char-unidata-list)
597 (let ((val (get-char-code-property char elt))
598 description)
599 (when val
600 (setq description (char-code-property-description elt val))
601 (if description
602 (insert (format " %s: %s (%s)\n" elt val description))
603 (insert (format " %s: %s\n" elt val))))))
604
657 (describe-text-properties pos (current-buffer)) 605 (describe-text-properties pos (current-buffer))
658 (describe-text-mode))))) 606 (describe-text-mode)))))
659 607