2 ;;; tm-sgnus.el --- tm-gnus module for September Gnus
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; Created: 1995/09/24
10 ;;; Version: $Revision: 7.24 $
11 ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
13 ;;; This file is part of tm (Tools for MIME).
15 ;;; This program is free software; you can redistribute it and/or
16 ;;; modify it under the terms of the GNU General Public License as
17 ;;; published by the Free Software Foundation; either version 2, or
18 ;;; (at your option) any later version.
20 ;;; This program is distributed in the hope that it will be useful,
21 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 ;;; General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with This program. If not, write to the Free Software
27 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
42 (defconst tm-gnus/RCS-ID
43 "$Id: tm-sgnus.el,v 7.24 1995/12/15 13:47:36 morioka Exp $")
45 (defconst tm-gnus/version
46 (concat (get-version-string tm-gnus/RCS-ID) " for September"))
52 (defvar tm-gnus/automatic-mime-preview t
53 "*If non-nil, show MIME processed article.
54 This variable is set to `gnus-show-mime'.")
56 (setq gnus-show-mime tm-gnus/automatic-mime-preview)
59 ;;; @ command functions
62 (defun tm-gnus/view-message (arg)
63 "MIME decode and play this message."
65 (let ((gnus-break-pages nil))
66 (gnus-summary-select-article t t)
68 (pop-to-buffer gnus-original-article-buffer t)
69 (let (buffer-read-only)
70 (if (text-property-any (point-min) (point-max) 'invisible t)
71 (remove-text-properties (point-min) (point-max)
72 gnus-hidden-properties)
74 (mime/viewer-mode nil nil nil gnus-original-article-buffer
78 (defun tm-gnus/summary-scroll-down ()
79 "Scroll down one line current article."
81 (gnus-summary-scroll-up -1)
84 (defun tm-gnus/summary-toggle-header (&optional arg)
86 (if tm-gnus/automatic-mime-preview
87 (let ((mime-viewer/ignored-field-regexp
89 (set-buffer gnus-article-buffer)
93 (if (re-search-forward "^$" nil t)
99 (goto-char (point-min))
100 (and (re-search-forward
101 (concat "^" field ":") nil t)
103 (buffer-substring-no-properties
104 (match-beginning 0) (match-end 0)))
107 mime-viewer/visible-field-regexp field))
110 mime-viewer/ignored-field-list)))
111 mime-viewer/ignored-field-regexp
113 (gnus-summary-select-article t t)
115 (gnus-summary-toggle-header arg)
118 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
119 (define-key gnus-summary-mode-map
120 "\e\r" (function tm-gnus/summary-scroll-down))
121 (define-key gnus-summary-mode-map
122 "t" (function tm-gnus/summary-toggle-header))
128 (defun mime-viewer/quitting-method-for-sgnus ()
129 (if (not gnus-show-mime)
130 (mime-viewer/kill-buffer))
131 (delete-other-windows)
132 (gnus-article-show-summary)
133 (if (or (not gnus-show-mime)
134 (null gnus-have-all-headers))
135 (gnus-summary-select-article nil t)
141 (set-alist 'mime-viewer/quitting-method-alist
142 'gnus-original-article-mode
143 (function mime-viewer/quitting-method-for-sgnus))
150 (defun tm-gnus/partial-preview-function ()
151 (tm-gnus/view-message (gnus-summary-article-number))
157 (set-atype 'mime/content-decoding-condition
158 '((type . "message/partial")
159 (method . mime-article/grab-message/partials)
160 (major-mode . gnus-original-article-mode)
161 (summary-buffer-exp . gnus-summary-buffer)
163 (set-alist 'tm-partial/preview-article-method-alist
164 'gnus-original-article-mode
165 'tm-gnus/partial-preview-function)
172 (defun tm-gnus/article-reset-variable ()
173 (setq tm-gnus/automatic-mime-preview nil)
176 (add-hook 'gnus-article-prepare-hook 'tm-gnus/article-reset-variable)
178 (defun tm-gnus/preview-article ()
179 (make-local-variable 'tm:mother-button-dispatcher)
180 (setq tm:mother-button-dispatcher
181 (function gnus-article-push-button))
182 (mime/viewer-mode nil nil nil gnus-original-article-buffer
184 (setq tm-gnus/automatic-mime-preview t)
185 (run-hooks 'tm-gnus/article-prepare-hook)
188 (setq gnus-show-mime-method (function tm-gnus/preview-article))
190 (defun tm-gnus/article-decode-encoded-word ()
191 (mime/decode-message-header)
192 (run-hooks 'tm-gnus/article-prepare-hook)
195 (setq gnus-decode-encoded-word-method
196 (function tm-gnus/article-decode-encoded-word))
198 (or (fboundp 'tm::gnus-article-hide-headers-if-wanted)
199 (fset 'tm::gnus-article-hide-headers-if-wanted
200 (symbol-function 'gnus-article-hide-headers-if-wanted))
203 (defun gnus-article-hide-headers-if-wanted ()
204 (or tm-gnus/automatic-mime-preview
205 (tm::gnus-article-hide-headers-if-wanted)
212 (defun tm-gnus/bbdb-setup ()
213 (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
215 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
216 (add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record)
219 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)