]> code.delx.au - gnu-emacs/blobdiff - lisp/disp-table.el
Fix race conditions with MS-Windows lock files by using _sopen.
[gnu-emacs] / lisp / disp-table.el
index 286c8f319ff99cb312cd4538ece8c249f3a030c1..423648f70b5c0fc114e225688a6261bdf84a1337 100644 (file)
@@ -1,12 +1,13 @@
 ;;; disp-table.el --- functions for dealing with char tables
 
-;; Copyright (C) 1987, 1994, 1995, 1999, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 1994-1995, 1999, 2001-2013 Free Software
+;; Foundation, Inc.
 
 ;; Author: Erik Naggum <erik@naggum.no>
 ;; Based on a previous version by Howard Gayle
 ;; Maintainer: FSF
 ;; Keywords: i18n
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -93,9 +94,27 @@ Valid symbols are `truncation', `wrap', `escape', `control',
        (while (< i 256)
          (aset vector i (aref dt i))
          (setq i (1+ i)))
-       (describe-vector vector))
+       (describe-vector
+        vector 'display-table-print-array))
       (help-mode))))
 
+(defun display-table-print-array (desc)
+  (insert "[")
+  (let ((column (current-column))
+       (width (window-width))
+       string)
+    (dotimes (i (length desc))
+      (setq string (format "%s" (aref desc i)))
+      (cond
+       ((>= (+ (current-column) (length string) 1)
+           width)
+       (insert "\n")
+       (insert (make-string column ? )))
+       ((> i 0)
+       (insert " ")))
+      (insert string)))
+  (insert "]\n"))
+
 ;;;###autoload
 (defun describe-current-display-table ()
   "Describe the display table in use in the selected window and buffer."
@@ -109,11 +128,27 @@ Valid symbols are `truncation', `wrap', `escape', `control',
 
 ;;;###autoload
 (defun standard-display-8bit (l h)
-  "Display characters in the range L to H literally."
+  "Display characters representing raw bytes in the range L to H literally.
+
+On a terminal display, each character in the range is displayed
+by sending the corresponding byte directly to the terminal.
+
+On a graphic display, each character in the range is displayed
+using the default font by a glyph whose code is the corresponding
+byte.
+
+Note that ASCII printable characters (SPC to TILDA) are displayed
+in the default way after this call."
   (or standard-display-table
       (setq standard-display-table (make-display-table)))
+  (if (> h 255)
+      (setq h 255))
   (while (<= l h)
-    (aset standard-display-table l (if (or (< l ?\s) (>= l 127)) (vector l)))
+    (if (< l 128)
+       (aset standard-display-table l
+             (if (or (< l ?\s) (= l 127)) (vector l)))
+      (let ((c (unibyte-char-to-multibyte l)))
+       (aset standard-display-table c (vector c))))
     (setq l (1+ l))))
 
 ;;;###autoload
@@ -235,9 +270,12 @@ in `.emacs'."
          (and (null arg)
               (char-table-p standard-display-table)
               ;; Test 161, because 160 displays as a space.
-              (equal (aref standard-display-table 161) [161])))
+              (equal (aref standard-display-table
+                           (unibyte-char-to-multibyte 161))
+                     (vector (unibyte-char-to-multibyte 161)))))
       (progn
-       (standard-display-default 160 255)
+       (standard-display-default
+        (unibyte-char-to-multibyte 160) (unibyte-char-to-multibyte 255))
        (unless (or (memq window-system '(x w32 ns)))
          (and (terminal-coding-system)
               (set-terminal-coding-system nil))))
@@ -261,5 +299,4 @@ in `.emacs'."
 
 (provide 'disp-table)
 
-;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7
 ;;; disp-table.el ends here