aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2003-03-29 17:11:42 +0000
committerKai Großjohann2003-03-29 17:11:42 +0000
commitfcfdeaf69d83970a7767c2cc74e646a0b024af9e (patch)
tree6092eda92771f06e22dd7b1eff4aa826a6775bcc
parentbeb402deed11deee9fdaddb986cc7c51c14082d0 (diff)
downloademacs-fcfdeaf69d83970a7767c2cc74e646a0b024af9e.tar.gz
emacs-fcfdeaf69d83970a7767c2cc74e646a0b024af9e.zip
(utf-translate-cjk-mode): Minor mode,
replaces variable utf-translate-cjk which must be set via Custom.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/international/utf-8.el102
2 files changed, 54 insertions, 51 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 17f47abc20c..cb9d00766ad 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12003-03-29 Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net> 12003-03-29 Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net>
2 2
3 * international/utf-8.el (utf-translate-cjk-mode): Minor mode,
4 replaces variable utf-translate-cjk which must be set via Custom.
5
3 * files.el (file-relative-name): If FILENAME and DIRECTORY are on 6 * files.el (file-relative-name): If FILENAME and DIRECTORY are on
4 different drives (on DOS/Windows) or use different handlers, do 7 different drives (on DOS/Windows) or use different handlers, do
5 like `expand-file-name' on FILENAME and return an absolute name. 8 like `expand-file-name' on FILENAME and return an absolute name.
diff --git a/lisp/international/utf-8.el b/lisp/international/utf-8.el
index 47247c7b507..f59512277fe 100644
--- a/lisp/international/utf-8.el
+++ b/lisp/international/utf-8.el
@@ -190,7 +190,7 @@ Setting this variable outside customize has no effect."
190 :type 'boolean 190 :type 'boolean
191 :group 'mule) 191 :group 'mule)
192 192
193(defcustom utf-translate-cjk nil 193(define-minor-mode utf-translate-cjk-mode
194 "Whether the UTF based coding systems should decode/encode CJK characters. 194 "Whether the UTF based coding systems should decode/encode CJK characters.
195Enabling this loads tables which allow the coding systems mule-utf-8, 195Enabling this loads tables which allow the coding systems mule-utf-8,
196mule-utf-16-le and mule-utf-16-be to encode characters in the charsets 196mule-utf-16-le and mule-utf-16-be to encode characters in the charsets
@@ -205,59 +205,59 @@ Chinese-Big5 and jisx for other environments.
205 205
206The tables are large (over 40000 entries), so this option is not the 206The tables are large (over 40000 entries), so this option is not the
207default. Also, installing them may be rather slow." 207default. Also, installing them may be rather slow."
208 :set (lambda (s v) 208 :init-value nil
209 (if v
210 ;; Fixme: Allow the use of the CJK charsets to be
211 ;; customized by reordering and possible omission.
212 (progn
213 ;; Redefine them with realistic initial sizes and a
214 ;; smallish rehash size to avoid wasting significant
215 ;; space after they're built.
216 (setq ucs-mule-cjk-to-unicode
217 (make-hash-table :test 'eq :size 43000 :rehash-size 1000)
218 ucs-unicode-to-mule-cjk
219 (make-hash-table :test 'eq :size 43000 :rehash-size 1000))
220 ;; Load the files explicitly, to avoid having to keep
221 ;; around the large tables they contain (as well as the
222 ;; ones which get built).
223 (cond
224 ((string= "Korean" current-language-environment)
225 (load "subst-jis")
226 (load "subst-big5")
227 (load "subst-gb2312")
228 (load "subst-ksc"))
229 ((string= "Chinese-BIG5" current-language-environment)
230 (load "subst-jis")
231 (load "subst-ksc")
232 (load "subst-gb2312")
233 (load "subst-big5"))
234 ((string= "Chinese-GB" current-language-environment)
235 (load "subst-jis")
236 (load "subst-ksc")
237 (load "subst-big5")
238 (load "subst-gb2312"))
239 (t
240 (load "subst-ksc")
241 (load "subst-gb2312")
242 (load "subst-big5")
243 (load "subst-jis"))) ; jis covers as much as big5, gb2312
244 (let ((table (make-char-table 'translation-table)))
245 (maphash (lambda (k v)
246 (aset table k t))
247 ucs-mule-cjk-to-unicode)
248 (define-translation-hash-table 'utf-subst-table-for-decode
249 ucs-unicode-to-mule-cjk)
250 (define-translation-hash-table 'utf-subst-table-for-encode
251 ucs-mule-cjk-to-unicode))
252 (define-translation-hash-table 'utf-subst-table-for-decode
253 (make-hash-table :test 'eq))
254 (define-translation-hash-table 'utf-subst-table-for-encode
255 (make-hash-table :test 'eq))))
256 (set-default s v))
257 :version "21.4" 209 :version "21.4"
258 :type 'boolean 210 :type 'boolean
259 :set-after '(current-language-environment) 211 :set-after '(current-language-environment)
260 :group 'mule) 212 :group 'mule
213 :global t
214 (if utf-translate-cjk-mode
215 ;; Fixme: Allow the use of the CJK charsets to be
216 ;; customized by reordering and possible omission.
217 (progn
218 ;; Redefine them with realistic initial sizes and a
219 ;; smallish rehash size to avoid wasting significant
220 ;; space after they're built.
221 (setq ucs-mule-cjk-to-unicode
222 (make-hash-table :test 'eq :size 43000 :rehash-size 1000)
223 ucs-unicode-to-mule-cjk
224 (make-hash-table :test 'eq :size 43000 :rehash-size 1000))
225 ;; Load the files explicitly, to avoid having to keep
226 ;; around the large tables they contain (as well as the
227 ;; ones which get built).
228 (cond
229 ((string= "Korean" current-language-environment)
230 (load "subst-jis")
231 (load "subst-big5")
232 (load "subst-gb2312")
233 (load "subst-ksc"))
234 ((string= "Chinese-BIG5" current-language-environment)
235 (load "subst-jis")
236 (load "subst-ksc")
237 (load "subst-gb2312")
238 (load "subst-big5"))
239 ((string= "Chinese-GB" current-language-environment)
240 (load "subst-jis")
241 (load "subst-ksc")
242 (load "subst-big5")
243 (load "subst-gb2312"))
244 (t
245 (load "subst-ksc")
246 (load "subst-gb2312")
247 (load "subst-big5")
248 (load "subst-jis"))) ; jis covers as much as big5, gb2312
249 (let ((table (make-char-table 'translation-table)))
250 (maphash (lambda (k v)
251 (aset table k t))
252 ucs-mule-cjk-to-unicode)
253 (define-translation-hash-table 'utf-subst-table-for-decode
254 ucs-unicode-to-mule-cjk)
255 (define-translation-hash-table 'utf-subst-table-for-encode
256 ucs-mule-cjk-to-unicode))
257 (define-translation-hash-table 'utf-subst-table-for-decode
258 (make-hash-table :test 'eq))
259 (define-translation-hash-table 'utf-subst-table-for-encode
260 (make-hash-table :test 'eq)))))
261 261
262(define-ccl-program ccl-decode-mule-utf-8 262(define-ccl-program ccl-decode-mule-utf-8
263 ;; 263 ;;