tiny-mime-jp.ps signature-jp.ps tiny-mime-eng.ps
GOMI = *.aux *.toc *.log $(TEXFILES) $(DVIFILES) *.ps $(UTILS)
-FILES = *.ol Makefile *.el *.c methods $(TEXFILES)
+FILES = *.ol *.pln Makefile *.el *.c methods tm-jp.tex $(TEXFILES)
-TARFILE = tm4.8.4.tar
+TARFILE = tm5.tar
.SUFFIXES: .ol .tex .dvi .ps
;;;
-;;; $Id: tl-list.el,v 0.6 1994/08/28 17:10:12 morioka Exp $
+;;; $Id: tl-list.el,v 1.0 1994/09/15 20:42:29 morioka Exp $
;;;
(provide 'tl-list)
(fset 'put-field 'put-alist)
(fset 'delete-field 'del-alist)
+
+
+;;; @ field unifier
+;;;
+
+(defun field-unifier-for-default (a b)
+ (let ((ret
+ (cond ((equal a b) a)
+ ((null (cdr b)) a)
+ ((null (cdr a)) b)
+ )))
+ (if ret
+ (list nil ret nil)
+ )))
+
+(defun field-unify (a b)
+ (let ((sym (symbol-concat "field-unifier-for-" (car a))))
+ (if (not (fboundp sym))
+ (setq sym (function field-unifier-for-default))
+ )
+ (funcall sym a b)
+ ))
+
+
+;;; @ type unifier
+;;;
+
+(defun assoc-unify (class instance)
+ (catch 'tag
+ (let ((cla (copy-alist class))
+ (ins (copy-alist instance))
+ (r class)
+ cell aret ret prev rest)
+ (while r
+ (setq cell (car r))
+ (setq aret (fetch-field (car cell) ins))
+ (if aret
+ (if (setq ret (field-unify cell aret))
+ (progn
+ (if (car ret)
+ (setq prev (put-field (car (car ret))
+ (cdr (car ret))
+ prev))
+ )
+ (if (nth 2 ret)
+ (setq rest (put-field (car (nth 2 ret))
+ (cdr (nth 2 ret))
+ rest))
+ )
+ (setq cla (put-field (car cell)(cdr (nth 1 ret)) cla))
+ (setq ins (delete-field (car cell) ins))
+ )
+ (throw 'tag nil)
+ ))
+ (setq r (cdr r))
+ )
+ (setq r (copy-alist ins))
+ (while r
+ (setq cell (car r))
+ (setq aret (fetch-field (car cell) cla))
+ (if aret
+ (if (setq ret (field-unify cell aret))
+ (progn
+ (if (car ret)
+ (setq prev (put-field (car (car ret))
+ (cdr (car ret))
+ prev))
+ )
+ (if (nth 2 ret)
+ (setq rest (put-field (car (nth 2 ret))
+ (cdr (nth 2 ret))
+ rest))
+ )
+ (setq cla (delete-field (car cell) cla))
+ (setq ins (put-field (car cell)(cdr (nth 1 ret)) ins))
+ )
+ (throw 'tag nil)
+ ))
+ (setq r (cdr r))
+ )
+ (list prev (append cla ins) rest)
+ )))
;;;
-;;; $Id: tl-str.el,v 1.4 1994/09/01 06:02:25 morioka Exp morioka $
+;;; $Id: tl-str.el,v 1.7 1994/09/25 21:33:52 morioka Exp $
;;;
(provide 'tl-str)
(goto-char (point-min))
(let* ((fill-prefix
(and (re-search-forward "^[^ \t>]*[>|]+[ \t#]*" nil t)
+ (re-search-forward "^[^ \t>]*[>|]+[ \t#]*" nil t)
(buffer-substring (match-beginning 0)
(match-end 0)
)))
(setq i (+ i 1))
)
dest))
+
+(defun symbol-concat (a b)
+ (intern (concat
+ (cond ((symbolp a)
+ (symbol-name a)
+ )
+ ((stringp a) a)
+ )
+ (cond ((symbolp b)
+ (symbol-name b)
+ )
+ ((stringp b) b)
+ ))))
+
+(defun top-string-match (pat str)
+ (if (string-match
+ (concat "^" (regexp-quote pat))
+ str)
+ (list pat (substring str (match-end 0)))
+ ))
+
+(defun middle-string-match (pat str)
+ (if (equal pat str)
+ (list nil pat nil)
+ (if (string-match (regexp-quote pat) str)
+ (let ((b (match-beginning 0))
+ (e (match-end 0)) )
+ (list (if (not (= b 0))
+ (substring str 0 b)
+ )
+ pat
+ (if (> (length str) e)
+ (substring str e)
+ )
+ )))))
--- /dev/null
+\e$B2,It!w5~Bg$G$9!#\e(B
+
+In article <199408221831.DAA24174@melon.jaist.ac.jp>,
+ \e$B<i2,\e(B \e$BCNI'\e(B (MORIOKA Tomohiko) <morioka@jaist.ac.jp> writes:
+
+\e$B<i2,\e(B> \e$B8=<BF(Hr$7$F!"Bg$-$J\e(B message \e$B$rH/Aw$9$k;~!"<+F0E*$K\e(B message/partial
+\e$B<i2,\e(B> \e$B7A<0$KJ,3d$7$F$/$l$k$b$N$r=q$-$^$7$?!#\e(B
+
+\e$BJXMx$J$N$G!"$9$3$72~NI\e(B(\e$B2~0-!)\e(B)\e$B$7$F$_$^$7$?!#\e(B
+
+1. mime-mode-exit \e$B$r>r7oIU$-$G8F$V$h$&$K$7!"\e(Bmime-mode \e$B0J30$G$b\e(B
+ \e$B;H$($k$h$&$K$7$?!#\e(B
+
+ \e$B:G6a\e(B mh-e 4.1 \e$B$N\e(B mh-edit-mhn \e$B$b;H$C$F$_$F$$$k$N$G!"\e(Bmime-mode \e$B0J30$G$b\e(B
+ \e$B;H$($k$h$&$K$7$?$H$$$&$N$,F05!$G$9!#6KC<$K8@$($PIaCJ$O\e(B MIME \e$B$rA4A3;H$C$F\e(B
+ \e$B$$$J$$?M$G$b!"<+F0J,3d$K$O;H$($k$H;W$$$^$9!#\e(B
+
+\e$B!t\e(B mh-edit-mhn \e$B$GJQ49$7$?8e\e(B mime/view-mode \e$B$KF~$C$F%W%l%S%e!<$7!"\e(B
+ \e$B$&$^$/$$$C$F$J$+$C$?$i\e(B mh-revert-mhn-edit \e$B$G$d$jD>$9!"$H$$$&\e(B
+ \e$B<j=g$O\e(B mime-mode \e$B$H\e(B metamail-* \e$B$h$j$O2wE,$G$9!#\e(B
+
+2. \e$B%X%C%@$H%\%G%#$N6h@Z$j$,6u9T$N>l9g$K$bBP1~$7$?!#\e(B
+
+ mh-edit-mhn \e$B$N=PNO$O$3$N7A<0$J$N$G!"$d$`$rF@$:$=$&$7$^$7$?!#\e(B
+
+3. mime/draft-file-name \e$B$,\e(B nil \e$B$N$H$-$K;H$&%U%!%$%kL>$r0J2<$N$h$&$K$7$?!#\e(B
+
+ (make-temp-name (expand-file-name "tm-draft" mime/tmp-dir))
+
+4. \e$BJ,3d$7$?%a%C%;!<%8$K$O!"$b$H$N\e(B Subject \e$B$N$&$7$m$K\e(B (1/3) \e$B$J$I$H$D$/\e(B
+ \e$B$h$&$K$7$?!#\e(B
+
+ \e$B6a$$>-Mh!"\e(Bsuper-pipe \e$B$d\e(B gnus-uu \e$B$N$h$&$K!"\e(Bmessage/partial \e$B$N$H$-$O$I\e(B
+ \e$B$l$+$R$H$D$N5-;v$r$_$l$PB>$N$rC5$7$K9T$/5!G=$,\e(B tm-view.el \e$B$K<BAu$5$l$k\e(B
+ \e$B$3$H$r4j$C$F$N$3$H$G$9\e(B ^_^
+
+
+
+\e$B$^$@5$$KF~$i$J$$E@$G$9$,!"\e(B
+
+1. \e$B$b$H$N\e(B(\e$B=q$-$+$1$N\e(B)\e$B%a%C%;!<%8$N%X%C%@$r$=$N$^$^Aw$C$F$7$^$&$N$G!"\e(B
+ \e$BNc$($P\e(B MH \e$B$N>l9g!"\e(BBcc:, Dcc: Fcc: \e$B$J$IK\MhAw$C$?;~$K>C$($k\e(B
+ \e$B$O$:$N$b$N$,FO$$$F$7$^$&\e(B(\e$B$H$/$K\e(B Bcc: \e$B$,8+$($k$N$OLdBj\e(B)\e$B!#\e(B
+ \e$B1#$9%U%#!<%k%I$r;XDj$G$-$k$h$&$K$9$Y$-!#\e(B
+
+2. \e$B@8@.$5$l$k\e(B id \e$B$,D9$C$?$i$7$/$F$+$C$30-$$!#\e(B
+ (\e$BNc$($P\e(B GNUS \e$B$N\e(B message-id \e$B@8@.%k!<%A%s$rE>MQ$7$F$O$I$&$+\e(B)
+
+\e$B$J$I$,$"$j$^$9!#\e(B
+
+\e$B<i2,\e(B> \e$B$^$?!"\e(Bmessage \e$B$N:GBg9T?t$rJQ?t\e(B mime/message-max-length \e$B$G;XDj$G$-$^\e(B
+\e$B<i2,\e(B> \e$B$9!#$H$j$"$($:!"\e(Bdefault \e$B$G$O\e(B 1000 \e$B9T$K$7$F$"$j$^$9$,!"$3$l$K4X$9$k0lHL\e(B
+\e$B<i2,\e(B> \e$BE*$JCM$O$"$k$s$G$7$g$&$+!)\e(B
+
+\e$B9T?t$h$j$O%P%$%H?t$,Bg;v$J$O$:$G!"$h$/8@$o$l$k$N$O\e(B1\e$BDL$"$?$j\e(B50KB\e$B$rD6$(\e(B
+\e$B$J$$$h$&$K$H$$$&@)Ls$G$9$M\e(B(\e$B$&$A$N%;%s%?!<$NMxMQ$N<j0z$K$b$=$&=q$$$F$"\e(B
+\e$B$j$^$7$?\e(B)\e$B!#5pBg$J%a!<%k$NB?$/$O%P%$%J%j%U%!%$%k$NE>Aw$G!"Cf?H$O\e(B base64
+\e$B$G0l9T\e(B80\e$B;z<e$K$J$C$F$$$k$H2>Dj$9$k$H!"\e(B600 \e$B9T6/$K$"$?$j$^$9!#$7$+$7\e(B50KB
+\e$B0J>e$N$b$N$ODL$i$J$$$h$&$K$J$C$F$$$k$H$$$&$o$1$G$O$J$/C1$K0BA4$d8zN($r\e(B
+\e$B9M$($F$NCM$G$7$g$&$+$i!"\e(Bsplit \e$B$NI8=`CM$G$b$"$k\e(B 1000 \e$B$GLdBj$J$$$H;W$$$^$9!#\e(B
+-----
+\e$B2,It<wCK!w5~ETBg3XBg7?7W;;5!%;%s%?!<8&5f3+H/It\e(B
;;;
-;;; $Id: tm-comp.el,v 1.1 1994/08/21 22:00:44 morioka Exp morioka $
+;;; $Id: tm-comp.el,v 1.2 1994/09/26 12:37:03 morioka Exp $
;;;
(provide 'tm-comp)
+(require 'tl-header)
+(require 'mail-utils)
+
+(defvar mime/tmp-dir (or (getenv "TM_TMPDIR") "/tmp/"))
(defvar mime/message-max-length 1000)
(defvar mime/message-sender-alist
(config (eval (cdr (assq major-mode mime/window-config-alist))))
)
(if (null mime/draft-file-name)
- (setq mime/draft-file-name "/tmp/tm-draft")
+ (setq mime/draft-file-name
+ (make-temp-name (expand-file-name "tm-draft" mime/tmp-dir)))
)
- (mime-mode-exit)
+ (if (and (boundp 'mime-mode-flag) mime-mode-flag)
+ (mime-mode-exit))
(if (<= lines mime/message-max-length)
(funcall cmd)
(let ((header (message/get-header-string-except
- "^Content-" separator))
+ "\\(^[Cc]ontent-\\|^[Ss]ubject:\\)" separator))
+ (subject (mail-fetch-field "subject"))
(id (concat "\""
(replace-space-with-underline (current-time-string))
"@" (system-name) "\""))
(switch-to-buffer buf)
(insert header)
(insert
+ (format "Subject: %s (%d/%d)\n" subject (+ i 1) total))
+ (insert
(format
"Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
id (+ i 1) total separator))
(save-restriction
(narrow-to-region (goto-char (point-min))
(progn
- (re-search-forward boundary nil t)
+ (re-search-forward
+ (concat "^\\(" (regexp-quote boundary) "\\)?$")
+ nil t)
(match-beginning 0)
))
(goto-char (point-min))
;;;
-;;; $Id: tm-gnus3.el,v 3.2 1994/08/31 12:07:15 morioka Exp $
+;;; $Id: tm-gnus3.el,v 5.0 1994/09/25 21:27:38 morioka Exp $
;;;
(provide 'tm-gnus3)
(gnus-Subject-select-article t t)
)
(pop-to-buffer gnus-Article-buffer t)
- (mime/view-mode)
+ (mime/viewer-mode)
)
(add-hook 'gnus-Select-group-hook
;;;
-;;; $Id: tm-gnus4.el,v 3.1 1994/08/31 05:29:42 morioka Exp $
+;;; $Id: tm-gnus4.el,v 5.0 1994/09/25 21:27:13 morioka Exp $
;;;
(provide 'tm-gnus4)
(require 'tm-gnus)
-(autoload 'mime/view-mode "tm-view" "View MIME message." t)
+(autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
(if (and (null gnus-startup-hook)
(boundp 'gnus-Startup-hook))
(gnus-summary-select-article t t)
)
(pop-to-buffer gnus-article-buffer t)
- (mime/view-mode)
+ (mime/viewer-mode)
)
(add-hook 'gnus-select-group-hook
--- /dev/null
+\documentstyle[a4j]{jreport}
+
+\title{tm ÀâÌÀ½ñ}
+\author{¼é²¬ ÃÎɧ\\
+ morioka@jaist.ac.jp}
+\date{\verb$Id: tm-jp.tex,v 2.1 1994/09/02 09:41:08 morioka Exp morioka $}
+
+\begin{document}
+
+\maketitle
+\tableofcontents
+
+\chapter{¤Ï¤¸¤á¤Ë}
+
+tm ¤Ï GNU Emacs ¤Ç MIME ¤ò³Ú¤·¤à¤¿¤á¤Î package ¤Ç¤¹¡£tm ¤ò»È¤¦¤È¡¢
+
+\begin{itemize}
+\item ¿¸À¸ì header ¤Î encode/decode
+\item mime/view-mode ¤ò»È¤Ã¤¿ MIME message ¤Î±ÜÍ÷¡¦ºÆÀ¸
+\item mh-e, GNUS, RMAIL ¤Ç¤Î MIME µ¡Ç½¤Î¶¯²½
+\end{itemize}
+
+\noindent ¤¬¹Ô¤Ê¤¨¤Þ¤¹¡£
+
+
+\section{Module °ìÍ÷}
+
+tm ¤Ï°Ê²¼¤Î module ¤«¤é¤Ê¤ê¤Þ¤¹¡£
+
+\begin{itemize}
+\item {\bf tiny-mime} : MIME header encoder/decoder
+\item {\bf tm-view} : MIME viewer
+\item {\bf tm-misc} : tm-MUA ¤Î¶¦ÄÌ module
+\item {\bf tm-MUAs} : MUA ¤Î MIME µ¡Ç½¶¯²½ module
+ \begin{itemize}
+ \item {\bf tm-mh-e} : mh-e ÍѤΠtm-MUA
+ \item {\bf tm-gnus} : GNUS ÍѤΠtm-MUA
+ \item {\bf tm-rmail} : RMAIL ÍѤΠtm-MUA
+ \end{itemize}
+\item {\bf tm-setup} tm-MUA ¤ÎÀßÄê module
+\item {\bf mime-setup} MIME ´Ø·¸¤ÎÀßÄê module
+\end{itemize}
+
+
+\chapter{Emacs version Ê̤ε¡Ç½¤ª¤è¤ÓÀ©¸Â}
+
+\section{Emacs (original)}
+
+Original ¤Î Emacs ¤Ç¤Ï¡¢ÅöÁ³¤Î¤³¤È¤Ê¤¬¤é¡¢Ã±°ìʸ»ú½¸¹ç¤·¤«»È¤¨¤Þ¤»¤ó¡£
+
+\section{NEmacs, NEpoch}
+
+NEmacs ¤Ç¤Ï¡¢ISO-2022-JP ¤ª¤è¤Ó US-ASCII ¤¬»È¤¨¤Þ¤¹¡£
+
+\begin{description}
+\item[¡ÎÃí°Õ¡Ï] outline.el ¤Ï NEmacs Éí°¤Î¤â¤Î¤Ç¤Ï¤Ê¤¯¡¢outln-18.el
+ ¤ò»È¤¦¤³¤È¤ò¿ä¾©¤·¤Þ¤¹¡£outln-18.el ¤ò»È¤¦¾ì¹ç¤Ï¡¢¤³¤ì¤ò outline.el
+ ¤Ë link ¤òÄ¥¤ë¤«¡¢rename ¤·¤Æ²¼¤µ¤¤¡£
+
+ outln-18.el ¤ò»È¤ï¤Ê¤¤¾ì¹ç¤Ï¡¢outline.el ¤Ë
+
+\begin{verbatim}
+(provide 'outline)
+\end{verbatim}
+
+ \noindent ¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£
+\end{description}
+
+
+\section{Mule}
+
+ISO-2022-JP, ISO-2022-JP-2, US-ASCII, ISO-8859-1..9, ISO-2022-CN,
+ISO-2022-KR, EUC-KR ¤Ê¤É¤Î¿¸À¸ì header ¤¬»È¤¨¤Þ¤¹¡£¤Þ¤¿¡¢´Ø¿ô
+mime/set-charset-and-encoding ¤ÇÄɲá¦Êѹ¹¤¬¤Ç¤¤Þ¤¹¡£
+
+\begin{description}
+\item[¡ÎÃí°Õ¡Ï] Emacs 18 base ¤Î Mule (Mule 1.1 ¤Ê¤É¡Ë¤Ç¤Ï¡¢Mule Éí°
+ ¤Î outline.el ¤ÎÂå¤ï¤ê¤Ëoutln-18.el ¤ò»È¤¦¤³¤È¤ò¿ä¾©¤·¤Þ¤¹¡£
+ outln-18.el ¤ò»È¤¦¾ì¹ç¤Ï¡¢¤³¤ì¤ò outline.el ¤Ë link ¤òÄ¥¤ë¤«¡¢rename
+ ¤·¤Æ²¼¤µ¤¤¡£
+
+ outln-18.el ¤ò»È¤ï¤Ê¤¤¾ì¹ç¤Ï¡¢outline.el ¤Ë
+
+\begin{verbatim}
+(provide 'outline)
+\end{verbatim}
+
+ \noindent ¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£
+\end{description}
+
+
+\chapter{Install ¤ÈÀßÄê}
+
+\section{Install}
+
+Install ¤Ï¼¡¤Î¼ê½ç¤Ç¹Ô¤Ê¤¤¤Þ¤¹¡£
+
+\begin{enumerate}
+\item Makefile ¤Î bindir ¤ò¼«Ê¬¤Î´Ä¶¤Ë¹ç¤ï¤»¤Æ½ñ¤´¹¤¨¤ë¡£
+\item methods/ °Ê²¼¤Ë¤¢¤ë method script ¤ò \ref{sec:method} Àá¤ò»²¾È¤·
+ ¤Æ¡¢¼«Ê¬¤Î´Ä¶¤Ë¹ç¤¦¤è¤¦¤Ë½ñ¤´¹¤¨¤ë¡£
+\item make all ¤¹¤ë¡£
+\item make install ¤¹¤ë¡£
+\item *.el ¤ò Emacs ¤ÎÊÑ¿ô load-path ¤Ç»ØÄꤵ¤ì¤¿ directory ¤Ë copy ¤¹¤ë¡£
+\end{enumerate}
+
+\noindent{\bf [Ãí°Õ]}
+\begin{itemize}
+\item tm-mh-e3.el ¤ò byte-compile ¤¹¤ë¾ì¹ç¤Ï¡¢mh-e version 3.* ¤ò load
+ ¤·¤¿¾õÂ֤ǹԤʤäƲ¼¤µ¤¤¡£
+\item tm-gnus3.el ¤ò byte-compile ¤¹¤ë¾ì¹ç¤Ï¡¢GNUS 3 ¤¬ load ¤µ¤ì¤¿¾õ
+ Â֤ǹԤʤäƲ¼¤µ¤¤¡£
+\item tl-18.el ¤ò byte-compile ¤¹¤ë¾ì¹ç¤Ï¡¢Emacs 18 ¤Ç¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤¡£
+\item tl-orig.el ¤ò byte-compile ¤¹¤ë¾ì¹ç¤Ï¡¢original Emacs ¤Ç¹Ô¤Ê¤Ã¤Æ
+ ²¼¤µ¤¤¡£
+\item tl-nemacs.el ¤ò byte-compile ¤¹¤ë¾ì¹ç¤Ï¡¢NEmacs ¤Ç¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤¡£
+\item tl-mule.el ¤ò byte-compile ¤¹¤ë¾ì¹ç¤Ï¡¢Mule ¤Ç¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤¡£
+\item Emacs 19 ¤Ç byte-compile ¤·¤¿ module ¤Ï Emacs 18 ¤Ç¤ÏÆ°¤¤Þ¤»¤ó¡£
+\end{itemize}
+
+
+\section{ÀßÄê}
+
+¤³¤Î package ¤Ë¤Ï mime-setup.el ¤È tm-setup.el ¤È¤¤¤¦´Ê°×ÀßÄê file ¤¬
+Éí°¤·¤Æ¤¤¤Þ¤¹¡£mime-setup.el ¤Ç¤Ï encoding ¤â´Þ¤á¤¿ÀßÄê¤ò¹Ô¤Ê¤¤¡¢
+tm-setup ¤Ç¤Ï tm-MUA ¤Ë´Ø¤¹¤ëÀßÄê¤Î¤ß¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
+
+\subsection{mime-setup}
+
+\begin{verbatim}
+(load "mime-setup")
+\end{verbatim}
+
+\noindent ¤È¤¹¤ë¤È MIME ¤Ë´Ø¤¹¤ë³Æ¼ïÀßÄê¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£mime-setup ¤Ï
+tm-setup ¤òÆɤó¤Ç¤¤¤ë¤Î¤Ç¡¢mime-setup ¤ò»È¤¦¾ì¹ç¡¢tm-setup ¤ò load ¤¹
+¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£
+
+mime-setup.el ¤Ïɸ½à¤Ç¤Ï SuperCite ¤ÎÀßÄê¤â¹Ô¤Ê¤¤¤Þ¤¹¡£¤³¤ì¤ò¤ä¤á¤ë¾ì
+¹ç .emacs ¤Ë°Ê²¼¤Î¤â¤Î¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£
+
+\begin{verbatim}
+(setq mime-setup-use-sc nil)
+\end{verbatim}
+
+mime-setup ¤Ç¤Ï signature ¤Î¼«Æ°ÀÚÂؤ¨ tool ¤âÉí°¤·¤Æ¤¤¤Þ¤¹¡£
+message header ¤Î field ¤Ë¹ç¤ï¤»¤Æ signature ¤Î¼«Æ°ÀÚÂؤò¹Ô¤Ê¤¤¤¿¤¤¾ì
+¹ç¤Ï .emacs ¤Ë°Ê²¼¤Î¤è¤¦¤Ê¤â¤Î¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£¡Ê¾Ü¤·¤¯¤Ï signature.el
+¤ÎÀâÌÀ½ñ¤ò»²¾È¤·¤Æ²¼¤µ¤¤¡Ë
+
+\begin{verbatim}
+(setq signature-file-alist
+ '((("Newsgroups" . "jokes") . "~/.signature-jokes")
+ (("Newsgroups" . ("zxr" "nzr")) . "~/.signature-sun")
+ (("To" . ("ishimaru" "z-suzuki")) . "~/.signature-sun")
+ (("To" . "tea") . "~/.signature-jokes")
+ (("To" . ("sim" "oku" "takuo")) . "~/.signature-formal")
+ ))
+\end{verbatim}
+
+mime-setup ¤ò»È¤¦¾ì¹ç¤Ï¡¢mime.el ¤¬É¬ÍפǤ¹¡£¤Þ¤¿¡¢SuperCite ¤ò»È¤¦¾ì
+¹ç¤Ï¡¢SuperCite ¤âɬÍפǤ¹¡£
+
+
+\subsection{tm-setup}
+
+tm-setup ¤Ï tm-MUA ¤ÎÀßÄê¤Î¤ß¤ò¹Ô¤Ê¤¦ module ¤Ç¤¹¡£mime-setup ¤ò load
+¤·¤Æ¤¤¤ë¾ì¹ç¡¢¤³¤ì¤òÍÛ¤Ë load ¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¤¬¡¢mime-setup ¤ò»È
+¤¤¤¿¤¯¤Ê¤¤¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤³¤ì¤ò load ¤·¤Æ²¼¤µ¤¤¡£
+
+\begin{verbatim}
+(load "tm-setup")
+\end{verbatim}
+
+
+\subsection{ÀßÄê file ¤ò»È¤ï¤Ê¤¤¾ì¹ç}
+
+tm-setup.el ¤ò»²¹Í¤Ë¤·¤Æ²¼¤µ¤¤¡£
+
+
+\subsection{MH ¤ÎÀßÄê}
+
+¤Þ¤¿¡¢MH ¤¬ MH-6.8JP2 ¤Î¾ì¹ç¡¢.mh\_profile ¤Ë
+
+\begin{verbatim}
+scan: -form scan.mime
+inc: -form inc.mime
+repl: -form replcomps.mime
+showproc: mhl
+\end{verbatim}
+
+\noindent ¤òÄɲ䷤Ƥ¯¤À¤µ¤¤¡£¤Þ¤¿¡¢¤½¤ì°Ê³°¤Î MH ¤Î½èÍý¤Ï Emacs ¤Î¦
+¤Ç¼è¤ê»ÅÀÚ¤ë¤Î¤Ç¡¢MH ¤ÎÀßÄê¤Ï¤·¤Ê¤¤¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+
+\chapter{tm-MUA}
+
+``tm-MUA'' ¤È¤¤¤¦¤Î¤Ï¡¢mh-e, GNUS, RMAIL ¤Ê¤É¤Î MUA ¤Î¤¿¤á¤Î MIME µ¡Ç½
+¶¯²½ module ¤ÎÁí¾Î¤Ç¤¹¡£
+
+¸½ºß¡¢tm-MUA ¤Ë¤Ï¡¢
+
+\begin{itemize}
+\item {\bf tm-mh-e} : mh-e ÍѤΠtm-MUA
+\item {\bf tm-gnus} : GNUS ÍѤΠtm-MUA
+\item {\bf tm-rmail} : RMAIL ÍѤΠtm-MUA
+\end{itemize}
+
+\noindent ¤¬¤¢¤ê¤Þ¤¹¡£¤³¤Î¾Ï¤Ç¤Ï¤³¤ì¤é¤Î module ¤Ë´Ø¤·¤ÆÀâÌÀ¤·¤Þ¤¹¡£
+
+
+\section{Summary mode}
+
+tm-MUA ¤ò»È¤¦¤È¡¢¸µ¤Î MUA ¤Î Summary mode ¤ËÂФ·¤Æ°Ê²¼¤Îµ¡Ç½¤¬Äɲ䵤ì
+¤Þ¤¹¡£
+
+\medskip
+\begin{center}
+ \begin{tabular}{|l|l|}\hline
+ key & µ¡Ç½ \\ \hline
+ M-t & MIME header ¤Î decode ¤Ë´Ø¤¹¤ë toggle \\
+ v & ËÜʸ¤ËÆþ¤ê¡¢mime/view-mode ¤Ë°Ü¤ë \\ \hline
+ \end{tabular}
+\end{center}
+\medskip
+
+
+\section{mime/viewer-mode}
+\label{sec:mime/viewer-mode}
+
+tm-MUA ¤ò»È¤¦¤È¡¢Summary mode ¤Ç {\bf v} ¤ò²¡¤¹¤³¤È¤Ë¤è¤Ã¤Æ¡¢
+mime/viewer-mode ¤È¤¤¤¦ MIME message ¤ò±ÜÍ÷¤¹¤ë¤¿¤á¤Î mode ¤ËÆþ¤ê¤Þ¤¹
+¡Ê⤷¡¢vm ¤Ç¤Ï°ã¤¦ key ¤Ë bind ¤·¤Æ¤¤¤ë¤½¤¦¤Ç¤¹¡Ë¡£mime/viewer-mode
+¤Ë¤Ï°Ê²¼¤Îµ¡Ç½¤¬¤¢¤ê¤Þ¤¹¡£
+
+\medskip
+\begin{center}
+ \begin{tabular}{|l|l|}\hline
+ key & µ¡Ç½ \\ \hline
+ u & ¾å¤Î content ¤ËÌá¤ë \\
+ & message ¤Î°ìÈÖ¾å¤Î content ¤Ç¤³¤ì¤ò¹Ô¤Ê¤¦¤È Summary mode
+ ¤ËÌá¤ë (*1) \\
+ p & Á°¤Î content ¤Ë°ÜÆ°¤¹¤ë \\
+ n & ¼¡¤Î content ¤Ë°ÜÆ°¤¹¤ë \\
+ SPC & scroll up ¤¹¤ë \\
+ M-SPC & scroll down ¤¹¤ë \\
+ v & content ¤òºÆÀ¸¤¹¤ë (*2) \\
+ e & content ¤«¤é file ¤ò¼è¤ê½Ð¤¹ (*2) \\
+ C-c C-p & content ¤ò°õºþ¤¹¤ë (*2) \\ \hline
+ \end{tabular}
+\end{center}
+\medskip
+
+\bigskip
+
+\newcounter{asteriskcount}
+\noindent{\bf ¡ÎÃí°Õ¡Ï}
+\vspace{-1ex}
+{\list{(*\arabic{asteriskcount})}{\usecounter{asteriskcount}\leftmargin=8ex}
+\item tm-mh-e, tm-gnus, tm-rmail ¤Ê¤É¤Ç tm-view ¤ÎÀßÄê¤ò¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
+ Summary mode ¤Ë¤ÏÌá¤ê¤Þ¤»¤ó¡£
+\item ¼ÂºÝ¤ÎÆ°ºî¤ÏÂбþ¤¹¤ë method ¤Ë°Í¤ê¤Þ¤¹¡£
+\endlist}
+
+
+\section{tm-gnus ¤Î customize}
+
+\subsection{article ¤ò save ¤¹¤ë»þ decoding ¤·¤Ê¤¤}
+
+article ¤ò save ¤¹¤ë»þ¡¢Êݸ¤µ¤ì¤ë message ¤Ï¤½¤Î»þɽ¼¨¤µ¤ì¤Æ¤¤¤ë¤è¤¦
+¤Ë¡¢¤½¤Î»þ¤Î MIME header decoding mode ¤Ë±þ¤¸¤Æ save ¤µ¤ì¤Þ¤¹¡£
+
+¤·¤«¤·¡¢article ¤ò save ¤¹¤ë»þ¡¢¾ï¤Ë¡¢MIME header decoding ¤ò¹Ô¤Ê¤ï¤Ê
+¤¤¡¢À¸¤Î message ¤ÇÊݸ¤·¤¿¤¤¾ì¹ç¤Ï¡¢ÊÑ¿ô
+tm-gnus/set-mime-header-decoding-mode ¤ÎÃͤò nil ¤Ë¤·¤Æ¡¢MIME header
+decoding ¤ò¹Ô¤Ê¤ï¤Ê¤¤ mode ¤Ë¤·¤Æ¡¢article save ´Ø¿ô¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤ËÀß
+Äꤷ¤Æ²¼¤µ¤¤¡£
+
+Save ¤Î¼Â¹Ô¸å¡¢MIME header decoding mode ¤òÁ°¤Î¾õÂÖ¤ËÌᤷ¤¿¤¤¾ì¹ç¤Ï¡¢
+°Ê²¼¤Î¤è¤¦¤Ë¡¢°ì»þÊÑ¿ô¤Ë MIME header decoding mode ¤òÊݸ¤·¤Æ¤ª¤±¤Ð OK
+¤Ç¤¹¡£
+
+\begin{verbatim}
+ (let ((mm mime/header-decoding-mode))
+ (tm-gnus/set-mime-header-decoding-mode nil)
+ (article save ´Ø¿ô)
+ (tm-gnus/set-mime-header-decoding-mode mm)
+ )
+\end{verbatim}
+
+°Ê²¼¤Ë¡¢mh-e ¤Î folder ¤Ë save ¤¹¤ë¾ì¹ç¤ÎÎã¤ò¼¨¤·¤Þ¤¹¡£
+
+\begin{verbatim}
+(add-hook 'gnus-Startup-hook
+ (function
+ (lambda ()
+ (setq gnus-default-article-saver
+ (function
+ (lambda ()
+ (interactive)
+ (let ((mm mime/header-decoding-mode))
+ (tm-gnus/set-mime-header-decoding-mode nil)
+ (gnus-Subject-save-in-folder)
+ (tm-gnus/set-mime-header-decoding-mode mm)
+ )))))))
+(add-hook 'gnus-startup-hook
+ (function
+ (lambda ()
+ (setq gnus-default-article-saver
+ (function
+ (lambda ()
+ (interactive)
+ (let ((mm mime/header-decoding-mode))
+ (tm-gnus/set-mime-header-decoding-mode nil)
+ (gnus-summary-save-in-folder)
+ (tm-gnus/set-mime-header-decoding-mode mm)
+ )))))))
+\end{verbatim}
+
+\subsection{reply ¤¹¤ë»þ Subject ¤Î encoding Ë¡¤ò reply ¸µ¤Ë¹ç¤ï¤»¤ë}
+
+Reply ¤¹¤ë»þ¡¢reply ¸µ¤Î Subject ¤Ë ASCII °Ê³°¤Îʸ»ú½¸¹ç¤ÎÆþ¤Ã¤Æ¤¤¤ë
+¾ì¹ç¡¢reply ¸µ¤¬ MIME encode ¤µ¤ì¤Æ¤¤¤¿¤é encode ¤·¡¢¤½¤¦¤Ç¤Ê¤«¤Ã¤¿¤é
+À¸¤ÇÆþ¤ì¤¿¤¤¾ì¹ç¤Ï¡¢¼¡¤Î¤è¤¦¤ËÀßÄꤷ¤Þ¤¹¡£
+
+\begin{verbatim}
+(add-hook 'gnus-article-prepare-hook
+ (function
+ (lambda ()
+ (if (mime/exist-encoded-word-in-subject)
+ (setq mime/no-encoding-header-fields '("X-Nsubject"))
+ (setq mime/no-encoding-header-fields '("X-Nsubject" "Subject"))
+ ))))
+\end{verbatim}
+
+
+\chapter{tm-view}
+
+tm-view ¤Ï MIME message ¤ò±ÜÍ÷¤¹¤ë¤¿¤á¤Îµ¡Ç½¤òÄ󶡤¹¤ë module ¤Ç¤¹¡£
+tm-view ¤Ï mime/viewer-mode ¤È¤¤¤¦ mode ¤òÄ󶡤·¤Þ¤¹¡£
+
+mime/viewer-mode ¤Îµ¡Ç½¤Ë´Ø¤·¤Æ¤Ï¡¢\ref{sec:mime/viewer-mode} Àá¤ò»²¾È
+¤·¤Æ²¼¤µ¤¤¡£
+
+\section{content ¤Î decode ¾ò·ï¤ÎÀßÄê}
+
+ÊÑ¿ô mime/content-decoding-condition ¤Ï decode »þ¤Î method ¤ò»ØÄꤹ¤ë
+¤¿¤á¤ÎÊÑ¿ô¤Ç¡¢tm-view 4 ¤ÎÊÑ¿ô mime/content-decoding-method-alist ¤ËÁê
+Åö¤·¤Þ¤¹¡£
+
+ÊÑ¿ô mime/content-decoding-method-alist ¤Ç¤Ï¡¢Ã±¤Ë
+content-type/subtype ¤ËÂФ¹¤ë method ¤ò»ØÄꤹ¤ë¤³¤È¤·¤«¤Ç¤¤Þ¤»¤ó¤Ç¤·
+¤¿¤¬¡¢ÊÑ¿ô mime/content-decoding-condition ¤Ç¤Ï decode »þ¤ÎÀ©Ìó¾ò·ï¤ò
+½ñ¤¯¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
+
+ÊÑ¿ô mime/content-decoding-condition ¤Ï¡¢
+
+\begin{eqnarray*}
+ (¾ò·ï_1 \;\; ¾ò·ï_2 \;\; ...)
+\end{eqnarray*}
+
+\noindent ¤È¤¤¤¦·Á¤ò¤·¤¿ list ¤Ç¡¢³Æ¾ò·ï¤Ï
+
+\begin{eqnarray*}
+ ((field-type_1 \; . \; value_1) \;\;
+ (field-type_2 \; . \; value_2) \;\; ...)
+\end{eqnarray*}
+
+\noindent ¤È¤¤¤¦·Á¤ÎÏ¢ÁÛ list ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
+
+Î㤨¤Ð¡¢text/plain ¤Î»þ¡¢tm-plain ¤òµ¯Æ°¤¹¤ë»þ¡¢
+
+\begin{quote}
+ ((type . "text/plain")
+ (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
+\end{quote}
+
+\noindent ¤È¤¤¤¦¾ò·ï¤ò½ñ¤¤Þ¤¹¡£¸«¤Æ¤ÎÄ̤ꡢ³°Éô method ¤Î°ú¿ô¤¬½ñ¤±¤ë
+¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£¾Ü¤·¤¯¤Ï \ref{sec:method-arguments} Àá¤Ç½Ò¤Ù¤Þ¤¹¡£
+
+¤³¤Î¾ò·ï¤Ï text/plain ¤Ç¤¢¤ë content ¤Ê¤éÁ´¤Æ¤Î decoding-mode ¤Ç͸ú¤Ç
+¤¹¡£¤·¤«¤·¡¢
+
+\begin{quote}
+ ((type . "text/plain")
+ (method "tm-plain" nil 'file 'type 'encoding 'mode 'name)
+ (mode . "play"))
+\end{quote}
+
+\noindent ¤Ê¤é¡¢play mode °Ê³°¤Ç¤Ï͸ú¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
+
+µÕ¤Ë¡¢
+
+\begin{quote}
+ ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file)
+ (mode . "play"))
+\end{quote}
+
+\noindent ¤Ê¤é¡¢Á´¤Æ¤Î content-type ¤Î play mode ¤Ç͸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
+
+¤³¤¦¤·¤Æ³Æ¾ò·ï¤òÁ°¤«¤é¸«¤Æ¹Ô¤¡¢ºÇ½é¤Ë͸ú¤Ë¤Ê¤Ã¤¿¾ò·ï¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
+
+
+\subsection{method ¤Î°ú¿ô¤Î»ØÄê¤Î»ÅÊý}
+\label{sec:method-arguments}
+
+¾ò·ï¤Î method field ¤Ï
+
+\begin{eqnarray*}
+ (method \; . \; SYMBOL)
+\end{eqnarray*}
+
+\noindent ¤«
+
+\begin{eqnarray*}
+ (method \; ʸ»úÎó \; FLAG \; °ú¿ô_1 \; °ú¿ô_2 \; ...)
+\end{eqnarray*}
+
+\noindent ¤È¤¤¤¦·Á¤ò¤·¤Æ¤¤¤Þ¤¹¡£
+
+method field ¤ÎÃͤ¬ symbol ¤Ç¤¢¤ë¾ì¹ç¤Ï¡¢ÆâÉô method ¤È¤·¤Æµ¯Æ°¤µ¤ì¤Þ
+¤¹¡£
+
+method field ¤ÎÃͤ¬ list ¤Ç¤¢¤ë¾ì¹ç¡¢³°Éô method ¤È¤·¤Æµ¯Æ°¤µ¤ì¤Þ¤¹¡£
+¤³¤Î¾ì¹ç¡¢
+
+\begin{quote}
+ \begin{tabular}{lcl}
+ ʸ»úÎó&:&³°Éô method ¤Î̾Á° \\
+ FLAG&:& t ¤Ê¤é content header ¤â³°Éô method ¤ËÅϤ¹¡£
+ nil ¤Ê¤é content body ¤Î¤ß¤òÅϤ¹¡£\\
+ °ú¿ôÎó&:&³°Éô method ¤Î°ú¿ô
+ \end{tabular}
+\end{quote}
+
+\noindent ¤È²ò¼á¤µ¤ì¤Þ¤¹¡£
+
+¤Þ¤¿¡¢³°Éô method ¤Î°ú¿ô¤Ï¼¡¤Î¤è¤¦¤Ê·Á¼°¤Ç½ñ¤¤Þ¤¹¡£
+
+\begin{quote}
+ \begin{tabular}{lcl}
+ ʸ»úÎó&:&¤½¤Îʸ»úÎó¤òÅϤ¹ \\
+ 'SYMBOL&:&SYMBOL ¤ò key ¤È¤·¤¿ÃͤòÅϤ¹\\
+ 'ʸ»úÎó&:&ʸ»úÎó¤ò key ¤È¤·¤¿ÃͤòÅϤ¹
+ \end{tabular}
+\end{quote}
+
+'SYMBOL ¤Ç»ØÄê¤Ç¤¤ë¤â¤Î¤Ë¤Ï¡¢
+
+\begin{quote}
+ \begin{tabular}{lcl}
+ 'file&:&content ¤òÅϤ¹¤¿¤á¤Î file ̾ \\
+ 'type&:&content-type/sub-type ̾ \\
+ 'encoding&:&content-transfer-encoding \\
+ 'mode&:&decoding mode \\
+ 'name&:&file ¤ËÍ¾ì¹ç¤Î file ̾
+ \end{tabular}
+\end{quote}
+
+\noindent ¤Ê¤É¤¬¤¢¤ê¡¢'ʸ»úÎó ¤Ç¤Ï Content-Type field ¤Î parameter ¤Î
+Ãͤ¬»ØÄê¤Ç¤¤Þ¤¹¡£
+
+
+\subsection{Îã}
+
+½é´üÃͤϰʲ¼¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
+
+\begin{verbatim}
+(defvar mime/content-decoding-condition
+ '(((type . "text/plain")
+ (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "text/x-latex")
+ (method "tm-latex" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "audio/basic")
+ (method "tm-au" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/gif")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/jpeg")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/tiff")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/x-tiff")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/x-xbm")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/x-pic")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "video/mpeg")`
+ (method "tm-mpeg" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "application/octet-stream")
+ (method "tm-file" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "message/partial")
+ (method . mime/decode-message/partial-region))
+ ((method "metamail" t
+ "-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play"))
+ ))
+\end{verbatim}
+
+Î㤨¤Ð¡¢¡ÖÁ´Éô metamail »È¤¦¤ó¤ä¡×¤È¤¤¤¦¾ì¹ç¡¢
+
+\begin{verbatim}
+(setq mime/content-decoding-condition
+ '(
+ ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file))
+ ))
+\end{verbatim}
+
+\noindent ¤È¤¹¤ì¤Ð OK ¤Ç¤¹¡£
+
+¹©Éפ¹¤ì¤Ð¡¢¤«¤Ê¤êÊ£»¨¤Ê¾ò·ï¤¬½ñ¤±¤ë¤Ç¤·¤ç¤¦¡£
+
+
+\section{method script}
+\label{sec:method}
+
+³Æ method ¤Ï shell script ¤Ç½ñ¤¤Þ¤¹¡£tm-verw.el ¤«¤éÅϤµ¤ì¤ë°ú¿ô¤Ï¡¢
+ÊÑ¿ô mime/content-decoding-condition ¤Ç»ØÄê¤Ç¤¤Þ¤¹¤¬¡¢É¸½àŪ¤Ê°ú¿ôÎó
+¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
+
+\medskip
+\begin{center}
+ \begin{tabular}{|c|l|} \hline
+ °ú¿ô & \multicolumn{1}{|c|}{ ÃÍ }\\ \hline
+ \$1 & decode Á°¤Î file ̾ \\
+ \$2 & Content-Type (type/sub-type) \\
+ \$3 & encoding
+ \{7bit / quoted-printable / base64 / 8bit / binary / ...\}\\
+ \$4 & decoding-mode \{play / extract / print\} \\
+ \$5 & file ̾ \\ \hline
+ \end{tabular}
+\end{center}
+\medskip
+
+¤Þ¤¿¡¢message/partial ¤À¤±¤Ï tm-view.el ¼«¿È¤ÇÉü¸µ¤·¤Þ¤¹¡£
+
+
+\section{À©¸Â}
+
+Éí°¤Î BASE64 decoder ¤Ç¤¢¤ë decode-b.c ¤Ï¤¤¤¤²Ã¸º¤Êºî¤ê¤Ê¤Î¤Ç¡¢Æ°¤«¤Ê
+¤«¤Ã¤¿¤é¡¢Ã»¤¤¥×¥í¥°¥é¥à¤Ê¤Î¤Ç¡¢°Õ¤òµâ¤ó¤Ç½¤Àµ¤·¤Æ²¼¤µ¤¤¡£
+(\verb+^+\_\verb+^+;
+
+¤Þ¤¿¡¢metamail Éí°¤Î mmencode ¤ò»È¤Ã¤Æ decode ¤·¤Æ¤âÎɤ¤¤Ç¤·¤ç¤¦¡£
+
+¤Þ¤¿¡¢Quoted-Printable ¤Î decoder ¤ÏÉí°¤·¤Þ¤»¤ó¤Î¤Ç¡¢mmencode ¤ò»È¤Ã
+¤Æ²¼¤µ¤¤¡£
+
+
+\chapter{tiny-mime}
+
+tiny-mime ¤Ï Mule, NEmacs, NEpoch ¾å¤ÇÆ°ºî¤¹¤ë MIME header ¤Î
+encoder/decoder ¤Ç¤¹¡£tiny-mime ¤Ï¡¢ÀΡ¢¤¨¤Ê¤ß ¤Ä¤°¤È¤â ¤µ¤ó¤¬
+fj.editor.emacs ¤ËÅê¹Æ¤µ¤ì¤¿ ISO-2022-JP MIME header decoder ¤ò¸µ¤Ë¤·
+¤Æ¤¤¤Þ¤¹¡£
+
+¸½ºß¤Ç¤Ï¡¢Åö»þ¤Î¤â¤Î¤ËÈæ¤Ù¡¢
+
+\begin{itemize}
+\item decoding »þ¤Ë¤ª¤±¤ë unfolding µ¡Ç½¤ÎÄɲÃ
+\item ISO-2022-JP ¤Ë²Ã¤¨¡¢ISO-2022-KR, ISO-8859-*, US-ASCII ¤Ê¤É¤Î¿¸À
+ ¸ì header ¤Î encode/decode µ¡Ç½¤ÎÄɲÃ
+\item Q-encoding ¤ÎÄɲÃ
+\item RFC 1522 ¤Ø¤ÎÂбþ
+\end{itemize}
+
+\noindent ¤È¤¤¤Ã¤¿µ¡Ç½¶¯²½¤¬¹Ô¤Ê¤ï¤ì¤Æ¤¤¤Þ¤¹¡£
+
+tiny-mime ¤Ï tm ¤Ë¤ª¤±¤ë MIME header encoder/decoder ¤Ç¤¢¤ê¡¢tm-view,
+tm-MUA ¤¬¤³¤ì¤òÍøÍѤ·¤Æ¤¤¤Þ¤¹¡£
+
+
+\section{mime/decode-message-header}
+
+{\tt mime/decode-message-header} ¤Ï MIME header ¤ò decode ¤¹¤ë¤¿¤á¤ÎÌ¿
+Îá¤Ç¤¹¡£tiny-mime ¤¬ load ¤µ¤ì¤Æ¤¤¤ë¾õÂ֤ǡ¢decode ¤·¤¿¤¤ buffer ¤Î¾å
+¤Ç¡¢
+
+{\list{}{\leftmargin=8ex}\item[]
+\par
+M-x {\tt mime/decode-message-header}
+\endlist}
+
+\noindent ¤ò¼Â¹Ô¤¹¤ë¤È¡¢¤½¤Î buffer ¾å¤Î MIME header ¤¬ decode ¤µ¤ì¤Þ
+¤¹¡£
+
+tm-MUA ¤ä tm-view ¤Ï¤³¤ÎÌ¿Îá¤ò¸Æ¤ó¤Ç¤¤¤ë¤Î¤Ç¡¢¤³¤ì¤é¤òÍøÍѤ·¤Æ¤¤¤ë¾ì¹ç¡¢
+Íۤˤ³¤ÎÌ¿Îá¤ò¼Â¹Ô¤¹¤ëɬÍפÏ̵¤¤¤Ç¤·¤ç¤¦¡£
+
+
+\section{mime/decode-region}
+
+region ¤ËÂФ·¤Æ¡¢
+
+{\list{}{\leftmargin=8ex}\item[]
+\par
+M-x {\tt mime/decode-region}
+\endlist}
+
+\noindent ¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¡¢°úÍÑ¤Ê¤É¤Ç buffer ¤Ë»Ä¤Ã¤¿ MIME header ¤ò
+decode ¤Ç¤¤Þ¤¹¡£
+
+
+\chapter{¥Ð¥°Êó¹ð¤Î»ÅÊý}
+
+tm ¤Î¥Ð¥°¤ò¸«¤Ä¤±¤¿¤é fj.editor.emacs ¤Ë post ¤¹¤ë¤«¡¢tm ML
+$<$tm@chamonix.jaist.ac.jp$>$ ¤Ë mail ¤òÁ÷¤Ã¤Æ²¼¤µ¤¤¡£
+
+tm ML ¤Ç¤Ï tm ¤Î¥Ð¥°¾ðÊó¤Î¸ò´¹¤äºÇ¿·ÈǤÎÇÛÉÛ¡¢tm ¤Î²þÎɤ˴ؤ¹¤ëµÄÏÀ¤ò
+¹Ô¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£tm ML ¤Ë»²²Ã¤·¤¿¤¤Êý¤Ï
+
+\begin{center}
+ tm-admin@chamonix.jaist.ac.jp
+\end{center}
+
+\noindent ¤Þ¤Ç mail ¤òÁ÷¤Ã¤Æ²¼¤µ¤¤¡£ÅÐÏ¿¤Ï¼êÆ°¤Ç¤¹¤Î¤Ç¡¢¤Ç¤¤ì¤Ð¡¢¼«Á³
+¸À¸ì¤Ç½ñ¤¤¤Æ²¼¤µ¤¤¡£(\verb+^+\_\verb+^+)
+
+\end{document}
;;; @ version
;;;
(defconst tm-mh-e/RCS-ID
- "$Id: tm-mh-e.el,v 3.1 1994/08/31 05:32:24 morioka Exp $")
+ "$Id: tm-mh-e.el,v 5.0 1994/09/25 21:28:29 morioka Exp $")
(defconst tm-mh-e/version
(and (string-match "[0-9][0-9.]*" tm-mh-e/RCS-ID)
(if (not (boundp 'mh-e-version))
(require 'tm-mh-e3)
)
-(autoload 'mime/view-mode "tm-view" "View MIME message." t)
+(autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
;;; @ MIME header decoding mode
(mh-invalidate-show-buffer)
(mh-show-msg (mh-get-msg-num t))
(pop-to-buffer mh-show-buffer t)
- (mime/view-mode)
+ (mime/viewer-mode)
)
--- /dev/null
+;;;
+;;; $Id: tm-rich.el,v 1.1 1994/09/05 14:34:06 morioka Exp morioka $
+;;;
+
+(provide 'tm-rich)
+
+(require 'tm-view)
+(require 'assoc)
+(require 'hilit19)
+
+
+(defun mime/get-text/enriched-face (str)
+ (let ((sym (intern str)))
+ (if (eq sym 'italic)
+ 'modeline
+ sym)))
+
+(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)
+ (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)))
+ (replace-match "")
+ (string-match "^[ \t\n\r]*<" cmd)
+ (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))
+ (if (not (bolp))
+ (insert " ")
+ )
+ (setq b (point))
+ (save-excursion
+ (save-restriction
+ (if (re-search-forward (concat "[ \t\n\r]*</"
+ cmd ">[ \t\n\r]*")
+ nil t)
+ (progn
+ (replace-match " ")
+ (setq e (- (point) 1))
+ )
+ (setq e end)
+ )))
+ (hilit-unhighlight-region b e)
+ (hilit-region-set-face b e sym)
+ )))
+ (fill-region fb (point) t)
+ ))))
+
+(defun mime/decode-text/enriched-body ()
+ (interactive)
+ (save-excursion
+ (save-restriction
+ (let ((beg (point-min)) (end (point-max)))
+ (goto-char (point-min))
+ (if (search-forward "\n\n" nil t)
+ (setq beg (match-end 0))
+ )
+ (mime/decode-text/enriched-region beg end)
+ ))))
+
+
+(aput 'mime/content-filter-alist
+ "text/enriched" (function mime/decode-text/enriched-body))
+
+(aput 'mime/content-filter-alist
+ "text/richtext" (function mime/decode-text/enriched-body))
;;;
-;;; $Id: tm-rmail.el,v 3.1 1994/08/31 05:37:24 morioka Exp $
+;;; $Id: tm-rmail.el,v 5.0 1994/09/25 21:26:05 morioka Exp $
;;;
(provide 'tm-rmail)
(if (< (string-to-int emacs-version) 19)
(require 'tl-18)
)
-(autoload 'mime/view-mode "tm-view" "View MIME message." t)
+(autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
(autoload 'mime/decode-message-header "tiny-mime" "Decode MIME header." t)
(add-hook 'rmail-show-message-hook
(function
(lambda ()
- (let ((buffer-read-only nil))
+ (let ((mf (buffer-modified-p))
+ (buffer-read-only nil))
(mime/decode-message-header)
- )
- (set-buffer-modified-p nil)
- )))
+ (set-buffer-modified-p mf)
+ ))))
(add-hook 'rmail-mode-hook
(function
(function
(lambda ()
(interactive)
- (pop-to-buffer "RMAIL")
- (mime/view-mode)
+ (pop-to-buffer rmail-buffer)
+ (mime/viewer-mode)
)))
)))
;;;
(defconst mime/viewer-RCS-ID
- "$Id: tm-view.el,v 3.8 1994/09/02 10:32:31 morioka Exp $")
+ "$Id: tm-view.el,v 5.1 1994/09/25 21:23:07 morioka Exp $")
(defconst mime/viewer-version
(and (string-match "[0-9][0-9.]*" mime/viewer-RCS-ID)
;;; @ require modules
;;;
-(require 'outline)
(require 'tl-str)
(require 'tl-list)
(require 'tl-header)
;;; @ variables
;;;
-(defvar mime/content-decoding-method-alist
- '(("text/plain" . "tm-plain")
- ("text/x-latex" . "tm-latex")
- ("audio/basic" . "tm-au")
- ("image/gif" . "tm-image")
- ("image/jpeg" . "tm-image")
- ("image/tiff" . "tm-image")
- ("image/x-tiff" . "tm-image")
- ("image/x-xbm" . "tm-image")
- ("image/x-pic" . "tm-image")
- ("video/mpeg" . "tm-mpeg")
- ("application/octet-stream" . "tm-file")
+(defvar mime/content-decoding-condition
+;;(setq mime/content-decoding-condition
+ '(((type . "text/plain")
+ (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "text/x-latex")
+ (method "tm-latex" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "audio/basic")
+ (method "tm-au" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/gif")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/jpeg")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/tiff")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/x-tiff")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/x-xbm")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "image/x-pic")
+ (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "video/mpeg")
+ (method "tm-mpeg" nil 'file 'type 'encoding 'mode 'name))
+ ((type . "application/octet-stream")
+ (method "tm-file" nil 'file 'type 'encoding 'mode 'name))
+ ;;((type . "message/external-body")
+ ;; (method "xterm" nil
+ ;; "-e" "showexternal"
+ ;; 'file '"access-type" '"name" '"site" '"directory"))
+ ((type . "message/partial")
+ (method . mime/decode-message/partial-region))
+ ((method "metamail" t
+ "-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play"))
))
+(defvar mime/content-filter-alist nil)
+
+(defvar mime/make-content-subject-function
+ (function
+ (lambda (cid subj ctype)
+ (insert
+ (format "[%s %s (%s)]\n"
+ (if (listp cid)
+ (mapconcat (function
+ (lambda (num)
+ (format "%s" (+ num 1))
+ ))
+ cid ".")
+ "0")
+ subj (car ctype)))
+ )))
+
+(defvar mime/make-content-header-filter
+ (function
+ (lambda (cid)
+ (if (listp cid)
+ (delete-region (goto-char (point-min))
+ (or (and (search-forward "\n\n" nil t)
+ (match-beginning 0))
+ (point-max))
+ )
+ )
+ )))
+
(defvar mime/default-showing-Content-Type-list
- '("text/plain" "text/x-latex" "message/rfc822"))
+;;(setq mime/default-showing-Content-Type-list
+ '("text/plain" "text/richtext" "text/enriched"
+ "text/x-latex" "message/rfc822" nil))
(defvar mime/go-to-top-node-method-alist
+;;(setq mime/go-to-top-node-method-alist
'((gnus-article-mode . (lambda ()
+ (mime/exit-view-mode)
+ (delete-other-windows)
(gnus-article-show-summary)
))
(rmail-mode . (lambda ()
(delete-other-windows)
))
(mh-show-mode . (lambda ()
- (pop-to-buffer
- (let ((name (buffer-name)))
- (string-match "show-" name)
- (substring name (match-end 0))
- ))
- ))
+ (let ((win (get-buffer-window
+ mime/output-buffer-name))
+ (buf
+ (nth 2 (car mime/preview-flat-content-list)))
+ )
+ (if win
+ (delete-window win)
+ )
+ (mime/exit-view-mode)
+ (pop-to-buffer
+ (let ((name (buffer-name buf)))
+ (string-match "show-" name)
+ (substring name (match-end 0))
+ ))
+ )))
(mime/show-message-mode . (lambda ()
(set-window-configuration
mime/show-mode-old-window-configuration)
- (let ((buf (current-buffer)))
- (pop-to-buffer mime/mother-buffer)
- (kill-buffer buf)
+ (let ((mother mime/mother-buffer))
+ (kill-buffer
+ (nth 2 (car
+ mime/preview-flat-content-list)))
+ (mime/exit-view-mode)
+ (pop-to-buffer mother)
+ (goto-char (point-min))
+ (mime/up-content)
)))
))
(defvar mime/tmp-dir "/tmp/")
-(defvar mime/hide-content-header nil)
-
(defvar mime/use-internal-decoder nil)
(defvar mime/body-decoding-mode "play" "MIME body decoding mode")
;;; @ parser
;;;
-(defun mime/parse-content ()
+(defun mime/parse-contents ()
(save-excursion
(save-restriction
- (mime/decode-message-header)
(goto-char (point-min))
(let* ((ctl (mime/Content-Type))
+ (ctype (car ctl))
(boundary (assoc "boundary" (cdr ctl)))
beg end dest)
+ (if (stringp ctype)
+ (setq ctype (downcase ctype))
+ )
(search-forward "\n\n" nil t)
(cond (boundary
(let ((sep (concat "\n--"
(save-excursion
(save-restriction
(narrow-to-region cb ce)
- (setq ret (mime/parse-content))
+ (setq ret (mime/parse-contents))
))
- (setq dest (append dest (list ret)))
+ (setq dest (nconc dest (list ret)))
(goto-char (nth 1 ret))
(search-forward (concat "--" boundary "\n") nil t)
(goto-char (setq cb (match-end 0)))
(save-excursion
(save-restriction
(narrow-to-region cb ce)
- (setq ret (mime/parse-content))
+ (setq ret (mime/parse-contents))
))
(setq dest (append dest (list ret)))
))
(search-forward (concat "\n--" boundary "--\n") nil t)
(setq end (match-beginning 0))
))
- ((string= (car ctl) "message/rfc822")
+ ((string= ctype "message/rfc822")
(save-excursion
(save-restriction
(narrow-to-region (match-end 0) (point-max))
- (setq dest (list (mime/parse-content)))
+ (setq dest (list (mime/parse-contents)))
))
(setq beg (point-min))
(setq end (point-max))
)
- (t
- (setq beg (point-min))
- (setq end (point-max))
- ))
+ (t (setq beg (point-min))
+ (setq end (point-max))
+ ))
(list beg end dest)
))))
)
(setq dest
(put-alist attribute
- (buffer-substring (match-beginning 0)
- (match-end 0))
+ (message/strip-quoted-string
+ (buffer-substring (match-beginning 0)
+ (match-end 0)))
dest))
)
)
default-encoding)
)))
-(defun mime/get-name (ctype)
+(defun mime/get-subject (param)
(save-excursion
(save-restriction
- (replace-as-filename
- (let (ret)
- (or (and (setq ret (assoc "name" ctype))
- (message/strip-quoted-string (cdr ret))
- )
- (and (setq ret (assoc "x-name" ctype))
- (message/strip-quoted-string (cdr ret))
- )
- (message/get-field-body "Content-Description")
- ""))
- ))))
+ (let (ret)
+ (or (and (setq ret (assoc "name" param))
+ (message/strip-quoted-string (cdr ret))
+ )
+ (and (setq ret (assoc "x-name" param))
+ (message/strip-quoted-string (cdr ret))
+ )
+ (message/get-field-body "Content-Description")
+ (message/get-field-body "Subject")
+ ""))
+ )))
-(defun mime/parse-message ()
- (interactive)
- (save-excursion
- (save-restriction
- (setq selective-display t)
- (make-variable-buffer-local 'mime/content-list)
- (let ((buffer-read-only nil))
- (setq mime/content-list (mime/parse-content))
+(defun mime/get-name (param)
+ (replace-as-filename (mime/get-subject param))
+ )
+
+(defun mime/make-preview-buffer (&optional buf cl obuf)
+ (let ((the-buf (current-buffer)) fcl)
+ (if (null buf)
+ (setq buf (current-buffer))
+ (setq buf (get-buffer buf))
+ )
+ (if (null cl)
+ (progn
+ (switch-to-buffer buf)
+ (setq cl mime/content-list)
+ ))
+ (if (null obuf)
+ (setq obuf (concat "*Preview-" (buffer-name buf) "*"))
+ )
+ (setq fcl (mime/make-flat-content-list cl))
+ (if (get-buffer obuf)
+ (progn
+ (switch-to-buffer obuf)
+ (erase-buffer)
+ ))
+ (let ((r fcl) cell cid ctype beg end e nb ne subj dest)
+ (while r
+ (setq cell (car r))
+ (setq beg (car cell))
+ (setq end (nth 1 cell))
+ (setq cid (mime/get-point-content-number beg cl))
+ (switch-to-buffer buf)
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (goto-char beg)
+ (setq ctype (mime/Content-Type))
+ (setq e
+ (if (not (member (car ctype)
+ mime/default-showing-Content-Type-list))
+ (progn
+ (goto-char beg)
+ (search-forward "\n\n" nil t)
+ (match-end 0)
+ )
+ end))
+ ))
+ (setq str (buffer-substring beg e))
+ (switch-to-buffer obuf)
+ (setq nb (point))
+ (insert str)
+ (setq ne (- (point) 1))
+ (save-excursion
+ (save-restriction
+ (narrow-to-region nb ne)
+ (mime/decode-message-header)
+ (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 mime/make-content-header-filter cid)
+ (goto-char nb)
+ (funcall mime/make-content-subject-function cid subj ctype)
+ (setq ne (point-max))
+ (setq dest (nconc dest (list (list nb ne buf beg end))))
+ ))
+ (setq r (cdr r))
)
- (mime/hide-all)
(set-buffer-modified-p nil)
+ (switch-to-buffer the-buf)
+ (list obuf dest)
)))
+(defun mime/parse-message ()
+ (interactive)
+ (make-variable-buffer-local 'mime/content-list)
+ (setq mime/content-list (mime/parse-contents))
+ (let ((ret (mime/make-preview-buffer)))
+ (make-variable-buffer-local 'mime/preview-buffer)
+ (setq mime/preview-buffer (car ret))
+ ret))
;;; @ content information
;;;
)
dest))
+(defun mime/get-point-preview-content (p &optional fcl)
+ (if (null fcl)
+ (setq fcl mime/preview-flat-content-list)
+ )
+ (catch 'tag
+ (let ((r fcl) cell)
+ (while r
+ (setq cell (car r))
+ (if (and (<= (car cell) p)(<= p (nth 1 cell)))
+ (throw 'tag cell)
+ )
+ (setq r (cdr r))
+ ))
+ (car (last fcl))
+ ))
+
;;; @ decoder
;;;
)))
))
-(defun mime/start-external-method-region (beg end ctype ctl encoding)
- (goto-char beg)
- (let ((method (cdr (assoc ctype mime/content-decoding-method-alist)))
- (name (mime/get-name ctl))
- )
- (if method
- (progn
- (search-forward "\n\n" nil t)
- (let ((file (make-temp-name
- (expand-file-name "TM" mime/tmp-dir)))
- (b (match-end 0))
- (e end))
- (goto-char b)
- (if (and (string= encoding "base64")
- mime/use-internal-decoder)
- (progn
- (mime/base64-decode-region b e nil file)
- (setq encoding "binary")
- )
- (write-region b e file)
+(defun mime/make-method-args (cal format)
+ (mapcar (function
+ (lambda (arg)
+ (if (stringp arg)
+ arg
+ (let ((ret (cdr (assoc (eval arg) cal))))
+ (if ret
+ ret
+ "")
+ ))
+ ))
+ format))
+
+(defun mime/start-external-method-region (beg end cal)
+ (let ((e end))
+ (if (< end (point-max))
+ (setq e (+ end 1))
+ )
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg e)
+ (goto-char beg)
+ (let ((method (cdr (assoc 'method cal)))
+ (name (mime/get-name cal))
)
- (start-process method mime/output-buffer-name method file
- ctype encoding
- (if mime/body-decoding-mode
- mime/body-decoding-mode
- "play")
- (replace-as-filename name)
- )
- (if (null (get-buffer-window mime/output-buffer-name))
- (let ((the-buf (current-buffer)))
- (split-window-vertically (/ (* (window-height) 3) 4))
- (pop-to-buffer mime/output-buffer-name)
- (pop-to-buffer the-buf)
- ))
- )))))
+ (if method
+ (let ((file (make-temp-name
+ (expand-file-name "TM" mime/tmp-dir)))
+ b args)
+ (if (nth 1 method)
+ (setq b beg)
+ (search-forward "\n\n" nil t)
+ (setq b (match-end 0))
+ )
+ (goto-char b)
+ (write-region b e file)
+ (setq cal (put-alist
+ 'name (replace-as-filename name) cal))
+ (setq cal (put-alist 'file file cal))
+ (setq args (nconc
+ (list (car method)
+ mime/output-buffer-name (car method)
+ )
+ (mime/make-method-args cal (cdr (cdr method)))
+ ))
+ (apply (function start-process) args)
+ (mime/show-output-buffer)
+ ))))))
+ )
-(defun mime/decode-message/partial-region (beg end ctype default-encoding)
+(defun mime/decode-message/partial-region (beg end cal)
(goto-char beg)
- (let ((root-dir (expand-file-name
- (concat "m-prts-" (user-login-name)) mime/tmp-dir))
- (id (cdr (assoc "id" ctype)))
- (number (cdr (assoc "number" ctype)))
- (total (cdr (assoc "total" ctype)))
- (the-buf (current-buffer))
- file)
+ (let* ((root-dir (expand-file-name
+ (concat "m-prts-" (user-login-name)) mime/tmp-dir))
+ (id (cdr (assoc "id" cal)))
+ (number (cdr (assoc "number" cal)))
+ (total (cdr (assoc "total" cal)))
+ (the-buf (current-buffer))
+ file
+ (mother mime/preview-buffer))
(if (not (file-exists-p root-dir))
(shell-command (concat "mkdir " root-dir))
)
(goto-char (point-max))
(setq i (+ i 1))
)
- (write-file (concat root-dir "/FULL"))
(delete-other-windows)
+ (write-file (concat root-dir "/FULL"))
+ (setq major-mode 'mime/show-message-mode)
+ (mime/viewer-mode mother)
(pop-to-buffer (current-buffer))
- (goto-char (point-min))
- (mime/show-message-mode the-buf)
))
)
(progn
(delete-other-windows)
(find-file file)
- (mime/show-message-mode the-buf)
+ (setq major-mode 'mime/show-message-mode)
+ (mime/viewer-mode mother)
+ (pop-to-buffer (current-buffer))
))
))
-(defun mime/decode-content-region (beg end)
- (interactive "*r")
- (save-excursion
- (save-restriction
- (outline-flag-region beg end ?\n)
- (let ((e end))
- (if (< end (point-max))
- (setq e (+ end 1))
+(defun mime/get-content-decoding-alist (al)
+ (let ((r mime/content-decoding-condition) ret)
+ (catch 'tag
+ (while r
+ (if (setq ret (nth 1 (assoc-unify (car r) al)))
+ (throw 'tag ret)
)
- (narrow-to-region beg e)
- (goto-char beg)
- (let ((ctl (mime/Content-Type)))
- (if ctl
- (let ((ctype (downcase (car ctl)))
- (encoding (mime/Content-Transfer-Encoding "7bit"))
- )
- (setq ctl (cdr ctl))
- (cond ((string= ctype "message/partial")
- (mime/decode-message/partial-region beg e
- ctl encoding)
- )
- (t (mime/start-external-method-region beg e
- ctype ctl encoding)
- (if (not (member
- ctype
- mime/default-showing-Content-Type-list))
- (mime/hide-region beg end)
- )
- ))
- ))))
- )))
-
-
-;;; @ hide
-;;;
-
-(defun mime/hide-region (beg end)
- (save-excursion
- (save-restriction
- (goto-char beg)
- (if (not mime/hide-content-header)
- (progn
- (search-forward "\n\n" nil t)
- (setq beg (match-end 0))
- ))
- (outline-flag-region beg end ?\^M)
- )))
+ (setq r (cdr r))
+ ))))
-(defun mime/hide-all ()
- (let ((fl (mime/make-flat-content-list))
- p c)
- (while fl
- (setq p (car (car fl)))
- (setq c (mime/get-content-region (mime/get-point-content-number p)))
- (if (null (nth 2 c))
- (save-excursion
- (save-restriction
- (narrow-to-region (car c)(nth 1 c))
- (goto-char (car c))
- (let ((ctl (mime/Content-Type)))
- (if (and ctl
- (not (member
- (car ctl)
- mime/default-showing-Content-Type-list)))
- (mime/hide-region (car c)(nth 1 c))
- )))))
- (setq fl (cdr fl))
- )))
+(defun mime/decode-content-region (beg end)
+ (interactive "*r")
+ (let (ctl encoding)
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (and (goto-char beg)
+ (setq ctl (mime/Content-Type))
+ (goto-char beg)
+ (setq encoding (mime/Content-Transfer-Encoding "7bit"))
+ )))
+ (if ctl
+ (let ((ctype (downcase (car ctl))) method cal ret)
+ (setq ctl (cdr ctl))
+ (setq cal (nconc (list (cons 'type ctype)
+ (cons 'encoding encoding)
+ )
+ ctl))
+ (if mime/body-decoding-mode
+ (setq cal (cons
+ (cons 'mode mime/body-decoding-mode)
+ cal))
+ )
+ (setq ret (mime/get-content-decoding-alist cal))
+ (setq method (cdr (assoc 'method ret)))
+ (cond ((and (symbolp method)
+ (fboundp method))
+ (funcall method beg end ret)
+ )
+ ((and (listp method)(stringp (car method)))
+ (mime/start-external-method-region beg end ret)
+ )
+ (t (mime/show-output-buffer
+ "No method are specified for %s\n" ctype)
+ ))
+ ))
+ ))
+(defun mime/show-output-buffer (&rest forms)
+ (let ((the-buf (current-buffer)))
+ (if (null (get-buffer-window mime/output-buffer-name))
+ (split-window-vertically (/ (* (window-height) 3) 4))
+ )
+ (pop-to-buffer mime/output-buffer-name)
+ (goto-char (point-max))
+ (if forms
+ (insert (apply (function format) forms))
+ )
+ (pop-to-buffer the-buf)
+ ))
-;;; @ MIME show message mode (major-mode)
-;;;
-(defun mime/show-message-mode (mother)
- (kill-all-local-variables)
- (make-variable-buffer-local 'mime/show-mode-old-window-configuration)
- (setq mime/show-mode-old-window-configuration
- (current-window-configuration))
- (make-variable-buffer-local 'mime/mother-buffer)
- (setq mime/mother-buffer mother)
- (setq major-mode 'mime/show-message-mode)
- (setq mode-name "MIME-View")
- (mime/view-mode)
- (run-hooks 'mime/show-message-mode-hook)
- )
-;;; @ MIME view message mode (minor-mode)
+;;; @ MIME viewer mode
;;;
-(defun mime/view-mode ()
+(defun mime/viewer-mode (&optional mother)
(interactive)
- (make-local-variable 'mime/view-mode-old-local-map)
- (let ((keymap (current-local-map)))
- (if (null keymap)
- (setq keymap (make-sparse-keymap))
- (progn
- (setq mime/view-mode-old-local-map keymap)
+ (let ((buf (get-buffer mime/output-buffer-name))
+ (the-buf (current-buffer))
+ )
+ (if buf
+ (progn
+ (switch-to-buffer buf)
+ (erase-buffer)
+ (switch-to-buffer the-buf)
+ )))
+ (let ((ret (mime/parse-message))
+ (mode major-mode))
+ (switch-to-buffer (car ret))
+ (setq major-mode 'mime/viewer-mode)
+ (setq mode-name "MIME-View")
+
+ (make-variable-buffer-local 'mime/viewer-original-major-mode)
+ (setq mime/viewer-original-major-mode
+ (if mother
+ (progn
+ (make-variable-buffer-local
+ 'mime/show-mode-old-window-configuration)
+ (setq mime/show-mode-old-window-configuration
+ (current-window-configuration))
+ (make-variable-buffer-local 'mime/mother-buffer)
+ (setq mime/mother-buffer mother)
+ 'mime/show-message-mode)
+ mode))
+ (let ((keymap (current-local-map)))
+ (if (null keymap)
+ (setq keymap (make-sparse-keymap))
(setq keymap (copy-keymap keymap))
- ))
- (let ((buf (get-buffer mime/output-buffer-name)))
- (if buf
- (let ((the-buf (current-buffer)))
- (switch-to-buffer buf)
- (erase-buffer)
- (switch-to-buffer the-buf)
- )))
- (use-local-map keymap)
- (define-key keymap "u" 'mime/up-content)
- (define-key keymap "p" 'mime/previous-content)
- (define-key keymap "n" 'mime/next-content)
- (define-key keymap " " 'mime/scroll-up-content)
- (define-key keymap "\M- " 'mime/scroll-down-content)
- (define-key keymap "v" 'mime/play-content)
- (define-key keymap "e" 'mime/extract-content)
- (define-key keymap "\C-c\C-p" 'mime/print-content)
- (define-key keymap "\C-c\C-x" 'mime/exit-view-mode)
- )
- (mime/parse-message)
- (search-forward "\n\n" nil t)
- )
+ )
+ (use-local-map keymap)
+ (define-key keymap "u" 'mime/up-content)
+ (define-key keymap "p" 'mime/previous-content)
+ (define-key keymap "n" 'mime/next-content)
+ (define-key keymap " " 'mime/scroll-up-content)
+ (define-key keymap "\M- " 'mime/scroll-down-content)
+ (define-key keymap "v" 'mime/play-content)
+ (define-key keymap "e" 'mime/extract-content)
+ (define-key keymap "\C-c\C-p" 'mime/print-content)
+ (define-key keymap "\C-c\C-x" 'mime/exit-view-mode)
+
+ (make-variable-buffer-local 'mime/preview-flat-content-list)
+ (setq mime/preview-flat-content-list (nth 1 ret))
+
+ (goto-char
+ (let ((ce (nth 1 (car mime/preview-flat-content-list)))
+ e)
+ (goto-char (point-min))
+ (search-forward "\n\n" nil t)
+ (setq e (match-end 0))
+ (if (<= e ce)
+ e
+ ce)))
+ )))
(defun mime/decode-content ()
(interactive)
- (let ((cr (mime/get-content-region
- (mime/get-point-content-number (point))))
- )
- (and cr
- (null (nth 2 cr))
- (mime/decode-content-region (car cr)(nth 1 cr))
- )))
+ (let ((pc (mime/get-point-preview-content (point))))
+ (if pc
+ (let ((the-buf (current-buffer)))
+ (switch-to-buffer (nth 2 pc))
+ (mime/decode-content-region (nth 3 pc)(nth 4 pc))
+ (if (eq (current-buffer) (nth 2 pc))
+ (switch-to-buffer the-buf)
+ )
+ ))))
(defun mime/play-content ()
(interactive)
(defun mime/up-content ()
(interactive)
- (let ((cn (mime/get-point-content-number (point)))
- r)
+ (let ((pc (mime/get-point-preview-content (point)))
+ (the-buf (current-buffer))
+ cn r)
+ (switch-to-buffer (nth 2 pc))
+ (setq cn (mime/get-point-content-number (nth 3 pc)))
(if (eq cn t)
(and (setq r (assoc major-mode mime/go-to-top-node-method-alist))
+ (switch-to-buffer the-buf)
(funcall (cdr r))
)
- (if (setq r (mime/get-content-region (butlast cn)))
- (goto-char (car r))
- )
+ (setq r (mime/get-content-region (cdr cn)))
+ (switch-to-buffer the-buf)
+ (catch 'tag
+ (let ((rfcl mime/preview-flat-content-list) cell)
+ (while rfcl
+ (setq cell (car rfcl))
+ (if (and (= (car r)(nth 3 cell))
+ (= (nth 1 r)(nth 4 cell))
+ )
+ (progn
+ (goto-char (nth 0 cell))
+ (throw 'tag nil)
+ ))
+ (setq rfcl (cdr rfcl))
+ )))
)))
(defun mime/previous-content ()
(interactive)
- (let* ((fcl (mime/make-flat-content-list))
+ (let* ((fcl mime/preview-flat-content-list)
(p (point))
(i (- (length fcl) 1))
)
(defun mime/next-content ()
(interactive)
- (let ((fcl (mime/make-flat-content-list))
+ (let ((fcl mime/preview-flat-content-list)
(p (point))
)
(catch 'tag
(defun mime/scroll-up-content ()
(interactive)
- (let ((fcl (mime/make-flat-content-list))
+ (let ((fcl mime/preview-flat-content-list)
(p (point))
(h (- (window-height) 1))
np)
(defun mime/scroll-down-content ()
(interactive)
- (let ((fcl (mime/make-flat-content-list))
+ (let ((fcl mime/preview-flat-content-list)
(p (point))
(h (- (window-height) 1))
pp)
(defun mime/exit-view-mode ()
(interactive)
- (if (and (boundp 'mime/view-mode-old-local-map)
- (keymapp mime/view-mode-old-local-map))
- (use-local-map mime/view-mode-old-local-map)
- )
- (show-all)
+ (kill-buffer (current-buffer))
)
+
+(fset 'mime/view-mode 'mime/viewer-mode)
+
+(run-hooks 'tm-view-load-hook)