;;; disp-table.el --- functions for dealing with char tables
-;; Copyright (C) 1987, 1994, 1995, 1999, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 1994, 1995, 1999, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Erik Naggum <erik@naggum.no>
;; Based on a previous version by Howard Gayle
;; 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 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;;;###autoload
(defun describe-display-table (dt)
"Describe the display table DT in a help buffer."
- (with-output-to-temp-buffer "*Help*"
+ (with-help-window "*Help*"
(princ "\nTruncation glyph: ")
(prin1 (display-table-slot dt 'truncation))
(princ "\nWrap glyph: ")
(aset vector i (aref dt i))
(setq i (1+ i)))
(describe-vector vector))
- (help-mode))
- (print-help-return-message)))
+ (help-mode))))
;;;###autoload
(defun describe-current-display-table ()
(or standard-display-table
(setq standard-display-table (make-display-table)))
(while (<= l h)
- (aset standard-display-table l (if (or (< l ?\ ) (>= l 127)) (vector l)))
+ (aset standard-display-table l (if (or (< l ?\s) (>= l 127)) (vector l)))
(setq l (1+ l))))
;;;###autoload
(or standard-display-table
(setq standard-display-table (make-display-table)))
(while (<= l h)
- (if (and (>= l ?\ ) (char-valid-p l))
+ (if (and (>= l ?\s) (char-valid-p l))
(aset standard-display-table l nil))
(setq l (1+ l))))
(aset standard-display-table c
(vector
(if window-system
- (logior uc (lsh (face-id 'underline) 19))
+ (make-glyph-code uc 'underline)
(create-glyph (concat "\e[4m" (char-to-string uc) "\e[m"))))))
;;;###autoload
(setq glyph-table (vconcat glyph-table (list string)))
(1- (length glyph-table)))
+;;;###autoload
+(defun make-glyph-code (char &optional face)
+ "Return a glyph code representing char CHAR with face FACE."
+ ;; Due to limitations on Emacs integer values, faces with
+ ;; face id greater that 4091 are silently ignored.
+ (if (and face (<= (face-id face) #xfff))
+ (logior char (lsh (face-id face) 19))
+ char))
+
+;;;###autoload
+(defun glyph-char (glyph)
+ "Return the character of glyph code GLYPH."
+ (logand glyph #x7ffff))
+
+;;;###autoload
+(defun glyph-face (glyph)
+ "Return the face of glyph code GLYPH, or nil if glyph has default face."
+ (let ((face-id (lsh glyph -19)))
+ (and (> face-id 0)
+ (car (delq nil (mapcar (lambda (face)
+ (and (eq (get face 'face) face-id)
+ face))
+ (face-list)))))))
+
;;;###autoload
(defun standard-display-european (arg)
"Semi-obsolete way to toggle display of ISO 8859 European characters.
variable, or else customize `enable-multibyte-characters'.
With prefix argument, this command enables European character display
-if arg is positive, disables it otherwise. Otherwise, it toggles
+if ARG is positive, disables it otherwise. Otherwise, it toggles
European character display.
When this mode is enabled, characters in the range of 160 to 255
(set-terminal-coding-system nil))))
(display-warning 'i18n
- "`standard-display-european' is semi-obsolete"
+ "`standard-display-european' is semi-obsolete; see its doc string for details"
:warning)
;; Switch to Latin-1 language environment
;; unless some other has been specified.
(if (equal current-language-environment "English")
(set-language-environment "latin-1"))
- (unless (or noninteractive (memq window-system '(x w32)))
+ (unless (or noninteractive (memq window-system '(x w32 mac)))
;; Send those codes literally to a character-based terminal.
;; If we are using single-byte characters,
;; it doesn't matter which coding system we use.
(provide 'disp-table)
-;;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7
+;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7
;;; disp-table.el ends here