;;; disp-table.el --- functions for dealing with char tables;; Copyright (C) 1987, 1994, 1995, 1999, 2002, 2003, 2004,;; 2005, 2006 Free Software Foundation, Inc.;; Author: Erik Naggum <erik@naggum.no>;; Based on a previous version by Howard Gayle;; Maintainer: FSF;; Keywords: i18n;; This file is part of GNU Emacs.;; 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);; 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;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the;; 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.;;; Commentary:;;; Code:(put'display-table'char-table-extra-slots6);;;###autoload(defunmake-display-table()"Return a new, empty display table."(make-char-table'display-tablenil))(orstandard-display-table(setqstandard-display-table(make-display-table)));;; Display-table slot names. The property value says which slot.(put'truncation'display-table-slot0)(put'wrap'display-table-slot1)(put'escape'display-table-slot2)(put'control'display-table-slot3)(put'selective-display'display-table-slot4)(put'vertical-border'display-table-slot5);;;###autoload(defundisplay-table-slot(display-tableslot)"Return the value of the extra slot in DISPLAY-TABLE named SLOT.SLOT may be a number from 0 to 5 inclusive, or a slot name (symbol).Valid symbols are `truncation', `wrap', `escape', `control',`selective-display', and `vertical-border'."(let((slot-number(if(numberpslot)slot(or(getslot'display-table-slot)(error"Invalid display-table slot name: %s"slot)))))(char-table-extra-slotdisplay-tableslot-number)));;;###autoload(defunset-display-table-slot(display-tableslotvalue)"Set the value of the extra slot in DISPLAY-TABLE named SLOT to VALUE.SLOT may be a number from 0 to 5 inclusive, or a name (symbol).Valid symbols are `truncation', `wrap', `escape', `control',`selective-display', and `vertical-border'."(let((slot-number(if(numberpslot)slot(or(getslot'display-table-slot)(error"Invalid display-table slot name: %s"slot)))))(set-char-table-extra-slotdisplay-tableslot-numbervalue)));;;###autoload(defundescribe-display-table(dt)"Describe the display table DT in a help buffer."(with-output-to-temp-buffer"*Help*"(princ"\nTruncation glyph: ")(prin1(display-table-slotdt'truncation))(princ"\nWrap glyph: ")(prin1(display-table-slotdt'wrap))(princ"\nEscape glyph: ")(prin1(display-table-slotdt'escape))(princ"\nCtrl glyph: ")(prin1(display-table-slotdt'control))(princ"\nSelective display glyph sequence: ")(prin1(display-table-slotdt'selective-display))(princ"\nVertical window border glyph: ")(prin1(display-table-slotdt'vertical-border))(princ"\nCharacter display glyph sequences:\n")(save-excursion(set-bufferstandard-output)(let((vector(make-vector256nil))(i0))(while(<i256)(asetvectori(arefdti))(setqi(1+i)))(describe-vectorvector))(help-mode))(print-help-return-message)));;;###autoload(defundescribe-current-display-table()"Describe the display table in use in the selected window and buffer."(interactive)(let((disptab(or(window-display-table(selected-window))buffer-display-tablestandard-display-table)))(ifdisptab(describe-display-tabledisptab)(message"No display table"))));;;###autoload(defunstandard-display-8bit(lh)"Display characters in the range L to H literally."(orstandard-display-table(setqstandard-display-table(make-display-table)))(while(<=lh)(asetstandard-display-tablel(if(or(<l?\ )(>=l127))(vectorl)))(setql(1+l))));;;###autoload(defunstandard-display-default(lh)"Display characters in the range L to H using the default notation."(orstandard-display-table(setqstandard-display-table(make-display-table)))(while(<=lh)(if(and(>=l?\ )(char-valid-pl))(asetstandard-display-tablelnil))(setql(1+l))));; This function does NOT take terminal-dependent escape sequences.;; For that, you need to go through create-glyph. Use one of the;; other functions below, or roll your own.;;;###autoload(defunstandard-display-ascii(cs)"Display character C using printable string S."(orstandard-display-table(setqstandard-display-table(make-display-table)))(asetstandard-display-tablec(vconcats)));;;###autoload(defunstandard-display-g1(csc)"Display character C as character SC in the g1 character set.This function assumes that your terminal uses the SO/SI characters;it is meaningless for an X frame."(if(memqwindow-system'(xw32mac))(error"Cannot use string glyphs in a windowing system"))(orstandard-display-table(setqstandard-display-table(make-display-table)))(asetstandard-display-tablec(vector(create-glyph(concat"\016"(char-to-stringsc)"\017")))));;;###autoload(defunstandard-display-graphic(cgc)"Display character C as character GC in graphics character set.This function assumes VT100-compatible escapes; it is meaningless for anX frame."(if(memqwindow-system'(xw32mac))(error"Cannot use string glyphs in a windowing system"))(orstandard-display-table(setqstandard-display-table(make-display-table)))(asetstandard-display-tablec(vector(create-glyph(concat"\e(0"(char-to-stringgc)"\e(B")))));;;###autoload(defunstandard-display-underline(cuc)"Display character C as character UC plus underlining."(orstandard-display-table(setqstandard-display-table(make-display-table)))(asetstandard-display-tablec(vector(ifwindow-system(logioruc(lsh(face-id'underline)19))(create-glyph(concat"\e[4m"(char-to-stringuc)"\e[m"))))));;;###autoload(defuncreate-glyph(string)"Allocate a glyph code to display by sending STRING to the terminal."(if(=(lengthglyph-table)65536)(error"No free glyph codes remain"));; Don't use slots that correspond to ASCII characters.(if(=(lengthglyph-table)32)(setqglyph-table(vconcatglyph-table(make-vector224nil))))(setqglyph-table(vconcatglyph-table(liststring)))(1-(lengthglyph-table)));;;###autoload(defunstandard-display-european(arg)"Semi-obsolete way to toggle display of ISO 8859 European characters.This function is semi-obsolete; if you want to do your editing withunibyte characters, it is better to `set-language-environment' coupledwith either the `--unibyte' option or the EMACS_UNIBYTE environmentvariable, or else customize `enable-multibyte-characters'.With prefix argument, this command enables European character displayif arg is positive, disables it otherwise. Otherwise, it togglesEuropean character display.When this mode is enabled, characters in the range of 160 to 255display not as octal escapes, but as accented characters. Codes 146and 160 display as apostrophe and space, even though they are not theASCII codes for apostrophe and space.Enabling European character display with this command noninteractivelyfrom Lisp code also selects Latin-1 as the language environment, andselects unibyte mode for all Emacs buffers \(both existing buffers andthose created subsequently). This provides increased compatibilityfor users who call this function in `.emacs'."(if(or(<=(prefix-numeric-valuearg)0)(and(nullarg)(char-table-pstandard-display-table);; Test 161, because 160 displays as a space.(equal(arefstandard-display-table161)[161])))(progn(standard-display-default160255)(unless(or(memqwindow-system'(xw32mac)))(and(terminal-coding-system)(set-terminal-coding-systemnil))))(display-warning'i18n"`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(equalcurrent-language-environment"English")(set-language-environment"latin-1"))(unless(ornoninteractive(memqwindow-system'(xw32mac)));; 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.(set-terminal-coding-system(let((c(intern(downcasecurrent-language-environment))))(if(coding-system-pc)c'latin-1))))(standard-display-european-internal)))(provide'disp-table);;; arch-tag: ffe4c28c-960c-47aa-b8a8-ae89d371ffc7;;; disp-table.el ends here