diff options
| author | Kenichi Handa | 1997-06-18 12:55:12 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-06-18 12:55:12 +0000 |
| commit | 426f97dc59bfd897b0f0d3ffbcb66c31225c8468 (patch) | |
| tree | e31e9a226f4c6a64753f9028d92cf2028eae8fa6 | |
| parent | be1d31dcea2631d5204286849f67e449c5758302 (diff) | |
| download | emacs-426f97dc59bfd897b0f0d3ffbcb66c31225c8468.tar.gz emacs-426f97dc59bfd897b0f0d3ffbcb66c31225c8468.zip | |
(list-character-sets): Set major mode of *Help*
buffer to help-mode.
(describe-coding-system): If user input null for coding system,
call describe-current-coding-system.
(describe-current-coding-system-briefly): Doc-string modified.
(print-coding-system-briefly): Print parent and alises of coding
system.
(describe-current-coding-system): Show more information neatly.
(list-coding-systems): If called interactively, do not list up
coding categories.
(list-input-methods): New function.
(mule-diag): Call list-input-methods for listing input methods.
| -rw-r--r-- | lisp/international/mule-diag.el | 296 |
1 files changed, 177 insertions, 119 deletions
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 523ff7e260b..fcb522dd1ba 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el | |||
| @@ -40,7 +40,10 @@ | |||
| 40 | "Display a list of all charsets." | 40 | "Display a list of all charsets." |
| 41 | (interactive) | 41 | (interactive) |
| 42 | (with-output-to-temp-buffer "*Help*" | 42 | (with-output-to-temp-buffer "*Help*" |
| 43 | (print-character-sets))) | 43 | (print-character-sets) |
| 44 | (save-excursion | ||
| 45 | (set-buffer standard-output) | ||
| 46 | (help-mode)))) | ||
| 44 | 47 | ||
| 45 | (defvar charset-other-info-func nil) | 48 | (defvar charset-other-info-func nil) |
| 46 | 49 | ||
| @@ -127,54 +130,57 @@ | |||
| 127 | ;;;###autoload | 130 | ;;;###autoload |
| 128 | (defun describe-coding-system (coding-system) | 131 | (defun describe-coding-system (coding-system) |
| 129 | "Display information of CODING-SYSTEM." | 132 | "Display information of CODING-SYSTEM." |
| 130 | (interactive "zCoding-system: ") | 133 | (interactive "zDescribe coding system (default, current choices): ") |
| 131 | (with-output-to-temp-buffer "*Help*" | 134 | (if (null coding-system) |
| 132 | (print-coding-system-briefly coding-system nil 'doc-string) | 135 | (describe-current-coding-system) |
| 133 | (let ((coding-spec (coding-system-spec coding-system))) | 136 | (with-output-to-temp-buffer "*Help*" |
| 134 | (princ "Type: ") | 137 | (print-coding-system-briefly coding-system 'doc-string) |
| 135 | (let ((type (coding-system-type coding-system)) | 138 | (let ((coding-spec (coding-system-spec coding-system))) |
| 136 | (flags (coding-system-flags coding-system))) | 139 | (princ "Type: ") |
| 137 | (princ type) | 140 | (let ((type (coding-system-type coding-system)) |
| 138 | (princ " (") | 141 | (flags (coding-system-flags coding-system))) |
| 139 | (cond ((eq type nil) | 142 | (princ type) |
| 140 | (princ "do no conversion)")) | 143 | (cond ((eq type nil) |
| 141 | ((eq type t) | 144 | (princ " (do no conversion)")) |
| 142 | (princ "do automatic conversion)")) | 145 | ((eq type t) |
| 143 | ((eq type 0) | 146 | (princ " (do automatic conversion)")) |
| 144 | (princ "Emacs internal multibyte form)")) | 147 | ((eq type 0) |
| 145 | ((eq type 1) | 148 | (princ " (Emacs internal multibyte form)")) |
| 146 | (princ "Shift-JIS, MS-KANJI)")) | 149 | ((eq type 1) |
| 147 | ((eq type 2) | 150 | (princ " (Shift-JIS, MS-KANJI)")) |
| 148 | (princ "variant of ISO-2022)\n") | 151 | ((eq type 2) |
| 149 | (princ "Initial designations:\n") | 152 | (princ " (variant of ISO-2022)\n") |
| 150 | (print-designation flags) | 153 | (princ "Initial designations:\n") |
| 151 | (princ "Other Form: \n ") | 154 | (print-designation flags) |
| 152 | (princ (if (aref flags 4) "short-form" "long-form")) | 155 | (princ "Other Form: \n ") |
| 153 | (if (aref flags 5) (princ ", ASCII@EOL")) | 156 | (princ (if (aref flags 4) "short-form" "long-form")) |
| 154 | (if (aref flags 6) (princ ", ASCII@CNTL")) | 157 | (if (aref flags 5) (princ ", ASCII@EOL")) |
| 155 | (princ (if (aref flags 7) ", 7-bit" ", 8-bit")) | 158 | (if (aref flags 6) (princ ", ASCII@CNTL")) |
| 156 | (if (aref flags 8) (princ ", use-locking-shift")) | 159 | (princ (if (aref flags 7) ", 7-bit" ", 8-bit")) |
| 157 | (if (aref flags 9) (princ ", use-single-shift")) | 160 | (if (aref flags 8) (princ ", use-locking-shift")) |
| 158 | (if (aref flags 10) (princ ", use-roman")) | 161 | (if (aref flags 9) (princ ", use-single-shift")) |
| 159 | (if (aref flags 10) (princ ", use-old-jis")) | 162 | (if (aref flags 10) (princ ", use-roman")) |
| 160 | (if (aref flags 11) (princ ", no-ISO6429")) | 163 | (if (aref flags 10) (princ ", use-old-jis")) |
| 161 | (princ ".")) | 164 | (if (aref flags 11) (princ ", no-ISO6429")) |
| 162 | ((eq type 3) | 165 | (princ ".")) |
| 163 | (princ "Big5.")) | 166 | ((eq type 3) |
| 164 | ((eq type 4) | 167 | (princ " (Big5)")) |
| 165 | (princ "do conversion by CCL program.")) | 168 | ((eq type 4) |
| 166 | (t (princ "invalid coding-system.")))) | 169 | (princ " (do conversion by CCL program)")) |
| 167 | (princ "\nEOL type:\n ") | 170 | (t (princ "invalid coding-system.")))) |
| 168 | (let ((eol-type (coding-system-eol-type coding-system))) | 171 | (princ "\nEOL type:\n ") |
| 169 | (cond ((vectorp eol-type) | 172 | (let ((eol-type (coding-system-eol-type coding-system))) |
| 170 | (princ "Automatic selection from:\n\t") | 173 | (cond ((vectorp eol-type) |
| 171 | (princ eol-type) | 174 | (princ "Automatic selection from:\n\t") |
| 172 | (princ "\n")) | 175 | (princ eol-type) |
| 173 | ((or (null eol-type) (eq eol-type 0)) (princ "LF\n")) | 176 | (princ "\n")) |
| 174 | ((eq eol-type 1) (princ "CRLF\n")) | 177 | ((or (null eol-type) (eq eol-type 0)) (princ "LF\n")) |
| 175 | ((eq eol-type 2) (princ "CR\n")) | 178 | ((eq eol-type 1) (princ "CRLF\n")) |
| 176 | (t (princ "invalid\n")))) | 179 | ((eq eol-type 2) (princ "CR\n")) |
| 177 | ))) | 180 | (t (princ "invalid\n"))))) |
| 181 | (save-excursion | ||
| 182 | (set-buffer standard-output) | ||
| 183 | (help-mode))))) | ||
| 178 | 184 | ||
| 179 | ;;;###autoload | 185 | ;;;###autoload |
| 180 | (defun describe-current-coding-system-briefly () | 186 | (defun describe-current-coding-system-briefly () |
| @@ -187,7 +193,7 @@ at the place of `..': | |||
| 187 | eol-type of buffer-file-coding-system (of the current buffer) | 193 | eol-type of buffer-file-coding-system (of the current buffer) |
| 188 | (keyboard-coding-system) | 194 | (keyboard-coding-system) |
| 189 | eol-type of (keyboard-coding-system) | 195 | eol-type of (keyboard-coding-system) |
| 190 | terminal-coding-system | 196 | (terminal-coding-system) |
| 191 | eol-type of (terminal-coding-system) | 197 | eol-type of (terminal-coding-system) |
| 192 | process-coding-system for read (of the current buffer, if any) | 198 | process-coding-system for read (of the current buffer, if any) |
| 193 | eol-type of process-coding-system for read (of the current buffer, if any) | 199 | eol-type of process-coding-system for read (of the current buffer, if any) |
| @@ -223,24 +229,18 @@ at the place of `..': | |||
| 223 | ))) | 229 | ))) |
| 224 | 230 | ||
| 225 | ;; Print symbol name and mnemonic letter of CODING-SYSTEM by `princ'. | 231 | ;; Print symbol name and mnemonic letter of CODING-SYSTEM by `princ'. |
| 226 | (defun print-coding-system-briefly (coding-system &optional aliases doc-string) | 232 | (defun print-coding-system-briefly (coding-system &optional doc-string) |
| 227 | (if (not coding-system) | 233 | (if (not coding-system) |
| 228 | (princ "nil\n") | 234 | (princ "nil\n") |
| 229 | (princ (format "%c -- %s" | 235 | (princ (format "%c -- %s" |
| 230 | (coding-system-mnemonic coding-system) | 236 | (coding-system-mnemonic coding-system) |
| 231 | coding-system)) | 237 | coding-system)) |
| 232 | (if aliases | 238 | (let ((parent (coding-system-parent coding-system))) |
| 233 | (progn | 239 | (if parent |
| 234 | (princ (format " (alias: %s" (car aliases))) | 240 | (princ (format " (alias of %s)" parent)))) |
| 235 | (setq aliases (cdr aliases)) | 241 | (let ((aliases (get coding-system 'alias-coding-systems))) |
| 236 | (while aliases | 242 | (if aliases |
| 237 | (princ " ") | 243 | (princ (format " %S" (cons 'alias: aliases))))) |
| 238 | (princ (car aliases)) | ||
| 239 | (setq aliases (cdr aliases))) | ||
| 240 | (princ ")")) | ||
| 241 | (let ((base (coding-system-base coding-system))) | ||
| 242 | (if (not (eq base coding-system)) | ||
| 243 | (princ (format " (alias of %s)" base))))) | ||
| 244 | (princ "\n") | 244 | (princ "\n") |
| 245 | (if (and doc-string | 245 | (if (and doc-string |
| 246 | (setq doc-string (coding-system-doc-string coding-system))) | 246 | (setq doc-string (coding-system-doc-string coding-system))) |
| @@ -275,28 +275,76 @@ at the place of `..': | |||
| 275 | (print-coding-system-briefly (car default-process-coding-system)) | 275 | (print-coding-system-briefly (car default-process-coding-system)) |
| 276 | (princ " encoding: ") | 276 | (princ " encoding: ") |
| 277 | (print-coding-system-briefly (cdr default-process-coding-system))) | 277 | (print-coding-system-briefly (cdr default-process-coding-system))) |
| 278 | (princ "\nCoding categories (in the order of priority):\n") | 278 | |
| 279 | (let ((l coding-category-list)) | 279 | (save-excursion |
| 280 | (while l | 280 | (set-buffer standard-output) |
| 281 | (princ (format " %-27s -> %s\n" (car l) (symbol-value (car l)))) | 281 | |
| 282 | (setq l (cdr l)))) | 282 | (princ "\nPriority order of coding systems:\n") |
| 283 | (princ "\nLook up tables for finding a coding system on I/O operations:\n") | 283 | (let ((l coding-category-list) |
| 284 | (let ((func (lambda (title alist) | 284 | (i 1) |
| 285 | (princ title) | 285 | coding aliases) |
| 286 | (if (not alist) | 286 | (while l |
| 287 | (princ " Nothing specified.\n") | 287 | (setq coding (symbol-value (car l))) |
| 288 | (while alist | 288 | (princ (format " %d. %s" i coding)) |
| 289 | (princ (format " %-27s -> %s\n" | 289 | (if (setq aliases (get coding 'alias-coding-systems)) |
| 290 | (concat "\"" (car (car alist)) "\"") | 290 | (progn |
| 291 | (cdr (car alist)))) | 291 | (princ " ") |
| 292 | (setq alist (cdr alist))))))) | 292 | (princ (cons 'alias: aliases)))) |
| 293 | (funcall func " File I/O (FILENAME -> CODING-SYSTEM):\n" | 293 | (terpri) |
| 294 | file-coding-system-alist) | 294 | (setq l (cdr l) i (1+ i)))) |
| 295 | (funcall func " Process I/O (PROGRAM-NAME -> CODING-SYSTEM):\n" | 295 | (princ "\n Other coding systems cannot be distinguished automatically |
| 296 | process-coding-system-alist) | 296 | from these, and therefore cannot be recognized automatically |
| 297 | (funcall func " Network stream I/O (SERVICE-NAME -> CODING-SYSTEM):\n" | 297 | with the present coding system priorities.\n\n") |
| 298 | network-coding-system-alist)) | 298 | |
| 299 | )) | 299 | (let ((categories '(coding-category-iso-7 coding-category-iso-else)) |
| 300 | coding-system codings) | ||
| 301 | (while categories | ||
| 302 | (setq coding-system (symbol-value (car categories))) | ||
| 303 | (mapcar | ||
| 304 | (function | ||
| 305 | (lambda (x) | ||
| 306 | (if (and (not (eq x coding-system)) | ||
| 307 | (get x 'no-initial-designation) | ||
| 308 | (let ((flags (coding-system-flags x))) | ||
| 309 | (not (or (aref flags 10) (aref flags 11))))) | ||
| 310 | (setq codings (cons x codings))))) | ||
| 311 | (get (car categories) 'coding-systems)) | ||
| 312 | (if codings | ||
| 313 | (let ((max-col (frame-width)) | ||
| 314 | pos) | ||
| 315 | (princ (format " The followings are decoded correctly but recognized as %s:\n " coding-system)) | ||
| 316 | (while codings | ||
| 317 | (setq pos (point)) | ||
| 318 | (insert (format " %s" (car codings))) | ||
| 319 | (if (> (current-column) max-col) | ||
| 320 | (progn | ||
| 321 | (goto-char pos) | ||
| 322 | (insert "\n ") | ||
| 323 | (goto-char (point-max)))) | ||
| 324 | (setq codings (cdr codings))) | ||
| 325 | (insert "\n\n"))) | ||
| 326 | (setq categories (cdr categories)))) | ||
| 327 | |||
| 328 | (princ "Look up tables for finding a coding system on I/O operations:\n") | ||
| 329 | (terpri) | ||
| 330 | (princ " OPERATION\tTARGET PATTERN\t\tCODING SYSTEM(s)\n") | ||
| 331 | (princ " ---------\t--------------\t\t----------------\n") | ||
| 332 | (let ((func (lambda (operation alist) | ||
| 333 | (princ " ") | ||
| 334 | (princ operation) | ||
| 335 | (if (not alist) | ||
| 336 | (princ "\tnothing specified\n") | ||
| 337 | (while alist | ||
| 338 | (indent-to 16) | ||
| 339 | (prin1 (car (car alist))) | ||
| 340 | (indent-to 40) | ||
| 341 | (princ (cdr (car alist))) | ||
| 342 | (princ "\n") | ||
| 343 | (setq alist (cdr alist))))))) | ||
| 344 | (funcall func "File I/O" file-coding-system-alist) | ||
| 345 | (funcall func "Process I/O" process-coding-system-alist) | ||
| 346 | (funcall func "Network I/O" network-coding-system-alist)) | ||
| 347 | (help-mode)))) | ||
| 300 | 348 | ||
| 301 | ;; Print detailed information on CODING-SYSTEM. | 349 | ;; Print detailed information on CODING-SYSTEM. |
| 302 | (defun print-coding-system (coding-system &optional aliases) | 350 | (defun print-coding-system (coding-system &optional aliases) |
| @@ -365,7 +413,8 @@ at the place of `..': | |||
| 365 | If called interactive, it prints name, mnemonic letter, and doc-string | 413 | If called interactive, it prints name, mnemonic letter, and doc-string |
| 366 | of each coding system. | 414 | of each coding system. |
| 367 | If not, it prints whole information of each coding system | 415 | If not, it prints whole information of each coding system |
| 368 | with the format which is more suitable for being read by a machine." | 416 | with the format which is more suitable for being read by a machine, |
| 417 | in addition, it prints list of coding category ordered by priority." | ||
| 369 | (interactive) | 418 | (interactive) |
| 370 | (with-output-to-temp-buffer "*Help*" | 419 | (with-output-to-temp-buffer "*Help*" |
| 371 | (if (interactive-p) | 420 | (if (interactive-p) |
| @@ -401,25 +450,25 @@ with the format which is more suitable for being read by a machine." | |||
| 401 | ## | 450 | ## |
| 402 | ")) | 451 | ")) |
| 403 | (let ((bases (coding-system-list 'base-only)) | 452 | (let ((bases (coding-system-list 'base-only)) |
| 404 | base coding-system aliases) | 453 | coding-system) |
| 405 | (while bases | 454 | (while bases |
| 406 | (setq base (car bases) bases (cdr bases)) | 455 | (setq coding-system (car bases)) |
| 407 | (if (consp base) | ||
| 408 | (setq coding-system (car base) aliases (cdr base)) | ||
| 409 | (setq coding-system base aliases nil)) | ||
| 410 | (if (interactive-p) | 456 | (if (interactive-p) |
| 411 | (print-coding-system-briefly coding-system aliases 'doc-string) | 457 | (print-coding-system-briefly coding-system 'doc-string) |
| 412 | (print-coding-system coding-system aliases)))) | 458 | (print-coding-system coding-system)) |
| 413 | (princ "\ | 459 | (setq bases (cdr bases)))) |
| 460 | (if (interactive-p) | ||
| 461 | nil | ||
| 462 | (princ "\ | ||
| 414 | ############################ | 463 | ############################ |
| 415 | ## LIST OF CODING CATEGORIES (ordered by priority) | 464 | ## LIST OF CODING CATEGORIES (ordered by priority) |
| 416 | ## CATEGORY:CODING-SYSTEM | 465 | ## CATEGORY:CODING-SYSTEM |
| 417 | ## | 466 | ## |
| 418 | ") | 467 | ") |
| 419 | (let ((l coding-category-list)) | 468 | (let ((l coding-category-list)) |
| 420 | (while l | 469 | (while l |
| 421 | (princ (format "%s:%s\n" (car l) (symbol-value (car l)))) | 470 | (princ (format "%s:%s\n" (car l) (symbol-value (car l)))) |
| 422 | (setq l (cdr l)))) | 471 | (setq l (cdr l))))) |
| 423 | )) | 472 | )) |
| 424 | 473 | ||
| 425 | ;;; FONT | 474 | ;;; FONT |
| @@ -483,7 +532,31 @@ with the format which is more suitable for being read by a machine." | |||
| 483 | (let ((fontset-info (fontset-info fontset))) | 532 | (let ((fontset-info (fontset-info fontset))) |
| 484 | (with-output-to-temp-buffer "*Help*" | 533 | (with-output-to-temp-buffer "*Help*" |
| 485 | (describe-fontset-internal fontset fontset-info))))) | 534 | (describe-fontset-internal fontset fontset-info))))) |
| 486 | 535 | ||
| 536 | ;;;###autoload | ||
| 537 | (defun list-input-methods () | ||
| 538 | "Print information of all input methods." | ||
| 539 | (interactive) | ||
| 540 | (with-output-to-temp-buffer "*Help*" | ||
| 541 | (princ "LANGUAGE\n NAME (`TITLE' in mode line)\n") | ||
| 542 | (princ " SHORT-DESCRIPTION\n------------------------------\n") | ||
| 543 | (setq input-method-alist | ||
| 544 | (sort input-method-alist | ||
| 545 | (function (lambda (x y) (string< (nth 1 x) (nth 1 y)))))) | ||
| 546 | (let ((l input-method-alist) | ||
| 547 | language elt) | ||
| 548 | (while l | ||
| 549 | (setq elt (car l) l (cdr l)) | ||
| 550 | (if (not (equal language (nth 1 elt))) | ||
| 551 | (progn | ||
| 552 | (setq language (nth 1 elt)) | ||
| 553 | (princ language) | ||
| 554 | (terpri))) | ||
| 555 | (princ (format " %s (`%s' in mode line)\n %s\n" | ||
| 556 | (car elt) (nth 3 elt) | ||
| 557 | (let ((title (nth 4 elt))) | ||
| 558 | (string-match ".*" title) | ||
| 559 | (match-string 0 title)))))))) | ||
| 487 | 560 | ||
| 488 | ;;; DIAGNOSIS | 561 | ;;; DIAGNOSIS |
| 489 | 562 | ||
| @@ -541,28 +614,13 @@ with the format which is more suitable for being read by a machine." | |||
| 541 | (insert "\n\n") | 614 | (insert "\n\n") |
| 542 | 615 | ||
| 543 | (insert-section 3 "Input methods") | 616 | (insert-section 3 "Input methods") |
| 544 | (insert "language\tinput-method\n" | 617 | (save-excursion (list-input-methods)) |
| 545 | "--------\t------------\n") | 618 | (insert-buffer "*Help*") |
| 546 | (let ((alist language-info-alist)) | 619 | (goto-char (point-max)) |
| 547 | (while alist | ||
| 548 | (insert (car (car alist))) | ||
| 549 | (indent-to 16) | ||
| 550 | (let ((methods (get-language-info (car (car alist)) 'input-method))) | ||
| 551 | (if methods | ||
| 552 | (insert-list (mapcar 'car methods)) | ||
| 553 | (insert "none\n"))) | ||
| 554 | (setq alist (cdr alist)))) | ||
| 555 | (insert "\n") | 620 | (insert "\n") |
| 556 | (if default-input-method | 621 | (if default-input-method |
| 557 | (insert "The input method used last time is: " | 622 | (insert "Default input method: %s\n" default-input-method) |
| 558 | (cdr default-input-method) | 623 | (insert "No default input method is specified.\n")) |
| 559 | "\n" | ||
| 560 | " for inputting the language: " | ||
| 561 | (car default-input-method) | ||
| 562 | "\n") | ||
| 563 | (insert "No input method has ever been selected.\n")) | ||
| 564 | |||
| 565 | (insert "\n") | ||
| 566 | 624 | ||
| 567 | (insert-section 4 "Coding systems") | 625 | (insert-section 4 "Coding systems") |
| 568 | (save-excursion (list-coding-systems)) | 626 | (save-excursion (list-coding-systems)) |