]> code.delx.au - gnu-emacs/blobdiff - lisp/international/mule-diag.el
(font-show-log): Limit each listing to 20 items.
[gnu-emacs] / lisp / international / mule-diag.el
index 75bf45f0525c701b232c5de8787233d772b0b3c4..5b58af5fcd9cf943264b62cdc8dca7949852e848 100644 (file)
@@ -1,9 +1,9 @@
 ;;; mule-diag.el --- show diagnosis of multilingual environment (Mule)
 
 ;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007  Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007
+;;   2005, 2006, 2007, 2008
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 ;; Copyright (C) 2003
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,9 +25,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -204,12 +202,12 @@ SORT-KEY should be `name' or `iso-spec' (default `name')."
 
 (defvar non-iso-charset-alist nil
   "Obsolete.")
-(make-obsolete-variable 'non-iso-charset-alist "no longer relevant" "23.1")
+(make-obsolete-variable 'non-iso-charset-alist "no longer relevant." "23.1")
 
 (defun decode-codepage-char (codepage code)
   "Decode a character that has code CODE in CODEPAGE.
 Return a decoded character string.  Each CODEPAGE corresponds to a
-coding system cpCODEPAGE.  This function is obsolete."
+coding system cpCODEPAGE."
   (decode-char (intern (format "cp%d" codepage)) code))
 (make-obsolete 'decode-codepage-char 'decode-char "23.1")
 
@@ -255,11 +253,13 @@ detailed meanings of these arguments."
                   32
                 (or (decode-char charset (+ (* row 256) i))
                     32)))              ; gap in mapping
-      ;; Don't insert a control code.
+      ;; Don't insert control codes, non-Unicode characters.
       (if (or (< ch 32) (= ch 127))
          (setq ch (single-key-description ch))
        (if (and (>= ch 128) (< ch 160))
-           (setq ch (format "%02Xh" ch))))
+           (setq ch (format "%02Xh" ch))
+         (if (> ch #x10FFFF)
+             (setq ch 32))))
       (insert "\t" ch)
       (setq i (1+ i))))
   (insert "\n"))
@@ -341,7 +341,7 @@ detailed meanings of these arguments."
              (push c aliases)))
        (if aliases
            (insert "Aliases: " (mapconcat #'symbol-name aliases ", ") ?\n)))
-      
+
       (dolist (elt `((:ascii-compatible-p "ASCII compatible." nil)
                     (:map "Map file: " identity)
                     (:unify-map "Unification map file: " identity)
@@ -638,7 +638,7 @@ Priority order for recognizing coding systems when reading files:\n")
            coding-system codings)
        (while categories
          (setq coding-system (symbol-value (car categories)))
-         (mapcar
+         (mapc
           (lambda (x)
             (if (and (not (eq x coding-system))
                       (let ((flags (coding-system-get :flags)))
@@ -874,44 +874,46 @@ The font must be already used by Emacs."
 
     ;; Insert a requested font name.
     (dolist (elt val)
-      (let ((requested (car elt)))
-       (if (stringp requested)
-           (insert "\n    " requested)
-         (let (family registry weight slant width adstyle)
-           (if (and (fboundp 'fontp) (fontp requested))
-               (setq family (font-get requested :family)
-                     registry (font-get requested :registry)
-                     weight (font-get requested :weight)
-                     slant (font-get requested :slant)
-                     width (font-get requested :width)
-                     adstyle (font-get requested :adstyle))
-             (setq family (aref requested 0)
-                   registry (aref requested 5)
-                   weight (aref requested 1)
-                   slant (aref requested 2)
-                   width (aref requested 3)
-                   adstyle (aref requested 4)))
-           (if (not family)
-               (setq family "*-*")
-             (if (symbolp family)
-                 (setq family (symbol-name family)))
-             (or (string-match "-" family)
-                 (setq family (concat "*-" family))))
-           (if (not registry)
-               (setq registry "*-*")
-             (if (symbolp registry)
-                 (setq registry (symbol-name registry)))
-             (or (string-match "-" registry)
-                 (= (aref registry (1- (length registry))) ?*)
-                 (setq registry (concat registry "*"))))
-           (insert (format"\n    -%s-%s-%s-%s-%s-*-*-*-*-*-*-%s"
-                          family (or weight "*") (or slant "*") (or width "*")
-                          (or adstyle "*") registry)))))
-
-      ;; Insert opened font names (if any).
-      (if (and (boundp 'print-opened) (symbol-value 'print-opened))
-         (dolist (opened (cdr elt))
-           (insert "\n\t[" opened "]"))))))
+      (if (not elt)
+         (insert "\n    -- inhibit fallback fonts --")
+       (let ((requested (car elt)))
+         (if (stringp requested)
+             (insert "\n    " requested)
+           (let (family registry weight slant width adstyle)
+             (if (and (fboundp 'fontp) (fontp requested))
+                 (setq family (font-get requested :family)
+                       registry (font-get requested :registry)
+                       weight (font-get requested :weight)
+                       slant (font-get requested :slant)
+                       width (font-get requested :width)
+                       adstyle (font-get requested :adstyle))
+               (setq family (aref requested 0)
+                     registry (aref requested 5)
+                     weight (aref requested 1)
+                     slant (aref requested 2)
+                     width (aref requested 3)
+                     adstyle (aref requested 4)))
+             (if (not family)
+                 (setq family "*-*")
+               (if (symbolp family)
+                   (setq family (symbol-name family)))
+               (or (string-match "-" family)
+                   (setq family (concat "*-" family))))
+             (if (not registry)
+                 (setq registry "*-*")
+               (if (symbolp registry)
+                   (setq registry (symbol-name registry)))
+               (or (string-match "-" registry)
+                   (= (aref registry (1- (length registry))) ?*)
+                   (setq registry (concat registry "*"))))
+             (insert (format"\n    -%s-%s-%s-%s-%s-*-*-*-*-*-*-%s"
+                            family (or weight "*") (or slant "*") (or width "*")
+                            (or adstyle "*") registry)))))
+
+       ;; Insert opened font names (if any).
+       (if (and (boundp 'print-opened) (symbol-value 'print-opened))
+           (dolist (opened (cdr elt))
+             (insert "\n\t[" opened "]")))))))
 
 (defun print-fontset (fontset &optional print-opened)
   "Print information about FONTSET.
@@ -1209,7 +1211,7 @@ The list is null if CHAR isn't found in `unicodedata-file'."
                           (string-to-number (nth 2 fields))
                           '((0 . "Spacing")
                             (1 . "Overlays and interior")
-                            (7 . "Nuktas") 
+                            (7 . "Nuktas")
                             (8 . "Hiragana/Katakana voicing marks")
                             (9 . "Viramas")
                             (10 . "Start of fixed position classes")
@@ -1291,7 +1293,32 @@ character)")
                                      (string (string-to-number
                                               (nth 13 fields) 16)))))))))))
 
+;;;###autoload
+(defun font-show-log ()
+  "Show log of font listing and opening."
+  (interactive)
+  (if (eq font-log t)
+      (message "Font logging is currently suppressed")
+    (with-output-to-temp-buffer "*Help*"
+      (set-buffer standard-output)
+      (dolist (elt (reverse font-log))
+       (insert (format "%s: %s\n" (car elt) (cadr elt)))
+       (setq elt (nth 2 elt))
+       (if (or (vectorp elt) (listp elt))
+           (let ((limit 20)
+                 (i 0))
+             (catch 'tag
+               (mapc #'(lambda (x)
+                         (setq i (1+ i))
+                         (when (= i 20)
+                           (insert "  ...\n")
+                           (throw 'tag nil))
+                         (insert (format "  %s\n" x)))
+                     elt)))
+         (insert (format "  %s\n" elt)))))))
+
+
 (provide 'mule-diag)
 
-;;; arch-tag: cd3b607c-2893-45a0-a4fa-a6535754dbee
+;; arch-tag: cd3b607c-2893-45a0-a4fa-a6535754dbee
 ;;; mule-diag.el ends here