X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=tm-rmail.el;h=24f4971e1cb3f57d42ffce8a6b1117f393f51be1;hb=64f6da47517dd7323f789a3a6afa5ce5221b08cb;hp=87e6c68105fd0de4429fec1d9b049cc04265d90a;hpb=e7cf063423325b2417e142f468f0c960f17a0c8e;p=elisp%2Ftm.git diff --git a/tm-rmail.el b/tm-rmail.el index 87e6c68..24f4971 100644 --- a/tm-rmail.el +++ b/tm-rmail.el @@ -1,12 +1,12 @@ ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko -;;; modified by KOBAYASHI Shuhei +;;; modified by KOBAYASHI Shuhei ;;; Created: 1994/8/30 ;;; Version: -;;; $Revision: 7.19 $ +;;; $Revision: 7.25 $ ;;; Keywords: mail, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). @@ -40,7 +40,7 @@ ;;; (defconst tm-rmail/RCS-ID - "$Id: tm-rmail.el,v 7.19 1995/12/07 04:55:49 morioka Exp $") + "$Id: tm-rmail.el,v 7.25 1996/06/12 05:38:23 morioka Exp $") (defconst tm-rmail/version (get-version-string tm-rmail/RCS-ID)) (defvar tm-rmail/decode-all nil) @@ -74,13 +74,7 @@ (defun tm-rmail/preview-message () (interactive) (setq tm-rmail/decode-all t) - (let ((ret (rmail-widen-to-current-msgbeg - (function - (lambda () - (cons (mime/Content-Type) - (mime/Content-Transfer-Encoding "7bit") - ) - ))))) + (let ((ret (tm-rmail/get-Content-Type-and-Content-Transfer-Encoding))) (narrow-to-region (point-min) (save-excursion (goto-char (point-max)) @@ -89,11 +83,35 @@ (match-beginning 0) (point-max) ))) - (mime/viewer-mode nil (car ret)(cdr ret) nil - (format "*Preview-%s [%d/%d]*" - (buffer-name) - rmail-current-message rmail-total-messages)) - )) + (let ((abuf (current-buffer)) + (buf-name (format "*Preview-%s [%d/%d]*" + (buffer-name) + rmail-current-message rmail-total-messages)) + buf win) + (if (and mime::article/preview-buffer + (setq buf (get-buffer mime::article/preview-buffer)) + ) + (progn + (save-excursion + (set-buffer buf) + (rename-buffer buf-name) + ) + (if (setq win (get-buffer-window buf)) + (progn + (delete-window (get-buffer-window abuf)) + (set-window-buffer win abuf) + (set-buffer abuf) + )) + )) + (setq win (get-buffer-window abuf)) + (save-window-excursion + (mime/viewer-mode nil (car ret)(cdr ret) nil buf-name) + (or buf + (setq buf (current-buffer)) + ) + ) + (set-window-buffer win buf) + ))) (defun tm-rmail/preview-message-if-you-need () (if tm-rmail/decode-all @@ -102,13 +120,55 @@ (add-hook 'rmail-show-message-hook 'tm-rmail/preview-message-if-you-need) +(cond ((fboundp 'rmail-summary-rmail-update) + ;; for Emacs 19 or later + (or (fboundp 'tm:rmail-summary-rmail-update) + (fset 'tm:rmail-summary-rmail-update + (symbol-function 'rmail-summary-rmail-update)) + ) + + (defun rmail-summary-rmail-update () + (tm:rmail-summary-rmail-update) + (if tm-rmail/decode-all + (let ((win (get-buffer-window rmail-buffer))) + (if win + (delete-window win) + ))) + ) + + (defun tm-rmail/get-Content-Type-and-Content-Transfer-Encoding () + (rmail-widen-to-current-msgbeg + (function + (lambda () + (cons (mime/Content-Type) + (mime/Content-Transfer-Encoding "7bit") + ))))) + ) + (t + ;; for Emacs 18 + (defun tm-rmail/get-Content-Type-and-Content-Transfer-Encoding () + (save-restriction + (rmail-widen-to-current-msgbeg + (function + (lambda () + (goto-char (point-min)) + (narrow-to-region (or (and (re-search-forward "^.+:" nil t) + (match-beginning 0)) + (point-min)) + (point-max)) + ))) + (cons (mime/Content-Type) + (mime/Content-Transfer-Encoding "7bit") + ))) + )) + (define-key rmail-mode-map "v" (function tm-rmail/preview-message)) (defun tm-rmail/setup () (local-set-key "v" (function (lambda () (interactive) - (pop-to-buffer rmail-buffer) + (set-buffer rmail-buffer) (tm-rmail/preview-message) ))) ) @@ -151,6 +211,12 @@ ) ) +(defun tm-rmail/show-summary-method () + (save-excursion + (set-buffer mime::preview/article-buffer) + (rmail-summary) + )) + (call-after-loaded 'tm-view (function @@ -166,6 +232,10 @@ (set-alist 'mime-viewer/over-to-next-method-alist 'rmail-mode (function tm-rmail/over-to-next-method)) + + (set-alist 'mime-viewer/show-summary-method + 'rmail-mode + (function tm-rmail/show-summary-method)) ))) @@ -284,16 +354,35 @@ GNUS. The message will be appended if being composed." 'tm-edit (function (lambda () - (autoload 'tm-mail/insert-message "tm-mail") + (require 'tm-mail) (set-alist 'mime-editor/message-inserter-alist 'mail-mode (function tm-mail/insert-message)) + (set-alist 'mime-editor/split-message-sender-alist + 'mail-mode (function + (lambda () + (interactive) + (sendmail-send-it) + ))) ))) ))) +;;; @ for BBDB +;;; + +(call-after-loaded + 'bbdb + (function + (lambda () + (require 'tm-bbdb) + ))) + + ;;; @ end ;;; (provide 'tm-rmail) (run-hooks 'tm-rmail-load-hook) + +;;; tm-rmail.el ends here.