;;;
-;;; $Id: tm-nemacs.el,v 4.4 1994/08/01 05:09:00 morioka Exp $
+;;; tm-nemacs.el --- tm definitions depended on NEmacs
+;;;
+;;; Copyright (C) 1995 Free Software Foundation, Inc.
+;;; Copyright (C) 1994,1995 MORIOKA Tomohiko
+;;;
+;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; Version:
+;;; $Id: tm-nemacs.el,v 7.1 1995/10/03 04:51:07 morioka Exp $
+;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
+;;;
+;;; This file is part of tm (Tools for MIME).
;;;
-(provide 'tm-nemacs)
+(require 'emu)
-(require 'tl-18)
-;;; @ constants
+;;; @ variables
;;;
-(defconst *junet* 2)
-(defconst *internal* 3)
-(defconst *euc-japan* 3)
-(defconst lc-ascii 0)
-(defconst lc-jp 146)
+(defvar mime/default-coding-system *junet*)
+(defvar mime/lc-charset-rule-list
+ (list
+ (list (list lc-ascii) "US-ASCII" nil)
+ (list (list lc-ascii lc-jp) "ISO-2022-JP" "B")
+ ))
-;;; @ variables
+
+;;; @@ (obsolete)
;;;
(defvar mime/lc-charset-and-encoding-alist
- (list
- (cons lc-ascii nil)
- (cons lc-jp '("ISO-2022-JP" . "B"))
- ))
+ (list (cons lc-ascii nil)
+ (cons lc-jp '("ISO-2022-JP" . "B"))
+ ))
+
+(defvar mime/latin-lc-list (list lc-ascii))
+
+
+;;; @ functions
+;;;
-(defvar mime/latin-lc-list
- (list lc-ascii))
-
-(defun mime/char-leading-char (chr)
- (if (< chr 128)
- lc-ascii
- lc-jp))
-
-;; by mol. 1993/9/26
-(defun string-width (str)
- "Return number of columns STRING will occupy.
- [Mule compatible function in tm-nemacs]"
- (length str))
-
-(defun char-bytes (chr)
- "Return number of bytes CHAR will occupy in a buffer.
- [Mule compatible function in tm-nemacs]"
- (if (< chr 128) 1 2))
-
-(defun char-width (chr)
- "Return number of columns CHAR will occupy when displayed.
- [Mule compatible function in tm-nemacs]"
- (if (< chr 128) 1 2))
-
-(defun code-convert-string (str ic oc)
- "Convert code in STRING from SOURCE code to TARGET code,
-On successful converion, returns the result string,
-else returns nil. [Mule compatible function in tm-nemacs]"
- (if (not (eq ic oc))
- (convert-string-kanji-code str ic oc)
- str))
-
-(defun check-ASCII-string (str)
- (let ((i 0)
- len)
- (setq len (length str))
- (catch 'label
- (while (< i len)
- (if (>= (elt str i) 128)
- (throw 'label nil))
- (setq i (+ i 1))
- )
- str)))
-
-;; by mol. 1993/10/4
(defun mime/convert-string-to-emacs (charset str)
- (cond ((string-match "^ISO-2022-JP$" charset)
- (convert-string-kanji-code str 2 3))
- ((string-match "^US-ASCII$" charset) str)
+ (cond ((string= "ISO-2022-JP" charset)
+ (convert-string-kanji-code str *junet* *internal*))
+ ((string= "US-ASCII" charset) str)
((string-match "^ISO-8859-[1-9]$" charset)
(check-ASCII-string str))
- (t nil)
))
-;; by mol. 1993/11/2
(defun mime/convert-string-from-emacs (string charset)
- (cond ((equal charset "ISO-2022-JP")
+ (cond ((string= charset "ISO-2022-JP")
(code-convert-string string *internal* *junet*))
- ((equal charset "US-ASCII") string)
- (t nil)
+ ((string= charset "US-ASCII") string)
))
-;; by mol. 1993/10/4
-(defun mime/decode-encoded-text (charset encoding str)
- (let ((ds (mime/convert-string-to-emacs
- charset
- (cond ((string-match "^B$" encoding)
- (mime/base64-decode-string str))
- ((string-match "^Q$" encoding)
- (mime/Quoted-Printable-decode-string str))
- (t
- (message "unknown encoding %s" encoding)
- (concat "=?" charset "?" encoding "?" str "?=")
- )))))
- (if ds
- ds
- (concat "=?" charset "?" encoding "?" str "?="))
- ))
+(defun mime/code-convert-region-to-emacs (beg end charset &optional encoding)
+ (if (stringp charset)
+ (progn
+ (setq charset (upcase charset))
+ (if (string= charset "ISO-2022-JP")
+ (convert-region-kanji-code beg end *junet* *internal*)
+ ))))
+
+
+;;; @ end
+;;;
+
+(provide 'tm-nemacs)
+
+(run-hooks 'tm-nemacs-load-hook)