aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-09-17 17:44:47 +0000
committerDave Love2000-09-17 17:44:47 +0000
commit7d354dd5ee0448b6fa583230a575114f38c28eda (patch)
tree634bb7722afb2c2469ef58b83f27086d9cb8caea
parent6a142f266eca5da37d9ee586cfddf514c810f239 (diff)
downloademacs-7d354dd5ee0448b6fa583230a575114f38c28eda.tar.gz
emacs-7d354dd5ee0448b6fa583230a575114f38c28eda.zip
*** empty log message ***
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/international/latin1-disp.el637
2 files changed, 639 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ff250d9a607..492ef6015e7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12000-09-17 Dave Love <fx@gnu.org> 12000-09-17 Dave Love <fx@gnu.org>
2 2
3 * international/latin1-disp.el: New file.
4
3 * calendar/cal-move.el (scroll-calendar-left) 5 * calendar/cal-move.el (scroll-calendar-left)
4 (scroll-calendar-right): Make arg optional (for active mode line). 6 (scroll-calendar-right): Make arg optional (for active mode line).
5 7
diff --git a/lisp/international/latin1-disp.el b/lisp/international/latin1-disp.el
new file mode 100644
index 00000000000..94d8e08f1a9
--- /dev/null
+++ b/lisp/international/latin1-disp.el
@@ -0,0 +1,637 @@
1;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals -*- coding: emacs-mule -*-
2
3;; Copyright (C) 2000 Free Software Foundation, Inc.
4
5;; Author: Dave Love <fx@gnu.org>
6;; Keywords: i18n
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23;; Boston, MA 02111-1307, USA.
24
25;;; Commentary:
26
27;; This package sets up display of ISO 8859-n for n>1 by substituting
28;; Latin-1 characters and sequences of them for characters which can't
29;; be displayed, either beacuse we're on a tty or beacuse we don't
30;; have the relevant window system fonts available. For instance,
31;; Latin-9 is very similar to Latin-1, so we can display most Latin-9
32;; characters using the Latin-1 characters at the same code point and
33;; fall back on more-or-less mnemonic ASCII sequences for the rest.
34
35;; For the Latin charsets the ASCII sequences are mostly consistent
36;; with the Quail prefix input sequences. Latin-4 uses the Quail
37;; postfix sequences as a prefix method isn't defined for Latin-4.
38
39;; A different approach is taken in the DOS display tables in
40;; term/internal.el, and the relevant ASCII sequences from there are
41;; available as an alternative; see `latin1-display-mnemonic'. Only
42;; these sequences are used for Cyrillic, Greek and Hebrew.
43
44;; If you don't even have Latin-1, see iso-ascii.el and use the
45;; complete tables from internal.el. The ASCII sequences used here
46;; are mostly in the same style as iso-ascii.
47
48;;; Code:
49
50(defconst latin1-display-sets '(latin-2 latin-3 latin-4 latin-5 latin-8
51 latin-9 cyrillic greek hebrew)
52 "The ISO8859 character sets with defined Latin-1 display sequences.
53These are the nicknames for the sets and correspond to Emacs language
54environments.")
55
56(defgroup latin1-display ()
57 "Set up display tables for ISO8859 characters using Latin-1."
58 :version "21.1"
59 :group 'i18n)
60
61(defcustom latin1-display-format "{%s}"
62 "A format string used to display the ASCII sequences.
63The default encloses the sequence in braces, but you could just use
64\"%s\" to avoid the braces."
65 :group 'latin1-display
66 :type 'string)
67
68;;;###autoload
69(defcustom latin1-display nil
70 "Set up Latin-1/ASCII display for ISO8859 character sets.
71This is done for each character set in the list `latin1-display-sets',
72if no font is available to display it. Characters are displayed using
73the corresponding Latin-1 characters where they match. Otherwise
74ASCII sequences are used, mostly following the Latin prefix input
75methods. Some different ASCII sequences are used if
76`latin1-display-mnemonic' is non-nil.
77
78Setting this variable directly does not take effect;
79use either M-x customize of the function `latin1-display'."
80 :group 'latin1-display
81 :type 'boolean
82 :require 'latin1-disp
83 :initialize 'custom-initialize-default
84 :set (lambda (symbol value)
85 (if value
86 (mapc (if value
87 #'latin1-display-setup
88 #'latin1-display-reset)
89 latin1-display-sets))))
90
91;;;###autoload
92(defun latin1-display (&rest sets)
93 "Set up Latin-1/ASCII display for the arguments character SETS.
94See option `latin1-display' for the method. The members of the list
95must be in `latin1-display-sets'. With no arguments, reset the
96display for all of `latin1-display-sets'. See also `latin1-display-setup'."
97 (if sets
98 (mapc #'latin1-display-setup sets)
99 (mapc #'latin1-display-reset latin1-display-sets)))
100
101(defcustom latin1-display-mnemonic nil
102 "Non-nil means to display potentially more mnemonic sequences.
103These are taken from the tables in `internal.el' rather than the Quail
104input sequences."
105 :type 'boolean
106 :group 'latin1-display)
107
108(defun latin1-display-char (char display &optional alt-display)
109 "Make an entry in `standard-display-table' for CHAR using string DISPLAY.
110If ALT-DISPLAY is provided, use that instead if
111`latin1-display-mnemonic' is non-nil. The actual string displayed is
112formatted using `latin1-display-format'."
113 (if (and (stringp alt-display)
114 latin1-display-mnemonic)
115 (setq display alt-display))
116 (if (stringp display)
117 (standard-display-ascii char (format latin1-display-format display))
118 (aset standard-display-table char display)))
119
120(defun latin1-display-identities (charset)
121 "Display each character in CHARSET as the corresponding Latin-1 character.
122CHARSET is a symbol naming a language environment using an ISO8859
123character set."
124 (if (eq charset 'cyrillic)
125 (setq charset 'cyrillic-iso))
126 (let ((i 32)
127 (set (car (remq 'ascii (get-language-info charset 'charset)))))
128 (while (<= i 127)
129 (aset standard-display-table
130 (make-char set i)
131 (vector (make-char 'latin-iso8859-1 i)))
132 (setq i (1+ i)))))
133
134(defun latin1-display-reset (language)
135 "Set up the default display for each character of LANGUAGE's charset.
136CHARSET is a symbol naming a language environment using an ISO8859
137character set."
138 (if (eq language 'cyrillic)
139 (setq language 'cyrillic-iso))
140 (let ((charset (car (remq 'ascii (get-language-info language
141 'charset)))))
142 (standard-display-default (make-char charset 32)
143 (make-char charset 127)))
144 (sit-for 0))
145
146;; Is there a better way than this?
147(defun latin1-display-check-font (language)
148 "Return non-nil if we have a font with an encoding for LANGUAGE.
149LANGUAGE is a symbol naming a language environment using an ISO8859
150character set: `latin-2', `hebrew' etc."
151 (if (eq language 'cyrillic)
152 (setq language 'cyrillic-iso))
153 (if window-system
154 (let* ((info (get-language-info language 'charset))
155 (str (symbol-name (car (remq 'ascii info)))))
156 (string-match "-iso8859-[0-9]+\\'" str)
157 (x-list-fonts (concat "*" (match-string 0 str))))))
158
159(defun latin1-display-setup (set &optional force)
160 "Set up Latin-1 display for characters in the given SET.
161SET must be a member of `latin1-display-sets'. Normally, check
162whether a font for SET is available and don't set the display if it
163is. If FORCE is non-nil, set up the display regardless."
164 (cond
165 ((eq set 'latin-2)
166 (when (or force
167 (not (latin1-display-check-font set)))
168 (latin1-display-identities set)
169 (mapc
170 (lambda (l)
171 (apply 'latin1-display-char l))
172 '((? "'C" "C'")
173 (? "'D" "/D")
174 (? "'S" "S'")
175 (? "'c" "c'")
176 (? "'d" "/d")
177 (? "'L" "L'")
178 (? "'n" "n'")
179 (? "'N" "N'")
180 (? "'r" "r'")
181 (? "'R" "R'")
182 (? "'s" "s'")
183 (? "'z" "z'")
184 (? "'Z" "Z'")
185 (? "`A" "A;")
186 (? "`E" "E;")
187 (? "`L" "/L")
188 (? "`S" ",S")
189 (? "`T" ",T")
190 (? "`Z" "Z^.")
191 (? "`a" "a;")
192 (? "`l" "/l")
193 (? "`e" "e;")
194 (? "`s" ",s")
195 (? "`t" ",t")
196 (? "`z" "z^.")
197 (? "`." "'.")
198 (? "~A" "A(")
199 (? "~C" "C<")
200 (? "~D" "D<")
201 (? "~E" "E<")
202 (? "~e" "e<")
203 (? "~L" "L<")
204 (? "~N" "N<")
205 (? "~O" "O''")
206 (? "~R" "R<")
207 (? "~S" "S<")
208 (? "~T" "T<")
209 (? "~U" "U''")
210 (? "~Z" "Z<")
211 (? "~a" "a(}")
212 (? "~c" "c<")
213 (? "~d" "d<")
214 (? "~l" "l<")
215 (? "~n" "n<")
216 (? "~o" "o''")
217 (? "~r" "r<")
218 (? "~s" "s<")
219 (? "~t" "t<")
220 (? "~u" "u''")
221 (? "~z" "z<")
222 (? "~v" "'<") ; ? in latin-pre
223 (? "~~" "'(")
224 (? "uu" "u^0")
225 (? "UU" "U^0")
226 (? "\"A")
227 (? "\"a")
228 (? "\"E" "E:")
229 (? "\"e")
230 (? "''" "'")
231 (? "'<") ; Lynx's rendering of caron
232 ))))
233
234 ((eq set 'latin-3)
235 (when (or force
236 (not (latin1-display-check-font set)))
237 (latin1-display-identities set)
238 (mapc
239 (lambda (l)
240 (apply 'latin1-display-char l))
241 '((? "/H")
242 (? "~`" "'(")
243 (? "^H" "H^")
244 (? "^h" "h^") (? ".I" "I^.")
245 (? ",S")
246 (? "~G" "G(")
247 (? "^J" "J^")
248 (? ".Z" "Z^.")
249 (? "/h")
250 (? ".i" "i^.")
251 (? ",s")
252 (? "~g" "g(")
253 (? "^j" "j^")
254 (? ".Z" "z^.")
255 (? ".c" "C^.")
256 (? "^C" "C^")
257 (? ".G" "G^.")
258 (? "^G" "G^")
259 (? "~U" "U(")
260 (? "^S" "S^")
261 (? ".C" "c^.")
262 (? "^c" "c^")
263 (? ".g" "g^.")
264 (? "^g" "g^")
265 (? "~u" "u(")
266 (? "^s" "s^")
267 (? "/." "^.")))))
268
269 ((eq set 'latin-4)
270 (when (or force
271 (not (latin1-display-check-font set)))
272 (latin1-display-identities set)
273 (mapc
274 (lambda (l)
275 (apply 'latin1-display-char l))
276 '((? "A," "A;")
277 (? "k/" "kk")
278 (? "R," ",R")
279 (? "I~" "?I")
280 (? "L," ",L")
281 (? "S~" "S<")
282 (? "E-")
283 (? "G," ",G")
284 (? "T/" "/T")
285 (? "Z~" "Z<")
286 (? "a," "a;")
287 (? "';")
288 (? "r," ",r")
289 (? "i~" "~i")
290 (? "l," ",l")
291 (? "'<")
292 (? "s~" "s<")
293 (? "e-")
294 (? "g," ",g")
295 (? "t/" "/t")
296 (? "N/" "NG")
297 (? "z~" "z<")
298 (? "n/" "ng")
299 (? "A-")
300 (? "I," "I;")
301 (? "C~" "C<")
302 (? "E," "E;")
303 (? "E." "E^.")
304 (? "I-")
305 (? "N," ",N")
306 (? "O-")
307 (? "K," ",K")
308 (? "U," "U;")
309 (? "U~" "~U")
310 (? "U-")
311 (? "a-")
312 (? "i," "i;")
313 (? "c~" "c<")
314 (? "e," "e;")
315 (? "e." "e^.")
316 (? "i-")
317 (? "d/" "/d")
318 (? "n," ",n")
319 (? "o-")
320 (? "k," ",k")
321 (? "u," "u;")
322 (? "u~" "~u")
323 (? "u-")
324 (? "^.")))))
325
326 ((eq set 'latin-5)
327 (when (or force
328 (not (latin1-display-check-font set)))
329 (latin1-display-identities set)
330 (mapc
331 (lambda (l)
332 (apply 'latin1-display-char l))
333 '((? "~g" "g(")
334 (? "~G" "G(")
335 (? ".I" "I^.")
336 (? ",s")
337 (? ",S")
338 (? "^e" "e<") ; from latin-post
339 (? ".e" "e^.")
340 (? "\"i" "i-") ; from latin-post
341 (? ".i" "i.")))))
342
343 ((eq set 'latin-8)
344 (when (or force
345 (not (latin1-display-check-font set)))
346 (latin1-display-identities set)
347 (mapc
348 (lambda (l)
349 (apply 'latin1-display-char l))
350 '((? ".B" "B`")
351 (? ".b" "b`")
352 (? ".c" "c`")
353 (? ".C" "C`")
354 (? ".D" "D`")
355 (? ".d" "d`")
356 (? "`w")
357 (? "`W")
358 (? "'w" "w'")
359 (? "'W" "W'")
360 (? "`y")
361 (? "`Y")
362 (? ".f" "f`")
363 (? ".F" "F`")
364 (? ".g" "g`")
365 (? ".G" "G`")
366 (? ".m" "m`")
367 (? ".M" "M`")
368 (? ".p" "p`")
369 (? ".P" "P`")
370 (? ".s" "s`")
371 (? ".S" "S`")
372 (? "\"w")
373 (? "\"W")
374 (? "^w" "w^")
375 (? "^W" "W^")
376 (? ".t" "t`")
377 (? ".T" "T`")
378 (? "^y" "y^")
379 (? "^Y" "Y^")
380 (? "\"Y")))))
381
382 ((eq set 'latin-9)
383 (when (or force
384 (not (latin1-display-check-font set)))
385 (latin1-display-identities set)
386 (mapc
387 (lambda (l)
388 (apply 'latin1-display-char l))
389 '((? "~s" "s<")
390 (? "~S" "S<")
391 (? "Euro" "E=")
392 (? "~z" "z<")
393 (? "~Z" "Z<")
394 (? "\"Y")
395 (? "oe")
396 (? "OE")))))
397
398 ((eq set 'greek)
399 (when (or force
400 (not (latin1-display-check-font set)))
401 (mapc
402 (lambda (l)
403 (apply 'latin1-display-char l))
404 '((? "9'")
405 (? "'9")
406 (? "-M")
407 (? "'%")
408 (? "'A")
409 (? "'E")
410 (? "'H")
411 (? "'I")
412 (? "'O")
413 (? "'Y")
414 (? "W%")
415 (? "i3")
416 (? "G*")
417 (? "D*")
418 (? "TH")
419 (? "L*")
420 (? "C*")
421 (? "P*")
422 (? "S*")
423 (? "F*")
424 (? "Q*")
425 (? "W*")
426 (? "\"I")
427 (? "\"Y")
428 (? "a%")
429 (? "e%")
430 (? "y%")
431 (? "i%")
432 (? "u3")
433 (? "a*")
434 (? "b*")
435 (? "g*")
436 (? "d*")
437 (? "e*")
438 (? "z*")
439 (? "y*")
440 (? "h*")
441 (? "i*")
442 (? "k")
443 (? "l*")
444 (? "m*")
445 (? "n*")
446 (? "c*")
447 (? "p*")
448 (? "r*")
449 (? "*s")
450 (? "s*")
451 (? "t*")
452 (? "u")
453 (? "f*")
454 (? "x*")
455 (? "q*")
456 (? "w*")
457 (? "\"i")
458 (? "\"u")
459 (? "'o")
460 (? "'u")
461 (? "'w")))
462 (mapc
463 (lambda (l)
464 (aset standard-display-table (car l) (string-to-vector (cadr l))))
465 '((? "A")
466 (? "B")
467 (? "E")
468 (? "Z")
469 (? "H")
470 (? "I")
471 (? "J")
472 (? "M")
473 (? "N")
474 (? "O")
475 (? "P")
476 (? "T")
477 (? "Y")
478 (? "X")
479 (? "o")))))
480
481 ((eq set 'hebrew)
482 (when (or force
483 (not (latin1-display-check-font set)))
484 ;; Don't start with identities, since we don't have definitions
485 ;; for a lot of Hebrew in internal.el. (Intlfonts is also
486 ;; missing some glyphs.)
487 (let ((i 34))
488 (while (<= i 62)
489 (aset standard-display-table
490 (make-char 'hebrew-iso8859-8 i)
491 (vector (make-char 'latin-iso8859-1 i)))
492 (setq i (1+ i))))
493 (mapc
494 (lambda (l)
495 (aset standard-display-table (car l) (string-to-vector (cadr l))))
496 '((? "=2")
497 (? "A+")
498 (? "B+")
499 (? "G+")
500 (? "D+")
501 (? "H+")
502 (? "W+")
503 (? "Z+")
504 (? "X+")
505 (? "Tj")
506 (? "J+")
507 (? "K%")
508 (? "K+")
509 (? "L+")
510 (? "M%")
511 (? "M+")
512 (? "N%")
513 (? "N+")
514 (? "S+")
515 (? "E+")
516 (? "P%")
517 (? "P+")
518 (? "Zj")
519 (? "ZJ")
520 (? "Q+")
521 (? "R+")
522 (? "Sh")
523 (? "T+")))))
524
525 ((eq set 'cyrillic)
526 (setq set 'cyrillic-iso)
527 (when (or force
528 (not (latin1-display-check-font set)))
529 (mapc
530 (lambda (l)
531 (apply 'latin1-display-char l))
532 '((? "Dj")
533 (? "Gj")
534 (? "IE")
535 (? "Lj")
536 (? "Nj")
537 (? "Ts")
538 (? "Kj")
539 (? "V%")
540 (? "Dzh")
541 (? "B=")
542 (? "")
543 (? "D")
544 (? "Z%")
545 (? "3")
546 (? "U")
547 (? "J=")
548 (? "L=")
549 (? "P=")
550 (? "Y")
551 (? "")
552 (? "C=")
553 (? "C%")
554 (? "S%")
555 (? "Sc")
556 (? "=\"")
557 (? "Y=")
558 (? "%\"")
559 (? "Ee")
560 (? "Yu")
561 (? "Ya")
562 (? "b")
563 (? "v=")
564 (? "g=")
565 (? "g")
566 (? "z%")
567 (? "z=")
568 (? "u")
569 (? "j=")
570 (? "k")
571 (? "l=")
572 (? "m=")
573 (? "n=")
574 (? "n")
575 (? "p")
576 (? "t=")
577 (? "f=")
578 (? "c=")
579 (? "c%")
580 (? "s%")
581 (? "sc")
582 (? "='")
583 (? "y=")
584 (? "%'")
585 (? "ee")
586 (? "yu")
587 (? "ya")
588 (? "N0")
589 (? "dj")
590 (? "gj")
591 (? "ie")
592 (? "lj")
593 (? "nj")
594 (? "ts")
595 (? "kj")
596 (? "v%")
597 (? "dzh")))
598 (mapc
599 (lambda (l)
600 (aset standard-display-table (car l) (string-to-vector (cadr l))))
601 '((? "")
602 (? "S")
603 (? "I")
604 (? "")
605 (? "J")
606 (? "")
607 (? "")
608 (? "-")
609 (? "A")
610 (? "B")
611 (? "E")
612 (? "K")
613 (? "M")
614 (? "H")
615 (? "O")
616 (? "P")
617 (? "C")
618 (? "T")
619 (? "X")
620 (? "a")
621 (? "e")
622 (? "o")
623 (? "c")
624 (? "y")
625 (? "x")
626 (? "s")
627 (? "i")
628 (? "")
629 (? "j")))))
630
631 (t (error "Unsupported character set: %S" set)))
632
633 (sit-for 0))
634
635(provide 'latin1-disp)
636
637;;; latin1-disp.el ends here