;;; utf-8.el --- UTF-8 decoding/encoding support -*- coding: iso-2022-7bit -*-
-;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-;; Copyright (C) 2001, 2002, 2003, 2004
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;; Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
;; Here we bind coding-system-for-read to nil so that coding tags
;; in the files are respected even if the files are not yet
;; byte-compiled
- (let ((coding-system-for-read nil))
+ (let ((coding-system-for-read nil)
+ ;; We must avoid clobbering this variable, in case the load
+ ;; files below use different coding systems.
+ (last-coding-system-used last-coding-system-used))
(cond ((string= "Korean" current-language-environment)
(load "subst-jis")
(load "subst-big5")
(set-buffer-multibyte nil)))
(when (and utf-8-compose-scripts (> length 1))
- ;; These currently have definitions which cover the relevant
- ;; unicodes. We could avoid loading thai-util &c by checking
- ;; whether the region contains any characters with the appropriate
- ;; categories. There aren't yet Unicode-based rules for Tibetan.
- (diacritic-compose-region (point-max) (point-min))
- (thai-compose-region (point-max) (point-min))
- (lao-compose-region (point-max) (point-min))
- (devanagari-compose-region (point-max) (point-min))
- (malayalam-compose-region (point-max) (point-min))
- (tamil-compose-region (point-max) (point-min)))
+ ;; This let-binding avoids recursive auto-loading. And, we
+ ;; anyway don't have to run the following code while
+ ;; auto-loading.
+ (let ((utf-8-compose-scripts nil))
+ ;; These currently have definitions which cover the relevant
+ ;; unicodes. We could avoid loading thai-util &c by checking
+ ;; whether the region contains any characters with the appropriate
+ ;; categories. There aren't yet Unicode-based rules for Tibetan.
+ (diacritic-compose-region (point-max) (point-min))
+ (thai-compose-region (point-max) (point-min))
+ (lao-compose-region (point-max) (point-min))
+ (devanagari-compose-region (point-max) (point-min))
+ (malayalam-compose-region (point-max) (point-min))
+ (tamil-compose-region (point-max) (point-min))))
(- (point-max) (point-min)))))
(defun utf-8-pre-write-conversion (beg end)
This is used as a post-read-conversion of utf-8 coding system."
(if (and utf-translate-cjk-mode
(not utf-translate-cjk-lang-env)
- (save-excursion
- (goto-char beg)
- (re-search-forward "\\cc\\|\\cj\\|\\ch" end t)))
+ (if (stringp beg)
+ (string-match "\\cc\\|\\cj\\|\\ch" beg)
+ (save-excursion
+ (goto-char beg)
+ (re-search-forward "\\cc\\|\\cj\\|\\ch" end t))))
(utf-translate-cjk-load-tables))
nil)