iso-ascii.el 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ;;; iso-ascii.el --- set up char tables for ISO 8859/1 on ASCII terminals
  2. ;; Copyright (C) 1987, 1995, 1998, 2001-2012 Free Software Foundation, Inc.
  3. ;; Author: Howard Gayle
  4. ;; Maintainer: FSF
  5. ;; Keywords: i18n
  6. ;; This file is part of GNU Emacs.
  7. ;; GNU Emacs is free software: you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation, either version 3 of the License, or
  10. ;; (at your option) any later version.
  11. ;; GNU Emacs is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  17. ;;; Commentary:
  18. ;; Written by Howard Gayle. See display-table.el for details.
  19. ;; This code sets up to display ISO 8859/1 characters on plain
  20. ;; ASCII terminals. The display strings for the characters are
  21. ;; more-or-less based on TeX.
  22. ;;; Code:
  23. (require 'disp-table)
  24. (eval-when-compile (require 'cl))
  25. (defgroup iso-ascii nil
  26. "Set up char tables for ISO 8859/1 on ASCII terminals."
  27. :prefix "iso-ascii-"
  28. :group 'i18n)
  29. (defcustom iso-ascii-convenient nil
  30. "Non-nil means `iso-ascii' should aim for convenience, not precision."
  31. :type 'boolean
  32. :group 'iso-ascii)
  33. (defvar iso-ascii-display-table (make-display-table)
  34. "Display table used for ISO-ASCII mode.")
  35. (defvar iso-ascii-standard-display-table nil
  36. "Display table used when not in ISO-ASCII mode.")
  37. ;; Don't alter iso-ascii-standard-display-table if this file is loaded again,
  38. ;; or even by using C-M-x on any of the expressions.
  39. (unless iso-ascii-standard-display-table
  40. (setq iso-ascii-standard-display-table
  41. standard-display-table))
  42. (defun iso-ascii-display (code string &optional convenient-string)
  43. (if iso-ascii-convenient
  44. (setq string (or convenient-string string))
  45. (setq string (concat "{" string "}")))
  46. ;; unibyte
  47. (aset iso-ascii-display-table code string)
  48. ;; multibyte
  49. (aset iso-ascii-display-table (make-char 'latin-iso8859-1 (- code 128))
  50. string))
  51. (iso-ascii-display 160 "_" " ") ; NBSP (no-break space)
  52. (iso-ascii-display 161 "!") ; inverted exclamation mark
  53. (iso-ascii-display 162 "c") ; cent sign
  54. (iso-ascii-display 163 "GBP") ; pound sign
  55. (iso-ascii-display 164 "$") ; general currency sign
  56. (iso-ascii-display 165 "JPY") ; yen sign
  57. (iso-ascii-display 166 "|") ; broken vertical line
  58. (iso-ascii-display 167 "S" "(S)") ; section sign
  59. (iso-ascii-display 168 "\"") ; diaeresis
  60. (iso-ascii-display 169 "C" "(C)") ; copyright sign
  61. (iso-ascii-display 170 "_a") ; ordinal indicator, feminine
  62. (iso-ascii-display 171 "<<") ; left angle quotation mark
  63. (iso-ascii-display 172 "~") ; not sign
  64. (iso-ascii-display 173 "-") ; soft hyphen
  65. (iso-ascii-display 174 "R" "(R)") ; registered sign
  66. (iso-ascii-display 175 "=") ; macron
  67. (iso-ascii-display 176 "o") ; degree sign
  68. (iso-ascii-display 177 "+-") ; plus or minus sign
  69. (iso-ascii-display 178 "2") ; superscript two
  70. (iso-ascii-display 179 "3") ; superscript three
  71. (iso-ascii-display 180 "'") ; acute accent
  72. (iso-ascii-display 181 "u") ; micro sign
  73. (iso-ascii-display 182 "P" "(P)") ; pilcrow
  74. (iso-ascii-display 183 ".") ; middle dot
  75. (iso-ascii-display 184 ",") ; cedilla
  76. (iso-ascii-display 185 "1") ; superscript one
  77. (iso-ascii-display 186 "_o") ; ordinal indicator, masculine
  78. (iso-ascii-display 187 ">>") ; right angle quotation mark
  79. (iso-ascii-display 188 "1/4") ; fraction one-quarter
  80. (iso-ascii-display 189 "1/2") ; fraction one-half
  81. (iso-ascii-display 190 "3/4") ; fraction three-quarters
  82. (iso-ascii-display 191 "?") ; inverted question mark
  83. (iso-ascii-display 192 "`A") ; A with grave accent
  84. (iso-ascii-display 193 "'A") ; A with acute accent
  85. (iso-ascii-display 194 "^A") ; A with circumflex accent
  86. (iso-ascii-display 195 "~A") ; A with tilde
  87. (iso-ascii-display 196 "\"A") ; A with diaeresis or umlaut mark
  88. (iso-ascii-display 197 "AA") ; A with ring
  89. (iso-ascii-display 198 "AE") ; AE diphthong
  90. (iso-ascii-display 199 ",C") ; C with cedilla
  91. (iso-ascii-display 200 "`E") ; E with grave accent
  92. (iso-ascii-display 201 "'E") ; E with acute accent
  93. (iso-ascii-display 202 "^E") ; E with circumflex accent
  94. (iso-ascii-display 203 "\"E") ; E with diaeresis or umlaut mark
  95. (iso-ascii-display 204 "`I") ; I with grave accent
  96. (iso-ascii-display 205 "'I") ; I with acute accent
  97. (iso-ascii-display 206 "^I") ; I with circumflex accent
  98. (iso-ascii-display 207 "\"I") ; I with diaeresis or umlaut mark
  99. (iso-ascii-display 208 "-D") ; D with stroke, Icelandic eth
  100. (iso-ascii-display 209 "~N") ; N with tilde
  101. (iso-ascii-display 210 "`O") ; O with grave accent
  102. (iso-ascii-display 211 "'O") ; O with acute accent
  103. (iso-ascii-display 212 "^O") ; O with circumflex accent
  104. (iso-ascii-display 213 "~O") ; O with tilde
  105. (iso-ascii-display 214 "\"O") ; O with diaeresis or umlaut mark
  106. (iso-ascii-display 215 "x") ; multiplication sign
  107. (iso-ascii-display 216 "/O") ; O with slash
  108. (iso-ascii-display 217 "`U") ; U with grave accent
  109. (iso-ascii-display 218 "'U") ; U with acute accent
  110. (iso-ascii-display 219 "^U") ; U with circumflex accent
  111. (iso-ascii-display 220 "\"U") ; U with diaeresis or umlaut mark
  112. (iso-ascii-display 221 "'Y") ; Y with acute accent
  113. (iso-ascii-display 222 "TH") ; capital thorn, Icelandic
  114. (iso-ascii-display 223 "ss") ; small sharp s, German
  115. (iso-ascii-display 224 "`a") ; a with grave accent
  116. (iso-ascii-display 225 "'a") ; a with acute accent
  117. (iso-ascii-display 226 "^a") ; a with circumflex accent
  118. (iso-ascii-display 227 "~a") ; a with tilde
  119. (iso-ascii-display 228 "\"a") ; a with diaeresis or umlaut mark
  120. (iso-ascii-display 229 "aa") ; a with ring
  121. (iso-ascii-display 230 "ae") ; ae diphthong
  122. (iso-ascii-display 231 ",c") ; c with cedilla
  123. (iso-ascii-display 232 "`e") ; e with grave accent
  124. (iso-ascii-display 233 "'e") ; e with acute accent
  125. (iso-ascii-display 234 "^e") ; e with circumflex accent
  126. (iso-ascii-display 235 "\"e") ; e with diaeresis or umlaut mark
  127. (iso-ascii-display 236 "`i") ; i with grave accent
  128. (iso-ascii-display 237 "'i") ; i with acute accent
  129. (iso-ascii-display 238 "^i") ; i with circumflex accent
  130. (iso-ascii-display 239 "\"i") ; i with diaeresis or umlaut mark
  131. (iso-ascii-display 240 "-d") ; d with stroke, Icelandic eth
  132. (iso-ascii-display 241 "~n") ; n with tilde
  133. (iso-ascii-display 242 "`o") ; o with grave accent
  134. (iso-ascii-display 243 "'o") ; o with acute accent
  135. (iso-ascii-display 244 "^o") ; o with circumflex accent
  136. (iso-ascii-display 245 "~o") ; o with tilde
  137. (iso-ascii-display 246 "\"o") ; o with diaeresis or umlaut mark
  138. (iso-ascii-display 247 "/") ; division sign
  139. (iso-ascii-display 248 "/o") ; o with slash
  140. (iso-ascii-display 249 "`u") ; u with grave accent
  141. (iso-ascii-display 250 "'u") ; u with acute accent
  142. (iso-ascii-display 251 "^u") ; u with circumflex accent
  143. (iso-ascii-display 252 "\"u") ; u with diaeresis or umlaut mark
  144. (iso-ascii-display 253 "'y") ; y with acute accent
  145. (iso-ascii-display 254 "th") ; small thorn, Icelandic
  146. (iso-ascii-display 255 "\"y") ; small y with diaeresis or umlaut mark
  147. (define-minor-mode iso-ascii-mode
  148. "Toggle ISO-ASCII mode.
  149. With a prefix argument ARG, enable the mode if ARG is positive,
  150. and disable it otherwise. If called from Lisp, enable the mode
  151. if ARG is omitted or nil."
  152. :variable (eq standard-display-table iso-ascii-display-table)
  153. (unless standard-display-table
  154. (setq standard-display-table iso-ascii-standard-display-table)))
  155. (provide 'iso-ascii)
  156. ;;; iso-ascii.el ends here