annotate lisp/mule/general-late.el @ 5611:d489e88450aa

Correct the docstring for posix-charset-to-coding-system-hash, mule-cmds.el lisp/ChangeLog addition: 2011-12-10 Aidan Kehoe <kehoea@parhasard.net> * mule/mule-cmds.el (posix-charset-to-coding-system-hash): Correct the docstring for this variable.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 10 Dec 2011 16:19:16 +0000
parents 10f179710250
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
1 ;;; general-late.el --- General Mule code that needs to be run late when
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
2 ;; dumping.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
3 ;; Copyright (C) 2006 Free Software Foundation
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
4
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
5 ;; Author: Aidan Kehoe
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
6
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
7 ;; This file is part of XEmacs.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
8
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
9 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
10 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
11 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
12 ;; option) any later version.
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
13
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
14 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
16 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
17 ;; for more details.
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
18
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4690
diff changeset
20 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
21
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
22 ;;; Commentary:
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
23
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
24 ;;; Code:
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
25
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
26 ;; The variable is declared in mule-cmds.el; it's initialised here, to give
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
27 ;; the language-specific code a chance to create its coding systems.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
28
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
29 (setq posix-charset-to-coding-system-hash
4145
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
30 (loop
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
31 ;; We want both normal and internal coding systems in order
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
32 ;; to pick up coding system aliases.
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
33 for coding-system in (coding-system-list 'every)
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
34 with res = (make-hash-table :test #'equal)
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
35 do
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
36 (setq coding-system (symbol-name coding-system))
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
37 (unless (or (string-match #r"\(-unix\|-mac\|-dos\)$" coding-system)
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
38 (string-match #r"^\(internal\|mswindows\)" coding-system))
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
39 (puthash
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
40 (replace-in-string (downcase coding-system) "[^a-z0-9]" "")
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
41 (coding-system-name (intern coding-system)) res))
edb00a8b4eff [xemacs-hg @ 2007-08-26 20:00:29 by aidan]
aidan
parents: 4073
diff changeset
42 finally return res)
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
43
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
44 ;; In a thoughtless act of cultural imperialism, move English, German
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
45 ;; and Japanese to the front of language-info-alist to make start-up a
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
46 ;; fraction faster for those languages.
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
47 language-info-alist
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
48 (cons (assoc "Japanese" language-info-alist)
5583
10f179710250 Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
49 (delete* "Japanese" language-info-alist :test #'equal :key #'car))
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
50 language-info-alist
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
51 (cons (assoc "German" language-info-alist)
5583
10f179710250 Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
52 (delete* "German" language-info-alist :test #'equal :key #'car))
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
53 language-info-alist
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
54 (cons (assoc "English" language-info-alist)
5583
10f179710250 Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
55 (delete* "English" language-info-alist :test #'equal :key #'car))
4246
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
56
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
57 ;; Make Installation-string actually reflect the environment at
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
58 ;; byte-compile time. (We can't necessarily decode it when version.el
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
59 ;; is loaded, since not all the coding systems are available then.)
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
60 Installation-string (if-boundp 'Installation-file-coding-system
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
61 (decode-coding-string
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
62 Installation-string
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
63 Installation-file-coding-system)
4549
68d1ca56cffa First part of interactive checks that coding systems encode regions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4246
diff changeset
64 Installation-string)
68d1ca56cffa First part of interactive checks that coding systems encode regions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4246
diff changeset
65
4690
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
66 ;; This used to be here to convince the byte-compiler to encode the
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
67 ;; output file using escape-quoted. This is no longer necessary, but
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
68 ;; keeping it here avoids doing the eval-when-compile clause below
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
69 ;; twice, which is a significant improvement.
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
70 system-type (symbol-value (intern "\u0073ystem-type")))
4549
68d1ca56cffa First part of interactive checks that coding systems encode regions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4246
diff changeset
71
4690
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
72 ;; When this file is being compiled, all the charsets have been loaded, so
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
73 ;; we can construct the query-skip-chars-arg string correctly.
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
74 (set-unicode-query-skip-chars-args
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
75 (eval-when-compile
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
76 (when-fboundp 'map-charset-chars
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
77 (loop
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
78 for charset in (charset-list)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
79 with skip-chars-string = ""
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
80 do
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
81 (block no-ucs-mapping
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
82 (map-charset-chars
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
83 #'(lambda (begin end)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
84 (loop
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
85 while (and begin (>= end begin))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
86 do
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
87 (when (= -1 (char-to-unicode begin))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
88 (return-from no-ucs-mapping))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
89 (setq begin (int-to-char (1+ begin)))))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
90 charset)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
91 (setq skip-chars-string
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
92 (concat skip-chars-string
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
93 (charset-skip-chars-string charset))))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
94 finally return skip-chars-string)))
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
95 unicode-invalid-sequence-regexp-range
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
96 (eval-when-compile
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
97 (concat (loop
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
98 for i from #x80 to #xFF
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
99 collect (aref (decode-coding-string (int-char i)
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4596
diff changeset
100 'utf-8) 0)))))
3707
f6f6fc9eb269 [xemacs-hg @ 2006-11-28 21:20:22 by aidan]
aidan
parents:
diff changeset
101
3767
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
102 ;; At this point in the dump, all the charsets have been loaded. Now, load
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
103 ;; their Unicode mappings.
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
104 (if load-unicode-tables-at-dump-time
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
105 (let ((data-directory (expand-file-name "etc" source-directory)))
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
106 (load-unicode-tables)))
6b2ef948e140 [xemacs-hg @ 2006-12-29 18:09:38 by aidan]
aidan
parents: 3707
diff changeset
107
4246
9fec7fedbf1b [xemacs-hg @ 2007-10-31 11:21:02 by aidan]
aidan
parents: 4145
diff changeset
108 ;;; general-late.el ends here