[mew-dist 25885] Application/Rtf

SAKAI Kiyotaka ksakai at example.com
2005年 1月 7日 (金) 14:53:34 JST


たまに Application/Rtf のファイルを添付して送ってくる人がいるので、この
表示もサポートしていただけないでしょうか。

以下のパッチでは rtf → html のフィルタは

  http://www.45.free.net/~vitus/ice/misc/

からダウンロード可能な rtf2html を使うようになっています。

ただ、このフイルタだと出力する漢字コードを指定できないので、shift_jis
決めうちにしているのが今ひとつですが。


Index: mew-darwin.el
===================================================================
RCS file: /cvsmew/mew/mew-darwin.el,v
retrieving revision 1.6
diff -u -r1.6 mew-darwin.el
--- mew-darwin.el	7 Jan 2005 04:30:11 -0000	1.6
+++ mew-darwin.el	7 Jan 2005 05:21:33 -0000
@@ -38,6 +38,7 @@
 (defvar mew-prog-msexcel         `(,mew-darwin-exec () t))
 (defvar mew-prog-mspowerpoint    `(,mew-darwin-exec () t))
 (defvar mew-prog-visio           `(,mew-darwin-exec () t))
+(defvar mew-prog-rtf             `(,mew-darwin-exec () t))
 
 ;;;
 ;;; Text/Html, Application/Xml, Image
@@ -65,6 +66,7 @@
 (defvar mew-prog-application/msword nil)
 (defvar mew-prog-application/msexcel nil)
 (defvar mew-prog-application/mspowerpoint nil)
+(defvar mew-prog-application/rtf nil)
 
 ;;
 
Index: mew-mime.el
===================================================================
RCS file: /cvsmew/mew/mew-mime.el,v
retrieving revision 1.72
diff -u -r1.72 mew-mime.el
--- mew-mime.el	7 Jan 2005 04:30:14 -0000	1.72
+++ mew-mime.el	7 Jan 2005 05:21:33 -0000
@@ -576,6 +576,10 @@
   (mew-mime-application/msoffice
    mew-prog-application/mspowerpoint cache begin end parameter))
 
+(defun mew-mime-application/rtf (cache begin end &optional parameter)
+  (mew-mime-application/msoffice
+   mew-prog-application/rtf cache begin end parameter))
+
 (defun mew-mime-application/msword-ext (cache begin end &optional parameter)
   (save-excursion
     (mew-erase-buffer)
@@ -591,6 +595,11 @@
     (mew-erase-buffer)
     (mew-mime-application/mspowerpoint cache begin end parameter)))
 
+(defun mew-mime-application/rtf-ext (cache begin end &optional parameter)
+  (save-excursion
+    (mew-erase-buffer)
+    (mew-mime-application/rtf cache begin end parameter)))
+
 (defun mew-mime-application/msoffice (prog cache begin end &optional parameter)
   (let ((doit t) file1 file2)
     (unless mew-internal-utf-8p
@@ -630,9 +639,13 @@
 			   (file-name-nondirectory file2)))
 	   (let ((buffer-file-coding-system)) ;; to prevent the side effect
 	     (mew-insert-file-contents file2)))
-	(mew-frwlet
-	 'utf-8 mew-cs-dummy
-	 (call-process prog nil (current-buffer) nil file1)))
+	(if (eq prog mew-prog-application/rtf)
+	    (mew-frwlet
+	     'shift_jis mew-cs-dummy
+	     (call-process prog nil (current-buffer) nil file1))
+	  (mew-frwlet
+	   'utf-8 mew-cs-dummy
+	   (call-process prog nil (current-buffer) nil file1))))
       (mew-delete-file file1)
       (mew-delete-file file2)
       (save-excursion
Index: mew-unix.el
===================================================================
RCS file: /cvsmew/mew/mew-unix.el,v
retrieving revision 1.32
diff -u -r1.32 mew-unix.el
--- mew-unix.el	7 Jan 2005 04:30:18 -0000	1.32
+++ mew-unix.el	7 Jan 2005 05:21:33 -0000
@@ -44,6 +44,8 @@
 (defvar mew-prog-visio           'mew-mime-application/octet-stream)
 (defvar mew-prog-mstnef          '(mew-mime-application-ms-tnef
 				   mew-mime-application-ms-tnef-ext))
+(defvar mew-prog-rtf             '(mew-mime-application/rtf
+				   mew-mime-application/rtf-ext))
 
 ;;;
 ;;; Text/Html, Application/Xml, Image
@@ -74,6 +76,7 @@
 (defvar mew-prog-application/msword "wvHtml")
 (defvar mew-prog-application/msexcel "xlhtml")
 (defvar mew-prog-application/mspowerpoint "ppthtml")
+(defvar mew-prog-application/rtf "rtf2html")
 
 (defvar mew-dir-list-function 'mew-dir-list-with-link-count)
 
Index: mew-vars2.el
===================================================================
RCS file: /cvsmew/mew/mew-vars2.el,v
retrieving revision 1.139
diff -u -r1.139 mew-vars2.el
--- mew-vars2.el	7 Jan 2005 04:30:19 -0000	1.139
+++ mew-vars2.el	7 Jan 2005 05:21:33 -0000
@@ -332,6 +332,8 @@
      mew-prog-visio                  mew-icon-unknown)
     ("application/ms-tnef"           "\\.dat$" mew-b64
      mew-prog-mstnef                 mew-icon-unknown)
+    ("application/rtf"               "\\.rtf$" mew-b64
+     mew-prog-rtf                    mew-icon-text)
     ("application/pgp-keys"          "\\.pka$"  nil
      mew-prog-pgp-keys               mew-icon-unknown)
     ("application/x-pkcs7-signature" "\\.p7s$"  mew-b64


-- 
酒井 清隆 (E-mail: kiyotaka.sakai at example.com)



Mew-dist メーリングリストの案内