FILES = README.eng Makefile *.el *.c methods \
doc/Makefile doc/*.pln doc/*.ol doc/*.tex
-TARFILE = tm5.13.tar
+TARFILE = tm5.15.tar
all: $(UTILS) $(DVI)
;;; @ version
;;;
(defconst mime/RCS-ID
- "$Id: tiny-mime.el,v 5.3 1994/10/25 11:51:05 morioka Exp $")
+ "$Id: tiny-mime.el,v 5.4 1994/10/26 14:45:53 morioka Exp $")
(defconst mime/tiny-mime-version (get-version-string mime/RCS-ID))
(defconst mime/Base64-encoding-and-encoded-text-regexp
(concat "\\(B\\)\\?" mime/Base64-encoded-text-regexp))
-(defconst mime/Quoted-Printable-hex-char "[0123456789ABCDEF]")
+(defconst mime/Quoted-Printable-hex-char-regexp "[0123456789ABCDEF]")
+(defconst mime/Quoted-Printable-octet-regexp
+ (concat "="
+ mime/Quoted-Printable-hex-char-regexp
+ mime/Quoted-Printable-hex-char-regexp))
(defconst mime/Quoted-Printable-encoded-text-regexp
- (concat "\\([^=?_]\\|="
- mime/Quoted-Printable-hex-char
- mime/Quoted-Printable-hex-char
- "\\)+"))
+ (concat "\\([^=?_]\\|" mime/Quoted-Printable-octet-regexp "\\)+"))
(defconst mime/Quoted-Printable-encoding-and-encoded-text-regexp
(concat "\\(Q\\)\\?" mime/Quoted-Printable-encoded-text-regexp))
;;;
-;;; $Id: tl-list.el,v 1.0 1994/09/15 20:42:29 morioka Exp $
+;;; $Id: tl-list.el,v 1.1 1994/10/26 15:55:34 morioka Exp $
;;;
(provide 'tl-list)
)
alist))))
+(defun set-alist (sym item value)
+ (if (not (boundp sym))
+ (set sym nil)
+ )
+ (set sym (put-alist item value (eval sym)))
+ )
+
;;; @ field
;;;
;;;
-;;; $Id: tm-mule.el,v 5.0 1994/10/19 23:47:58 morioka Exp $
+;;; $Id: tm-mule.el,v 5.1 1994/10/26 14:43:57 morioka Exp $
;;;
(provide 'tm-mule)
("ISO-2022-CN" . *iso-2022-ss2-7*)
("ISO-2022-KR" . *iso-2022-kr*)
("EUC-KR" . *euc-kr*)
+ ("ISO-8859-1" . *ctext*)
))
(defvar mime/charset-lc-alist
(defun mime/decode-encoded-text (charset encoding str)
(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))
+ (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) str)
)))
+
+
+(defun mime/code-convert-region-to-emacs (beg end charset)
+ (if (stringp charset)
+ (progn
+ (setq charset (upcase charset))
+ (let ((ct (cdr (assoc charset mime/charset-coding-system-alist))))
+ (if ct
+ (code-convert beg end ct *internal*)
+ )))))
;;;
-;;; $Id: tm-nemacs.el,v 5.0 1994/10/19 23:49:23 morioka Exp $
+;;; $Id: tm-nemacs.el,v 5.1 1994/10/26 15:08:12 morioka Exp $
;;;
(provide 'tm-nemacs)
ds
(concat "=?" charset "?" encoding "?" str "?="))
))
+
+(defun mime/code-convert-region-to-emacs (beg end charset)
+ (if (stringp charset)
+ (progn
+ (setq charset (upcase charset))
+ (if (string= charset "ISO-2022-JP")
+ (convert-region-kanji-code beg end 2 3)
+ ))))
;;;
-;;; $Id: tm-orig.el,v 5.1 1994/10/20 00:43:09 morioka Exp $
+;;; $Id: tm-orig.el,v 5.2 1994/10/26 14:44:58 morioka Exp $
;;;
(provide 'tm-orig)
))
(concat "=?" charset "?" encoding "?" str "?=")
))
+
+
+(defun mime/code-convert-region-to-emacs (beg end charset)
+ )
;;;
-;;; $Id: tm-rich.el,v 1.1 1994/09/05 14:34:06 morioka Exp morioka $
+;;; $Id: tm-rich.el,v 1.2 1994/10/26 15:57:51 morioka Exp $
;;;
(provide 'tm-rich)
(require 'tm-view)
-(require 'assoc)
-(require 'hilit19)
+(if (and (>= (string-to-int emacs-version) 19) window-system)
+ (progn
+ (require 'hilit19)
-(defun mime/get-text/enriched-face (str)
- (let ((sym (intern str)))
- (if (eq sym 'italic)
- 'modeline
- sym)))
+ (defun mime/set-face-region (b e face)
+ (let ((sym (intern face)))
+ (if (eq sym 'italic)
+ (setq sym 'modeline)
+ )
+ (if (member sym (face-list))
+ (progn
+ (hilit-unhighlight-region b e)
+ (hilit-region-set-face b e sym)
+ ))
+ ))
+ )
+ (defun mime/set-face-region (beg end sym)
+ )
+ )
+(defvar mime/text/enriched-face-list
+ '("bold" "italic" "fixed" "underline"))
+
(defun mime/decode-text/enriched-region (beg end)
(interactive "*r")
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char beg)
- (let (cmd sym (fb (point)) fe b e)
+ (let (cmd (fb (point)) fe b e)
(while (re-search-forward
"[ \t\n\r]*<[^<>\n\r \t]+>[ \t\n\r]*" nil t)
(setq cmd (buffer-substring (match-beginning 0) (match-end 0)))
(setq cmd (substring cmd (match-end 0)))
(string-match ">[ \t\n\r]*$" cmd)
(setq cmd (substring cmd 0 (match-beginning 0)))
- (setq sym (mime/get-text/enriched-face cmd))
(cond ((string= cmd "nl")
(fill-region fb (point) t)
(insert "\n")
(setq fb (point))
)
- ((member sym (face-list))
+ ((member (downcase cmd) mime/text/enriched-face-list)
(if (not (bolp))
(insert " ")
)
)
(setq e end)
)))
- (hilit-unhighlight-region b e)
- (hilit-region-set-face b e sym)
+ (mime/set-face-region b e cmd)
)))
(fill-region fb (point) t)
))))
-(defun mime/decode-text/enriched-body ()
+(defun mime/decode-text/enriched (ctl)
(interactive)
(save-excursion
(save-restriction
))))
-(aput 'mime/content-filter-alist
- "text/enriched" (function mime/decode-text/enriched-body))
+(set-alist 'mime/content-filter-alist
+ "text/enriched" (function mime/decode-text/enriched))
-(aput 'mime/content-filter-alist
- "text/richtext" (function mime/decode-text/enriched-body))
+(set-alist 'mime/content-filter-alist
+ "text/richtext" (function mime/decode-text/enriched))
;;;
(defconst mime/viewer-RCS-ID
- "$Id: tm-view.el,v 5.13 1994/10/19 15:26:16 morioka Exp $")
+ "$Id: tm-view.el,v 5.15 1994/10/26 16:02:22 morioka Exp $")
(defconst mime/viewer-version (get-version-string mime/viewer-RCS-ID))
"-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play"))
))
-(defvar mime/content-filter-alist nil)
+(defvar mime/content-filter-alist
+ '(("text/plain" . mime/decode-text/plain)))
(defvar mime/make-content-subject-function
(function
(setq subj (mime/get-subject (cdr ctype)))
(let ((f (cdr (assoc (car ctype) mime/content-filter-alist))))
(if (and f (fboundp f))
- (funcall f)
+ (funcall f ctype)
))
(funcall mime/make-content-header-filter cid)
(goto-char nb)
;;; @ decoder
;;;
-(defun mime/base64-decode-region (beg end &optional buf filename)
- (let ((the-buf (current-buffer)) ret)
- (if (null buf)
- (setq buf (get-buffer-create mime/decoding-buffer-name))
- )
- (save-excursion
- (save-restriction
- (switch-to-buffer buf)
- (erase-buffer)
- (switch-to-buffer the-buf)
- (narrow-to-region beg end)
- (goto-char (point-min))
- (while (re-search-forward
- (concat "^"
- mime/Base64-encoded-text-regexp
- "$") nil t)
- (setq ret (mime/base64-decode-string
- (buffer-substring (match-beginning 0)
- (match-end 0)
- )))
- (switch-to-buffer buf)
- (insert ret)
- (switch-to-buffer the-buf)
- )))
- (if filename
- (progn
- (switch-to-buffer buf)
- (let ((kanji-flag nil)
- (mc-flag nil)
- (file-coding-system
- (if (featurep 'mule) *noconv*))
- )
- (write-file filename)
- (kill-buffer buf)
- (switch-to-buffer the-buf)
- )))
- ))
+(defun mime/Quoted-Printable-decode-region (beg end)
+ (interactive "*r")
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (while (re-search-forward "=\n" nil t)
+ (replace-match "")
+ )
+ (goto-char (point-min))
+ (while (re-search-forward "_" nil t)
+ (replace-match " ")
+ )
+ (goto-char (point-min))
+ (while (re-search-forward mime/Quoted-Printable-octet-regexp nil t)
+ (replace-match
+ (mime/Quoted-Printable-decode-string
+ (buffer-substring (match-beginning 0)(match-end 0))
+ ))
+ )
+ )))
+
+(defun mime/Base64-decode-region (beg end)
+ (interactive "*r")
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char (point-min))
+ (while (search-forward "\n" nil t)
+ (replace-match "")
+ )
+ (let ((str (buffer-substring (point-min)(point-max))))
+ (delete-region (point-min)(point-max))
+ (insert (mime/base64-decode-string str))
+ ))))
(defun mime/make-method-args (cal format)
(mapcar (function
))
+;;; @ content filter
+;;;
+
+(defun mime/decode-text/plain (ctl)
+ (interactive)
+ (save-excursion
+ (save-restriction
+ (let ((charset (cdr (assoc "charset" (cdr ctl))))
+ (encoding
+ (save-excursion
+ (save-restriction
+ (goto-char (point-min))
+ (narrow-to-region (point-min)
+ (or (and (search-forward "\n\n" nil t)
+ (match-beginning 0))
+ (point-max)))
+ (goto-char (point-min))
+ (mime/Content-Transfer-Encoding "7bit")
+ )))
+ (beg (point-min)) (end (point-max))
+ )
+ (goto-char (point-min))
+ (if (search-forward "\n\n" nil t)
+ (setq beg (match-end 0))
+ )
+ (if (cond ((string= encoding "quoted-printable")
+ (mime/Quoted-Printable-decode-region beg end)
+ t)
+ ((string= encoding "base64")
+ (mime/Base64-decode-region beg end)
+ t))
+ (mime/code-convert-region-to-emacs beg (point-max) charset)
+ )
+ ))))
+
;;; @ MIME viewer mode
;;;