aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2000-08-29 05:38:10 +0000
committerKenichi Handa2000-08-29 05:38:10 +0000
commita399ef7b3ac87d1e8ea26f4067f438ab4adc5fdf (patch)
tree7eff04d452c393b3e157c7b3797b040eb971f9e8
parent464cc13084c958d2784cc0a105178ccf54f9462f (diff)
downloademacs-a399ef7b3ac87d1e8ea26f4067f438ab4adc5fdf.tar.gz
emacs-a399ef7b3ac87d1e8ea26f4067f438ab4adc5fdf.zip
(charset-multibyte-form-string): New function.
(list-character-sets-1): Use charset-multibyte-form-string. (describe-character-set): New function. (describe-coding-system): Hyperlinks to safe character sets.
-rw-r--r--lisp/international/mule-diag.el95
1 files changed, 69 insertions, 26 deletions
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index b723e5fc977..370dda98469 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -120,6 +120,24 @@ but still shows the full information."
120 (list-character-sets-1 sort-key) 120 (list-character-sets-1 sort-key)
121 (help-setup-xref (list #'list-character-sets nil) t))))) 121 (help-setup-xref (list #'list-character-sets nil) t)))))
122 122
123(defun charset-multibyte-form-string (charset)
124 (let ((info (charset-info charset)))
125 (cond ((eq charset 'ascii)
126 "xx")
127 ((eq charset 'eight-bit-control)
128 (format "%2X Xx" (aref info 6)))
129 ((eq charset 'eight-bit-graphic)
130 "XX")
131 (t
132 (let ((str (format "%2X" (aref info 6))))
133 (if (> (aref info 7) 0)
134 (setq str (format "%s %2X"
135 str (aref info 7))))
136 (setq str (concat str " XX"))
137 (if (> (aref info 2) 1)
138 (setq str (concat str " XX")))
139 str)))))
140
123;; Insert a list of character sets sorted by SORT-KEY. SORT-KEY 141;; Insert a list of character sets sorted by SORT-KEY. SORT-KEY
124;; should be one of `id', `name', and `iso-spec'. If SORT-KEY is nil, 142;; should be one of `id', `name', and `iso-spec'. If SORT-KEY is nil,
125;; it defaults to `id'. 143;; it defaults to `id'.
@@ -141,21 +159,7 @@ but still shows the full information."
141 (setq charset-info-list 159 (setq charset-info-list
142 (cons (list (charset-id charset) ; ID-NUM 160 (cons (list (charset-id charset) ; ID-NUM
143 charset ; CHARSET-NAME 161 charset ; CHARSET-NAME
144 (cond ((eq charset 'ascii) ; MULTIBYTE-FORM 162 (charset-multibyte-form-string charset); MULTIBYTE-FORM
145 "xx")
146 ((eq charset 'eight-bit-control)
147 (format "%2X Xx" (aref info 6)))
148 ((eq charset 'eight-bit-graphic)
149 "XX")
150 (t
151 (let ((str (format "%2X" (aref info 6))))
152 (if (> (aref info 7) 0)
153 (setq str (format "%s %2X"
154 str (aref info 7))))
155 (setq str (concat str " XX"))
156 (if (> (aref info 2) 1)
157 (setq str (concat str " XX")))
158 str)))
159 (aref info 2) ; DIMENSION 163 (aref info 2) ; DIMENSION
160 (aref info 3) ; CHARS 164 (aref info 3) ; CHARS
161 (aref info 8) ; FINAL-CHAR 165 (aref info 8) ; FINAL-CHAR
@@ -470,6 +474,42 @@ detailed meanings of these arguments."
470 474
471 475
472;;;###autoload 476;;;###autoload
477(defun describe-character-set (charset)
478 "Display information about character set CHARSET."
479 (interactive (list (let ((non-iso-charset-alist nil))
480 (read-charset "Charset: "))))
481 (or (charsetp charset)
482 (error "Invalid charset: %S" charset))
483 (let ((info (charset-info charset)))
484 (with-output-to-temp-buffer "*Help*"
485 (save-excursion
486 (set-buffer standard-output)
487 (insert "Character set: " (symbol-name charset)
488 (format " (ID:%d)\n\n" (aref info 0)))
489 (insert (aref info 13) "\n\n") ; description
490 (insert "number of contained characters: "
491 (if (= (aref info 2) 1)
492 (format "%d\n" (aref info 3))
493 (format "%dx%d\n" (aref info 3) (aref info 3))))
494 (insert "the final char of ISO2022's desgination sequence: ")
495 (if (aref info 8)
496 (insert (format "`%c'\n" (aref info 8)))
497 (insert "not assigned\n"))
498 (insert (format "width (how many columns on screen): %d\n"
499 (aref info 4)))
500 (insert (format "internal multibyte sequence: %s\n"
501 (charset-multibyte-form-string charset)))
502 (let ((coding (plist-get (aref info 14) 'preferred-coding-system)))
503 (when coding
504 (insert (format "prefered coding system: %s\n" coding))
505 (search-backward (symbol-name coding))
506 (help-xref-button 0 #'describe-coding-system coding
507 "mouse-2, RET: describe this coding system")))
508 (help-setup-xref (list #'describe-character-set charset)
509 (interactive-p))
510 ))))
511
512;;;###autoload
473(defun describe-char-after (&optional pos) 513(defun describe-char-after (&optional pos)
474 "Display information of in current buffer at position POS. 514 "Display information of in current buffer at position POS.
475The information includes character code, charset and code points in it, 515The information includes character code, charset and code points in it,
@@ -683,19 +723,22 @@ which font is being used for displaying the character."
683 (princ "\n ") 723 (princ "\n ")
684 (princ prewrite) 724 (princ prewrite)
685 (princ "\n"))) 725 (princ "\n")))
686 (let ((charsets (coding-system-get coding-system 'safe-charsets)))
687 (when charsets
688 (if (eq charsets t)
689 (princ "This coding system can encode all charsets.\n")
690 (princ "This coding system encode the following charsets:\n")
691 (princ " ")
692 (while charsets
693 (princ " ")
694 (princ (car charsets))
695 (setq charsets (cdr charsets))))))
696 (save-excursion 726 (save-excursion
697 (set-buffer standard-output) 727 (set-buffer standard-output)
698 (help-mode))))) 728 (let ((charsets (coding-system-get coding-system 'safe-charsets)))
729 (when charsets
730 (if (eq charsets t)
731 (insert "This coding system can encode all charsets.\n")
732 (insert "This coding system encode the following charsets:\n ")
733 (while charsets
734 (insert " " (symbol-name (car charsets)))
735 (search-backward (symbol-name (car charsets)))
736 (help-xref-button 0 #'describe-character-set (car charsets))
737 (goto-char (point-max))
738 (setq charsets (cdr charsets))))))
739 (help-setup-xref (list #'describe-coding-system coding-system)
740 (interactive-p))))))
741
699 742
700;;;###autoload 743;;;###autoload
701(defun describe-current-coding-system-briefly () 744(defun describe-current-coding-system-briefly ()