summaryrefslogtreecommitdiff
path: root/lisp/international
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-07-14 05:56:32 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-07-14 05:56:32 +0000
commit99715bbc447eb633e45ffa23b87284771ce3ac74 (patch)
tree3a8a53dfe3dbdd9f8e36965e9f043eae522d3c0e /lisp/international
parent556b89447234f15d1784a23dadbfe429464463a8 (diff)
parent763bb2d43615bc3ae816422f965d76d5e1ae4bdd (diff)
downloademacs-99715bbc447eb633e45ffa23b87284771ce3ac74.tar.gz
Merged from emacs@sv.gnu.org.
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-331 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-332 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-333 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-334 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-335 Add note about "link" button-class to etc/TODO * emacs@sv.gnu.org/emacs--devo--0--patch-336 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-337 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-338 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-339 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-340 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-341 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-342 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-343 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-344 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-345 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-346 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-347 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-348 Update for ERC 5.1.3. * emacs@sv.gnu.org/emacs--devo--0--patch-349 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-350 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/gnus--rel--5.10--patch-111 Update from CVS: texi/gnus.texi (Summary Buffer Lines): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-112 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-113 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-114 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-572
Diffstat (limited to 'lisp/international')
-rw-r--r--lisp/international/mule-cmds.el188
-rw-r--r--lisp/international/mule.el22
2 files changed, 114 insertions, 96 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index c50afd2de74..1cd077413c3 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1128,7 +1128,19 @@ see `language-info-alist'."
(setq lang-env (symbol-name lang-env)))
(set-language-info-internal lang-env key info)
(if (equal lang-env current-language-environment)
- (set-language-environment lang-env)))
+ (cond ((eq key 'coding-priority)
+ (set-language-environment-coding-systems lang-env))
+ ((eq key 'input-method)
+ (set-language-environment-input-method lang-env))
+ ((eq key 'nonascii-translation)
+ (set-language-environment-nonascii-translation lang-env))
+ ((eq key 'charset)
+ (set-language-environment-charset lang-env))
+ ((eq key 'overriding-fontspec)
+ (set-language-environment-fontset lang-env))
+ ((and (not default-enable-multibyte-characters)
+ (or (eq key 'unibyte-syntax) (eq key 'unibyte-display)))
+ (set-language-environment-unibyte lang-env)))))
(defun set-language-info-internal (lang-env key info)
"Internal use only.
@@ -1835,92 +1847,29 @@ specifies the character set for the major languages of Western Europe."
'exit-function)))
(run-hooks 'exit-language-environment-hook)
(if (functionp func) (funcall func))))
- (let ((default-eol-type (coding-system-eol-type
- default-buffer-file-coding-system)))
- (reset-language-environment)
-
- ;; The features might set up coding systems.
- (let ((required-features (get-language-info language-name 'features)))
- (while required-features
- (require (car required-features))
- (setq required-features (cdr required-features))))
-
- (setq current-language-environment language-name)
- (set-language-environment-coding-systems language-name default-eol-type))
- (let ((input-method (get-language-info language-name 'input-method)))
- (when input-method
- (setq default-input-method input-method)
- (if input-method-history
- (setq input-method-history
- (cons input-method
- (delete input-method input-method-history))))))
- (let ((nonascii (get-language-info language-name 'nonascii-translation))
- (dos-table
- (if (eq window-system 'pc)
- (intern
- (format "cp%d-nonascii-translation-table" dos-codepage)))))
- (cond
- ((char-table-p nonascii)
- (setq nonascii-translation-table nonascii))
- ((and (eq window-system 'pc) (boundp dos-table))
- ;; DOS terminals' default is to use a special non-ASCII translation
- ;; table as appropriate for the installed codepage.
- (setq nonascii-translation-table (symbol-value dos-table)))
- ((charsetp nonascii)
- (setq nonascii-insert-offset (- (make-char nonascii) 128)))))
-
- ;; Unibyte setups if necessary.
- (unless default-enable-multibyte-characters
- ;; Syntax and case table.
- (let ((syntax (get-language-info language-name 'unibyte-syntax)))
- (if syntax
- (let ((set-case-syntax-set-multibyte nil))
- (load syntax nil t))
- ;; No information for syntax and case. Reset to the defaults.
- (let ((syntax-table (standard-syntax-table))
- (standard-table (standard-case-table))
- (case-table (make-char-table 'case-table))
- (ch (if (eq window-system 'pc) 128 160)))
- (while (< ch 256)
- (modify-syntax-entry ch " " syntax-table)
- (setq ch (1+ ch)))
- (dotimes (i 128)
- (aset case-table i (aref standard-table i)))
- (set-char-table-extra-slot case-table 0 nil)
- (set-char-table-extra-slot case-table 1 nil)
- (set-char-table-extra-slot case-table 2 nil)
- (set-standard-case-table case-table))
- (let ((list (buffer-list)))
- (while list
- (with-current-buffer (car list)
- (set-case-table (standard-case-table)))
- (setq list (cdr list))))))
- (set-display-table-and-terminal-coding-system language-name))
+ (reset-language-environment)
+ ;; The features might set up coding systems.
(let ((required-features (get-language-info language-name 'features)))
(while required-features
(require (car required-features))
(setq required-features (cdr required-features))))
- ;; Don't invoke fontset-related functions if fontsets aren't
- ;; supported in this build of Emacs.
- (when (fboundp 'fontset-list)
- (let ((overriding-fontspec (get-language-info language-name
- 'overriding-fontspec)))
- (if overriding-fontspec
- (set-overriding-fontspec-internal overriding-fontspec))))
+ (setq current-language-environment language-name)
+
+ (set-language-environment-coding-systems language-name)
+ (set-language-environment-input-method language-name)
+ (set-language-environment-nonascii-translation language-name)
+ (set-language-environment-charset language-name)
+ (set-language-environment-fontset language-name)
+ ;; Unibyte setups if necessary.
+ (unless default-enable-multibyte-characters
+ (set-language-environment-unibyte language-name))
(let ((func (get-language-info language-name 'setup-function)))
(if (functionp func)
(funcall func)))
- (if (and utf-translate-cjk-mode
- (not (eq utf-translate-cjk-lang-env language-name))
- (catch 'tag
- (dolist (charset (get-language-info language-name 'charset))
- (if (memq charset utf-translate-cjk-charsets)
- (throw 'tag t)))
- nil))
- (utf-translate-cjk-load-tables))
+
(run-hooks 'set-language-environment-hook)
(force-mode-line-update t))
@@ -1949,14 +1898,11 @@ specifies the character set for the major languages of Western Europe."
;; proper windows-1252 coding system. --fx]
(aset standard-display-table 146 [39]))))
-(defun set-language-environment-coding-systems (language-name
- &optional eol-type)
- "Do various coding system setups for language environment LANGUAGE-NAME.
-
-The optional arg EOL-TYPE specifies the eol-type of the default value
-of `buffer-file-coding-system' set by this function."
+(defun set-language-environment-coding-systems (language-name)
+ "Do various coding system setups for language environment LANGUAGE-NAME."
(let* ((priority (get-language-info language-name 'coding-priority))
- (default-coding (car priority)))
+ (default-coding (car priority))
+ (eol-type (coding-system-eol-type default-buffer-file-coding-system)))
(if priority
(let ((categories (mapcar 'coding-system-category priority)))
(set-default-coding-systems
@@ -1971,6 +1917,80 @@ of `buffer-file-coding-system' set by this function."
;; Changing the binding of a coding category requires this call.
(update-coding-systems-internal)))))
+(defun set-language-environment-input-method (language-name)
+ "Do various input method setups for language environment LANGUAGE-NAME."
+ (let ((input-method (get-language-info language-name 'input-method)))
+ (when input-method
+ (setq default-input-method input-method)
+ (if input-method-history
+ (setq input-method-history
+ (cons input-method
+ (delete input-method input-method-history)))))))
+
+(defun set-language-environment-nonascii-translation (language-name)
+ "Do unibyte/multibyte translation setup for language environment LANGUAGE-NAME."
+ (let ((nonascii (get-language-info language-name 'nonascii-translation))
+ (dos-table
+ (if (eq window-system 'pc)
+ (intern
+ (format "cp%d-nonascii-translation-table" dos-codepage)))))
+ (cond
+ ((char-table-p nonascii)
+ (setq nonascii-translation-table nonascii))
+ ((and (eq window-system 'pc) (boundp dos-table))
+ ;; DOS terminals' default is to use a special non-ASCII translation
+ ;; table as appropriate for the installed codepage.
+ (setq nonascii-translation-table (symbol-value dos-table)))
+ ((charsetp nonascii)
+ (setq nonascii-insert-offset (- (make-char nonascii) 128))))))
+
+(defun set-language-environment-charset (language-name)
+ "Do various charset setups for language environment LANGUAGE-NAME."
+ (if (and utf-translate-cjk-mode
+ (not (eq utf-translate-cjk-lang-env language-name))
+ (catch 'tag
+ (dolist (charset (get-language-info language-name 'charset))
+ (if (memq charset utf-translate-cjk-charsets)
+ (throw 'tag t)))
+ nil))
+ (utf-translate-cjk-load-tables)))
+
+(defun set-language-environment-fontset (language-name)
+ "Do various fontset setups for language environment LANGUAGE-NAME."
+ ;; Don't invoke fontset-related functions if fontsets aren't
+ ;; supported in this build of Emacs.
+ (if (fboundp 'fontset-list)
+ (set-overriding-fontspec-internal
+ (get-language-info language-name 'overriding-fontspec))))
+
+(defun set-language-environment-unibyte (language-name)
+ "Do various unibyte-mode setups for language environment LANGUAGE-NAME."
+ ;; Syntax and case table.
+ (let ((syntax (get-language-info language-name 'unibyte-syntax)))
+ (if syntax
+ (let ((set-case-syntax-set-multibyte nil))
+ (load syntax nil t))
+ ;; No information for syntax and case. Reset to the defaults.
+ (let ((syntax-table (standard-syntax-table))
+ (standard-table (standard-case-table))
+ (case-table (make-char-table 'case-table))
+ (ch (if (eq window-system 'pc) 128 160)))
+ (while (< ch 256)
+ (modify-syntax-entry ch " " syntax-table)
+ (setq ch (1+ ch)))
+ (dotimes (i 128)
+ (aset case-table i (aref standard-table i)))
+ (set-char-table-extra-slot case-table 0 nil)
+ (set-char-table-extra-slot case-table 1 nil)
+ (set-char-table-extra-slot case-table 2 nil)
+ (set-standard-case-table case-table))
+ (let ((list (buffer-list)))
+ (while list
+ (with-current-buffer (car list)
+ (set-case-table (standard-case-table)))
+ (setq list (cdr list))))))
+ (set-display-table-and-terminal-coding-system language-name))
+
(defsubst princ-list (&rest args)
"Print all arguments with `princ', then print \"\n\"."
(while args (princ (car args)) (setq args (cdr args)))
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 4d2d22c51c0..1cce13c76a3 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1,6 +1,6 @@
;;; mule.el --- basic commands for mulitilingual environment
-;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
;; Free Software Foundation, Inc.
;; Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
;; National Institute of Advanced Industrial Science and Technology (AIST)
@@ -283,16 +283,14 @@ would need to index the corresponding Emacs charset."
(make-char-internal (charset-id charset) code1 code2))
(put 'make-char 'byte-compile
- (function
- (lambda (form)
- (let ((charset (nth 1 form)))
- (if (charset-quoted-standard-p charset)
- (byte-compile-normal-call
- (cons 'make-char-internal
- (cons (charset-id (nth 1 charset)) (nthcdr 2 form))))
- (byte-compile-normal-call
- (cons 'make-char-internal
- (cons (list 'charset-id charset) (nthcdr 2 form)))))))))
+ (lambda (form)
+ (let ((charset (nth 1 form)))
+ (byte-compile-normal-call
+ (cons 'make-char-internal
+ (cons (if (charset-quoted-standard-p charset)
+ (charset-id (nth 1 charset))
+ (list 'charset-id charset))
+ (nthcdr 2 form)))))))
(defun charset-list ()
"Return list of charsets ever defined.
@@ -2308,5 +2306,5 @@ This function is intended to be added to `auto-coding-functions'."
;;;
(provide 'mule)
-;;; arch-tag: 9aebaa6e-0e8a-40a9-b857-cb5d04a39e7c
+;; arch-tag: 9aebaa6e-0e8a-40a9-b857-cb5d04a39e7c
;;; mule.el ends here