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 ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
10 ;;; This file is part of tm (Tools for MIME).
23 (defconst tm-gnus/RCS-ID
24 "$Id: tm-sgnus.el,v 7.13 1995/10/31 08:53:36 morioka Exp $")
26 (defconst tm-gnus/version
27 (concat (get-version-string tm-gnus/RCS-ID) " for September"))
33 (defvar tm-gnus/automatic-mime-preview t
34 "*If non-nil, show MIME processed article.
35 This variable is set to `gnus-show-mime'.")
37 (setq gnus-show-mime tm-gnus/automatic-mime-preview)
40 ;;; @ command functions
43 (defun tm-gnus/view-message (arg)
44 "MIME decode and play this message."
46 (let ((gnus-break-pages nil))
47 (gnus-summary-select-article t t)
49 (pop-to-buffer gnus-original-article-buffer t)
50 (let (buffer-read-only)
51 (if (text-property-any (point-min) (point-max) 'invisible t)
52 (remove-text-properties (point-min) (point-max)
53 gnus-hidden-properties)
55 (mime/viewer-mode nil nil nil gnus-original-article-buffer
59 (defun tm-gnus/summary-scroll-down ()
60 "Scroll down one line current article."
62 (gnus-summary-scroll-up -1)
65 (defun tm-gnus/summary-toggle-header (&optional arg)
68 (let ((mime-viewer/ignored-field-list
70 (set-buffer gnus-article-buffer)
73 (rfc822/get-field-body field)
75 mime-viewer/ignored-field-list))
76 mime-viewer/ignored-field-list)))
77 (gnus-summary-select-article t t)
79 (gnus-summary-toggle-header arg)
82 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
83 (define-key gnus-summary-mode-map
84 "\e\r" (function tm-gnus/summary-scroll-down))
85 (define-key gnus-summary-mode-map
86 "t" (function tm-gnus/summary-toggle-header))
92 (defun mime-viewer/quitting-method-for-sgnus ()
93 (mime-viewer/kill-buffer)
94 (delete-other-windows)
95 (gnus-article-show-summary)
96 (gnus-summary-display-article (gnus-summary-article-number))
102 (set-alist 'mime-viewer/quitting-method-alist
103 'gnus-original-article-mode
104 (function mime-viewer/quitting-method-for-sgnus))
114 (set-atype 'mime/content-decoding-condition
115 '((type . "message/partial")
116 (method . mime-article/grab-message/partials)
117 (major-mode . gnus-original-article-mode)
118 (summary-buffer-exp . gnus-summary-buffer)
120 (set-alist 'tm-partial/preview-article-method-alist
121 'gnus-original-article-mode
123 (tm-gnus/view-message (gnus-summary-article-number))
131 (cond ((not (boundp 'nnheader-encoded-words-decoding))
132 (defun tm-gnus/decode-summary-from-and-subjects ()
133 (mapcar (lambda (header)
134 (let ((from (mail-header-from header))
135 (subj (mail-header-subject header))
137 (mail-header-set-from
140 (mime-eword/decode-string from)
142 (mail-header-set-subject
145 (mime-eword/decode-string subj)
148 gnus-newsgroup-headers)
150 (add-hook 'gnus-select-group-hook
151 (function tm-gnus/decode-summary-from-and-subjects))
158 (defun tm-gnus/preview-article ()
159 (make-local-variable 'tm:mother-button-dispatcher)
160 (setq tm:mother-button-dispatcher
161 (function gnus-article-push-button))
162 (mime/viewer-mode nil nil nil gnus-original-article-buffer
164 (run-hooks 'tm-gnus/article-prepare-hook)
167 (setq gnus-show-mime-method (function tm-gnus/preview-article))
169 (or (fboundp 'tm::gnus-article-hide-headers-if-wanted)
170 (fset 'tm::gnus-article-hide-headers-if-wanted
171 (symbol-function 'gnus-article-hide-headers-if-wanted))
174 (defun gnus-article-hide-headers-if-wanted ()
175 (if (not gnus-show-mime)
176 (tm::gnus-article-hide-headers-if-wanted)
183 (defun tm-gnus/bbdb-setup ()
184 (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
186 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
187 (add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record)
190 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)