2 ;;; tm-gnus.el --- MIME extension for GNUS
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; modified by KOBAYASHI Shuhei <shuhei@cmpt01.phys.tohoku.ac.jp>
9 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
10 ;;; Created: 1993/11/20 (obsolete mol's gnus-mime.el)
12 ;;; $Id: tm-gnus.el,v 7.16 1996/01/25 02:41:11 morioka Exp $
13 ;;; Keywords: news, MIME, multimedia, encoded-word, multilingual
15 ;;; This file is part of tm (Tools for MIME).
17 ;;; This program is free software; you can redistribute it and/or
18 ;;; modify it under the terms of the GNU General Public License as
19 ;;; published by the Free Software Foundation; either version 2, or
20 ;;; (at your option) any later version.
22 ;;; This program is distributed in the hope that it will be useful,
23 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 ;;; General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with This program. If not, write to the Free Software
29 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
39 (defvar tm-gnus/startup-hook nil)
45 (cond ((boundp 'gnus-original-article-buffer)
46 ;; for September Gnus and Gnus 5.2 ..
50 "^\\((ding) Gnus\\|Gnus v5\\|September Gnus\\)" gnus-version)
51 (fboundp 'mail-header-from))
52 ;; for Gnus 5.0 .. 5.1.*
56 (set-alist 'mime-viewer/content-header-filter-alist
58 (function tm-gnus/content-header-filter))
59 (set-alist 'mime-viewer/code-converter-alist
61 (function tm-gnus/code-convert-region-to-emacs))
63 (defvar tm-gnus/code-converted nil)
64 (defun tm-gnus/maybe-code-convert ()
65 (or tm-gnus/automatic-mime-preview
66 (let ((mid (rfc822/get-field-body "Message-Id")))
68 (and tm-gnus/code-converted
69 (string-equal tm-gnus/code-converted mid))
71 (tm-gnus/code-convert-region-to-emacs
72 (point-min)(point-max)
73 mime/default-coding-system)
74 (tm-gnus/decode-encoded-word-if-you-need)
75 (setq tm-gnus/code-converted mid)
77 (add-hook 'gnus-article-display-hook 'tm-gnus/maybe-code-convert)
79 ((fboundp 'gnus-article-prepare)
80 ;; for GNUS 3.15 .. 4.*
83 (add-hook 'gnus-select-group-hook 'tm-gnus/decode-summary-subjects)
84 (fset 'gnus-article-set-mode-line
85 (function tm-gnus/article-set-mode-line))
87 (or (fboundp 'tm:gnus-article-delete-headers)
88 (fset 'tm:gnus-article-delete-headers
89 (symbol-function 'gnus-article-delete-headers))
91 (defun gnus-article-delete-headers ()
92 (or tm-gnus/automatic-mime-preview
93 (tm:gnus-article-delete-headers)
97 (or (fboundp 'tm-gnus/original-news-reply)
98 (fset 'tm-gnus/original-news-reply
99 (symbol-function 'gnus-news-reply))
101 (defun gnus-news-reply (&optional yank)
102 (if (eq major-mode 'mime/viewer-mode)
103 (let ((major-mode 'gnus-article-mode))
104 (tm-gnus/original-news-reply yank)
106 (tm-gnus/original-news-reply yank)
109 ((string-match "^GNUS 3" gnus-version)
112 (defvar gnus-article-buffer gnus-Article-buffer)
119 ;; suggested by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
120 ;; 1995/11/08 (c.f. [tm ML:1067])
121 (defun tm-gnus/insert-article (&optional message)
123 (let (;; for Emacs 19
124 (mail-citation-hook '(mime-editor/inserted-message-filter))
125 news-reply-header-hook
129 (mail-yank-ignored-headers mime-editor/yank-ignored-field-regexp)
130 (news-make-reply-yank-header (function
131 (lambda (message-id from) "")
133 (news-yank-original-quoting-indicator "")
135 ;; select raw article buffer
138 (set-buffer gnus-article-buffer)
139 (if (eq major-mode 'mime/viewer-mode)
140 mime::preview/article-buffer
141 gnus-article-buffer)))
143 (news-reply-yank-original 0)
146 ;;; modified by Steven L. Baur <steve@miranova.com>
147 ;;; 1995/12/6 (c.f. [tm-en:209])
148 (defun mime-editor/attach-to-news-reply-menu ()
149 "Arrange to attach MIME editor's popup menu to VM's"
150 (if (boundp 'news-reply-menu)
152 (setq news-reply-menu (append news-reply-menu
154 mime-editor/popup-menu-for-xemacs))
155 (remove-hook 'news-setup-hook
156 'mime-editor/attach-to-news-reply-menu)
164 'mime-editor/message-inserter-alist
165 'news-reply-mode (function tm-gnus/insert-article))
167 (autoload 'tm-mail/insert-message "tm-mail")
168 (set-alist 'mime-editor/message-inserter-alist
169 'mail-mode (function tm-mail/insert-message))
170 (if (string-match "XEmacs\\|Lucid" emacs-version)
171 (add-hook 'news-setup-hook 'mime-editor/attach-to-news-reply-menu)
181 (run-hooks 'tm-gnus-load-hook)
183 ;;; tm-gnus.el ends here