From: morioka Date: Mon, 9 Mar 1998 19:34:12 +0000 (+0000) Subject: tm 7.71. X-Git-Tag: tm7_71~1 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=71851275e841060de5eefb7ac5de23b0dca47e02;p=elisp%2Fapel.git tm 7.71. --- diff --git a/ChangeLog b/ChangeLog index d806a48..c1574ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,67 @@ +Thu Jul 11 14:11:12 1996 MORIOKA Tomohiko + + * tl: Version 7.36 was released. + + * emu.el (emacs-minor-version): New variable for Emacs 18. + +Thu Jul 11 13:59:54 1996 MORIOKA Tomohiko + + * emu-nemacs.el (charsets-mime-charset-alist): New variable. + (default-mime-charset): New variable. + (mime-charset-coding-system-alist): New variable. + (mime-charset-to-coding-system): New function. + (detect-mime-charset-region): New function. + (encode-mime-charset-region): New function. + (encode-mime-charset-string): New function. + +Thu Jul 11 09:04:23 1996 MORIOKA Tomohiko + + * emu.el (charsets-to-mime-charset): New function; moved from + emu-*.el. + +Thu Jul 11 08:58:54 1996 MORIOKA Tomohiko + + * emu-x20.el, emu-mule.el, emu-e19.el: Function + `charsets-to-mime-charset' was moved to emu.el. + + * emu-e19.el (charsets-mime-charset-alist): New variable. + (default-mime-charset): New variable. + (charsets-to-mime-charset): New function. + (detect-mime-charset-region): New function. + (encode-mime-charset-region): New function. + (encode-mime-charset-string): New function. + +Wed Jul 10 13:58:11 1996 MORIOKA Tomohiko + + * emu-x20.el (encode-mime-charset-region): New function. + (encode-mime-charset-string): New function. + +Wed Jul 10 13:55:09 1996 MORIOKA Tomohiko + + * emu-x20.el (detect-mime-charset-region): New function. + + * emu-x20.el (mime-charset-to-coding-system): New function. + + * emu-x20.el (mime-charset-coding-system-alist): New variable. + + * emu-x20.el (charsets-to-mime-charset): New function. + + * emu-x20.el (default-mime-charset): New variable. + + * emu-x20.el: charset constants were abolished. + (charsets-mime-charset-alist): New variable. + + * emu-mule.el: charset constants were abolished. + +Wed Jul 10 12:54:46 1996 MORIOKA Tomohiko + + * emu-mule.el (encode-mime-charset-string): New function. + +Wed Jul 10 11:58:23 1996 MORIOKA Tomohiko + + * emu-mule.el (encode-mime-charset-region): New function. + + Tue Jul 9 13:16:23 1996 MORIOKA Tomohiko * tl: Version 7.31.1 was released. diff --git a/emu-e19.el b/emu-e19.el index d3a0e09..a000f4e 100644 --- a/emu-e19.el +++ b/emu-e19.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-e19.el,v 7.22 1996/06/26 08:27:20 morioka Exp $ +;;; $Id: emu-e19.el,v 7.24 1996/07/11 08:51:00 morioka Exp $ ;;; Keywords: emulation, compatibility, Mule, Latin-1 ;;; ;;; This file is part of tl (Tiny Library). @@ -143,6 +143,36 @@ between START and END. [emu-e19.el; Mule emulating function]" ))) +;;; @ MIME charset +;;; + +(defvar charsets-mime-charset-alist + (list (cons (list charset-ascii) 'us-ascii))) + +(defvar default-mime-charset 'iso-8859-1) + +(defun detect-mime-charset-region (start end) + "Return MIME charset for region between START and END. +\[emu-e19.el]" + (if (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char start) + (re-search-forward "[\200-\377]" nil t) + )) + default-mime-charset + 'us-ascii)) + +(defun encode-mime-charset-region (start end charset) + "Encode the text between START and END which is +encoded in MIME CHARSET. [emu-e19.el]" + ) + +(defun encode-mime-charset-string (string charset) + "Encode the STRING which is encoded in MIME CHARSET. [emu-e19.el]" + string) + + ;;; @ character ;;; diff --git a/emu-mule.el b/emu-mule.el index b3be9e9..2d3fb1d 100644 --- a/emu-mule.el +++ b/emu-mule.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-mule.el,v 7.31 1996/07/08 07:46:02 morioka Exp $ +;;; $Id: emu-mule.el,v 7.36 1996/07/11 09:03:20 morioka Exp $ ;;; Keywords: emulation, compatibility, Mule ;;; ;;; This file is part of tl (Tiny Library). @@ -60,40 +60,6 @@ ;;; @ character set ;;; -;; 94 character set -(defconst charset-ascii lc-ascii "ASCII") -(defconst charset-jisx0201-kana lc-kana "JIS X0201 Katakana") -(defconst charset-jisx0201-latin lc-roman "JIS X0201 Latin") - -;; 96 character set -(defconst charset-latin-1 lc-ltn1 "ISO-8859-1 (Latin-1)") -(defconst charset-latin-2 lc-ltn2 "ISO-8859-2 (Latin-2)") -(defconst charset-latin-3 lc-ltn3 "ISO-8859-3 (Latin-3)") -(defconst charset-latin-4 lc-ltn4 "ISO-8859-4 (Latin-4)") -(defconst charset-cyrillic lc-crl "ISO-8859-5 (Cyrillic)") -(defconst charset-arabic lc-arb "ISO-8859-6 (Arabic)") -(defconst charset-greek lc-grk "ISO-8859-7 (Greek)") -(defconst charset-hebrew lc-hbw "ISO-8859-8 (Hebrew)") -(defconst charset-latin-5 lc-ltn5 "ISO-8859-9 (Latin-5)") - -;; 94x94 character set -(defconst charset-jisx0208-1978 lc-jpold "JIS X0208-1978") -(defconst charset-gb2312 lc-cn "GB 2312-1980") -(defconst charset-jisx0208 lc-jp "JIS X0208-1983") -(defconst charset-ksc5601 lc-kr "KS C5601-1987") -(defconst charset-jisx0212 lc-jp2 "JIS X0212-1990") -(defconst charset-cns11643-1 lc-cns1 "CNS 11643-1986 plane 1") -(defconst charset-cns11643-2 lc-cns2 "CNS 11643-1986 plane 2") -(defconst charset-cns11643-3 lc-cns3 "CNS 11643-1986 plane 3") -(defconst charset-cns11643-4 lc-cns4 "CNS 11643-1986 plane 4") -(defconst charset-cns11643-5 lc-cns5 "CNS 11643-1986 plane 5") -(defconst charset-cns11643-6 lc-cns6 "CNS 11643-1986 plane 6") -(defconst charset-cns11643-7 lc-cns7 "CNS 11643-1986 plane 7") - -;; Big 5 -(defconst charset-big5-1 lc-big5-1 "Big5 Level 1") -(defconst charset-big5-2 lc-big5-2 "Big5 Level 2") - (defalias 'charset-description 'char-description) (defalias 'charset-registry 'char-registry) (defalias 'charset-columns 'char-width) @@ -175,34 +141,6 @@ encoded in CODING-SYSTEM. [emu-mule.el]" (defvar default-mime-charset 'iso-2022-int-1) -(defun charsets-to-mime-charset (charsets) - (if charsets - (or (catch 'tag - (let ((rest charsets-mime-charset-alist) - cell csl) - (while (setq cell (car rest)) - (if (catch 'not-subset - (let ((set1 charsets) - (set2 (car cell)) - obj) - (while set1 - (setq obj (car set1)) - (or (memq obj set2) - (throw 'not-subset nil) - ) - (setq set1 (cdr set1)) - ) - t)) - (throw 'tag (cdr cell)) - ) - (setq rest (cdr rest)) - ))) - default-mime-charset))) - -(defun detect-mime-charset-region (beg end) - (charsets-to-mime-charset - (cons lc-ascii (find-charset-region beg end)))) - (defvar mime-charset-coding-system-alist '((iso-8859-1 . *ctext*) (gb2312 . *euc-china*) @@ -222,6 +160,27 @@ encoded in CODING-SYSTEM. [emu-mule.el]" (and (coding-system-p cs) cs) ))) +(defun detect-mime-charset-region (start end) + "Return MIME charset for region between START and END. +\[emu-mule.el]" + (charsets-to-mime-charset + (cons lc-ascii (find-charset-region start end)))) + +(defun encode-mime-charset-region (start end charset) + "Encode the text between START and END which is +encoded in MIME CHARSET. [emu-mule.el]" + (let ((cs (mime-charset-to-coding-system charset))) + (if cs + (code-convert start end *internal* cs) + ))) + +(defun encode-mime-charset-string (string charset) + "Encode the STRING which is encoded in MIME CHARSET. [emu-mule.el]" + (let ((cs (mime-charset-to-coding-system charset))) + (if cs + (code-convert-string string *internal* cs) + string))) + ;;; @ character ;;; diff --git a/emu-nemacs.el b/emu-nemacs.el index c200e9d..aa44107 100644 --- a/emu-nemacs.el +++ b/emu-nemacs.el @@ -7,7 +7,7 @@ ;;; Author: MORIOKA Tomohiko ;;; modified by KOBAYASHI Shuhei ;;; Version: -;;; $Id: emu-nemacs.el,v 7.31 1996/06/26 08:25:19 morioka Exp $ +;;; $Id: emu-nemacs.el,v 7.32 1996/07/11 13:59:54 morioka Exp $ ;;; Keywords: emulation, compatibility, NEmacs, Mule ;;; ;;; This file is part of tl (Tiny Library). @@ -183,6 +183,57 @@ else returns nil. [emu-nemacs.el; Mule emulating function]" ))) +;;; @ MIME charset +;;; + +(defvar charsets-mime-charset-alist + (list (cons (list charset-ascii) 'us-ascii))) + +(defvar default-mime-charset 'iso-2022-jp) + +(defvar mime-charset-coding-system-alist + '((iso-2022-jp . 2) + (shift_jis . 1) + )) + +(defun mime-charset-to-coding-system (charset) + (if (stringp charset) + (setq charset (intern (downcase charset))) + ) + (cdr (assq charset mime-charset-coding-system-alist)) + ) + +(defun detect-mime-charset-region (start end) + "Return MIME charset for region between START and END. +\[emu-nemacs.el]" + (if (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char start) + (re-search-forward "[\200-\377]" nil t) + )) + default-mime-charset + 'us-ascii)) + +(defun encode-mime-charset-region (start end charset) + "Encode the text between START and END which is +encoded in MIME CHARSET. [emu-nemacs.el]" + (let ((cs (mime-charset-to-coding-system charset))) + (if cs + (save-excursion + (save-restriction + (narrow-to-region start end) + (convert-region-kanji-code start end 3 cs) + ))))) + +(defun encode-mime-charset-string (string charset) + "Encode the STRING which is encoded in MIME CHARSET. [emu-nemacs.el]" + (let ((cs (mime-charset-to-coding-system charset))) + (if cs + (convert-string-kanji-code string 3 cs) + string))) + + ;;; @ character ;;; diff --git a/emu-x20.el b/emu-x20.el index e5d03d9..4cd7ccc 100644 --- a/emu-x20.el +++ b/emu-x20.el @@ -1,12 +1,12 @@ ;;; -;;; emu-x20.el --- Mule 2 emulation module for XEmacs 20 with Mule +;;; emu-x20.el --- emu API implementation for XEmacs 20 with mule ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-x20.el,v 7.18 1996/06/30 01:00:37 morioka Exp $ +;;; $Id: emu-x20.el,v 7.27 1996/07/11 09:02:01 morioka Exp $ ;;; Keywords: emulation, compatibility, Mule, XEmacs ;;; ;;; This file is part of tl (Tiny Library). @@ -39,31 +39,6 @@ ;;; @ character set ;;; -(mapcar (lambda (charset) - (set - (cond ((eq charset 'japanese-kana) 'charset-jisx0201-kana) - ((eq charset 'japanese-roman) 'charset-jisx0201-latin) - ((eq charset 'japanese-old) 'charset-jisx0208-1978) - ((eq charset 'chinese-gb) 'charset-gb2312) - ((eq charset 'japanese) 'charset-jisx0208) - ((eq charset 'koran) 'charset-ksc5601) - ((eq charset 'japanese-2) 'charset-jisx0212) - ((eq charset 'chinese-cns-1) 'charset-cns11643-1) - ((eq charset 'chinese-cns-2) 'charset-cns11643-2) - ((eq charset 'chinese-cns-3) 'charset-cns11643-3) - ((eq charset 'chinese-cns-4) 'charset-cns11643-4) - ((eq charset 'chinese-cns-5) 'charset-cns11643-5) - ((eq charset 'chinese-cns-6) 'charset-cns11643-6) - ((eq charset 'chinese-cns-7) 'charset-cns11643-7) - ((eq charset 'chinese-big5-1) 'charset-big5-1) - ((eq charset 'chinese-big5-2) 'charset-big5-2) - (t (intern (concat "charset-" (symbol-name charset)))) - ) - charset) - ) - (charset-list) - ) - (defalias 'charset-description 'charset-doc-string) (defun find-charset-string (string) @@ -165,6 +140,73 @@ in the region between START and END. ,@body)) +;;; @ MIME charset +;;; + +(defvar charsets-mime-charset-alist + '(((ascii) . us-ascii) + ((ascii latin-1) . iso-8859-1) + ((ascii latin-2) . iso-8859-2) + ((ascii latin-3) . iso-8859-3) + ((ascii latin-4) . iso-8859-4) +;;; ((ascii cyrillic) . iso-8859-5) + ((ascii cyrillic) . koi8-r) + ((ascii arabic) . iso-8859-6) + ((ascii greek) . iso-8859-7) + ((ascii hebrew) . iso-8859-8) + ((ascii latin-5) . iso-8859-9) + ((ascii japanese-old japanese) . iso-2022-jp) + ((ascii korean) . euc-kr) + ((ascii chinese-big5-1 chinese-big5-2) . big5) + ((ascii japanese-old chinese-gb japanese korean + japanese-2 latin-1 greek) . iso-2022-jp-2) + ((ascii japanese-old chinese-gb japanese korean + japanese-2 chinese-cns-1 chinese-cns-2 + latin-1 greek) . iso-2022-int-1) + )) + +(defvar default-mime-charset 'iso-2022-int-1) + +(defvar mime-charset-coding-system-alist + '((iso-8859-1 . ctext) + (gb2312 . euc-china) + (koi8-r . koi8) + (iso-2022-jp-2 . iso-2022-ss2-7) + (x-iso-2022-jp-2 . iso-2022-ss2-7) + (shift_jis . sjis) + (x-shiftjis . sjis) + )) + +(defun mime-charset-to-coding-system (charset) + "Return coding-system by MIME charset. [emu-x20.el]" + (if (stringp charset) + (setq charset (intern (downcase charset))) + ) + (or (cdr (assq charset mime-charset-coding-system-alist)) + (and (memq charset (coding-system-list)) charset) + )) + +(defun detect-mime-charset-region (start end) + "Return MIME charset for region between START and END. +\[emu-x20.el]" + (charsets-to-mime-charset (charsets-in-region start end))) + +(defun encode-mime-charset-region (start end charset) + "Encode the text between START and END which is +encoded in MIME CHARSET. [emu-x20.el]" + (let ((cs (mime-charset-to-coding-system charset))) + (if cs + (encode-coding-region start end cs) + ))) + +(defun encode-mime-charset-string (string charset) + "Encode the STRING which is encoded in MIME CHARSET. [emu-x20.el]" + (let ((cs (mime-charset-to-coding-system charset))) + (if cs + (encode-coding-string string cs) + string))) + + ;;; @ character ;;; diff --git a/emu.el b/emu.el index 019b2c0..8d5cebd 100644 --- a/emu.el +++ b/emu.el @@ -7,7 +7,7 @@ ;;; Author: MORIOKA Tomohiko ;;; modified by KOBAYASHI Shuhei ;;; Version: -;;; $Id: emu.el,v 7.17 1996/07/03 06:27:10 morioka Exp $ +;;; $Id: emu.el,v 7.19 1996/07/11 14:11:12 morioka Exp $ ;;; Keywords: emulation, compatibility, NEmacs, Mule, XEmacs ;;; ;;; This file is part of tl (Tiny Library). @@ -30,6 +30,10 @@ (or (boundp 'emacs-major-version) (defconst emacs-major-version (string-to-int emacs-version))) +(or (boundp 'emacs-minor-version) + (defconst emacs-minor-version + (string-to-int + (substring emacs-version (string-match "18\\." emacs-version))))) (defvar running-emacs-18 (<= emacs-major-version 18)) (defvar running-xemacs (string-match "XEmacs" emacs-version)) @@ -62,6 +66,37 @@ )) +;;; @ MIME charset +;;; + +(defun charsets-to-mime-charset (charsets) + "Return MIME charset from list of charset CHARSETS. +This function refers variable `charsets-mime-charset-alist' +and `default-mime-charset'. [emu.el]" + (if charsets + (or (catch 'tag + (let ((rest charsets-mime-charset-alist) + cell csl) + (while (setq cell (car rest)) + (if (catch 'not-subset + (let ((set1 charsets) + (set2 (car cell)) + obj) + (while set1 + (setq obj (car set1)) + (or (memq obj set2) + (throw 'not-subset nil) + ) + (setq set1 (cdr set1)) + ) + t)) + (throw 'tag (cdr cell)) + ) + (setq rest (cdr rest)) + ))) + default-mime-charset))) + + ;;; @ Emacs 19.29 emulation ;;;