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 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.11 $
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.
37 (defconst tm-gnus/RCS-ID
38 "$Id: tm-gnus4.el,v 7.11 1995/12/05 07:36:32 morioka Exp $")
40 (defconst tm-gnus/version
41 (concat (get-version-string tm-gnus/RCS-ID) " for 3.15 .. 5.1"))
47 (defvar tm-gnus/automatic-mime-preview t
48 "*If non-nil, show MIME processed article.
49 This variable is set to `gnus-show-mime'.")
51 (defvar tm-gnus/original-article-buffer " *Original Article*")
52 (defvar gnus-original-article-buffer nil)
58 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
60 (defun tm-gnus/view-message (arg)
61 "MIME decode and play this message."
63 (let ((gnus-break-pages nil)
65 (gnus-summary-select-article t t)
67 (pop-to-buffer gnus-article-buffer t)
68 (let ((str (buffer-string))
69 (obuf (get-buffer tm-gnus/original-article-buffer))
70 (pbuf (current-buffer))
75 (setq buffer-read-only nil)
78 (setq obuf (get-buffer-create tm-gnus/original-article-buffer))
84 (make-local-variable 'tm:mother-button-dispatcher)
85 (setq tm:mother-button-dispatcher
86 (function gnus-article-push-button))
88 nil nil nil tm-gnus/original-article-buffer gnus-article-buffer)
89 (run-hooks 'tm-gnus/article-prepare-hook)
92 (defun tm-gnus/summary-scroll-down ()
93 "Scroll down one line current article."
95 (gnus-summary-scroll-up -1)
98 (defun mime-viewer/quitting-method-for-gnus4 ()
99 (if (not gnus-show-mime)
100 (mime-viewer/kill-buffer)
102 (delete-other-windows)
103 (gnus-article-show-summary)
104 (if (or (not gnus-show-mime)
105 (null gnus-have-all-headers))
106 (gnus-summary-select-article nil t)
113 (set-alist 'mime-viewer/quitting-method-alist
115 (function mime-viewer/quitting-method-for-gnus4))
126 (set-atype 'mime/content-decoding-condition
127 '((type . "message/partial")
128 (method . mime-article/grab-message/partials)
129 (major-mode . gnus-article-mode)
130 (summary-buffer-exp . gnus-summary-buffer)
133 (set-alist 'tm-partial/preview-article-method-alist
137 (tm-gnus/view-message (gnus-summary-article-number))
145 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
146 (define-key gnus-summary-mode-map
147 "\e\r" (function tm-gnus/summary-scroll-down))
149 (defun tm-gnus/article-reset-variable ()
150 (setq gnus-original-article-buffer gnus-article-buffer)
151 (setq tm-gnus/automatic-mime-preview nil)
153 (setq buffer-read-only nil)
156 (add-hook 'gnus-article-prepare-hook 'tm-gnus/article-reset-variable)
158 (defun tm-gnus/decode-encoded-word-if-you-need ()
159 (if (not gnus-have-all-headers)
161 (mime/decode-message-header)
162 (run-hooks 'tm-gnus/article-prepare-hook)
165 (defun tm-gnus/preview-article-if-you-need ()
166 (if (not gnus-have-all-headers)
167 (let ((str (buffer-string))
168 (obuf (get-buffer tm-gnus/original-article-buffer))
169 (pbuf (current-buffer))
174 (setq buffer-read-only nil)
177 (setq obuf (get-buffer-create tm-gnus/original-article-buffer))
183 (make-local-variable 'tm:mother-button-dispatcher)
184 (setq tm:mother-button-dispatcher
185 (function gnus-article-push-button))
187 nil nil nil tm-gnus/original-article-buffer gnus-article-buffer)
188 (gnus-article-show-summary)
189 (setq tm-gnus/automatic-mime-preview t)
190 (setq gnus-original-article-buffer tm-gnus/original-article-buffer)
191 (run-hooks 'tm-gnus/article-prepare-hook)
194 (setq gnus-show-mime-method
195 (if tm-gnus/automatic-mime-preview
196 (function tm-gnus/preview-article-if-you-need)
197 (function tm-gnus/decode-encoded-word-if-you-need)
200 (setq gnus-show-mime t)
206 (defun tm-gnus/bbdb-setup ()
207 (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
209 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
210 (add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record)
213 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)