1 ;;; mule-diag.el --- Show diagnosis of multilingual environment (MULE)
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
6 ;; Keywords: multilingual, charset, coding system, fontset, diagnosis
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; General utility function
27 ;; Print all arguments with single space separator in one line.
28 (defun print-list (&rest args)
33 (setq args (cdr args)))
37 ;; Re-order the elements of charset-list.
38 (defun sort-charset-list ()
41 (function (lambda (x y) (< (charset-id x) (charset-id y)))))))
46 (defun list-character-sets (&optional arg)
47 "Display a list of all character sets.
49 The ID column contains a charset identification number for internal use.
50 The B column contains a number of bytes occupied in a buffer.
51 The W column contains a number of columns occupied in a screen.
53 With prefix arg, the output format gets more cryptic
54 but contains full information about each character sets."
57 (with-output-to-temp-buffer "*Help*"
59 (set-buffer standard-output)
60 (let ((l charset-list)
64 (insert "ID Name B W Description\n")
65 (insert "-- ---- - - -----------\n")
67 (setq charset (car l) l (cdr l))
68 (insert (format "%03d %s" (charset-id charset) charset))
70 (insert (format "%d %d %s\n"
71 (charset-bytes charset)
72 (charset-width charset)
73 (charset-description charset)))))
75 #########################
77 ## Each line corresponds to one charset.
78 ## The following attributes are listed in this order
79 ## separated by a colon `:' in one line.
81 ## CHARSET-SYMBOL-NAME,
84 ## BYTES (of multibyte form: 1, 2, 3, or 4),
85 ## WIDTH (occupied column numbers: 1 or 2),
86 ## DIRECTION (0:left-to-right, 1:right-to-left),
87 ## ISO-FINAL-CHAR (character code of ISO-2022's final character)
88 ## ISO-GRAPHIC-PLANE (ISO-2022's graphic plane, 0:GL, 1:GR)
89 ## DESCRIPTION (describing string of the charset)
92 (setq charset (car l) l (cdr l))
93 (princ (format "%03d:%s:%d:%d:%d:%d:%d:%d:%d:%s\n"
96 (charset-dimension charset)
97 (charset-chars charset)
98 (charset-bytes charset)
99 (charset-width charset)
100 (charset-direction charset)
101 (charset-iso-final-char charset)
102 (charset-iso-graphic-plane charset)
103 (charset-description charset))))))
105 (setq truncate-lines t))))
109 ;; Print information of designation of each graphic register in FLAGS
110 ;; in human readable format. See the documentation of
111 ;; `make-coding-system' for the meaning of FLAGS.
112 (defun print-designation (flags)
113 (let ((graphic-register 0)
115 (while (< graphic-register 4)
116 (setq charset (aref flags graphic-register))
120 (cond ((null charset)
123 "no initial designation, and used by any charsets")
126 charset (charset-description charset)))
128 (if (charsetp (car charset))
129 (format "%s:%s, and also used by the followings:"
131 (charset-description (car charset)))
132 "no initial designation, and used by the followings:"))
134 "invalid designation information"))))
135 (when (listp charset)
136 (setq charset (cdr charset))
138 (cond ((eq (car charset) t)
139 (princ "\tany other charsets\n"))
140 ((charsetp (car charset))
141 (princ (format "\t%s:%s\n"
143 (charset-description (car charset)))))
145 "invalid designation information"))
146 (setq charset (cdr charset))))
147 (setq graphic-register (1+ graphic-register)))))
150 (defun describe-coding-system (coding-system)
151 "Display information of CODING-SYSTEM."
152 (interactive "zDescribe coding system (default, current choices): ")
153 (if (null coding-system)
154 (describe-current-coding-system)
155 (with-output-to-temp-buffer "*Help*"
156 (print-coding-system-briefly coding-system 'doc-string)
157 (let ((coding-spec (coding-system-spec coding-system)))
159 (let ((type (coding-system-type coding-system))
160 (flags (coding-system-flags coding-system)))
163 (princ " (do no conversion)"))
165 (princ " (do automatic conversion)"))
167 (princ " (Emacs internal multibyte form)"))
169 (princ " (Shift-JIS, MS-KANJI)"))
171 (princ " (variant of ISO-2022)\n")
172 (princ "Initial designations:\n")
173 (print-designation flags)
174 (princ "Other Form: \n ")
175 (princ (if (aref flags 4) "short-form" "long-form"))
176 (if (aref flags 5) (princ ", ASCII@EOL"))
177 (if (aref flags 6) (princ ", ASCII@CNTL"))
178 (princ (if (aref flags 7) ", 7-bit" ", 8-bit"))
179 (if (aref flags 8) (princ ", use-locking-shift"))
180 (if (aref flags 9) (princ ", use-single-shift"))
181 (if (aref flags 10) (princ ", use-roman"))
182 (if (aref flags 10) (princ ", use-old-jis"))
183 (if (aref flags 11) (princ ", no-ISO6429"))
188 (princ " (do conversion by CCL program)"))
190 (princ " (text with random binary characters)"))
191 (t (princ ": invalid coding-system."))))
192 (princ "\nEOL type: ")
193 (let ((eol-type (coding-system-eol-type coding-system)))
194 (cond ((vectorp eol-type)
195 (princ "Automatic selection from:\n\t")
198 ((or (null eol-type) (eq eol-type 0)) (princ "LF\n"))
199 ((eq eol-type 1) (princ "CRLF\n"))
200 ((eq eol-type 2) (princ "CR\n"))
201 (t (princ "invalid\n")))))
202 (let ((postread (coding-system-get coding-system 'post-read-conversion)))
204 (princ "After decoding a text normally,")
205 (princ " perform post-conversion by the function: ")
209 (let ((prewrite (coding-system-get coding-system 'pre-write-conversion)))
211 (princ "Before encoding a text normally,")
212 (princ " perform pre-conversion by the function: ")
216 (let ((charsets (coding-system-get coding-system 'safe-charsets)))
219 (princ "This coding system can encode charsets:\n")
220 (princ "This coding system encode the following charsets:\n")
224 (princ (car charsets))
225 (setq charsets (cdr charsets))))))
227 (set-buffer standard-output)
231 (defun describe-current-coding-system-briefly ()
232 "Display coding systems currently used in a brief format in echo area.
234 The format is \"F[..],K[..],T[..],P>[..],P<[..], default F[..],P<[..],P<[..]\",
235 where mnemonics of the following coding systems come in this order
236 at the place of `..':
237 buffer-file-coding-system (of the current buffer)
238 eol-type of buffer-file-coding-system (of the current buffer)
239 (keyboard-coding-system)
240 eol-type of (keyboard-coding-system)
241 (terminal-coding-system)
242 eol-type of (terminal-coding-system)
243 process-coding-system for read (of the current buffer, if any)
244 eol-type of process-coding-system for read (of the current buffer, if any)
245 process-coding-system for write (of the current buffer, if any)
246 eol-type of process-coding-system for write (of the current buffer, if any)
247 default-buffer-file-coding-system
248 eol-type of default-buffer-file-coding-system
249 default-process-coding-system for read
250 eol-type of default-process-coding-system for read
251 default-process-coding-system for write
252 eol-type of default-process-coding-system"
254 (let* ((proc (get-buffer-process (current-buffer)))
255 (process-coding-systems (if proc (process-coding-system proc))))
257 "F[%c%c],K[%c%c],T[%c%c],P>[%c%c],P<[%c%c], default F[%c%c],P>[%c%c],P<[%c%c]"
258 (coding-system-mnemonic buffer-file-coding-system)
259 (coding-system-eol-type-mnemonic buffer-file-coding-system)
260 (coding-system-mnemonic (keyboard-coding-system))
261 (coding-system-eol-type-mnemonic (keyboard-coding-system))
262 (coding-system-mnemonic (terminal-coding-system))
263 (coding-system-eol-type-mnemonic (terminal-coding-system))
264 (coding-system-mnemonic (car process-coding-systems))
265 (coding-system-eol-type-mnemonic (car process-coding-systems))
266 (coding-system-mnemonic (cdr process-coding-systems))
267 (coding-system-eol-type-mnemonic (cdr process-coding-systems))
268 (coding-system-mnemonic default-buffer-file-coding-system)
269 (coding-system-eol-type-mnemonic default-buffer-file-coding-system)
270 (coding-system-mnemonic (car default-process-coding-system))
271 (coding-system-eol-type-mnemonic (car default-process-coding-system))
272 (coding-system-mnemonic (cdr default-process-coding-system))
273 (coding-system-eol-type-mnemonic (cdr default-process-coding-system))
276 ;; Print symbol name and mnemonic letter of CODING-SYSTEM by `princ'.
277 (defun print-coding-system-briefly (coding-system &optional doc-string)
278 (if (not coding-system)
280 (princ (format "%c -- %s"
281 (coding-system-mnemonic coding-system)
283 (let ((aliases (coding-system-get coding-system 'alias-coding-systems)))
284 (if (eq coding-system (car aliases))
286 (princ (format " %S" (cons 'alias: (cdr aliases)))))
287 (if (memq coding-system aliases)
288 (princ (format " (alias of %s)" (car aliases))))))
291 (setq doc-string (coding-system-doc-string coding-system)))
292 (princ (format " %s\n" doc-string)))))
295 (defun describe-current-coding-system ()
296 "Display coding systems currently used in a detailed format."
298 (with-output-to-temp-buffer "*Help*"
299 (let* ((proc (get-buffer-process (current-buffer)))
300 (process-coding-systems (if proc (process-coding-system proc))))
301 (princ "Coding system for saving this buffer:\n ")
302 (if (local-variable-p 'buffer-file-coding-system)
303 (print-coding-system-briefly buffer-file-coding-system)
304 (princ "Not set locally, use the default.\n"))
305 (princ "Default coding system (for new files):\n ")
306 (print-coding-system-briefly default-buffer-file-coding-system)
307 (princ "Coding system for keyboard input:\n ")
308 (print-coding-system-briefly (keyboard-coding-system))
309 (princ "Coding system for terminal output:\n ")
310 (print-coding-system-briefly (terminal-coding-system))
311 (when (get-buffer-process (current-buffer))
312 (princ "Coding systems for process I/O:\n")
313 (princ " encoding input to the process: ")
314 (print-coding-system-briefly (cdr process-coding-systems))
315 (princ " decoding output from the process: ")
316 (print-coding-system-briefly (car process-coding-systems)))
317 (princ "Defaults for subprocess I/O:\n")
318 (princ " decoding: ")
319 (print-coding-system-briefly (car default-process-coding-system))
320 (princ " encoding: ")
321 (print-coding-system-briefly (cdr default-process-coding-system)))
324 (set-buffer standard-output)
326 (princ "\nPriority order for recognizing coding systems when reading files:\n")
327 (let ((l coding-category-list)
332 (setq coding (symbol-value (car l)))
333 ;; Do not list up the same coding system twice.
334 (when (not (memq coding coding-list))
335 (setq coding-list (cons coding coding-list))
336 (princ (format " %d. %s " i coding))
337 (setq aliases (coding-system-get coding 'alias-coding-systems))
338 (if (eq coding (car aliases))
340 (princ (cons 'alias: (cdr aliases))))
341 (if (memq coding aliases)
342 (princ (list 'alias 'of (car aliases)))))
347 (princ "\n Other coding systems cannot be distinguished automatically
348 from these, and therefore cannot be recognized automatically
349 with the present coding system priorities.\n\n")
351 (let ((categories '(coding-category-iso-7 coding-category-iso-7-else))
352 coding-system codings)
354 (setq coding-system (symbol-value (car categories)))
358 (if (and (not (eq x coding-system))
359 (coding-system-get x 'no-initial-designation)
360 (let ((flags (coding-system-flags x)))
361 (not (or (aref flags 10) (aref flags 11)))))
362 (setq codings (cons x codings)))))
363 (get (car categories) 'coding-systems))
365 (let ((max-col (frame-width))
367 (princ (format " The followings are decoded correctly but recognized as %s:\n " coding-system))
370 (insert (format " %s" (car codings)))
371 (when (> (current-column) max-col)
374 (goto-char (point-max)))
375 (setq codings (cdr codings)))
377 (setq categories (cdr categories))))
379 (princ "Particular coding systems specified for certain file names:\n")
381 (princ " OPERATION\tTARGET PATTERN\t\tCODING SYSTEM(s)\n")
382 (princ " ---------\t--------------\t\t----------------\n")
383 (let ((func (lambda (operation alist)
387 (princ "\tnothing specified\n")
390 (prin1 (car (car alist)))
391 (if (>= (current-column) 40)
394 (princ (cdr (car alist)))
396 (setq alist (cdr alist)))))))
397 (funcall func "File I/O" file-coding-system-alist)
398 (funcall func "Process I/O" process-coding-system-alist)
399 (funcall func "Network I/O" network-coding-system-alist))
402 ;; Print detailed information on CODING-SYSTEM.
403 (defun print-coding-system (coding-system)
404 (let ((type (coding-system-type coding-system))
405 (eol-type (coding-system-eol-type coding-system))
406 (flags (coding-system-flags coding-system))
407 (aliases (coding-system-get coding-system 'alias-coding-systems)))
408 (if (not (eq (car aliases) coding-system))
409 (princ (format "%s (alias of %s)\n" coding-system (car aliases)))
410 (princ coding-system)
411 (setq aliases (cdr aliases))
414 (princ (car aliases))
415 (setq aliases (cdr aliases)))
416 (princ (format ":%s:%c:%d:"
418 (coding-system-mnemonic coding-system)
419 (if (integerp eol-type) eol-type 3)))
420 (cond ((eq type 2) ; ISO-2022
424 (setq charset (aref flags idx))
425 (cond ((null charset)
433 (princ (car charset))
434 (setq charset (cdr charset))
437 (princ (car charset))
438 (setq charset (cdr charset)))
443 (princ (if (aref flags idx) 1 0))
446 (princ (if (aref flags idx) 1 0))))
449 (if (symbolp (car flags))
450 (princ (format " %s" (car flags)))
451 (setq i 0 len (length (car flags)))
453 (princ (format " %x" (aref (car flags) i)))
456 (if (symbolp (cdr flags))
457 (princ (format "%s" (cdr flags)))
458 (setq i 0 len (length (cdr flags)))
460 (princ (format " %x" (aref (cdr flags) i)))
464 (princ (coding-system-doc-string coding-system))
468 (defun list-coding-systems (&optional arg)
469 "Display a list of all coding systems.
470 It prints mnemonic letter, name, and description of each coding systems.
472 With prefix arg, the output format gets more cryptic,
473 but contains full information about each coding systems."
475 (with-output-to-temp-buffer "*Help*"
478 ###############################################
479 # List of coding systems in the following format:
480 # MNEMONIC-LETTER -- CODING-SYSTEM-NAME
484 #########################
485 ## LIST OF CODING SYSTEMS
486 ## Each line corresponds to one coding system
487 ## Format of a line is:
488 ## NAME[,ALIAS...]:TYPE:MNEMONIC:EOL:FLAGS:POST-READ-CONVERSION
489 ## :PRE-WRITE-CONVERSION:DOC-STRING,
491 ## NAME = coding system name
492 ## ALIAS = alias of the coding system
493 ## TYPE = nil (no conversion), t (undecided or automatic detection),
494 ## 0 (EMACS-MULE), 1 (SJIS), 2 (ISO2022), 3 (BIG5), or 4 (CCL)
495 ## EOL = 0 (LF), 1 (CRLF), 2 (CR), or 3 (Automatic detection)
498 ## comma (`,') separated data of the followings:
499 ## G0, G1, G2, G3, SHORT-FORM, ASCII-EOL, ASCII-CNTL, SEVEN,
500 ## LOCKING-SHIFT, SINGLE-SHIFT, USE-ROMAN, USE-OLDJIS, NO-ISO6429
501 ## else if TYPE = 4 then
502 ## comma (`,') separated CCL programs for read and write
505 ## POST-READ-CONVERSION, PRE-WRITE-CONVERSION = function name to be called
508 (let ((bases (coding-system-list 'base-only))
511 (setq coding-system (car bases))
513 (print-coding-system-briefly coding-system 'doc-string)
514 (print-coding-system coding-system))
515 (setq bases (cdr bases))))))
518 (defun list-coding-categories ()
519 "Display a list of all coding categories."
520 (with-output-to-temp-buffer "*Help*"
522 ############################
523 ## LIST OF CODING CATEGORIES (ordered by priority)
524 ## CATEGORY:CODING-SYSTEM
527 (let ((l coding-category-list))
529 (princ (format "%s:%s\n" (car l) (symbol-value (car l))))
534 ;; Print information of a font in FONTINFO.
535 (defun describe-font-internal (font-info &optional verbose)
536 (print-list "name (opened by):" (aref font-info 0))
537 (print-list " full name:" (aref font-info 1))
538 (let ((charset (aref font-info 2)))
539 (print-list " charset:"
540 (format "%s (%s)" charset (charset-description charset))))
541 (print-list " size:" (format "%d" (aref font-info 3)))
542 (print-list " height:" (format "%d" (aref font-info 4)))
543 (print-list " baseline-offset:" (format "%d" (aref font-info 5)))
544 (print-list "relative-compose:" (format "%d" (aref font-info 6))))
547 (defun describe-font (fontname)
548 "Display information about fonts which partially match FONTNAME."
549 (interactive "sFontname (default, current choice for ASCII chars): ")
550 (or (and window-system (boundp 'global-fontset-alist))
551 (error "No fontsets being used"))
552 (when (or (not fontname) (= (length fontname) 0))
553 (setq fontname (cdr (assq 'font (frame-parameters))))
554 (if (query-fontset fontname)
556 (nth 2 (assq 'ascii (aref (fontset-info fontname) 2))))))
557 (let ((font-info (font-info fontname)))
559 (message "No matching font")
560 (with-output-to-temp-buffer "*Help*"
561 (describe-font-internal font-info 'verbose)))))
563 ;; Print information of FONTSET. If optional arg PRINT-FONTS is
564 ;; non-nil, print also names of all fonts in FONTSET. This function
565 ;; actually INSERT such information in the current buffer.
566 (defun print-fontset (fontset &optional print-fonts)
567 (let* ((fontset-info (fontset-info fontset))
568 (size (aref fontset-info 0))
569 (height (aref fontset-info 1))
570 (fonts (and print-fonts (aref fontset-info 2)))
571 (xlfd-fields (x-decompose-font-name fontset))
574 (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum))
575 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)))
576 (if (string-match "^bold$\\|^demibold$" weight)
577 (setq style (concat weight " "))
578 (setq style "medium "))
579 (cond ((string-match "^i$" slant)
580 (setq style (concat style "italic")))
581 ((string-match "^o$" slant)
582 (setq style (concat style "slant")))
583 ((string-match "^ri$" slant)
584 (setq style (concat style "reverse italic")))
585 ((string-match "^ro$" slant)
586 (setq style (concat style "reverse slant")))))
591 (insert (if (> size 0) (format "%2dx%d" size height) " -"))
595 (insert " O Charset / Fontname\n"
596 " - ------------------\n")
598 (let ((l charset-list)
599 charset font-info opened fontname)
601 (setq charset (car l) l (cdr l))
602 (setq font-info (assq charset fonts))
604 (setq opened ?? fontname "not specified")
605 (if (nth 2 font-info)
606 (if (stringp (nth 2 font-info))
607 (setq opened ?o fontname (nth 2 font-info))
608 (setq opened ?- fontname (nth 1 font-info)))
609 (setq opened ?x fontname (nth 1 font-info))))
610 (insert (format " %c %s\n %s\n"
611 opened charset fontname)))))))
614 (defun describe-fontset (fontset)
615 "Display information of FONTSET.
617 It prints name, size, and style of FONTSET, and lists up fonts
618 contained in FONTSET.
620 The column WDxHT contains width and height (pixels) of each fontset
621 \(i.e. those of ASCII font in the fontset). The letter `-' in this
622 column means that the corresponding fontset is not yet used in any
625 The O column of each font contains one of the following letters.
626 o -- font already opened
627 - -- font not yet opened
628 x -- font can't be opened
629 ? -- no font specified
631 The Charset column of each font contains a name of character set
632 displayed by the font."
634 (if (not (and window-system (boundp 'global-fontset-alist)))
635 (error "No fontsets being used")
636 (let ((fontset-list (mapcar '(lambda (x) (list x)) (fontset-list)))
637 (completion-ignore-case t))
638 (list (completing-read
639 "Fontset (default, used by the current frame): "
640 fontset-list nil t)))))
641 (if (= (length fontset) 0)
642 (setq fontset (cdr (assq 'font (frame-parameters)))))
643 (if (not (query-fontset fontset))
644 (error "Current frame is using font, not fontset"))
645 (let ((fontset-info (fontset-info fontset)))
646 (with-output-to-temp-buffer "*Help*"
648 (set-buffer standard-output)
649 (insert "Fontset-Name\t\t\t\t\t\t WDxHT Style\n")
650 (insert "------------\t\t\t\t\t\t ----- -----\n")
651 (print-fontset fontset t)))))
654 (defun list-fontsets (arg)
655 "Display a list of all fontsets.
657 It prints name, size, and style of each fontset.
658 With prefix arg, it also lists up fonts contained in each fontset.
659 See the function `describe-fontset' for the format of the list."
661 (if (not (and window-system (boundp 'global-fontset-alist)))
662 (error "No fontsets being used")
663 (with-output-to-temp-buffer "*Help*"
665 (set-buffer standard-output)
666 (insert "Fontset-Name\t\t\t\t\t\t WDxHT Style\n")
667 (insert "------------\t\t\t\t\t\t ----- -----\n")
668 (let ((fontsets (fontset-list)))
670 (print-fontset (car fontsets) arg)
671 (setq fontsets (cdr fontsets))))))))
674 (defun list-input-methods ()
675 "Print information of all input methods."
677 (with-output-to-temp-buffer "*Help*"
678 (if (not input-method-alist)
681 No input method is available, perhaps because you have not yet
682 installed LEIM (Libraries of Emacs Input Method).
684 LEIM is available from the same ftp directory as Emacs. For instance,
685 if there exists an archive file `emacs-20.N.tar.gz', there should also
686 be a file `leim-20.N.tar.gz'. When you extract this file, LEIM files
687 are put under the subdirectory `emacs-20.N/leim'. When you install
688 Emacs again, you should be able to use various input methods."))
689 (princ "LANGUAGE\n NAME (`TITLE' in mode line)\n")
690 (princ " SHORT-DESCRIPTION\n------------------------------\n")
691 (setq input-method-alist
692 (sort input-method-alist
693 (function (lambda (x y) (string< (nth 1 x) (nth 1 y))))))
694 (let ((l input-method-alist)
697 (setq elt (car l) l (cdr l))
698 (when (not (equal language (nth 1 elt)))
699 (setq language (nth 1 elt))
702 (princ (format " %s (`%s' in mode line)\n %s\n"
704 (let ((title (nth 3 elt)))
705 (if (and (consp title) (stringp (car title)))
708 (let ((description (nth 4 elt)))
709 (string-match ".*" description)
710 (match-string 0 description)))))))))
714 ;; Insert a header of a section with SECTION-NUMBER and TITLE.
715 (defun insert-section (section-number title)
716 (insert "########################################\n"
717 "# Section " (format "%d" section-number) ". " title "\n"
718 "########################################\n\n"))
722 "Display diagnosis of the multilingual environment (MULE).
724 It prints various information related to the current multilingual
725 environment, including lists of input methods, coding systems,
726 character sets, and fontsets (if Emacs running under some window
727 system which uses fontsets)."
729 (with-output-to-temp-buffer "*Mule-Diagnosis*"
731 (set-buffer standard-output)
732 (insert "\t###############################\n"
733 "\t### Diagnosis of your Emacs ###\n"
734 "\t###############################\n\n"
735 "CONTENTS: Section 1. General Information\n"
736 " Section 2. Display\n"
737 " Section 3. Input methods\n"
738 " Section 4. Coding systems\n"
739 " Section 5. Character sets\n")
740 (if (and window-system (boundp 'global-fontset-alist))
741 (insert " Section 6. Fontsets\n"))
744 (insert-section 1 "General Information")
745 (insert "Version of this emacs:\n " (emacs-version) "\n\n")
747 (insert-section 2 "Display")
749 (insert "Window-system: "
750 (symbol-name window-system)
751 (format "%s" window-system-version))
752 (insert "Terminal: " (getenv "TERM")))
755 (if (eq window-system 'x)
756 (let ((font (cdr (assq 'font (frame-parameters)))))
757 (insert "The selected frame is using the "
758 (if (query-fontset font) "fontset" "font")
760 (insert "Coding system of the terminal: "
761 (symbol-name (terminal-coding-system))))
764 (insert-section 3 "Input methods")
765 (save-excursion (list-input-methods))
766 (insert-buffer-substring "*Help*")
768 (if default-input-method
769 (insert "Default input method: " default-input-method "\n")
770 (insert "No default input method is specified\n"))
772 (insert-section 4 "Coding systems")
773 (save-excursion (list-coding-systems t))
774 (insert-buffer-substring "*Help*")
775 (save-excursion (list-coding-categories))
776 (insert-buffer-substring "*Help*")
779 (insert-section 5 "Character sets")
780 (save-excursion (list-character-sets t))
781 (insert-buffer-substring "*Help*")
784 (when (and window-system (boundp 'global-fontset-alist))
785 (insert-section 6 "Fontsets")
786 (save-excursion (list-fontsets t))
787 (insert-buffer-substring "*Help*"))
794 (defun dump-charsets ()
795 "Dump information of all charsets into the file \"CHARSETS\".
796 The file is saved in the directory `data-directory'."
797 (let ((file (expand-file-name "CHARSETS" data-directory))
799 (or (file-writable-p file)
800 (error "Can't write to file %s" file))
801 (setq buf (find-file-noselect file))
802 (save-window-excursion
805 (setq buffer-read-only nil)
807 (list-character-sets t)
808 (insert-buffer-substring "*Help*")
809 (let (make-backup-files
810 coding-system-for-write)
817 (defun dump-codings ()
818 "Dump information of all coding systems into the file \"CODINGS\".
819 The file is saved in the directory `data-directory'."
820 (let ((file (expand-file-name "CODINGS" data-directory))
822 (or (file-writable-p file)
823 (error "Can't write to file %s" file))
824 (setq buf (find-file-noselect file))
825 (save-window-excursion
828 (setq buffer-read-only nil)
830 (list-coding-systems t)
831 (insert-buffer-substring "*Help*")
832 (list-coding-categories)
833 (insert-buffer-substring "*Help*")
834 (let (make-backup-files
835 coding-system-for-write)
841 ;;; mule-diag.el ends here