From c6b287dbd7789726678fcdc1ec497bdda703e8a6 Mon Sep 17 00:00:00 2001 From: morioka Date: Mon, 9 Mar 1998 19:55:43 +0000 Subject: [PATCH] tm 7.77. --- ChangeLog | 44 ++++++++++++++++++++++++++++++++ Makefile | 2 +- gnus/ChangeLog | 32 +++++++++++++++++++++++ gnus/gnus-art-mime.el | 18 ++++++++----- gnus/gnus-mime.el | 25 ++---------------- gnus/gnus-msg-mime.el | 59 ++++++++++++++++++++++++++++++++++++++++++ gnus/gnus-sum-mime.el | 45 ++++++++++++++++++-------------- gnus/message-mime.el | 65 ++++++++++++++++++++++++++++++++++++++++++++++ gnus/mk-tgnus | 10 +++++--- methods/ChangeLog | 17 ++++++++++--- methods/tm-html | 4 +-- mime-setup.el.in | 11 +++++++- tm-edit.el | 68 ++++++++++++++++++++++++++++++------------------- tm-ew-d.el | 40 ++++++++++++++++------------- tm-setup.el | 62 +++++++++++++++++++++++--------------------- 15 files changed, 369 insertions(+), 133 deletions(-) create mode 100644 gnus/gnus-msg-mime.el create mode 100644 gnus/message-mime.el diff --git a/ChangeLog b/ChangeLog index faef459..d0ae604 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +Fri Aug 9 12:16:23 1996 MORIOKA Tomohiko + + * tm: Version 7.77 + * tm/gnus: gnus-mime Version 0.3 was released. + + * tm-edit.el (mime-editor/encrypt-recipient-fields-list): New + variable. + (mime-editor/make-encrypt-recipient-header): New function. + (mime-editor/encrypt-pgp-elkins): Use function + `mime-editor/make-encrypt-recipient-header'. + +Wed Aug 7 16:42:47 1996 MORIOKA Tomohiko + + * mime-setup.el.in: setup for message-mime.el. + +Wed Aug 7 15:50:44 1996 MORIOKA Tomohiko + + * tm-ew-d.el (mime/decode-encoded-text): unfolding must be after + code-converted. + +Wed Aug 7 05:59:03 1996 MORIOKA Tomohiko + + * tm-setup.el: Don't define function to load up tm-gnus or + gnus-mime if GNUS or Gnus has been loaded. + +Wed Aug 7 05:49:42 1996 MORIOKA Tomohiko + + * tm-setup.el: Use `call-after-loaded' to setup + gnus-mime. (cf. [tm-en:661]) + +Wed Aug 7 03:35:52 1996 MORIOKA Tomohiko + + * tm-ew-d.el (mime-eword/decode-region): New optional argument + `must-unfold'. + + * tm-ew-d.el (mime-eword/decode-string): New optional argument + `unfolding'. + (mime/decode-encoded-text): New optional argument `unfolding'. + (mime/decode-encoded-word): New implementation. + + * tm-ew-d.el (mime/decode-encoded-word): new optional argument + `unfolding'. + + Tue Aug 6 12:29:11 1996 MORIOKA Tomohiko * tl: Version 7.44 was released. diff --git a/Makefile b/Makefile index 859af92..e0c8c27 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ TL_FILES = tl/README.en tl/Makefile tl/mk-tl tl/tl-els \ FILES = $(TM_FILES) $(TM_MUA_FILES) $(MEL_FILES) $(TL_FILES) -TARFILE = tm7.76.tar.gz +TARFILE = tm7.77.tar.gz elc: $(EMACS) $(FLAGS) -l inst-tm -f compile-tm diff --git a/gnus/ChangeLog b/gnus/ChangeLog index 0537e8c..3fbf291 100644 --- a/gnus/ChangeLog +++ b/gnus/ChangeLog @@ -1,3 +1,35 @@ +Fri Aug 9 12:29:10 1996 MORIOKA Tomohiko + + * tm/gnus: gnus-mime Version 0.3 was released. + + * gnus-sum-mime.el (gnus-set-summary-default-charset): + code-conversion should do by line because of robustness. + +Thu Aug 8 15:51:57 1996 MORIOKA Tomohiko + + * mk-tgnus: gnus-msg-mime.el was added. + + * gnus-msg-mime.el: New module. + + * gnus-art-mime.el (gnus-article-preview-mime-message): prevent + side effect of `mime/viewer-mode' (cf. [bug-tm-en:666]) + +Wed Aug 7 16:37:57 1996 MORIOKA Tomohiko + + * mk-tgnus: message-mime.el was added. + + * message-mime.el: Function `tm-gnus/insert-article' was renamed + to `message-mime-insert-article'. + + * message-mime.el: New module. + + * gnus-mime.el: setting for tm-edit were split into + message-mime.el. + + * gnus-art-mime.el (gnus-decode-rfc1522): + decoded encoded-word in XOVER must be unfolded. + + Tue Aug 6 12:10:47 1996 MORIOKA Tomohiko * tm/gnus: gnus-mime Version 0.2 was released. diff --git a/gnus/gnus-art-mime.el b/gnus/gnus-art-mime.el index 627fa0c..cd7ed4c 100644 --- a/gnus/gnus-art-mime.el +++ b/gnus/gnus-art-mime.el @@ -6,7 +6,8 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Created: 1996/8/6 -;;; Version: $Id: gnus-art-mime.el,v 0.1 1996/08/06 12:00:10 morioka Exp $ +;;; Version: +;;; $Id: gnus-art-mime.el,v 0.3 1996/08/08 15:12:51 morioka Exp $ ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is not part of GNU Emacs yet. @@ -37,9 +38,11 @@ (goto-char (point-min)) ;; for XOVER (while (re-search-forward "^[0-9]+\t\\([^\t]+\\)\t" nil t) - (mime-eword/decode-region (match-beginning 1) (match-end 1)) + (mime-eword/decode-region (match-beginning 1) (match-end 1) + 'unfolding 'must-unfold) (if (re-search-forward "[^\t]+" nil t) - (mime-eword/decode-region (match-beginning 0)(match-end 0)) + (mime-eword/decode-region (match-beginning 0)(match-end 0) + 'unfolding 'must-unfold) ) )) (mime-eword/decode-region (point-min)(point-max) t) @@ -59,10 +62,11 @@ (set-buffer gnus-summary-buffer) default-mime-charset)) ) - (mime/viewer-mode nil nil nil gnus-original-article-buffer - gnus-article-buffer - gnus-article-mode-map) - ) + (save-window-excursion + (mime/viewer-mode nil nil nil gnus-original-article-buffer + gnus-article-buffer + gnus-article-mode-map) + )) (run-hooks 'tm-gnus/article-prepare-hook) ) diff --git a/gnus/gnus-mime.el b/gnus/gnus-mime.el index 596f5c6..3b47692 100644 --- a/gnus/gnus-mime.el +++ b/gnus/gnus-mime.el @@ -5,7 +5,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Created: 1996/8/6 -;;; Version: $Revision: 0.2 $ +;;; Version: $Revision: 0.3 $ ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is not part of GNU Emacs yet. @@ -52,7 +52,7 @@ it is used as hook to set. [gnus-mime.el]" ;;; (defconst gnus-mime-RCS-ID - "$Id: gnus-mime.el,v 0.2 1996/08/06 12:05:37 morioka Exp $") + "$Id: gnus-mime.el,v 0.3 1996/08/07 16:31:12 morioka Exp $") (defconst gnus-mime-version (get-version-string gnus-mime-RCS-ID)) @@ -154,16 +154,6 @@ The function is called from the article buffer.") ;;; @ for tm-edit ;;; -;; suggested by OKABE Yasuo -;; 1995/11/08 (c.f. [tm ML:1067]) -(defun tm-gnus/insert-article (&optional message) - (interactive) - (let ((message-cite-function 'mime-editor/inserted-message-filter) - (message-reply-buffer gnus-original-article-buffer) - ) - (message-yank-original nil) - )) - ;;; modified by Steven L. Baur ;;; 1995/12/6 (c.f. [tm-en:209]) (defun mime-editor/attach-to-news-reply-menu () @@ -181,20 +171,9 @@ The function is called from the article buffer.") 'tm-edit (function (lambda () - (set-alist 'mime-editor/message-inserter-alist - 'message-mode (function tm-gnus/insert-article)) (if (string-match "XEmacs\\|Lucid" emacs-version) (add-hook 'news-setup-hook 'mime-editor/attach-to-news-reply-menu) ) - - (set-alist 'mime-editor/split-message-sender-alist - 'message-mode - (lambda () - (interactive) - (let (message-send-hook - message-sent-message-via) - (message-send) - ))) ))) diff --git a/gnus/gnus-msg-mime.el b/gnus/gnus-msg-mime.el new file mode 100644 index 0000000..5959f8a --- /dev/null +++ b/gnus/gnus-msg-mime.el @@ -0,0 +1,59 @@ +;;; +;;; gnus-msg-mime.el --- MIME extensions +;;; for mail and post interface of Gnus +;;; +;;; Copyright (C) 1996 Free Software Foundation, Inc. +;;; +;;; Author: MORIOKA Tomohiko +;;; Created: 1996/8/8 +;;; Version: +;;; $Id: gnus-msg-mime.el,v 0.1 1996/08/08 15:49:36 morioka Exp $ +;;; Keywords: news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is not part of GNU Emacs yet. +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with This program. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: + +(require 'gnus-msg) + +(defun gnus-copy-article-buffer-with-no-filter () + ;; make a copy of the article buffer with all text properties removed + ;; this copy is in the buffer gnus-article-copy. + ;; if ARTICLE-BUFFER is nil, gnus-article-buffer is used + ;; this buffer should be passed to all mail/news reply/post routines. + (setq gnus-article-copy (get-buffer-create " *gnus article copy*")) + (buffer-disable-undo gnus-article-copy) + (or (memq gnus-article-copy gnus-buffer-list) + (setq gnus-buffer-list (cons gnus-article-copy gnus-buffer-list))) + (let (mime-viewer/plain-text-preview-hook + (mime-viewer/ignored-field-regexp "^:$")) + (save-window-excursion + (mime/viewer-mode nil nil nil + gnus-original-article-buffer gnus-article-copy) + ) + gnus-article-copy)) + + +;;(fset 'gnus-copy-article-buffer 'gnus-copy-article-buffer-with-no-filter) + + +;;; @ end +;;; + +(provide 'gnus-msg-mime) + +;;; gnus-msg-mime.el ends here diff --git a/gnus/gnus-sum-mime.el b/gnus/gnus-sum-mime.el index 1da1760..bbbe8f3 100644 --- a/gnus/gnus-sum-mime.el +++ b/gnus/gnus-sum-mime.el @@ -7,7 +7,7 @@ ;;; Author: MORIOKA Tomohiko ;;; Created: 1996/8/6 ;;; Version: -;;; $Id: gnus-sum-mime.el,v 0.1 1996/08/06 12:00:53 morioka Exp $ +;;; $Id: gnus-sum-mime.el,v 0.2 1996/08/09 12:29:10 morioka Exp $ ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is not part of GNU Emacs yet. @@ -36,24 +36,31 @@ ;;; (defun gnus-set-summary-default-charset () - (decode-mime-charset-region - (point-min)(point-max) - (save-excursion - (set-buffer gnus-summary-buffer) - (let ((rest gnus-newsgroup-default-charset-alist) - cell) - (catch 'tag - (while (setq cell (car rest)) - (if (string-match (car cell) gnus-newsgroup-name) - (throw 'tag - (progn - (make-local-variable 'default-mime-charset) - (setq default-mime-charset (cdr cell)) - ))) - (setq rest (cdr rest)) - ))) - default-mime-charset) - )) + (let ((charset + (save-excursion + (set-buffer gnus-summary-buffer) + (let ((rest gnus-newsgroup-default-charset-alist) + cell) + (catch 'tag + (while (setq cell (car rest)) + (if (string-match (car cell) gnus-newsgroup-name) + (throw 'tag + (progn + (make-local-variable 'default-mime-charset) + (setq default-mime-charset (cdr cell)) + ))) + (setq rest (cdr rest)) + ))) + default-mime-charset))) + (goto-char (point-min)) + (while (< (point)(point-max)) + (decode-mime-charset-region (point) + (progn + (end-of-line) + (point)) + default-mime-charset) + (forward-char) + ))) ;;; @ command functions diff --git a/gnus/message-mime.el b/gnus/message-mime.el new file mode 100644 index 0000000..acbafed --- /dev/null +++ b/gnus/message-mime.el @@ -0,0 +1,65 @@ +;;; +;;; message-mime.el --- MIME extensions for message.el +;;; +;;; Copyright (C) 1996 Free Software Foundation, Inc. +;;; +;;; Author: MORIOKA Tomohiko +;;; Created: 1996/8/6 +;;; Version: +;;; $Id: message-mime.el,v 0.2 1996/08/07 16:33:30 morioka Exp $ +;;; Keywords: news, MIME, multimedia, multilingual, encoded-word +;;; +;;; This file is not part of GNU Emacs yet. +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with This program. If not, write to the Free Software +;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;;; +;;; Code: + +;;; @ for tm-edit +;;; + +;; suggested by OKABE Yasuo +;; 1995/11/08 (c.f. [tm ML:1067]) +(defun message-mime-insert-article (&optional message) + (interactive) + (let ((message-cite-function 'mime-editor/inserted-message-filter) + (message-reply-buffer gnus-original-article-buffer) + ) + (message-yank-original nil) + )) + +(call-after-loaded + 'tm-edit + (function + (lambda () + (set-alist 'mime-editor/message-inserter-alist + 'message-mode (function message-mime-insert-article)) + (set-alist 'mime-editor/split-message-sender-alist + 'message-mode + (lambda () + (interactive) + (let (message-send-hook + message-sent-message-via) + (message-send) + ))) + ))) + + +;;; @ end +;;; + +(provide 'message-mime) + +;;; message-mime.el ends here diff --git a/gnus/mk-tgnus b/gnus/mk-tgnus index 26f5de6..3212e57 100644 --- a/gnus/mk-tgnus +++ b/gnus/mk-tgnus @@ -1,6 +1,6 @@ ;;; -*-Emacs-Lisp-*- ;;; -;;; $Id: mk-tgnus,v 6.0 1996/08/06 12:10:47 morioka Exp $ +;;; $Id: mk-tgnus,v 7.1 1996/08/08 15:51:57 morioka Exp $ ;;; (setq load-path @@ -26,6 +26,8 @@ (byte-compile-file "gnus-charset.el") (byte-compile-file "gnus-sum-mime.el") (byte-compile-file "gnus-art-mime.el") + (byte-compile-file "message-mime.el") + (byte-compile-file "gnus-msg-mime.el") ) ((string-match "GNUS 4" gnus-version) (require 'tm-gnus) @@ -100,10 +102,12 @@ (t (install-el-files path "gnus-mime.el" "gnus-charset.el" - "gnus-sum-mime.el" "gnus-art-mime.el") + "gnus-sum-mime.el" "gnus-art-mime.el" + "message-mime.el" "gnus-msg-mime.el") (install-elc-files path "gnus-mime.elc" "gnus-charset.elc" - "gnus-sum-mime.elc" "gnus-art-mime.elc") + "gnus-sum-mime.elc" "gnus-art-mime.elc" + "message-mime.elc" "gnus-msg-mime.elc") )) (setq command-line-args-left (cdr command-line-args-left)) )) diff --git a/methods/ChangeLog b/methods/ChangeLog index 140571b..983d723 100644 --- a/methods/ChangeLog +++ b/methods/ChangeLog @@ -1,13 +1,22 @@ +Thu Aug 8 15:58:28 1996 MORIOKA Tomohiko + + * tm-html: `grep -s' seems not work fine. + +Mon Mar 25 12:35:55 1996 MORIOKA Tomohiko + + * tm-au: Rob Kooper 's patch was applied for + SGI machine + (cf. [tm-en:392]) + Sun Mar 24 22:40:03 1996 Rob Kooper * tm-au: patch for SGI machine (cf. [tm-en:392]) Mon Mar 11 15:05:27 1996 MORIOKA Tomohiko - * tm-html: - When starting netscape to view a html message it would always start a - new netscape browser. Following patch to tm/methods/tm-html will - prevent this. (cf.[bug-tm-en:373]) + * tm-html: When starting netscape to view a html message it would + always start a new netscape browser. Following patch to + tm/methods/tm-html will prevent this. (cf.[bug-tm-en:373]) Mon Mar 10 23:07:42 1996 Rob Kooper diff --git a/methods/tm-html b/methods/tm-html index 97f02eb..a1b07b7 100755 --- a/methods/tm-html +++ b/methods/tm-html @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: tm-html,v 4.0 1996/03/11 15:05:27 morioka Exp $ +# $Id: tm-html,v 4.1 1996/08/08 15:58:28 morioka Exp $ # if [ "$TM_TMP_DIR" = "" ]; then @@ -25,7 +25,7 @@ tmdecode "$3" $1 $filename case "$4" in "play") - if [ `echo $TM_WWW_BROWSER | grep -s netscape` ]; then + if [ `echo $TM_WWW_BROWSER | grep netscape` ]; then echo netscape if [ -h $HOME/.netscape/lock ]; then netscape -remote "openURL(file:$filename,new-window)" diff --git a/mime-setup.el.in b/mime-setup.el.in index 9165ab9..ee120d3 100644 --- a/mime-setup.el.in +++ b/mime-setup.el.in @@ -5,8 +5,10 @@ ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko +;;; Maintainer: Shuhei KOBAYASHI +;;; and MORIOKA Tomohiko ;;; Version: -;;; $Id: mime-setup.el.in,v 7.21 1996/06/25 01:02:40 shuhei-k Exp $ +;;; $Id: mime-setup.el.in,v 7.22 1996/08/07 16:42:47 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). @@ -147,6 +149,13 @@ ))) (setq message-forward-end-separator "") +(call-after-loaded + 'message + (function + (lambda () + (require 'message-mime) + ))) + ;;; @ end ;;; diff --git a/tm-edit.el b/tm-edit.el index 5e9643f..c50c5a1 100644 --- a/tm-edit.el +++ b/tm-edit.el @@ -8,7 +8,7 @@ ;;; MORIOKA Tomohiko ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1994/08/21 renamed from mime.el -;;; Version: $Revision: 7.76 $ +;;; Version: $Revision: 7.77 $ ;;; Keywords: mail, news, MIME, multimedia, multilingual ;;; ;;; This file is part of tm (Tools for MIME). @@ -122,7 +122,7 @@ ;;; (defconst mime-editor/RCS-ID - "$Id: tm-edit.el,v 7.76 1996/08/06 12:29:11 morioka Exp $") + "$Id: tm-edit.el,v 7.77 1996/08/09 12:16:23 morioka Exp $") (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) @@ -1662,15 +1662,48 @@ Content-Transfer-Encoding: 7bit ) )))) +(defvar mime-editor/encrypt-recipient-fields-list '("To" "cc")) + +(defun mime-editor/make-encrypt-recipient-header () + (let* ((names mime-editor/encrypt-recipient-fields-list) + (values + (rfc822/get-field-bodies (cons "From" names) + nil mail-header-separator)) + (from (prog1 + (car values) + (setq values (cdr values)))) + (header (and (stringp from) + (if (string-equal from "") + "" + (format "From: %s\n" from) + ))) + recipients) + (while (and names values) + (let ((name (car names)) + (value (car values)) + ) + (and (stringp value) + (or (string-equal value "") + (progn + (setq header (concat header name ": " value "\n") + recipients (if recipients + (concat recipients " ," value) + value)) + )))) + (setq names (cdr names) + values (cdr values)) + ) + (vector from recipients header) + )) + (defun mime-editor/encrypt-pgp-elkins (beg end boundary) (save-excursion (save-restriction - (let (from to cc recipients) - (let ((ret (rfc822/get-field-bodies - '("From" "To" "cc") nil mail-header-separator))) - (setq from (car ret) ret (cdr ret) - to (car ret) ret (cdr ret) - cc (car ret)) + (let (from recipients header) + (let ((ret (mime-editor/make-encrypt-recipient-header))) + (setq from (aref ret 0) + recipients (aref ret 1) + header (aref ret 2)) ) (narrow-to-region beg end) (let* ((ret @@ -1681,24 +1714,7 @@ Content-Transfer-Encoding: 7bit (pgp-boundary (concat "pgp-" boundary)) ) (goto-char beg) - (if (and (stringp from) - (not (string-equal from ""))) - (insert (format "From: %s\n" from)) - ) - (if (and (stringp to) - (not (string-equal to ""))) - (progn - (insert (format "To: %s\n" to)) - (setq recipients to) - )) - (if (and (stringp cc) - (not (string-equal cc ""))) - (progn - (insert (format "cc: %s\n" cc)) - (if recipients - (setq recipients (concat recipients "," cc)) - (setq recipients cc) - ))) + (insert header) (insert (format "Content-Type: %s\n" ctype)) (if encoding (insert (format "Content-Transfer-Encoding: %s\n" encoding)) diff --git a/tm-ew-d.el b/tm-ew-d.el index fb9ccf4..0eabbea 100644 --- a/tm-ew-d.el +++ b/tm-ew-d.el @@ -10,7 +10,7 @@ ;;; MORIOKA Tomohiko ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1993/6/3 (1995/10/3 obsolete tiny-mime.el) -;;; Version: $Revision: 7.13 $ +;;; Version: $Revision: 7.18 $ ;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). @@ -41,7 +41,7 @@ ;;; (defconst tm-ew-d/RCS-ID - "$Id: tm-ew-d.el,v 7.13 1996/07/14 11:40:02 morioka Exp $") + "$Id: tm-ew-d.el,v 7.18 1996/08/07 15:50:44 morioka Exp $") (defconst mime/eword-decoder-version (get-version-string tm-ew-d/RCS-ID)) @@ -65,7 +65,7 @@ ;;; @ for string ;;; -(defun mime-eword/decode-string (str) +(defun mime-eword/decode-string (str &optional unfolding) (setq str (rfc822/unfolding-string str)) (let ((dest "")(ew nil) beg end) @@ -81,9 +81,11 @@ (setq dest (concat dest (substring str 0 beg))) ) ) - (setq dest (concat dest - (mime/decode-encoded-word (substring str beg end)) - )) + (setq dest + (concat dest + (mime/decode-encoded-word + (substring str beg end) unfolding) + )) (setq str (substring str end)) (setq ew t) ) @@ -94,7 +96,7 @@ ;;; @ for region ;;; -(defun mime-eword/decode-region (beg end &optional unfolding) +(defun mime-eword/decode-region (beg end &optional unfolding must-unfold) (interactive "*r") (save-excursion (save-restriction @@ -111,12 +113,11 @@ (goto-char (point-min)) (let (charset encoding text) (while (re-search-forward mime/encoded-word-regexp nil t) - (insert (mime/decode-encoded-word + (insert (mime/decode-encoded-word (prog1 (buffer-substring (match-beginning 0) (match-end 0)) (delete-region (match-beginning 0) (match-end 0)) - ) - )) + ) must-unfold)) )) ))) @@ -154,12 +155,11 @@ ;;; @ encoded-word decoder ;;; -(defun mime/decode-encoded-word (word) +(defun mime/decode-encoded-word (word &optional unfolding) (or (if (string-match mime/encoded-word-regexp word) (let ((charset - (upcase - (substring word (match-beginning 1) (match-end 1)) - )) + (substring word (match-beginning 1) (match-end 1)) + ) (encoding (upcase (substring word (match-beginning 2) (match-end 2)) @@ -167,7 +167,7 @@ (text (substring word (match-beginning 3) (match-end 3)) )) - (mime/decode-encoded-text charset encoding text) + (mime/decode-encoded-text charset encoding text unfolding) )) word)) @@ -175,7 +175,7 @@ ;;; @ encoded-text decoder ;;; -(defun mime/decode-encoded-text (charset encoding str) +(defun mime/decode-encoded-text (charset encoding str &optional unfolding) (let ((dest (cond ((string-equal "B" encoding) (base64-decode-string str)) @@ -184,8 +184,12 @@ (t (message "unknown encoding %s" encoding) nil)))) (if dest - (decode-mime-charset-string dest charset) - ))) + (progn + (setq dest (decode-mime-charset-string dest charset)) + (if unfolding + (rfc822/unfolding-string dest) + dest) + )))) ;;; @ end diff --git a/tm-setup.el b/tm-setup.el index 151047f..913e5c4 100644 --- a/tm-setup.el +++ b/tm-setup.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: tm-setup.el,v 7.4 1996/08/06 12:12:53 morioka Exp $ +;;; $Id: tm-setup.el,v 7.6 1996/08/07 05:59:03 morioka Exp $ ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). @@ -96,40 +96,44 @@ )) -;;; @ for GNUS +;;; @ for GNUS and Gnus ;;; -(defvar tm-setup/use-gnusutil nil) - -(defun tm-setup/load-GNUS () - (require 'tm-gnus) - ) - -(if (and (boundp 'MULE) tm-setup/use-gnusutil) - (progn - (add-hook 'gnus-Group-mode-hook (function gnusutil-initialize)) - (add-hook 'gnus-group-mode-hook (function gnusutil-initialize)) - (autoload 'gnusutil-initialize "gnusutil") - (autoload 'gnusutil-add-group "gnusutil") - (add-hook 'gnusutil-initialize-hook 'tm-setup/load-GNUS) +(if (featurep 'gnus) + (if (boundp 'gnus-load-hook) + (require 'gnus-mime) + (require 'tm-gnus) ) - (add-hook 'gnus-Startup-hook 'tm-setup/load-GNUS 'append) - (add-hook 'gnus-startup-hook 'tm-setup/load-GNUS 'append) + ;; for GNUS + (defvar tm-setup/use-gnusutil nil) + + (defun tm-setup/load-GNUS () + (require 'tm-gnus) + ) + + (if (and (boundp 'MULE) tm-setup/use-gnusutil) + (progn + (add-hook 'gnus-Group-mode-hook (function gnusutil-initialize)) + (add-hook 'gnus-group-mode-hook (function gnusutil-initialize)) + (autoload 'gnusutil-initialize "gnusutil") + (autoload 'gnusutil-add-group "gnusutil") + (add-hook 'gnusutil-initialize-hook 'tm-setup/load-GNUS) + ) + (add-hook 'gnus-Startup-hook 'tm-setup/load-GNUS 'append) + (add-hook 'gnus-startup-hook 'tm-setup/load-GNUS 'append) + ) + + ;; for Gnus + (defun tm-setup/load-gnus () + (let (gnus-load-hook) + (remove-hook 'gnus-startup-hook 'tm-setup/load-GNUS) + (require 'gnus-mime) + )) + + (add-hook 'gnus-load-hook 'tm-setup/load-gnus) ) -;;; @ for Gnus -;;; - -(defun tm-setup/load-gnus () - (let (gnus-load-hook) - (remove-hook 'gnus-startup-hook 'tm-setup/load-GNUS) - (require 'gnus-mime) - )) - -(add-hook 'gnus-load-hook 'tm-setup/load-gnus) - - ;;; @ end ;;; -- 1.7.10.4