-;;; iso-ascii.el --- set up char tables for ISO 8859/1 on ASCII terminals.
+;;; iso-ascii.el --- set up char tables for ISO 8859/1 on ASCII terminals
-;; Copyright (C) 1987, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 1995, 1998, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: Howard Gayle
;; Maintainer: FSF
;; 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 2, 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
;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(require 'disp-table)
-(defvar iso-ascii-convenient nil
- "*Non-nil means `iso-ascii' should aim for convenience, not precision.")
+(defgroup iso-ascii nil
+ "Set up char tables for ISO 8859/1 on ASCII terminals."
+ :prefix "iso-ascii-"
+ :group 'i18n)
+
+(defcustom iso-ascii-convenient nil
+ "*Non-nil means `iso-ascii' should aim for convenience, not precision."
+ :type 'boolean
+ :group 'iso-ascii)
+
+(defvar iso-ascii-display-table (make-display-table)
+ "Display table used for ISO-ASCII mode.")
+
+(defvar iso-ascii-standard-display-table nil
+ "Display table used when not in ISO-ASCII mode.")
+;; Don't alter iso-ascii-standard-display-table if this file is loaded again,
+;; or even by using C-M-x on any of the expressions.
+(unless iso-ascii-standard-display-table
+ (setq iso-ascii-standard-display-table
+ standard-display-table))
(defun iso-ascii-display (code string &optional convenient-string)
(if iso-ascii-convenient
(setq string (or convenient-string string))
(setq string (concat "{" string "}")))
- (standard-display-ascii code string))
+ ;; unibyte
+ (aset iso-ascii-display-table code string)
+ ;; multibyte
+ (aset iso-ascii-display-table (make-char 'latin-iso8859-1 (- code 128))
+ string))
(iso-ascii-display 160 "_" " ") ; NBSP (no-break space)
(iso-ascii-display 161 "!") ; inverted exclamation mark
(iso-ascii-display 179 "3") ; superscript three
(iso-ascii-display 180 "'") ; acute accent
(iso-ascii-display 181 "u") ; micro sign
-(iso-ascii-display 182 "P" "{P}") ; pilcrow
+(iso-ascii-display 182 "P" "(P)") ; pilcrow
(iso-ascii-display 183 ".") ; middle dot
(iso-ascii-display 184 ",") ; cedilla
(iso-ascii-display 185 "1") ; superscript one
(iso-ascii-display 254 "th") ; small thorn, Icelandic
(iso-ascii-display 255 "\"y") ; small y with diaeresis or umlaut mark
+(defun iso-ascii-mode (arg)
+ "Toggle ISO-ASCII mode."
+ (interactive "P")
+ (unless arg
+ (setq arg (eq standard-display-table iso-ascii-standard-display-table)))
+ (setq standard-display-table
+ (if arg
+ iso-ascii-display-table
+ iso-ascii-standard-display-table)))
+
(provide 'iso-ascii)
+;; arch-tag: 687edf0d-f792-471e-b50e-be805938359a
;;; iso-ascii.el ends here