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.18 $
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.18 1996/03/04 08:16:42 morioka 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))
133 (set-atype 'mime/content-decoding-condition
134 '((type . "message/partial")
135 (method . mime-article/grab-message/partials)
136 (major-mode . gnus-article-mode)
137 (summary-buffer-exp . gnus-summary-buffer)
140 (set-alist 'tm-partial/preview-article-method-alist
144 (tm-gnus/view-message (gnus-summary-article-number))
152 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
153 (define-key gnus-summary-mode-map
154 "\e\r" (function tm-gnus/summary-scroll-down))
156 (defun tm-gnus/article-reset-variable ()
157 (setq gnus-original-article-buffer nil)
158 (setq tm-gnus/automatic-mime-preview nil)
160 (setq buffer-read-only nil)
163 (add-hook 'gnus-article-prepare-hook 'tm-gnus/article-reset-variable)
165 (defun tm-gnus/decode-encoded-word-if-you-need ()
166 (if (not gnus-have-all-headers)
168 (mime/decode-message-header)
169 (run-hooks 'tm-gnus/article-prepare-hook)
172 (defun tm-gnus/preview-article-if-you-need ()
173 (if (not gnus-have-all-headers)
174 (let ((str (buffer-string))
175 (obuf (get-buffer tm-gnus/original-article-buffer))
176 (pbuf (current-buffer))
181 (setq buffer-read-only nil)
184 (setq obuf (get-buffer-create tm-gnus/original-article-buffer))
190 (make-local-variable 'tm:mother-button-dispatcher)
191 (setq tm:mother-button-dispatcher
192 (function gnus-article-push-button))
193 (save-window-excursion
195 nil nil nil tm-gnus/original-article-buffer gnus-article-buffer)
197 (setq tm-gnus/automatic-mime-preview t)
198 (setq gnus-original-article-buffer tm-gnus/original-article-buffer)
199 (let (buffer-read-only)
200 (run-hooks 'tm-gnus/article-prepare-hook)
202 (if (featurep 'tm-gd3)
203 (setq buffer-read-only nil)
207 (setq gnus-show-mime-method
208 (if tm-gnus/automatic-mime-preview
209 (function tm-gnus/preview-article-if-you-need)
210 (function tm-gnus/decode-encoded-word-if-you-need)
213 (setq gnus-show-mime t)
226 (autoload 'tm-bbdb/update-record "tm-bbdb")
228 (defun tm-gnus/bbdb-setup ()
229 (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
231 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
232 ;;(add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record)
233 (add-hook 'gnus-article-display-hook 'tm-bbdb/update-record)
236 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)
246 ;;; tm-gnus4.el ends here