1 ;;(require 'un-define) ;; xemacs need it for utf-8
2 ;; the order MULE-CUS need to convert utf8 back
3 ;; NOT WORKING in emacs 22 without mule-ucs & mule-gbk,
4 ;; it will auto matically get from LC_CTYPE & current-lanuage-environment
6 ;; the following 3 lines for GBK
8 ;; (set-language-environment 'Chinese-GBK) ;; let emacs to use gbk to read source file?
11 ;; (setq utf-translate-cjk-charsets
13 ;; chinese-big5-1 chinese-big5-2
17 ;; japanese-jisx0208 japanese-jisx0212
25 ; (un-define-change-charset-order '(ascii chinese-gb2312 chinese-big5-1 chinese-big5-2))
30 ;; (un-define-change-charset-order '(ascii chinese-big5-1 chinese-big5-2 chinese-gb2312))
32 (gb-first) ;; seems not working with emacs22
35 ;; startup slow in LC_CTYPE=zh_CN.utf8 probably no font?
36 (set-keyboard-coding-system 'utf-8) ;; but x is utf8
37 ;;(set-buffer-file-coding-system 'utf-8)
38 ;;(set-terminal-coding-system 'utf-8)
39 ;;(setq-default enable-multibyte-characters t)
41 (prefer-coding-system 'utf-8)
45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 ;; some settings for coding systems are not yet correct
47 ;; after 'set-language-environment', especially not in UTF-8 locales, fix this:
48 (let* ((tmp (shell-command-to-string "locale charmap"))
49 (tmp (substring tmp 0 (string-match "\[ \t\n\]" tmp)))
51 (when (or (and (fboundp 'find-coding-system) ; XEmacs only
52 (find-coding-system (intern tmp)))
54 (coding-system-p (intern tmp)))
55 ;; set the coding system priorities:
56 ;; (this is also important to make XIM in utf-8 work for XEmacs
57 ;; because XEmacs has no variable/function to set the
58 ;; coding-system for XIM, it is just autodetected which
59 ;; will work correctly only when the coding-system priorities
61 (if (not (and (string-match "XEmacs" emacs-version)
62 (string-match "utf-8" tmp)))
63 (prefer-coding-system (intern tmp))
64 ;; it's strange, but (prefer-coding-system 'utf-8) doesn't
66 ;; use 'set-coding-priority-list instead, which achieves
67 ;; the same and works for 'utf-8 as well:
68 (set-coding-priority-list (list (intern tmp)))
69 (set-coding-category-system (intern tmp) (intern tmp)))
70 (set-default-coding-systems (intern tmp))
71 (set-keyboard-coding-system (intern tmp))
72 (set-terminal-coding-system (intern tmp))
73 (when (and (string-match "XEmacs" emacs-version)
74 (locate-library "lookup")
75 (string-match "utf-8" tmp))
76 ;; It seems that lookup must loaded before the
77 ;; lookup-process-coding-system can be changed.
79 (setq lookup-process-coding-system 'utf-8))))