tm 7.67.
[elisp/tm.git] / tm-mail.el
index e37229c..b9cae54 100644 (file)
@@ -1,78 +1,89 @@
 ;;;
-;;; $Id: tm-mail.el,v 1.1 1995/11/04 08:22:24 morioka Exp $
+;;; tm-mail.el --- mail-mode extension.
 ;;;
+;;; Copyright (C) 1995,1996 KOBAYASHI Shuhei
+;;; 
+;;; Author: KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>
+;;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;;         and Neal Becker <neal@neal.ctd.comsat.com>
+;;; Maintainer: KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>
+;;; Created: 1995/11/27
+;;; Version: $Id: tm-mail.el,v 6.0 1996/04/16 18:24:02 morioka Exp $
+;;; Keywords: mail, MIME, multimedia
+;;;
+;;; This file is part of tm (Tools for MIME).
+;;;
+;;; 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 'tm-view)
-
-(autoload 'mime-editor/caesar-region "tm-edit" nil t)
-
-(defun mime-viewer/quitting-method-for-mime/show-message-mode ()
-  (set-window-configuration mime/show-mode-old-window-configuration)
-  (let ((mother mime::preview/mother-buffer))
-    (kill-buffer
-     (mime::preview-content-info/buffer (car mime::preview/content-list)))
-    (mime-viewer/kill-buffer)
-    (pop-to-buffer mother)
-    ;;(goto-char (point-min))
-    ;;(mime-viewer/up-content)
-    ))
+(require 'tm-edit)
 
-(defun mime-article/view-message/rfc822 (beg end cal)
-  (let* ((cnum (mime-article/point-content-number beg))
-        (cur-buf (current-buffer))
-        (new-name (format "%s-%s" (buffer-name) cnum))
-        (mother mime::article/preview-buffer)
-        str)
-    (setq str (buffer-substring beg end))
-    (switch-to-buffer new-name)
-    (erase-buffer)
-    (insert str)
-    (goto-char (point-min))
-    (if (re-search-forward "^\n" nil t)
-       (delete-region (point-min) (match-end 0))
+(defun tm-mail/insert-message (&optional message)
+  (interactive)
+  (let* (mail-yank-hooks
+        (mail-citation-hook '(mime-editor/inserted-message-filter))
+        )
+    (cond
+     ((and (boundp 'vm-mail-buffer) vm-mail-buffer)
+      ;; called from VM.
+      (let ((mail-reply-buffer vm-mail-buffer))
+        (if (null message)
+            (call-interactively 'vm-yank-message)
+          (vm-yank-message message)))
       )
-    (setq major-mode 'mime/show-message-mode)
-    (mime/viewer-mode mother)
+     ((boundp 'rmail-send-actions-rmail-buffer)
+      ;; called from RMAIL, emacs-19.29 or later.
+      (mail-yank-original nil)
+      )
+     ((and (boundp 'gnus-article-buffer) (get-buffer gnus-article-buffer))
+      ;; maybe called from Gnus.
+      (tm-gnus/insert-article)
+      )
+     ((and (boundp 'mail-reply-buffer) mail-reply-buffer)
+      ;; maybe called from RMAIL.
+      (mail-yank-original nil)
+      )
+     (t
+      (message "Sorry, I don't have message inserter for your MUA.")
+      ))
     ))
 
-(defun mime-article/decode-caesar (beg end cal)
-  (let* ((cnum (mime-article/point-content-number beg))
-        (cur-buf (current-buffer))
-        (new-name (format "%s-%s" (buffer-name) cnum))
-        (mother mime::article/preview-buffer)
-        (charset (cdr (assoc "charset" params)))
-        (mode major-mode)
-        str)
-    (setq str (buffer-substring beg end))
-    (switch-to-buffer new-name)
-    (erase-buffer)
-    (insert str)
-    (goto-char (point-min))
-    (if (re-search-forward "^\n" nil t)
-       (delete-region (point-min) (match-end 0))
+(defvar tm-mail/use-xemacs-popup-menu running-xemacs)
+
+(if (and running-xemacs tm-mail/use-xemacs-popup-menu)
+    (cond 
+     ((string-match "19.14" emacs-version)
+      (setq mail-menubar-menu
+           (append mail-menubar-menu
+                   (list "---"
+                         mime-editor/popup-menu-for-xemacs)))
       )
-    (let ((m (assq mode mime-viewer/code-converter-alist)))
-      (if (and m (fboundp (setq m (cdr m))))
-         (funcall m (point-min) (point-max) charset encoding)
-       (mime-viewer/default-code-convert-region (point-min) (point-max)
-                                                charset encoding)
-       ))
-    (save-excursion
-      (set-mark (point-min))
-      (goto-char (point-max))
-      (mime-editor/caesar-region)
+     (t
+      (setq mail-mode-menu
+           (append mail-mode-menu
+                   (list "---"
+                         mime-editor/popup-menu-for-xemacs)))
       )
-    (view-mode)
-    ))
+     )
+  )
 
-(set-atype 'mime/content-decoding-condition
-          '((type . "message/rfc822")
-            (method . mime-article/view-message/rfc822)
-            ))
 
-(set-atype 'mime/content-decoding-condition
-          '((type . "text/x-rot13-47")
-            (method . mime-article/decode-caesar)
-            ))
+;;; @ end
+;;;
 
 (provide 'tm-mail)
+
+;;; tm-mail.el ends here