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.9 $
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.9 1995/12/03 17:30:57 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))
64 (gnus-summary-select-article t t)
66 (pop-to-buffer gnus-article-buffer t)
67 (let ((str (buffer-string))
68 (obuf (get-buffer tm-gnus/original-article-buffer))
69 (pbuf (current-buffer))
74 (setq buffer-read-only nil)
77 (setq obuf (get-buffer-create tm-gnus/original-article-buffer))
83 (make-local-variable 'tm:mother-button-dispatcher)
84 (setq tm:mother-button-dispatcher
85 (function gnus-article-push-button))
87 nil nil nil tm-gnus/original-article-buffer gnus-article-buffer)
88 (run-hooks 'tm-gnus/article-prepare-hook)
91 (defun tm-gnus/summary-scroll-down ()
92 "Scroll down one line current article."
94 (gnus-summary-scroll-up -1)
97 (defun mime-viewer/quitting-method-for-gnus4 ()
98 (if (not gnus-show-mime)
99 (mime-viewer/kill-buffer)
101 (delete-other-windows)
102 (gnus-article-show-summary)
103 (if (or (not gnus-show-mime)
104 (null gnus-have-all-headers))
105 (gnus-summary-select-article nil t)
112 (set-alist 'mime-viewer/quitting-method-alist
114 (function mime-viewer/quitting-method-for-gnus4))
125 (set-atype 'mime/content-decoding-condition
126 '((type . "message/partial")
127 (method . mime-article/grab-message/partials)
128 (major-mode . gnus-article-mode)
129 (summary-buffer-exp . gnus-summary-buffer)
132 (set-alist 'tm-partial/preview-article-method-alist
136 (tm-gnus/view-message (gnus-summary-article-number))
144 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
145 (define-key gnus-summary-mode-map
146 "\e\r" (function tm-gnus/summary-scroll-down))
148 (defun tm-gnus/article-reset-variable ()
149 (setq gnus-original-article-buffer gnus-article-buffer)
150 (setq tm-gnus/automatic-mime-preview nil)
152 (setq buffer-read-only nil)
155 (add-hook 'gnus-article-prepare-hook 'tm-gnus/article-reset-variable)
157 (defun tm-gnus/decode-encoded-word-if-you-need ()
158 (if (not gnus-have-all-headers)
160 (mime/decode-message-header)
161 (run-hooks 'tm-gnus/article-prepare-hook)
164 (defun tm-gnus/preview-article-if-you-need ()
165 (if (not gnus-have-all-headers)
166 (let ((str (buffer-string))
167 (obuf (get-buffer tm-gnus/original-article-buffer))
168 (pbuf (current-buffer))
173 (setq buffer-read-only nil)
176 (setq obuf (get-buffer-create tm-gnus/original-article-buffer))
182 (make-local-variable 'tm:mother-button-dispatcher)
183 (setq tm:mother-button-dispatcher
184 (function gnus-article-push-button))
186 nil nil nil tm-gnus/original-article-buffer gnus-article-buffer)
187 (gnus-article-show-summary)
188 (run-hooks 'tm-gnus/article-prepare-hook)
191 (setq gnus-show-mime-method
192 (if tm-gnus/automatic-mime-preview
193 (function tm-gnus/preview-article-if-you-need)
194 (function tm-gnus/decode-encoded-word-if-you-need)
197 (setq gnus-show-mime t)
203 (defun tm-gnus/bbdb-setup ()
204 (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
206 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
207 (add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record)
210 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)