]> code.delx.au - gnu-emacs/blobdiff - lisp/international/iso-ascii.el
* international/mule-cmds.el (register-input-method); Purecopy arguments.
[gnu-emacs] / lisp / international / iso-ascii.el
index 8a8f19617fa11a0ca508a2742a87ce016aecef47..c2eedc05353f3ef0ec9e02e61ba7e544057b8807 100644 (file)
@@ -1,6 +1,7 @@
-;;; 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  Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;; Maintainer: FSF
@@ -8,10 +9,10 @@
 
 ;; 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
@@ -19,8 +20,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, 675 Mass Ave, Cambridge, MA 02139, 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
@@ -65,7 +87,7 @@
 (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