-;;; japan-util.el --- utilities for Japanese
+;;; japan-util.el --- utilities for Japanese -*- coding: iso-2022-7bit; -*-
-;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
-;; Licensed to the Free Software Foundation.
+;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998, 2000, 2003
+;; National Institute of Advanced Industrial Science and Technology (AIST)
+;; Registration Number H14PRO021
;; Keywords: mule, multilingual, Japanese
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
-;;; Code:
-
-(defvar sentence-end-save nil)
+;;; Commentary:
-;;;###autoload
-(defun setup-japanese-environment ()
- "Setup multilingual environment (MULE) for Japanese."
- (interactive)
- (set-language-environment "Japanese"))
+;;; Code:
;;;###autoload
(defun setup-japanese-environment-internal ()
- (cond ((eq system-type 'ms-dos)
- (prefer-coding-system 'japanese-shift-jis))
- ((eq system-type 'usg-unix-v)
- (prefer-coding-system 'japanese-iso-8bit)))
- (setq sentence-end-save sentence-end)
- (setq sentence-end (concat sentence-end "\\|[\e$B!#!)!*\e(B]")))
-
-(defun exit-japanese-environment ()
- (setq sentence-end sentence-end-save))
+ ;; By default, we use 'japanese-iso-8bit for file names. But, the
+ ;; following prefer-coding-system will override it.
+ (if (memq system-type '(windows-nt ms-dos cygwin))
+ (prefer-coding-system 'japanese-shift-jis)
+ (prefer-coding-system 'japanese-iso-8bit)))
(defconst japanese-kana-table
'((?\e$B$"\e(B ?\e$B%"\e(B ?\e(I1\e(B) (?\e$B$$\e(B ?\e$B%$\e(B ?\e(I2\e(B) (?\e$B$&\e(B ?\e$B%&\e(B ?\e(I3\e(B) (?\e$B$(\e(B ?\e$B%(\e(B ?\e(I4\e(B) (?\e$B$*\e(B ?\e$B%*\e(B ?\e(I5\e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\e(B ?<) (?\e$B!d\e(B ?>)
(?\e$B!l\e(B ?') (?\e$B!m\e(B ?\") (?\e$B!o\e(B ?\\) (?\e$B!p\e(B ?$) (?\e$B!s\e(B ?%) (?\e$B!t\e(B ?#) (?\e$B!u\e(B ?&) (?\e$B!v\e(B ?*)
(?\e$B!w\e(B ?@))
"Japanese JISX0208 symbol character table.
(defconst japanese-alpha-numeric-table
'((?\e$B#0\e(B . ?0) (?\e$B#1\e(B . ?1) (?\e$B#2\e(B . ?2) (?\e$B#3\e(B . ?3) (?\e$B#4\e(B . ?4)
(?\e$B#5\e(B . ?5) (?\e$B#6\e(B . ?6) (?\e$B#7\e(B . ?7) (?\e$B#8\e(B . ?8) (?\e$B#9\e(B . ?9)
- (?\e$B#A\e(B . ?A) (?\e$B#B\e(B . ?B) (?\e$B#C\e(B . ?C) (?\e$B#D\e(B . ?D) (?\e$B#E\e(B . ?E)
+ (?\e$B#A\e(B . ?A) (?\e$B#B\e(B . ?B) (?\e$B#C\e(B . ?C) (?\e$B#D\e(B . ?D) (?\e$B#E\e(B . ?E)
(?\e$B#F\e(B . ?F) (?\e$B#G\e(B . ?G) (?\e$B#H\e(B . ?H) (?\e$B#I\e(B . ?I) (?\e$B#J\e(B . ?J)
(?\e$B#K\e(B . ?K) (?\e$B#L\e(B . ?L) (?\e$B#M\e(B . ?M) (?\e$B#N\e(B . ?N) (?\e$B#O\e(B . ?O)
(?\e$B#P\e(B . ?P) (?\e$B#Q\e(B . ?Q) (?\e$B#R\e(B . ?R) (?\e$B#S\e(B . ?S) (?\e$B#T\e(B . ?T)
Optional argument ASCII-ONLY non-nil means to return only ASCII character."
(if (stringp obj)
(japanese-string-conversion obj 'japanese-hankaku-region ascii-only)
- (or (get-char-code-property obj 'ascii)
- (and (not ascii-only)
+ (or (and (not ascii-only)
(get-char-code-property obj 'jisx0201))
+ (get-char-code-property obj 'ascii)
obj)))
;;;###autoload
(goto-char (point-min))
(while (re-search-forward "\\cH\\|\\cK" nil t)
(let* ((kana (preceding-char))
- (composition (get-char-code-property kana 'kana-composition))
+ (composition
+ (and (not hankaku)
+ (get-char-code-property kana 'kana-composition)))
next slot)
(if (and composition (setq slot (assq (following-char) composition)))
(japanese-replace-region (match-beginning 0) (1+ (point))
(goto-char (point-min))
(while (re-search-forward "\\cj" nil t)
(let* ((zenkaku (preceding-char))
- (hankaku (or (get-char-code-property zenkaku 'ascii)
- (and (not ascii-only)
- (get-char-code-property zenkaku 'jisx0201)))))
+ (hankaku (or (and (not ascii-only)
+ (get-char-code-property zenkaku 'jisx0201))
+ (get-char-code-property zenkaku 'ascii))))
(if hankaku
(japanese-replace-region (match-beginning 0) (match-end 0)
hankaku)))))))
;;
(provide 'japan-util)
+;;; arch-tag: b579595c-c9ad-4b57-9314-98cd8b214f89
;;; japan-util.el ends here