2 ;;; tm-gnus4.el --- tm-gnus module for GNUS 4, 5.0.* and 5.1.*.
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; modified by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
9 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
10 ;;; Created: 1993/11/20 (merged tm-gnus5.el)
11 ;;; Version: $Revision: 7.19 $
12 ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
14 ;;; This file is part of tm (Tools for MIME).
16 ;;; This program is free software; you can redistribute it and/or
17 ;;; modify it under the terms of the GNU General Public License as
18 ;;; published by the Free Software Foundation; either version 2, or
19 ;;; (at your option) any later version.
21 ;;; This program is distributed in the hope that it will be useful,
22 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 ;;; General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with This program. If not, write to the Free Software
28 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
39 (defconst tm-gnus/RCS-ID
40 "$Id: tm-gnus4.el,v 7.19 1996/06/06 16:43:42 shuhei-k Exp $")
42 (defconst tm-gnus/version
43 (concat (get-version-string tm-gnus/RCS-ID) " for 3.15 .. 5.1.*"))
49 (defvar tm-gnus/automatic-mime-preview t
50 "*If non-nil, show MIME processed article.
51 This variable is set to `gnus-show-mime'.")
53 (defvar tm-gnus/original-article-buffer " *Original Article*")
54 (defvar gnus-original-article-buffer nil)
60 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
62 (defun tm-gnus/view-message (arg)
63 "MIME decode and play this message."
65 (let ((gnus-break-pages nil)
67 (gnus-summary-select-article t t)
69 (pop-to-buffer gnus-article-buffer t)
70 (let ((str (buffer-string))
71 (obuf (get-buffer tm-gnus/original-article-buffer))
72 (pbuf (current-buffer))
77 (setq buffer-read-only nil)
80 (setq obuf (get-buffer-create tm-gnus/original-article-buffer))
86 (make-local-variable 'tm:mother-button-dispatcher)
87 (setq tm:mother-button-dispatcher
88 (function gnus-article-push-button))
90 nil nil nil tm-gnus/original-article-buffer gnus-article-buffer)
91 (let (buffer-read-only)
92 (run-hooks 'tm-gnus/article-prepare-hook)
96 (defun tm-gnus/summary-scroll-down ()
97 "Scroll down one line current article."
99 (gnus-summary-scroll-up -1)
102 (defun mime-viewer/quitting-method-for-gnus4 ()
103 (if (not gnus-show-mime)
104 (mime-viewer/kill-buffer)
106 (delete-other-windows)
107 (gnus-article-show-summary)
108 (if (or (not gnus-show-mime)
109 (null gnus-have-all-headers))
110 (gnus-summary-select-article nil t)
117 (set-alist 'mime-viewer/quitting-method-alist
119 (function mime-viewer/quitting-method-for-gnus4))
120 (set-alist 'mime-viewer/show-summary-method
122 (function mime-viewer/quitting-method-for-gnus4))
129 ;; suggested by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
130 ;; 1995/11/08 (c.f. [tm ML:1067])
131 (defun tm-gnus/insert-article (&optional message)
133 (let (;; for Emacs 19
134 (mail-citation-hook '(mime-editor/inserted-message-filter))
135 news-reply-header-hook
139 (mail-yank-ignored-headers mime-editor/yank-ignored-field-regexp)
140 (news-make-reply-yank-header (function
141 (lambda (message-id from) "")
143 (news-yank-original-quoting-indicator "")
145 ;; select raw article buffer
148 (set-buffer gnus-article-buffer)
149 (if (eq major-mode 'mime/viewer-mode)
150 mime::preview/article-buffer
151 gnus-article-buffer)))
153 (news-reply-yank-original 0)
156 ;;; modified by Steven L. Baur <steve@miranova.com>
157 ;;; 1995/12/6 (c.f. [tm-en:209])
158 (defun mime-editor/attach-to-news-reply-menu ()
159 "Arrange to attach MIME editor's popup menu to VM's"
160 (if (boundp 'news-reply-menu)
162 (setq news-reply-menu (append news-reply-menu
164 mime-editor/popup-menu-for-xemacs))
165 (remove-hook 'news-setup-hook
166 'mime-editor/attach-to-news-reply-menu)
174 'mime-editor/message-inserter-alist
175 'news-reply-mode (function tm-gnus/insert-article))
177 (autoload 'tm-mail/insert-message "tm-mail")
178 (set-alist 'mime-editor/message-inserter-alist
179 'mail-mode (function tm-mail/insert-message))
180 (if (string-match "XEmacs\\|Lucid" emacs-version)
181 (add-hook 'news-setup-hook 'mime-editor/attach-to-news-reply-menu)
193 (set-atype 'mime/content-decoding-condition
194 '((type . "message/partial")
195 (method . mime-article/grab-message/partials)
196 (major-mode . gnus-article-mode)
197 (summary-buffer-exp . gnus-summary-buffer)
200 (set-alist 'tm-partial/preview-article-method-alist
204 (tm-gnus/view-message (gnus-summary-article-number))
212 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
213 (define-key gnus-summary-mode-map
214 "\e\r" (function tm-gnus/summary-scroll-down))
216 (defun tm-gnus/article-reset-variable ()
217 (setq gnus-original-article-buffer nil)
218 (setq tm-gnus/automatic-mime-preview nil)
220 (setq buffer-read-only nil)
223 (add-hook 'gnus-article-prepare-hook 'tm-gnus/article-reset-variable)
225 (defun tm-gnus/decode-encoded-word-if-you-need ()
226 (if (not gnus-have-all-headers)
228 (mime/decode-message-header)
229 (run-hooks 'tm-gnus/article-prepare-hook)
232 (defun tm-gnus/preview-article-if-you-need ()
233 (if (not gnus-have-all-headers)
234 (let ((str (buffer-string))
235 (obuf (get-buffer tm-gnus/original-article-buffer))
236 (pbuf (current-buffer))
241 (setq buffer-read-only nil)
244 (setq obuf (get-buffer-create tm-gnus/original-article-buffer))
250 (make-local-variable 'tm:mother-button-dispatcher)
251 (setq tm:mother-button-dispatcher
252 (function gnus-article-push-button))
253 (save-window-excursion
255 nil nil nil tm-gnus/original-article-buffer gnus-article-buffer)
257 (setq tm-gnus/automatic-mime-preview t)
258 (setq gnus-original-article-buffer tm-gnus/original-article-buffer)
259 (let (buffer-read-only)
260 (run-hooks 'tm-gnus/article-prepare-hook)
262 (if (featurep 'tm-gd3)
263 (setq buffer-read-only nil)
267 (setq gnus-show-mime-method
268 (if tm-gnus/automatic-mime-preview
269 (function tm-gnus/preview-article-if-you-need)
270 (function tm-gnus/decode-encoded-word-if-you-need)
273 (setq gnus-show-mime t)
286 (autoload 'tm-bbdb/update-record "tm-bbdb")
288 (defun tm-gnus/bbdb-setup ()
289 (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
291 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
292 ;;(add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record)
293 (add-hook 'gnus-article-display-hook 'tm-bbdb/update-record)
296 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)
306 ;;; tm-gnus4.el ends here