From: morioka Date: Mon, 9 Mar 1998 08:30:50 +0000 (+0000) Subject: tm 7.9. X-Git-Tag: tm7_9~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ea28a6a167b312d383a06f09f6e09ffc96d110d;p=elisp%2Ftm.git tm 7.9. --- diff --git a/Changes-7.07-7.09.en b/Changes-7.07-7.09.en new file mode 100644 index 0000000..24fa739 --- /dev/null +++ b/Changes-7.07-7.09.en @@ -0,0 +1,146 @@ +* tl + + Attached version 6.6.8. + + - tl-822.el was created as new RFC 822 parser. + - tl-cite.el was created as a citation utility. + + +* tm + +tm/mime-setup.el +---------------------------- +revision 7.0 +date: 1995/10/03 04:27:39; author: morioka; state: Exp; lines: +12 -4 +tm-eword.el was used instead of tiny-mime.el. +---------------------------- + +tm/tm-def.el +---------------------------- +revision 6.9 +date: 1995/10/03 04:30:57; author: morioka; state: Exp; lines: +2 -2 +Function `tm:browse-url' was modified to call variable +`tm:mother-button-dispatcher' interactively. +---------------------------- + +tm/tm-ew-d.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:34:26; author: morioka; state: Exp; lines: +24 -33 +It was separated from tiny-mime.el as MIME encoded-word decoder. A lot +of parts were changed. +---------------------------- + +tm/tm-ew-e.el +---------------------------- +revision 7.0 +date: 1995/10/03 04:35:11; author: morioka; state: Exp; +It was created as MIME encoded-word encoder. It was wrote from scratch. +---------------------------- + +tm/tm-eword.el +---------------------------- +revision 7.0 +date: 1995/10/03 04:40:06; author: morioka; state: Exp; lines: +28 -549 +(1) tiny-mime.el was renamed to tm-eword.el. +(2) decoder was moved to tm-ew-d.el. +(3) major parts of encoder were erased, tm-ew-e.el was used. +---------------------------- + +tm/tm-mule.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:49:53; author: morioka; state: Exp; lines: +11 -1 +comment was modified. +---------------------------- +revision 7.0 +date: 1995/10/03 04:44:11; author: morioka; state: Exp; lines: +59 -24 +Definitions for tm-ew-e.el were added. +---------------------------- + +tm/tm-nemacs.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:51:07; author: morioka; state: Exp; lines: +11 -1 +comment was modified. +---------------------------- +revision 7.0 +date: 1995/10/03 04:44:50; author: morioka; state: Exp; lines: +11 -1 +Definitions for tm-ew-e.el were added. +---------------------------- + +tm/tm-orig.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:52:16; author: morioka; state: Exp; lines: +11 -1 +comment was modified. +---------------------------- +revision 7.0 +date: 1995/10/03 04:45:50; author: morioka; state: Exp; lines: +13 -3 +Definitions for tm-ew-e.el were added. +---------------------------- + +tm/tm-view.el +---------------------------- +revision 7.9 +date: 1995/10/03 04:56:10; author: morioka; state: Exp; lines: +2 -5 +tm-eword.el was used instead of tiny-mime.el. +---------------------------- +revision 7.8 +date: 1995/09/26 16:04:39; author: morioka; state: Exp; lines: +5 -2 +In function `mime-viewer/display-content', problems of getting subject +was fixed. +---------------------------- +revision 7.7 +date: 1995/09/26 14:49:23; author: morioka; state: Exp; lines: +2 -1 +In function `mime-viewer/display-content', problem of single-part +message which has hidden body was fixed. +---------------------------- + +tm/tm-rmail.el +---------------------------- +revision 6.7 +date: 1995/09/28 06:05:20; author: morioka; state: Exp; lines: +18 -10 +encoded-word decoder was set to variable `rmail-message-filter' again. +---------------------------- + +tm/tm-vm.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:04:35; author: morioka; state: Exp; lines: +22 -9 +Comment was modified because tm-eword.el was used instead of +tiny-mime.el. +---------------------------- + + +* tm/gnus + + Version 7.0 を添付した。 + +tm/gnus/tm-gnus.el +---------------------------- +revision 6.5 +date: 1995/09/28 02:20:46; author: morioka; state: Exp; lines: +9 -9 +modified to support ``Gnus 5.* with September patch''. +---------------------------- + +tm/gnus/tm-gnus5.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:07:54; author: morioka; state: Exp; lines: +31 -22 +tm-eword.el was used instead of tiny-mime.el. +---------------------------- + +tm/gnus/tm-ognus.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:08:59; author: morioka; state: Exp; lines: +20 -5 +tm-eword.el was used instead of tiny-mime.el. +---------------------------- + +tm/gnus/tm-sgnus.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:09:53; author: morioka; state: Exp; lines: +27 -14 +tm-eword.el was used instead of tiny-mime.el. +---------------------------- diff --git a/Changes-7.07-7.09.ja b/Changes-7.07-7.09.ja new file mode 100644 index 0000000..204fc88 --- /dev/null +++ b/Changes-7.07-7.09.ja @@ -0,0 +1,148 @@ +* tl + + Version 6.6.8 を添付した。 + + - 新しい tl-822.el を作成した。 + - citation 用の utility として tl-cite.el を作成した。 + + +* tm + +tm/mime-setup.el +---------------------------- +revision 7.0 +date: 1995/10/03 04:27:39; author: morioka; state: Exp; lines: +12 -4 +tiny-mime.el を使うのをやめて、tm-eword.el を使うようにした。 +---------------------------- + +tm/tm-def.el +---------------------------- +revision 6.9 +date: 1995/10/03 04:30:57; author: morioka; state: Exp; lines: +2 -2 +変数 tm:mother-button-dispatcher を interactive に呼ぶように関数 +tm:browse-url を修正した。 +---------------------------- + +tm/tm-ew-d.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:34:26; author: morioka; state: Exp; lines: +24 -33 +MIME encoded-word decoder として tiny-mime.el から分離し、大幅に書き直 +した。 +---------------------------- + +tm/tm-ew-e.el +---------------------------- +revision 7.0 +date: 1995/10/03 04:35:11; author: morioka; state: Exp; +MIME encoded-word encoder として新設した。encoder は全面的に書き直され +ている。 +---------------------------- + +tm/tm-eword.el +---------------------------- +revision 7.0 +date: 1995/10/03 04:40:06; author: morioka; state: Exp; lines: +28 -549 +(1) tiny-mime.el を tm-eword.el に改名した。 +(2) decoder を tm-ew-d.el に移した。 +(3) encoder の大部分を削除し、tm-ew-e.el を使うようにした。 +---------------------------- + +tm/tm-mule.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:49:53; author: morioka; state: Exp; lines: +11 -1 +comment を修正した。 +---------------------------- +revision 7.0 +date: 1995/10/03 04:44:11; author: morioka; state: Exp; lines: +59 -24 +tm-ew-e.el 用の定義を追加した。 +---------------------------- + +tm/tm-nemacs.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:51:07; author: morioka; state: Exp; lines: +11 -1 +comment を修正した。 +---------------------------- +revision 7.0 +date: 1995/10/03 04:44:50; author: morioka; state: Exp; lines: +11 -1 +tm-ew-e.el 用の定義を追加した。 +---------------------------- + +tm/tm-orig.el +---------------------------- +revision 7.1 +date: 1995/10/03 04:52:16; author: morioka; state: Exp; lines: +11 -1 +comment を修正した。 +---------------------------- +revision 7.0 +date: 1995/10/03 04:45:50; author: morioka; state: Exp; lines: +13 -3 +tm-ew-e.el 用の定義を追加した。 +---------------------------- + +tm/tm-view.el +---------------------------- +revision 7.9 +date: 1995/10/03 04:56:10; author: morioka; state: Exp; lines: +2 -5 +tiny-mime.el を使うのをやめて、tm-ew-d.el を使うようにした。 +---------------------------- +revision 7.8 +date: 1995/09/26 16:04:39; author: morioka; state: Exp; lines: +5 -2 +関数 mime-viewer/display-content において、subject を取る部分の不具合 +を修正した。 +---------------------------- +revision 7.7 +date: 1995/09/26 14:49:23; author: morioka; state: Exp; lines: +2 -1 +body が隠された single-part の message の場合の関数 +mime-viewer/display-content の不具合を修正した。 +---------------------------- + +tm/tm-rmail.el +---------------------------- +revision 6.7 +date: 1995/09/28 06:05:20; author: morioka; state: Exp; lines: +18 -10 +encoded-word の decode はやっぱり変数 rmail-message-filter に設定する +ことにした。 +---------------------------- + +tm/tm-vm.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:04:35; author: morioka; state: Exp; lines: +22 -9 +tiny-mime.el を使うのをやめて tm-ew-e.el を使うことになったのに伴い、 +comment を修正した。 +---------------------------- + + +* tm/gnus + + Version 7.0 を添付した。 + +tm/gnus/tm-gnus.el +---------------------------- +revision 6.5 +date: 1995/09/28 02:20:46; author: morioka; state: Exp; lines: +9 -9 +``Gnus 5.* with September patch'' に対応した。 +---------------------------- + +tm/gnus/tm-gnus5.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:07:54; author: morioka; state: Exp; lines: +31 -22 +tiny-mime.el を使うのをやめて tm-ew-d.el を使うことにした。 +---------------------------- + +tm/gnus/tm-ognus.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:08:59; author: morioka; state: Exp; lines: +20 -5 +tiny-mime.el を使うのをやめて tm-ew-d.el を使うようにした。 +---------------------------- + +tm/gnus/tm-sgnus.el +---------------------------- +revision 7.0 +date: 1995/10/03 05:09:53; author: morioka; state: Exp; lines: +27 -14 +tiny-mime.el を使うのをやめて tm-ew-d.el を使うようにした。 +---------------------------- diff --git a/Makefile b/Makefile index 9841c63..de5db71 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 7.0 1995/09/26 12:36:27 morioka Exp morioka $ +# $Id: Makefile,v 7.1 1995/10/03 05:14:34 morioka Exp morioka $ # include config.tm @@ -9,9 +9,9 @@ GOMI = $(UTILS) *.elc loadpath TM_FILES = tm/README.eng tm/rel-*.ol tm/Changes* \ tm/config.tm tm/Makefile tm/mk-tm \ - tm/tm-view.el tm/tiny-mime.el \ - tm/tm-parse.el tm/tm-play.el \ tm/tm-mule.el tm/tm-nemacs.el tm/tm-orig.el tm/tm-def.el \ + tm/tm-eword.el tm/tm-ew-d.el tm/tm-ew-e.el \ + tm/tm-view.el tm/tm-parse.el tm/tm-play.el \ tm/tm-ftp.el tm/tm-latex.el tm/tm-w3.el tm/tm-partial.el \ tm/tm-tar.el \ tm/tm-rich.el tm/richtext.el tm/tinyrich.el \ @@ -34,7 +34,7 @@ TL_FILES = tl/README.eng tl/Makefile tl/mk-tl tl/*.el tl/doc/*.texi FILES = $(TM_FILES) $(TM_MUA_FILES) $(MEL_FILES) $(TL_FILES) -TARFILE = tm7.06.tar +TARFILE = tm7.09.tar nemacs: diff --git a/gnus/Makefile b/gnus/Makefile index 50ec763..af9da58 100644 --- a/gnus/Makefile +++ b/gnus/Makefile @@ -17,7 +17,7 @@ TMDIR19 = $(HOME)/lib/emacs19/lisp FILES = tm/gnus/*.el tm/doc/tm-gnus*.texi -TARFILE = tm-gnus6.24.tar +TARFILE = tm-gnus7.00.tar gnus3: diff --git a/gnus/g5-path b/gnus/g5-path index 0e9686c..71dd762 100644 --- a/gnus/g5-path +++ b/gnus/g5-path @@ -12,6 +12,6 @@ ;; ;; please edit this ;; - '("/usr/local/lib/emacs/site-lisp/gnus-5.0/lisp") + '("/usr/local/lib/emacs/site-lisp/gnus-5.0.6/lisp") ;; load-path)) diff --git a/gnus/mk-tgnus b/gnus/mk-tgnus index c6005bc..7a95247 100644 --- a/gnus/mk-tgnus +++ b/gnus/mk-tgnus @@ -6,22 +6,22 @@ (require 'gnus) (require 'tm-view) (princ (format "%s\n" gnus-version)) - (cond ((string-match "GNUS 3" gnus-version) - (byte-compile-file "tm-gnus3.el") + (cond ((boundp 'gnus-original-article-buffer) + (byte-compile-file "tm-sgnus.el") ) - ((string-match "GNUS 4" gnus-version) - (byte-compile-file "tm-gnus4.el") + ((string-match "Gnus v5\\|September Gnus" gnus-version) + (byte-compile-file "tm-gnus5.el") ) ((string-match "(ding)" gnus-version) (require 'tm-dgnus) (byte-compile-file "tm-dgnus.el") (byte-compile-file "tm-gnus5.el") ) - ((string-match "Gnus v5" gnus-version) - (byte-compile-file "tm-gnus5.el") + ((string-match "GNUS 4" gnus-version) + (byte-compile-file "tm-gnus4.el") ) - ((string-match "September Gnus" gnus-version) - (byte-compile-file "tm-sgnus.el") + ((string-match "GNUS 3" gnus-version) + (byte-compile-file "tm-gnus3.el") )) (byte-compile-file "tm-gnus.el") ) diff --git a/gnus/tm-gnus.el b/gnus/tm-gnus.el index 5e0df97..460dc80 100644 --- a/gnus/tm-gnus.el +++ b/gnus/tm-gnus.el @@ -6,7 +6,7 @@ ;;; ;;; Author: Morioka Tomohiko ;;; Version: -;;; $Id: tm-gnus.el,v 6.4 1995/09/24 20:22:40 morioka Exp $ +;;; $Id: tm-gnus.el,v 6.5 1995/09/28 02:20:46 morioka Exp $ ;;; Keywords: news, MIME, multimedia, encoded-word, multilingual ;;; ;;; This file is part of tm (Tools for MIME). @@ -24,20 +24,20 @@ ;;; @ set up ;;; -(cond ((string-match "^GNUS [0-3]" gnus-version) - (require 'tm-gnus3) +(cond ((boundp 'gnus-original-article-buffer) + (require 'tm-sgnus) ) - ((string-match "^GNUS 4" gnus-version) - (require 'tm-gnus4) + ((string-match "^\\(Gnus v5\\|September Gnus\\)" gnus-version) + (require 'tm-gnus5) ) ((string-match "(ding)" gnus-version) (require 'tm-dgnus) ) - ((string-match "^Gnus v5" gnus-version) - (require 'tm-gnus5) + ((string-match "^GNUS 4" gnus-version) + (require 'tm-gnus4) ) - ((string-match "^September Gnus" gnus-version) - (require 'tm-sgnus) + ((string-match "^GNUS [0-3]" gnus-version) + (require 'tm-gnus3) )) diff --git a/gnus/tm-gnus5.el b/gnus/tm-gnus5.el index 7fd9c0f..d6e17fa 100644 --- a/gnus/tm-gnus5.el +++ b/gnus/tm-gnus5.el @@ -1,5 +1,13 @@ ;;; -;;; tm-gnus5.el --- tm-gnus module for GNUS 5.* +;;; tm-gnus5.el --- tm-gnus module for Gnus 5.* +;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Keywords: news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is part of tm (Tools for MIME). ;;; (require 'tl-str) @@ -7,12 +15,18 @@ (require 'tl-misc) (require 'gnus) +(autoload 'mime/viewer-mode "tm-view" "View MIME message." t) +(autoload 'mime/decode-message-header + "tm-ew-d" "Decode MIME encoded-word." t) +(autoload 'mime/decode-encoded-words-string + "tm-ew-d" "Decode MIME encoded-word." t) + ;;; @ version ;;; (defconst tm-gnus/RCS-ID - "$Id: tm-gnus5.el,v 6.22 1995/09/11 07:41:23 morioka Exp $") + "$Id: tm-gnus5.el,v 7.0 1995/10/03 05:07:54 morioka Exp $") (defconst tm-gnus/version (concat (get-version-string tm-gnus/RCS-ID) " for GNUS 5")) @@ -32,15 +46,6 @@ ) -;;; @ autoload -;;; - -(autoload 'mime/viewer-mode "tm-view" "View MIME message." t) -(autoload 'mime/decode-message-header - "tiny-mime" "Decode MIME encoded-word." t) -(autoload 'mime/decode-string "tiny-mime" "Decode MIME encoded-word." t) - - ;;; @ variables ;;; @@ -105,17 +110,21 @@ article is automatic MIME decoded.") ;;; (defun tm-gnus/decode-summary-from-and-subjects () - (mapcar (function - (lambda (header) - (mail-header-set-from - header - (mime/decode-string (or (mail-header-from header) "")) - ) - (mail-header-set-subject - header - (mime/decode-string (or (mail-header-subject header) "")) - ) - )) + (mapcar (lambda (header) + (let ((from (mail-header-from header)) + (subj (mail-header-subject header)) + ) + (mail-header-set-from + header + (if from + (mime/decode-encoded-words-string from) + "")) + (mail-header-set-subject + header + (if subj + (mime/decode-encoded-words-string subj) + "")) + )) gnus-newsgroup-headers) ) diff --git a/gnus/tm-ognus.el b/gnus/tm-ognus.el index 3b5c064..1b7b936 100644 --- a/gnus/tm-ognus.el +++ b/gnus/tm-ognus.el @@ -1,13 +1,25 @@ ;;; -;;; tm-gnus.el --- tm-gnus module for GNUS 3.* and 4.* +;;; tm-ognus.el --- tm-gnus module for GNUS 3.* and 4.* ;;; -;;; $Id: tm-ognus.el,v 6.8 1995/09/02 07:40:13 morioka Exp $ +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Version: +;;; $Id: tm-ognus.el,v 7.0 1995/10/03 05:08:59 morioka Exp $ +;;; Keywords: news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is part of tm (Tools for MIME). ;;; (require 'emu) -(require 'tiny-mime) (require 'gnus) +(autoload 'mime/decode-message-header + "tm-ew-d" "Decode MIME encoded-word." t) +(autoload 'mime/decode-encoded-words-string + "tm-ew-d" "Decode MIME encoded-word." t) + (defvar tm-gnus/decoding-mode t "*Decode MIME header if non-nil.") @@ -51,7 +63,8 @@ If you don't like it, define your own gnus-article-set-mode-line." (let ((maxlen 15) ;Maximum subject length (subject (if gnus-current-headers - (mime/decode-string (nntp-header-subject gnus-current-headers)) + (mime/decode-encoded-words-string + (nntp-header-subject gnus-current-headers)) "") )) ;; The value must be a string to escape %-constructs because of subject. @@ -76,7 +89,9 @@ If you don't like it, define your own gnus-article-set-mode-line." (mapcar (function (lambda (header) (let ((subj (or (gnus-header-subject header) ""))) - (nntp-set-header-subject header (mime/decode-string subj)) + (nntp-set-header-subject + header + (mime/decode-encoded-words-string subj)) ))) gnus-newsgroup-headers) ) diff --git a/gnus/tm-sgnus.el b/gnus/tm-sgnus.el index 47a0c96..90ebb52 100644 --- a/gnus/tm-sgnus.el +++ b/gnus/tm-sgnus.el @@ -1,6 +1,14 @@ ;;; ;;; tm-sgnus.el --- tm-gnus module for September GNUS ;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Keywords: news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is part of tm (Tools for MIME). +;;; (require 'tl-str) (require 'tl-list) @@ -12,7 +20,7 @@ ;;; (defconst tm-gnus/RCS-ID - "$Id: tm-sgnus.el,v 6.24 1995/09/26 12:08:35 morioka Exp $") + "$Id: tm-sgnus.el,v 7.0 1995/10/03 05:09:53 morioka Exp $") (defconst tm-gnus/version (concat (get-version-string tm-gnus/RCS-ID) " for September")) @@ -23,8 +31,9 @@ (autoload 'mime/viewer-mode "tm-view" "View MIME message." t) (autoload 'mime/decode-message-header - "tiny-mime" "Decode MIME encoded-word." t) -(autoload 'mime/decode-string "tiny-mime" "Decode MIME encoded-word." t) + "tm-ew-d" "Decode MIME encoded-words in message header." t) +(autoload 'mime/decode-encoded-words-string + "tm-ew-d" "Decode MIME encoded-words in string." t) ;;; @ variables @@ -89,17 +98,21 @@ article is automatic MIME decoded.") ;;; (defun tm-gnus/decode-summary-from-and-subjects () - (mapcar (function - (lambda (header) - (mail-header-set-from - header - (mime/decode-string (or (mail-header-from header) "")) - ) - (mail-header-set-subject - header - (mime/decode-string (or (mail-header-subject header) "")) - ) - )) + (mapcar (lambda (header) + (let ((from (mail-header-from header)) + (subj (mail-header-subject header)) + ) + (mail-header-set-from + header + (if from + (mime/decode-encoded-words-string from) + "")) + (mail-header-set-subject + header + (if subj + (mime/decode-encoded-words-string subj) + "")) + )) gnus-newsgroup-headers) ) diff --git a/mime-setup.el b/mime-setup.el index 9a56c80..5829653 100644 --- a/mime-setup.el +++ b/mime-setup.el @@ -1,7 +1,15 @@ ;;; -;;; mime-setup: setup file to use tm and mime.el. +;;; mime-setup.el --- setup file to use tm and mime.el. ;;; -;;; $Id: mime-setup.el,v 6.2 1995/09/06 10:07:26 morioka Exp $ +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Version: +;;; $Id: mime-setup.el,v 7.0 1995/10/03 04:27:39 morioka Exp $ +;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is part of tm (Tools for MIME). ;;; (require 'tm-setup) @@ -108,10 +116,10 @@ )) -;;; @ for tiny-mime +;;; @ for encoded-word ;;; -(autoload 'mime/encode-message-header "tiny-mime" +(autoload 'mime/encode-message-header "tm-eword" "convert message header to MIME style." t) (add-hook 'mime-translate-hook (function mime/encode-message-header)) diff --git a/mk-tm b/mk-tm index 56805c1..13632dc 100644 --- a/mk-tm +++ b/mk-tm @@ -1,6 +1,6 @@ ;;; -*-Emacs-Lisp-*- ;;; -;;; $Id: mk-tm,v 4.0 1995/09/26 12:35:39 morioka Exp morioka $ +;;; $Id: mk-tm,v 5.0 1995/10/03 05:13:18 morioka Exp morioka $ ;;; (setq load-path (append @@ -29,7 +29,9 @@ "tm-orig" )) '("signature" - "tiny-mime" "tm-def" "tm-parse" "tm-view" "tm-play" + "tm-def" + "tm-ew-d" "tm-ew-e" "tm-eword" + "tm-parse" "tm-view" "tm-play" "tm-latex" "tm-w3" "tm-tar" "tm-rmail" "tm-comp" "tm-setup" "mime-setup" diff --git a/tm-comp.el b/tm-comp.el index ef6b7cb..c2fa487 100644 --- a/tm-comp.el +++ b/tm-comp.el @@ -21,7 +21,7 @@ ;;; (defconst mime/composer-RCS-ID - "$Id: tm-comp.el,v 6.11 1995/09/04 00:47:37 morioka Exp $") + "$Id: tm-comp.el,v 6.12 1995/09/28 03:56:17 morioka Exp $") (defconst mime/composer-version (get-version-string mime/composer-RCS-ID)) @@ -434,26 +434,27 @@ Optional argument ENCODING specifies an encoding method such as base64." ;;; (defun message/get-header-string-except (pat boundary) - (save-excursion - (save-restriction - (narrow-to-region (goto-char (point-min)) - (progn - (re-search-forward - (concat "^\\(" (regexp-quote boundary) "\\)?$") - nil t) - (match-beginning 0) - )) - (goto-char (point-min)) - (let (field header) - (while (re-search-forward message/field-regexp nil t) - (setq field (buffer-substring (match-beginning 0) - (match-end 0) - )) - (if (not (string-match pat field)) - (setq header (concat header field "\n")) - )) - header) - ))) + (let ((case-fold-search t)) + (save-excursion + (save-restriction + (narrow-to-region (goto-char (point-min)) + (progn + (re-search-forward + (concat "^\\(" (regexp-quote boundary) "\\)?$") + nil t) + (match-beginning 0) + )) + (goto-char (point-min)) + (let (field header) + (while (re-search-forward message/field-regexp nil t) + (setq field (buffer-substring (match-beginning 0) + (match-end 0) + )) + (if (not (string-match pat field)) + (setq header (concat header field "\n")) + )) + header) + )))) (defun replace-space-with-underline (str) (mapconcat (function @@ -465,6 +466,9 @@ Optional argument ENCODING specifies an encoding method such as base64." ) +;;; @ end +;;; + (provide 'tm-comp) (run-hooks 'tm-comp-load-hook) diff --git a/tm-def.el b/tm-def.el index f27f59d..f8d3f76 100644 --- a/tm-def.el +++ b/tm-def.el @@ -6,13 +6,14 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: tm-def.el,v 6.7 1995/09/25 22:21:48 morioka Exp $ +;;; $Id: tm-def.el,v 6.9 1995/10/03 04:30:57 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, definition ;;; ;;; This file is part of tm (Tools for MIME). ;;; (require 'emu) +(require 'tl-header) ;;; @ variables @@ -98,7 +99,7 @@ (if (fboundp browse-url-browser-function) (call-interactively browse-url-browser-function) (if (fboundp tm:mother-button-dispatcher) - (funcall tm:mother-button-dispatcher event) + (call-interactively tm:mother-button-dispatcher) ) )) diff --git a/tm-ew-d.el b/tm-ew-d.el new file mode 100644 index 0000000..d14dead --- /dev/null +++ b/tm-ew-d.el @@ -0,0 +1,162 @@ +;;; +;;; tm-ew-d.el --- RFC 1522 based multilingual MIME message header +;;; decoder for GNU Emacs +;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1992 ENAMI Tsugutomo +;;; Copyright (C) 1993,1994,1995 MORIOKA Tomohiko +;;; +;;; Author: ENAMI Tsugutomo +;;; MORIOKA Tomohiko +;;; Version: +;;; $Id: tm-ew-d.el,v 7.1 1995/10/03 04:34:26 morioka Exp $ +;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word +;;; + +(require 'emu) +(require 'mel) +(require 'tm-def) + + +;;; @ MIME encoded-word definition +;;; + +(defconst mime/encoded-text-regexp "[!->@-~]+") +(defconst mime/encoded-word-regexp (concat (regexp-quote "=?") + "\\(" + mime/charset-regexp + "\\)" + (regexp-quote "?") + "\\(B\\|Q\\)" + (regexp-quote "?") + "\\(" + mime/encoded-text-regexp + "\\)" + (regexp-quote "?="))) + + +;;; @ for string +;;; + +(defun mime/decode-encoded-words-string (str) + (let ((dest "")(ew nil) + beg end) + (while (setq beg (string-match mime/encoded-word-regexp str)) + (if (> beg 0) + (if (not (and (eq ew t) (string= (substring str 0 beg) " "))) + (setq dest (concat dest (substring str 0 beg) + )) + ) + ) + (setq end (match-end 0)) + (setq dest (concat dest + (mime/decode-encoded-word (substring str beg end)) + )) + (setq str (substring str end)) + (setq ew t) + ) + (concat dest str) + )) + + +;;; @ for region +;;; + +(defun mime/decode-encoded-words-region (beg end &optional unfolding) + (interactive "*r") + (save-excursion + (save-restriction + (narrow-to-region beg end) + (if unfolding + (mime/unfolding) + ) + (goto-char (point-min)) + (while (re-search-forward + (concat (regexp-quote "?=") "\\s +" (regexp-quote "=?")) + nil t) + (replace-match "?==?") + ) + (goto-char (point-min)) + (let (charset encoding text) + (while (re-search-forward mime/encoded-word-regexp nil t) + (insert (mime/decode-encoded-word + (prog1 + (buffer-substring (match-beginning 0) (match-end 0)) + (delete-region (match-beginning 0) (match-end 0)) + ) + )) + )) + ))) + + +;;; @ for message header +;;; + +(defun mime/decode-message-header () + (interactive "*") + (save-excursion + (save-restriction + (narrow-to-region (goto-char (point-min)) + (progn (re-search-forward "^$" nil t) (point))) + (mime/decode-encoded-words-region (point-min) (point-max) t) + ))) + +(defun mime/unfolding () + (goto-char (point-min)) + (let (field beg end) + (while (re-search-forward message/field-name-regexp nil t) + (setq beg (match-beginning 0)) + (setq end (message/field-end)) + (setq field (buffer-substring beg end)) + (if (string-match mime/encoded-word-regexp field) + (save-restriction + (narrow-to-region (goto-char beg) end) + (while (re-search-forward "\n[ \t]+" nil t) + (replace-match " ") + ) + (goto-char (point-max)) + )) + ))) + + +;;; @ encoded-word decoder +;;; + +(defun mime/decode-encoded-word (word) + (or (if (string-match mime/encoded-word-regexp word) + (let ((charset + (upcase + (substring word (match-beginning 1) (match-end 1)) + )) + (encoding + (upcase + (substring word (match-beginning 2) (match-end 2)) + )) + (text + (substring word (match-beginning 3) (match-end 3)) + )) + (mime/decode-encoded-text charset encoding text) + )) + word)) + + +;;; @ encoded-text decoder +;;; + +(defun mime/decode-encoded-text (charset encoding str) + (let ((dest + (cond ((string= "B" encoding) + (base64-decode-string str)) + ((string= "Q" encoding) + (q-encoding-decode-string str)) + (t (message "unknown encoding %s" encoding) + nil)))) + (if dest + (mime/convert-string-to-emacs charset dest) + ))) + + +;;; @ end +;;; + +(provide 'tm-ew-d) diff --git a/tm-ew-e.el b/tm-ew-e.el new file mode 100644 index 0000000..0150f19 --- /dev/null +++ b/tm-ew-e.el @@ -0,0 +1,397 @@ +;;; +;;; tm-ew-d.el --- RFC 1522 based multilingual MIME message header +;;; encoder for GNU Emacs +;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1993,1994,1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Version: +;;; $Id: tm-ew-e.el,v 7.0 1995/10/03 04:35:11 morioka Exp $ +;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word +;;; + +(require 'mel) +(require 'tl-822) +(require 'tm-def) + + +;;; @ encoded-text encoder +;;; + +(defun tm-eword::encode-encoded-text (charset encoding string &optional mode) + (let ((text + (cond ((string= encoding "B") + (base64-encode-string string)) + ((string= encoding "Q") + (q-encoding-encode-string string mode)) + ) + )) + (if text + (concat "=?" charset "?" encoding "?" text "?=") + ))) + + +;;; @ leading char +;;; + +(defun tm-eword::char-type (chr) + (if (or (= chr 32)(= chr ?\t)) + nil + (char-leading-char chr) + )) + +(defun tm-eword::parse-lc-word (str) + (let* ((rest (string-to-char-list str)) + (chr (car rest)) + (lc (tm-eword::char-type chr)) + (p (char-bytes chr)) + ) + (catch 'tag + (while (setq rest (cdr rest)) + (setq chr (car rest)) + (if (not (eq lc (tm-eword::char-type chr))) + (throw 'tag nil) + ) + (setq p (+ p (char-bytes chr))) + )) + (cons (cons lc (substring str 0 p)) (substring str p)) + )) + +(defun tm-eword::split-to-lc-words (str) + (let (ret dest) + (while (and (not (string= str "")) + (setq ret (tm-eword::parse-lc-word str)) + ) + (setq dest (cons (car ret) dest)) + (setq str (cdr ret)) + ) + (reverse dest) + )) + + +;;; @ word +;;; + +(defun tm-eword::parse-word (lcwl) + (let* ((lcw (car lcwl)) + (lc (car lcw)) + ) + (if (null lc) + lcwl + (let ((lcl (list lc)) + (str (cdr lcw)) + ) + (catch 'tag + (while (setq lcwl (cdr lcwl)) + (setq lcw (car lcwl)) + (setq lc (car lcw)) + (if (null lc) + (throw 'tag nil) + ) + (if (not (memq lc lcl)) + (setq lcl (cons lc lcl)) + ) + (setq str (concat str (cdr lcw))) + )) + (cons (cons lcl str) lcwl) + )))) + +(defun tm-eword::lc-words-to-words (lcwl) + (let (ret dest) + (while (setq ret (tm-eword::parse-word lcwl)) + (setq dest (cons (car ret) dest)) + (setq lcwl (cdr ret)) + ) + (reverse dest) + )) + + +;;; @ rule +;;; + +(defun mime/find-charset-rule (lcl) + (if lcl + (let ((ret (some-element + (function + (lambda (elt) + (subsetp lcl (car elt)) + )) + mime/lc-charset-rule-list) + )) + (if ret + (cdr ret) + mime/unknown-charset-rule) + ) + '(nil nil) + )) + +(defun tm-eword::words-to-ruled-words (wl) + (mapcar (function + (lambda (word) + (cons (cdr word) (mime/find-charset-rule (car word))) + )) + wl)) + +(defun tm-eword::space-process (seq) + (let (prev a ac b c cc) + (while seq + (setq b (car seq)) + (setq seq (cdr seq)) + (setq c (car seq)) + (setq cc (nth 1 c)) + (if (null (nth 1 b)) + (progn + (setq a (car prev)) + (setq ac (nth 1 a)) + (if (and (nth 2 a)(nth 2 c)) + (cond ((equal ac cc) + (setq prev (cons + (cons (concat (car a)(car b)(car c)) + (cdr a)) + (cdr prev) + )) + (setq seq (cdr seq)) + ) + (t + (setq prev (cons + (cons (concat (car a)(car b)) + (cdr a)) + (cdr prev) + )) + )) + (setq prev (cons b prev)) + )) + (setq prev (cons b prev)) + )) + (reverse prev) + )) + +(defun tm-eword::split-string (str) + (tm-eword::space-process + (tm-eword::words-to-ruled-words + (tm-eword::lc-words-to-words + (tm-eword::split-to-lc-words str) + )))) + + +;;; @ length +;;; + +(defun base64-length (string) + (let ((l (length string))) + (* (+ (/ l 3) + (if (= (mod l 3) 0) 0 1) + ) 4) + )) + +(defun q-encoding-length (string) + (let ((l 0)(i 0)(len (length string)) chr) + (while (< i len) + (setq chr (elt string i)) + (if (string-match "[A-Za-z0-9!*+/=_---]" (char-to-string chr)) + (setq l (+ l 1)) + (setq l (+ l 3)) + ) + (setq i (+ i 1)) ) + l)) + +(defun tm-eword::encoded-word-length (rword) + (let ((charset (nth 1 rword)) + (encoding (nth 2 rword)) + (string (car rword)) + ret) + (setq ret + (cond ((equal encoding "B") + (setq string + (mime/convert-string-from-emacs string charset)) + (base64-length string) + ) + ((equal encoding "Q") + (setq string + (mime/convert-string-from-emacs string charset)) + (q-encoding-length string) + ))) + (if ret + (cons (+ 7 (length charset) ret) string) + ))) + + +;;; @ encode-string +;;; + +(defun tm-eword::encode-string-1 (column rwl &optional mode) + (let* ((rword (car rwl)) + (ret (tm-eword::encoded-word-length rword)) + string len) + (if (null ret) + (cond ((and (setq string (car rword)) + (<= (setq len (+ (length string) column)) 76) + ) + (setq rwl (cdr rwl)) + ) + (t + (setq string "\n ") + (setq len 1) + )) + (cond ((and (setq len (car ret)) + (<= (+ column len) 76) + ) + (setq string + (tm-eword::encode-encoded-text + (nth 1 rword) (nth 2 rword) (cdr ret) + )) + (setq len (+ (length string) column)) + (setq rwl (cdr rwl)) + ) + (t + (setq string (car rword)) + (let* ((ls (reverse (string-to-char-list string))) + (sl (length string)) + (p sl) str) + (while (and ls + (progn + (setq p (- p (char-bytes (car ls)))) + (setq str (substring string 0 p)) + (setq ret (tm-eword::encoded-word-length + (cons str (cdr rword)) + )) + (setq str (cdr ret)) + (setq len (+ (car ret) column)) + (> len 76) + )) + (setq ls (cdr ls)) + ) + (if ls + (progn + (setq rwl (cons (cons (substring string p) (cdr rword)) + (cdr rwl))) + (setq string + (tm-eword::encode-encoded-text + (nth 1 rword) (nth 2 rword) str)) + (setq len (+ (length string) column)) + ) + (setq string "\n ") + (setq len 1) + ) + ))) + ) + (list string len rwl) + )) + +(defun tm-eword::encode-rwl (column rwl &optional mode) + (let (ret dest) + (while rwl + (setq ret (tm-eword::encode-string-1 column rwl mode)) + (setq dest (concat dest (car ret)) + column (nth 1 ret) + rwl (nth 2 ret)) + ) + (list dest column) + )) + +(defun tm-eword::encode-string (column str &optional mode) + (tm-eword::encode-rwl column (tm-eword::split-string str) mode) + ) + + +;;; @ converter +;;; + +(defun tm-eword::phrase-to-rwl (phrase) + (let (token type dest) + (while phrase + (setq token (car phrase)) + (setq type (car token)) + (cond ((eq type 'quoted-string) + (setq dest + (append dest + '(("\"" nil nil)) + (tm-eword::words-to-ruled-words + (tm-eword::lc-words-to-words + (tm-eword::split-to-lc-words (cdr token)))) + '(("\"" nil nil)) + )) + ) + ((eq type 'comment) + (setq dest + (append dest + '(("(" nil nil)) + (tm-eword::words-to-ruled-words + (tm-eword::lc-words-to-words + (tm-eword::split-to-lc-words (cdr token)))) + '((")" nil nil)) + )) + ) + (t + (setq dest (append dest + (tm-eword::words-to-ruled-words + (tm-eword::lc-words-to-words + (tm-eword::split-to-lc-words (cdr token)) + )))) + )) + (setq phrase (cdr phrase)) + ) + (tm-eword::space-process dest) + )) + +(defun tm-eword::phrase-route-addr-to-rwl (phrase-route-addr) + (if (eq (car phrase-route-addr) 'phrase-route-addr) + (let ((phrase (nth 1 phrase-route-addr)) + (route (nth 2 phrase-route-addr)) + dest) + (setq dest (tm-eword::phrase-to-rwl phrase)) + (if dest + (setq dest (append dest '((" " nil nil)))) + ) + (append + dest + (list (list (concat "<" (rfc822/addr-to-string route) ">") nil nil)) + )))) + +(defun tm-eword::addr-spec-to-rwl (addr-spec) + (if (eq (car addr-spec) 'addr-spec) + (list (list (rfc822/addr-to-string (cdr addr-spec)) nil nil)) + )) + +(defun tm-eword::mailbox-to-rwl (mbox) + (let ((addr (nth 1 mbox)) + (comment (nth 2 mbox)) + dest) + (setq dest (or (tm-eword::phrase-route-addr-to-rwl addr) + (tm-eword::addr-spec-to-rwl addr) + )) + (if comment + (setq dest + (append dest + '((" " nil nil) + ("(" nil nil)) + (tm-eword::split-string comment) + '((")" nil nil)) + ))) + dest)) + +(defun tm-eword::addresses-to-rwl (addresses) + (let ((dest (tm-eword::mailbox-to-rwl (car addresses)))) + (if dest + (while (setq addresses (cdr addresses)) + (setq dest (append dest + '(("," nil nil)) + '((" " nil nil)) + (tm-eword::mailbox-to-rwl (car addresses)) + )) + )) + dest)) + +(defun tm-eword::encode-address-list (column str) + (tm-eword::encode-rwl + column + (tm-eword::addresses-to-rwl + (rfc822/parse-addresses + (rfc822/lexical-analyze str))))) + + +;;; @ end +;;; + +(provide 'tm-ew-e) diff --git a/tm-eword.el b/tm-eword.el index fcedc33..cd01794 100644 --- a/tm-eword.el +++ b/tm-eword.el @@ -1,179 +1,50 @@ ;;; -;;; A multilingual MIME message header encoder/decoder. -;;; by Morioka Tomohiko (morioka@jaist.ac.jp) +;;; tm-eword.el --- RFC 1522 based multilingual MIME message header +;;; encoder/decoder for GNU Emacs ;;; -;;; original MIME decoder is -;;; mime.el,v 1.5 1992/07/18 07:52:08 by Enami Tsugutomo +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1993,1994,1995 MORIOKA Tomohiko ;;; - -;;; @ require modules +;;; Author: MORIOKA Tomohiko +;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word ;;; -(require 'tl-misc) -(require 'tl-822) -(require 'tl-num) -(require 'base64) -(require 'qprint) +(require 'tl-header) +(require 'tl-str) +(require 'tm-def) -;;; @ version -;;; -(defconst mime/RCS-ID - "$Id: tm-eword.el,v 5.12 1995/05/21 16:06:27 morioka Exp morioka $") +(autoload 'mime/decode-encoded-words-string "tm-ew-d") +(autoload 'mime/decode-encoded-words-region "tm-ew-d" nil t) +(autoload 'mime/decode-message-header "tm-ew-d" nil t) -(defconst mime/tiny-mime-version (get-version-string mime/RCS-ID)) +(require 'tm-ew-e) -;;; @ MIME encoded-word definition +;;; @ version ;;; -(defconst mime/charset-regexp "[A-Za-z0-9!#$%&'*+---^_`{}|~]") -(defconst mime/encoded-text-regexp "[!->@-~]+") - -(defconst mime/Base64-token-regexp "[A-Za-z0-9+/=]") -(defconst mime/Base64-encoded-text-regexp - (concat "\\(" - mime/Base64-token-regexp - mime/Base64-token-regexp - mime/Base64-token-regexp - mime/Base64-token-regexp - "\\)+")) -(defconst mime/Base64-encoding-and-encoded-text-regexp - (concat "\\(B\\)\\?" mime/Base64-encoded-text-regexp)) - -(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-octet-regexp "\\)+")) -(defconst mime/Quoted-Printable-encoding-and-encoded-text-regexp - (concat "\\(Q\\)\\?" mime/Quoted-Printable-encoded-text-regexp)) +(defconst tm-eword/RCS-ID + "$Id: tm-eword.el,v 7.0 1995/10/03 04:40:06 morioka Exp $") -(defconst mime/encoded-word-regexp (concat (regexp-quote "=?") - "\\(" - mime/charset-regexp - "+\\)" - (regexp-quote "?") - "\\(B\\|Q\\)" - (regexp-quote "?") - "\\(" - mime/encoded-text-regexp - "\\)" - (regexp-quote "?="))) - -(defun mime/nth-string (s n) - (if (stringp s) - (substring s (match-beginning n) (match-end n)) - (buffer-substring (match-beginning n) (match-end n)))) - -(defun mime/encoded-word-charset (str) - (mime/nth-string str 1)) - -(defun mime/encoded-word-encoding (str) - (mime/nth-string str 2)) - -(defun mime/encoded-word-encoded-text (str) - (mime/nth-string str 3)) - -(defun mime/rest-of-string (str) - (if (stringp str) - (substring str (match-end 0)) - (buffer-substring (match-end 0)(point-max)) - )) +(defconst tm-eword/version (get-version-string tm-eword/RCS-ID)) ;;; @ variables ;;; -(defvar mime/no-encoding-header-fields '("X-Nsubject")) +(defvar mime/no-encoding-header-fields '("X-Nsubject" "Newsgroups")) (defvar mime/use-X-Nsubject nil) -;;; @ compatible module among Mule, NEmacs and NEpoch -;;; -(cond ((boundp 'MULE) (require 'tm-mule)) - ((boundp 'NEMACS)(require 'tm-nemacs)) - (t (require 'tm-orig)) - ) - - ;;; @ Application Interface ;;; -;;; @@ MIME header decoders -;;; - -;; by mol. 1993/10/4 -(defun mime/decode-encoded-word (word) - (if (string-match mime/encoded-word-regexp word) - (let ((charset (upcase (mime/encoded-word-charset word))) - (encoding (mime/encoded-word-encoding word)) - (text (mime/encoded-word-encoded-text word))) - (mime/decode-encoded-text charset encoding text)) - word)) - -(defun mime/decode-region (beg end) - (interactive "*r") - (save-excursion - (save-restriction - (narrow-to-region beg end) - (goto-char (point-min)) - (let (charset encoding text) - (while (re-search-forward mime/encoded-word-regexp nil t) - (insert (mime/decode-encoded-word - (prog1 - (buffer-substring (match-beginning 0) (match-end 0)) - (delete-region (match-beginning 0) (match-end 0)) - ) - )) - )) - ))) - -(defun mime/decode-message-header () - (interactive "*") - (save-excursion - (save-restriction - (narrow-to-region (goto-char (point-min)) - (progn (re-search-forward "^$" nil t) (point))) - (mime/prepare-decode-message-header) - (mime/decode-region (point-min) (point-max)) - ))) - -(defun mime/decode-string (str) - (let ((dest "")(ew nil) - beg end) - (while (setq beg (string-match mime/encoded-word-regexp str)) - (if (> beg 0) - (if (not (and (eq ew t) (string= (substring str 0 beg) " "))) - (setq dest (concat dest (substring str 0 beg) - )) - ) - ) - (setq end (match-end 0)) - (setq dest (concat dest (mime/decode-encoded-word (substring str beg end)) - )) - (setq str (substring str end)) - (setq ew t) - ) - (concat dest str) - )) - ;;; @@ MIME header encoders ;;; -(defun mime/encode-string (string encoding &optional mode) - (cond ((equal encoding "B") - (base64-encode-string string) - ) - ((equal encoding "Q") - (quoted-printable-encode-string string (or mode 'phrase)) - ) - )) - (defun mime/encode-field (str) - (setq str (rfc822/unfolding-string str)) + (setq str (message/unfolding-string str)) (let ((ret (message/divide-field str)) field-name field-body) (setq field-name (car ret)) @@ -193,8 +64,8 @@ (string-match "^bcc:$" field-name) (string-match "^Resent-bcc:$" field-name) ) - (mime/encode-address-list - (+ (length field-name) 1) field-body) + (car (tm-eword::encode-address-list + (+ (length field-name) 1) field-body)) ) (t (catch 'tag @@ -206,12 +77,17 @@ ) (setq r (cdr r)) )) - (nth 1 (mime/encode-header-string - (+ (length field-name) 1) field-body)) + (car (tm-eword::encode-string + (+ (length field-name) 1) field-body)) )) )) )) +(defun mime/exist-encoded-word-in-subject () + (let ((str (message/get-field-body "Subject"))) + (if (and str (string-match mime/encoded-word-regexp str)) + str))) + (defun mime/encode-message-header () (interactive "*") (save-excursion @@ -219,7 +95,8 @@ (narrow-to-region (goto-char (point-min)) (progn (re-search-forward - (concat "^" (regexp-quote mail-header-separator) "$") + (concat + "^" (regexp-quote mail-header-separator) "$") nil t) (match-beginning 0) )) @@ -236,464 +113,20 @@ ))) )) (if mime/use-X-Nsubject - (progn - (goto-char (point-min)) - (if (re-search-forward "^Subject:.*\\(\n\\s +.*\\)*" nil t) - (let ((str (buffer-substring (match-beginning 0)(match-end 0)))) - (if (string-match mime/encoded-word-regexp str) - (insert (concat - "\nX-Nsubject: " - (nth 1 (message/divide-field - (mime/decode-string - (rfc822/unfolding-string str)) - )))) - )) - ))) - ))) - - -;;; @ functions for message header encoding -;;; - -(defun mime/encode-and-split-string (n string charset encoding) - (let ((i 0) (j 0) - (len (length string)) - (js (mime/convert-string-from-emacs string charset)) - (cesl (+ (length charset) (length encoding) 6 )) - ewl m rest) - (setq ewl (mime/encoded-word-length js encoding)) - (if (null ewl) nil - (progn - (setq m (+ n ewl cesl)) - (if (> m 76) - (progn - (while (and (< i len) - (setq js (mime/convert-string-from-emacs - (substring string 0 i) charset)) - (setq m (+ n (mime/encoded-word-length js encoding) cesl)) - (< m 76)) - (setq j i) - (setq i (+ i (char-bytes (elt string i)))) - ) - (setq js (mime/convert-string-from-emacs - (substring string 0 j) charset)) - (setq m (+ n (mime/encoded-word-length js encoding) cesl)) - (setq rest (substring string j)) - ) - (setq rest nil)) - (if (string= js "") - (list 1 "" string) - (list m (concat "=?" charset "?" encoding "?" - (mime/encode-string js encoding) - "?=") rest)) - )) - )) - -(defun mime/encode-header-word (n string charset encoding) - (let (dest str ret m) - (if (null (setq ret (mime/encode-and-split-string n string charset encoding))) - nil - (progn - (setq dest (nth 1 ret)) - (setq m (car ret)) - (setq str (nth 2 ret)) - (while (and (stringp str) - (setq ret (mime/encode-and-split-string 1 str charset encoding)) - ) - (setq dest (concat dest "\n " (nth 1 ret))) - (setq m (car ret)) - (setq str (nth 2 ret)) - ) - (list m dest) - )) - )) - -(defun mime/encode-header-string (n string &optional mode) - (if (string= string "") - (list n "") - (let ((ssl (mime/separate-string-for-encoder string)) - i len cell et w ew (dest "") b l) - (setq len (length ssl)) - (setq cell (nth 0 ssl)) - (setq et (car cell)) - ;; string-width crashes when the argument is nil, - ;; so replace the argument - ;; (original modification by Kenji Rikitake 9-JAN-1995) - (setq w (or (cdr cell) "")) - (if (eq et nil) - (progn - (if (> (+ n (string-width w)) 76) - (progn - (setq dest (concat dest "\n ")) - (setq b 1) - ) - (setq b n)) - (setq dest (concat dest w)) - (setq b (+ b (string-width w))) - ) - (progn - (setq ew (mime/encode-header-word n (cdr cell) (car et) (cdr et))) - (setq dest (nth 1 ew)) - (setq b (car ew)) - )) - (setq i 1) - (while (< i len) - (setq cell (nth i ssl)) - (setq et (car cell)) - (setq w (cdr cell)) - (cond ((string-match "^[ \t]*$" w) - (setq b (+ b (string-width (cdr cell)))) - (setq dest (concat dest (cdr cell))) - ) - ((eq et nil) - (if (> (+ b (string-width w)) 76) - (progn - (if (eq (elt dest (- (length dest) 1)) 32) - (setq dest (substring dest 0 (- (length dest) 1))) - ) - (setq dest (concat dest "\n " w)) - (setq b (+ (length w) 1)) - ) - (setq l (length dest)) - (if (and (>= l 2) - (eq (elt dest (- l 2)) ?\?) - (eq (elt dest (- l 1)) ?=) - ) - (progn - (setq dest (concat dest " ")) - (setq b (+ b 1)) - )) - (setq dest (concat dest w)) - (setq b (+ b (string-width w))) - )) - (t - (if (not (eq (elt dest (- (length dest) 1)) 32)) - (progn - (setq dest (concat dest " ")) - (setq b (+ b 1)) - )) - (setq ew - (mime/encode-header-word b (cdr cell) (car et) (cdr et))) - (setq b (car ew)) - (if (string-match "^\n" (nth 1 ew)) - (setq dest (concat (substring dest 0 (- (length dest) 1)) - (nth 1 ew))) - (setq dest (concat dest (nth 1 ew))) - ) - )) - (setq i (+ i 1)) - ) - (list b dest) - ))) - -(defun mime/encode-address-list (n str) - (let* ((ret (message/parse-addresses str)) - (r ret) cell en-ret j cl (dest "") s) - (while r - (setq cell (car r)) - (cond ((string= (nth 1 cell) "<") - (setq en-ret (mime/encode-header-string n (nth 0 cell) 'phrase)) - (setq dest (concat dest (nth 1 en-ret))) - (setq n (car en-ret)) - (if (> (length r) 1) - (setq en-ret - (mime/encode-header-string - n (concat (nth 1 cell)(nth 2 cell)(nth 3 cell) ", "))) - (setq en-ret (mime/encode-header-string - n (concat (nth 1 cell)(nth 2 cell)(nth 3 cell)))) - ) - (if (and (eq (elt (nth 1 en-ret) 0) ?\n) - (eq (elt dest (- (length dest) 1)) 32)) - (setq dest (substring dest 0 (- (length dest) 1))) - ) - (setq dest (concat dest (nth 1 en-ret))) - (setq n (car en-ret)) - ) - ((= (length cell) 4) - (setq en-ret (mime/encode-header-string n (nth 0 cell))) - (setq dest (concat dest (nth 1 en-ret))) - (setq n (car en-ret)) - - (setq en-ret (mime/encode-header-string (+ n 2) (nth 2 cell) - 'comment)) - (if (eq (elt (nth 1 en-ret) 0) ?\n) - (progn - (setq dest (concat dest "\n (")) - (setq en-ret (mime/encode-header-string 2 (nth 2 cell) - 'comment)) - ) - (progn - (setq dest (concat dest " (")) - )) - (setq dest (concat dest (nth 1 en-ret))) - (setq n (car en-ret)) - (if (> (length r) 1) - (setq en-ret - (mime/encode-header-string n (concat (nth 3 cell) ", ")) - ) - (setq en-ret (mime/encode-header-string n (nth 3 cell))) - ) - (setq dest (concat dest (nth 1 en-ret))) - (setq n (car en-ret)) - ) - (t - (if (> (length r) 1) - (setq en-ret - (mime/encode-header-string n (concat (nth 0 cell) ", ")) - ) - (setq en-ret (mime/encode-header-string n (nth 0 cell))) - ) - (setq dest (concat dest (nth 1 en-ret))) - (setq n (car en-ret)) - )) - (setq r (cdr r)) - ) - dest)) - - -;;; @ utility for encoder -;;; - -;;; @@ encoded-word length -;;; - -(defun mime/encoded-word-length (string encoding) - (cond ((equal encoding "B") (base64-encoded-length string)) - ((equal encoding "Q") (quoted-printable-encoded-length string)) - )) - -;;; @@ separate by character set -;;; - -;; by mol. 1993/11/2 -(defconst LC-space 2) - -;; by mol. 1993/10/16 -(defun mime/char-type (chr) - (if (or (= chr 32)(= chr ?\t)) - LC-space - (get-lc chr) - )) - -(defun mime/separate-string-by-chartype (string) - (let ((len (length string)) - (dest nil) (ds "") s - pcs i j cs chr) - (if (= len 0) nil - (progn - (setq chr (elt string 0)) - (setq pcs (mime/char-type chr)) - (setq i (char-bytes chr)) - (setq ds (substring string 0 i)) - (while (< i len) - (setq chr (elt string i)) - (setq cs (mime/char-type chr)) - (setq j (+ i (char-bytes chr))) - (setq s (substring string i j)) - (setq i j) - (if (= cs pcs) - (setq ds (concat ds s)) - (progn (setq dest (append dest (list (cons pcs ds)))) - (setq pcs cs) - (setq ds s) - )) - ) - (if (not (string= ds "")) - (setq dest (append dest (list (cons pcs ds))))) - dest) + (let ((str (mime/exist-encoded-word-in-subject))) + (if str + (insert + (concat + "\nX-Nsubject: " + (mime/decode-encoded-words-string + (message/unfolding-string str)) + ))))) ))) -(defun mime/separate-string-by-charset (str) - (let ((rl (mime/separate-string-by-chartype str)) - (i 1) len (pcell nil) cell ncell dpcell (dest nil) LC) - (setq len (length rl)) - (setq dpcell (list (nth 0 rl))) - (setq cell (nth 1 rl)) - (setq ncell (nth 2 rl)) - (while (< i len) - (setq LC (car (car dpcell))) - (cond ((and (not (eq LC lc-ascii)) - (eq (car cell) LC-space) - (not (eq (car ncell) lc-ascii))) - (setq dpcell (list (cons LC - (concat (cdr (car dpcell)) (cdr cell)) - ))) - ) - ((and (not (eq LC lc-ascii)) - (eq LC (car cell))) - (setq dpcell (list (cons LC - (concat (cdr (car dpcell)) (cdr cell)) - ))) - ) - ((and (eq LC lc-ascii) - (member (car cell) mime/latin-lc-list)) - (setq dpcell (list (cons (car cell) - (concat (cdr (car dpcell)) (cdr cell)) - ))) - ) - ((and (member LC mime/latin-lc-list) - (eq (car cell) lc-ascii)) - (setq dpcell (list (cons LC - (concat (cdr (car dpcell)) (cdr cell)) - ))) - ) - (t - (setq dest (append dest dpcell)) - (setq dpcell (list cell)) - )) - (setq i (+ i 1)) - (setq cell ncell) - (setq ncell (nth (+ i 1) rl)) - ) - (setq dest (append dest dpcell)) - )) - -(defun mime/separate-string-for-encoder (string) - (let (lastspace) - (if (string-match "[ \t]+$" string) - (progn - (setq lastspace (substring string - (match-beginning 0) - (match-end 0))) - (setq string (substring string 0 (match-beginning 0))) - )) - (let ((rl (mime/separate-string-by-charset string)) - (i 0) len cell0 cell1 cell2 (dest nil)) - (setq len (length rl)) - (setq cell0 (nth 0 rl)) - (setq cell1 (nth 1 rl)) - (setq cell2 (nth 2 rl)) - (while (< i len) - (cond ((and (not (eq (car cell0) lc-ascii)) - (eq (car cell1) LC-space) - (not (eq (car cell2) lc-ascii)) - ) - (setq dest - (append dest (list - (cons - (cdr (assoc (car cell0) - mime/lc-charset-and-encoding-alist)) - (concat (cdr cell0) (cdr cell1)) - )))) - (setq i (+ i 2)) - (setq cell0 (nth i rl)) - (setq cell1 (nth (+ i 1) rl)) - (setq cell2 (nth (+ i 2) rl)) - ) - (t - (setq dest - (append dest (list - (cons - (cdr (assoc (car cell0) - mime/lc-charset-and-encoding-alist)) - (cdr cell0))))) - (setq i (+ i 1)) - (setq cell0 cell1) - (setq cell1 cell2) - (setq cell2 (nth (+ i 2) rl)) - )) - ) - (append dest - (if lastspace - (list (cons nil lastspace)))) - ))) - - +;;; @ end ;;; -;;; basic functions for MIME header decoder -;;; - -;;; @ utility for decoder -;;; - -(defun mime/unfolding () - (goto-char (point-min)) - (let (field beg end) - (while (re-search-forward message/field-regexp nil t) - (setq beg (match-beginning 0)) - (setq end (match-end 0)) - (setq field (buffer-substring beg end)) - (if (string-match mime/encoded-word-regexp field) - (progn - (save-excursion - (save-restriction - (narrow-to-region (goto-char beg) end) - (while (re-search-forward "\n[ \t]+" nil t) - (replace-match " ") - ) - )) - )) - )) - ) - -(defun mime/prepare-decode-message-header () - (mime/unfolding) - (goto-char (point-min)) - (while (re-search-forward - (concat (regexp-quote "?=") - "\\s +" - (regexp-quote "=?")) - nil t) - (replace-match "?==?") - ) - ) - -(setq mime-charset-list - (list (list "US-ASCII" lc-ascii) - (list "ISO-8859-1" lc-ascii lc-ltn1) - (list "ISO-8859-2" lc-ascii lc-ltn2) - (list "ISO-8859-3" lc-ascii lc-ltn3) - (list "ISO-8859-4" lc-ascii lc-ltn4) - (list "ISO-8859-5" lc-ascii lc-crl) - (list "ISO-8859-7" lc-ascii lc-grk) - (list "ISO-8859-9" lc-ascii lc-ltn5) - (list "ISO-2022-JP" lc-ascii lc-jp) - (list "ISO-2022-KR" lc-ascii lc-kr) - (list "ISO-2022-JP-2" lc-ascii lc-ltn1 lc-grk - lc-jp lc-cn lc-kr lc-jp2) - (list "ISO-2022-INT-1" lc-ascii lc-ltn1 lc-grk - lc-jp lc-cn lc-kr lc-jp2 lc-cns1 lc-cns2) - )) - -(setq eword-field-body-separator-regexp " / ") - -(if (string-match eword-field-body-separator-regexp str) - (list (substring str 0 (match-beginning 0)) - (substring str (match-beginning 0)(match-end 0)) - (substring str (match-end 0)) - )) - -(defun find-lc-set-string (str) - (let (dest (len (length str))(i 0) chr lc) - (while (< i len) - (setq chr (elt str i)) - (setq lc (get-lc chr)) - (if (not (memq lc dest)) - (setq dest (cons lc dest)) - ) - (setq i (+ i (char-bytes chr))) - ) - dest)) - -(defun mime/lc-set-to-charset (lc-set) - (let ((rest mime-charset-list) cell) - (catch 'tag - (while rest - (setq cell (car rest)) - (if (subsetp lc-set (cdr cell)) - (throw 'tag (car cell)) - ) - (setq rest (cdr rest)) - )))) - -(run-hooks 'mime/tiny-mime-load-hook) -(provide 'tiny-mime) +(provide 'tm-eword) -;;; @ -;;; Local Variables: -;;; mode: emacs-lisp -;;; mode: outline-minor -;;; outline-regexp: ";;; @+\\|(......" -;;; End: +(run-hooks 'tm-eword-load-hook) diff --git a/tm-mule.el b/tm-mule.el index 6de3879..9eb71d4 100644 --- a/tm-mule.el +++ b/tm-mule.el @@ -1,16 +1,79 @@ ;;; -;;; $Id: tm-mule.el,v 6.5 1995/09/12 13:24:04 morioka Exp $ +;;; tm-mule.el --- tm definitions depended on Mule +;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Version: +;;; $Id: tm-mule.el,v 7.1 1995/10/03 04:49:53 morioka Exp $ +;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is part of tm (Tools for MIME). ;;; (require 'emu) (require 'tl-list) -;;; @ variables +;;; @ coding-system ;;; (defvar mime/default-coding-system *ctext*) +(defvar mime/charset-coding-system-alist + '(("ISO-2022-JP" . *iso-2022-ss2-7*) + ("ISO-2022-JP-2" . *iso-2022-ss2-7*) + ("X-ISO-2022-JP-2" . *iso-2022-ss2-7*) + ("ISO-2022-CN" . *iso-2022-ss2-7*) + ("ISO-2022-KR" . *iso-2022-kr*) + ("EUC-KR" . *euc-kr*) + ("ISO-8859-1" . *ctext*) + ("ISO-8859-2" . *iso-8859-2*) + ("ISO-8859-3" . *iso-8859-3*) + ("ISO-8859-4" . *iso-8859-4*) + ("ISO-8859-5" . *iso-8859-5*) + ("ISO-8859-7" . *iso-8859-7*) + ("ISO-8859-8" . *iso-8859-8*) + ("ISO-8859-9" . *iso-8859-9*) + ("ISO-2022-INT-1" . *iso-2022-int-1*) + )) + + +;;; @ charset and encoding +;;; + +(defvar mime/lc-charset-rule-list + (list + (list (list lc-ascii) "US-ASCII" nil) + (list (list lc-ascii lc-ltn1) "ISO-8859-1" "Q") + (list (list lc-ascii lc-ltn2) "ISO-8859-2" "Q") + (list (list lc-ascii lc-ltn3) "ISO-8859-3" "Q") + (list (list lc-ascii lc-ltn4) "ISO-8859-4" "Q") +;;;(list (list lc-ascii lc-crl) "ISO-8859-5" "Q") + (list (list lc-ascii lc-crl) "KOI8-R" "Q") + (list (list lc-ascii lc-grk) "ISO-8859-7" "Q") + (list (list lc-ascii lc-hbw) "ISO-8859-8" "Q") + (list (list lc-ascii lc-ltn5) "ISO-8859-9" "Q") + (list (list lc-ascii lc-jp) "ISO-2022-JP" "B") + (list (list lc-ascii lc-kr) "EUC-KR" "B") + (list (list lc-ascii + lc-jp lc-cn + lc-kr lc-jp2 + lc-ltn1 lc-grk) "ISO-2022-JP-2" "B") + (list (list lc-ascii + lc-jp lc-cn + lc-kr lc-jp2 + lc-cns1 lc-cns2 + lc-ltn1 lc-grk) "ISO-2022-INT-1" "B") + )) + +(defvar mime/unknown-charset-rule '("ISO-2022-INT-1" "B")) + + +;;; @ (obsoleted) +;;; + (defvar mime/lc-charset-and-encoding-alist (list (cons lc-ascii nil) @@ -31,24 +94,6 @@ (defvar mime/latin-lc-list (list lc-ascii lc-ltn1 lc-ltn2 lc-ltn3 lc-ltn4 lc-ltn5)) -(defvar mime/charset-coding-system-alist - '(("ISO-2022-JP" . *iso-2022-ss2-7*) - ("ISO-2022-JP-2" . *iso-2022-ss2-7*) - ("X-ISO-2022-JP-2" . *iso-2022-ss2-7*) - ("ISO-2022-CN" . *iso-2022-ss2-7*) - ("ISO-2022-KR" . *iso-2022-kr*) - ("EUC-KR" . *euc-kr*) - ("ISO-8859-1" . *ctext*) - ("ISO-8859-2" . *iso-8859-2*) - ("ISO-8859-3" . *iso-8859-3*) - ("ISO-8859-4" . *iso-8859-4*) - ("ISO-8859-5" . *iso-8859-5*) - ("ISO-8859-7" . *iso-8859-7*) - ("ISO-8859-8" . *iso-8859-8*) - ("ISO-8859-9" . *iso-8859-9*) - ("ISO-2022-INT-1" . *iso-2022-int-1*) - )) - (defvar mime/charset-lc-alist (list (cons "ISO-8859-1" lc-ltn1) ; Latin-1 @@ -62,10 +107,6 @@ (cons "ISO-8859-9" lc-ltn5) ; Latin-5 )) - -;;; @ define charset and encoding -;;; - (defun mime/set-charset-and-encoding (lc cs charset encoding) (setq mime/lc-charset-and-encoding-alist (put-alist lc (cons charset encoding) @@ -115,6 +156,10 @@ ) dest)) + +;;; @ functions +;;; + (defun mime/convert-string-to-emacs (charset str) (let ((cs (cdr (assoc charset mime/charset-coding-system-alist)))) (cond (cs diff --git a/tm-nemacs.el b/tm-nemacs.el index 865cc6a..32052c1 100644 --- a/tm-nemacs.el +++ b/tm-nemacs.el @@ -1,5 +1,15 @@ ;;; -;;; $Id: tm-nemacs.el,v 6.3 1995/08/27 14:24:22 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 +;;; 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). ;;; (require 'emu) @@ -10,6 +20,16 @@ (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") + )) + + +;;; @@ (obsolete) +;;; + (defvar mime/lc-charset-and-encoding-alist (list (cons lc-ascii nil) (cons lc-jp '("ISO-2022-JP" . "B")) diff --git a/tm-orig.el b/tm-orig.el index 762e462..aa02eb8 100644 --- a/tm-orig.el +++ b/tm-orig.el @@ -1,5 +1,15 @@ ;;; -;;; $Id: tm-orig.el,v 6.3 1995/08/27 14:26:18 morioka Exp $ +;;; tm-orig.el --- tm definitions depended on FSF Original Emacs +;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Version: +;;; $Id: tm-orig.el,v 7.1 1995/10/03 04:52:16 morioka Exp $ +;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is part of tm (Tools for MIME). ;;; (require 'emu) @@ -10,6 +20,18 @@ (defvar mime/default-coding-system nil) +(defvar mime/lc-charset-rule-list + (list + (list (list lc-ascii) "US-ASCII" nil) + (list (list lc-ascii lc-ltn1) "ISO-8859-1" "Q") + )) + +(defvar mime/decoding-charset-list '("US-ASCII" "ISO-8859-1")) + + +;;; @@ (obsolete) +;;; + (defvar mime/lc-charset-and-encoding-alist (list (cons lc-ascii nil) (cons lc-ltn1 '("ISO-8859-1" . "Q")) @@ -17,8 +39,6 @@ (defvar mime/latin-lc-list (list lc-ascii lc-ltn1)) -(defvar mime/decoding-charset-list '("US-ASCII" "ISO-8859-1")) - ;;; @ functions ;;; diff --git a/tm-partial.el b/tm-partial.el index 8e037a9..d39a78f 100644 --- a/tm-partial.el +++ b/tm-partial.el @@ -11,7 +11,7 @@ ;;; ;;; This file is a part of tm (Tools for MIME). ;;; -;;; $Id: tm-partial.el,v 6.0 1995/09/20 14:39:23 morioka Exp $ +;;; $Id: tm-partial.el,v 6.1 1995/09/26 14:50:54 morioka Exp $ ;;; (require 'tm-view) @@ -154,7 +154,7 @@ ;; (make-variable-buffer-local 'mime/content-list) ;; (setq mime/content-list (mime/parse-contents)) (make-variable-buffer-local 'mime::article/content-info) - (setq mime::article/content-info (mime-viewer/parse)) + (setq mime::article/content-info (mime/parse-message)) ) (delete-other-windows) (switch-to-buffer buffer) diff --git a/tm-rmail.el b/tm-rmail.el index 45c4718..222c898 100644 --- a/tm-rmail.el +++ b/tm-rmail.el @@ -1,5 +1,13 @@ ;;; -;;; $Id: tm-rmail.el,v 6.6 1995/06/26 22:52:13 morioka Exp $ +;;; $Id: tm-rmail.el,v 6.7 1995/09/28 06:05:20 morioka Exp $ +;;; +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; +;;; Author: MORIOKA Tomohiko +;;; Keywords: mail, news, MIME, multimedia +;;; +;;; This file is part of tm (Tools for MIME). ;;; (require 'tl-header) @@ -10,6 +18,15 @@ (autoload 'mime/Content-Type "tm-view" "parse Content-Type field.") (autoload 'mime/decode-message-header "tiny-mime" "Decode MIME header." t) +(setq rmail-message-filter + (function + (lambda () + (let ((mf (buffer-modified-p)) + (buffer-read-only nil)) + (mime/decode-message-header) + (set-buffer-modified-p mf) + )))) + (defun tm-rmail/show-all-header-p () (save-restriction (narrow-to-region (point-min) @@ -42,15 +59,6 @@ (defalias 'tm-rmail/quitting-method 'tm-rmail/quitting-method-to-article) -(add-hook 'rmail-show-message-hook - (function - (lambda () - (let ((mf (buffer-modified-p)) - (buffer-read-only nil)) - (mime/decode-message-header) - (set-buffer-modified-p mf) - )))) - (add-hook 'rmail-mode-hook (function (lambda () diff --git a/tm-view.el b/tm-view.el index e7d224c..0d40908 100644 --- a/tm-view.el +++ b/tm-view.el @@ -10,16 +10,13 @@ ;;; This file is part of tm (Tools for MIME). ;;; -;;; @ require modules -;;; - (require 'tl-str) (require 'tl-list) (require 'tl-atype) (require 'tl-misc) (require 'tl-header) (require 'mel) -(require 'tiny-mime) +(require 'tm-ew-d) (require 'tm-def) (require 'tm-parse) @@ -28,7 +25,7 @@ ;;; (defconst mime-viewer/RCS-ID - "$Id: tm-view.el,v 7.6 1995/09/26 11:53:46 morioka Exp $") + "$Id: tm-view.el,v 7.9 1995/10/03 04:56:10 morioka Exp $") (defconst mime-viewer/version (get-version-string mime-viewer/RCS-ID)) (defconst mime/viewer-version mime-viewer/version) @@ -371,7 +368,10 @@ The compressed face will be piped to this command.") (if (> he end) (setq he end) ) - (setq subj (mime-viewer/get-subject params encoding)) + (save-restriction + (narrow-to-region beg end) + (setq subj (mime-viewer/get-subject params encoding)) + ) (set-buffer obuf) (setq nb (point)) (narrow-to-region nb nb) @@ -392,6 +392,7 @@ The compressed face will be piped to this command.") (null (mime::content-info/children cinfo)) ) (set-buffer obuf) + (goto-char (point-max)) (mime-viewer/insert-content-subject cnum cinfo ctype params subj) ) (t (set-buffer obuf)) diff --git a/tm-vm.el b/tm-vm.el index f7ba9a1..f0effa6 100644 --- a/tm-vm.el +++ b/tm-vm.el @@ -1,21 +1,27 @@ ;;; -;;; tm-vm.el: tm-MUA for VM -;;; This version is tested under VM-5.76 with tm-6.20 +;;; tm-vm.el --- tm-MUA for VM ;;; -;;; Written by MASUTANI Yasuhiro -;;; Modified by SHIONO -;;; and Steinar Bang -;;; and Kenji Wakamiya +;;; Copyright (C) 1995 Free Software Foundation, Inc. +;;; +;;; Author: MASUTANI Yasuhiro +;;; and Kenji Wakamiya +;;; modified by SHIONO , +;;; Steinar Bang , +;;; and MORIOKA Tomohiko +;;; Keywords: news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is part of tm (Tools for MIME). +;;; +;;; This version is tested under VM-5.76 with tm-6.20. ;;; ;;; Plese insert (require 'tm-vm) in your .vm or .emacs. ;;; -(provide 'tm-vm) (require 'tm-view) (require 'vm) (defconst tm-vm/RCS-ID - "$Id: tm-vm.el,v 6.3 1995/09/26 00:15:07 morioka Exp $") + "$Id: tm-vm.el,v 7.0 1995/10/03 05:04:35 morioka Exp $") (defconst tm-vm/version (get-version-string tm-vm/RCS-ID)) (define-key vm-mode-map "Z" 'tm-vm/view-message) @@ -29,6 +35,7 @@ 'vm-virtual-mode 'tm-vm/quit-view-message) + ;;; @ for MIME header ;;; ;; If you don't use tiny-mime patch for VM (by RIKITAKE Kenji @@ -36,7 +43,7 @@ ;; (setq vm-summary-format "%n %*%a %-17.17F %-3.3m %2d %4l/%-5c, %I\"%UA\"\n") ;; (defun vm-summary-function-A (m) -;; (mime/decode-string (vm-su-subject m))) +;; (mime/decode-encoded-words-string (vm-su-subject m))) ;;; @ functions @@ -128,3 +135,9 @@ all marked messages are affected, other messages are ignored." (set-buffer (car vbufs)) (vm-preview-current-message) (setq vbufs (cdr vbufs)))))) + + +;;; @ end +;;; + +(provide 'tm-vm)