+;;; @ for tm-edit
+;;;
+
+(defun tm-rmail/forward ()
+ "Forward current message in message/rfc822 content-type message
+from rmail. The message will be appended if being composed."
+ (interactive)
+ ;;>> this gets set even if we abort. Can't do anything about it, though.
+ (rmail-set-attribute "forwarded" t)
+ (let ((initialized nil)
+ (beginning nil)
+ (msgnum rmail-current-message)
+ (rmail-buffer (current-buffer))
+ (subject (concat "["
+ (mail-strip-quoted-names
+ (mail-fetch-field "From"))
+ ": " (or (mail-fetch-field "Subject") "") "]")))
+ ;; If only one window, use it for the mail buffer.
+ ;; Otherwise, use another window for the mail buffer
+ ;; so that the Rmail buffer remains visible
+ ;; and sending the mail will get back to it.
+ (setq initialized
+ (if (one-window-p t)
+ (mail nil nil subject)
+ (mail-other-window nil nil subject)))
+ (save-excursion
+ ;; following two variables are used in 19.29 or later.
+ (make-local-variable 'rmail-send-actions-rmail-buffer)
+ (make-local-variable 'rmail-send-actions-rmail-msg-number)
+ (make-local-variable 'mail-reply-buffer)
+ (setq rmail-send-actions-rmail-buffer rmail-buffer)
+ (setq rmail-send-actions-rmail-msg-number msgnum)
+ (setq mail-reply-buffer rmail-buffer)
+ (goto-char (point-max))
+ (forward-line 1)
+ (setq beginning (point))
+ (mime-editor/insert-tag "message" "rfc822")
+;; (insert-buffer rmail-buffer))
+;; (mime-editor/inserted-message-filter))
+ (tm-mail/insert-message))
+ (if (not initialized)
+ (goto-char beginning))
+ ))
+
+(defun gnus-mail-forward-using-mail-mime ()
+ "Forward current article in message/rfc822 content-type message from
+GNUS. The message will be appended if being composed."
+ (let ((initialized nil)
+ (beginning nil)
+ (forwarding-buffer (current-buffer))
+ (subject
+ (concat "[" gnus-newsgroup-name "] "
+ ;;(mail-strip-quoted-names (gnus-fetch-field "From")) ": "
+ (or (gnus-fetch-field "Subject") ""))))
+ ;; If only one window, use it for the mail buffer.
+ ;; Otherwise, use another window for the mail buffer
+ ;; so that the Rmail buffer remains visible
+ ;; and sending the mail will get back to it.
+ (setq initialized
+ (if (one-window-p t)
+ (mail nil nil subject)
+ (mail-other-window nil nil subject)))
+ (save-excursion
+ (goto-char (point-max))
+ (setq beginning (point))
+ (mime-editor/insert-tag "message" "rfc822")
+ (insert-buffer forwarding-buffer)
+ ;; You have a chance to arrange the message.
+ (run-hooks 'gnus-mail-forward-hook)
+ )
+ (if (not initialized)
+ (goto-char beginning))
+ ))
+
+(call-after-loaded
+ 'mime-setup
+ (function
+ (lambda ()
+ (substitute-key-definition
+ 'rmail-forward 'tm-rmail/forward rmail-mode-map)
+
+ ;; (setq gnus-mail-forward-method 'gnus-mail-forward-using-mail-mime)
+
+ (call-after-loaded
+ 'tm-edit
+ (function
+ (lambda ()
+ (require 'tm-mail)
+ (set-alist 'mime-editor/message-inserter-alist
+ 'mail-mode (function tm-mail/insert-message))
+ )))
+ )))
+
+
+;;; @ for BBDB
+;;;
+
+(call-after-loaded
+ 'bbdb
+ (function
+ (lambda ()
+ (require 'tm-bbdb)
+ )))
+
+