tm 7.69.
[elisp/tm.git] / gnus / tm-gnus.el
1 ;;;
2 ;;; tm-gnus.el --- MIME extension for GNUS
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; modified by KOBAYASHI Shuhei <shuhei@cmpt01.phys.tohoku.ac.jp>
9 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
10 ;;; Created: 1993/11/20 (obsolete mol's gnus-mime.el)
11 ;;; Version:
12 ;;;     $Id: tm-gnus.el,v 7.22 1996/06/27 14:43:48 morioka Exp $
13 ;;; Keywords: news, MIME, multimedia, encoded-word, multilingual
14 ;;;
15 ;;; This file is part of tm (Tools for MIME).
16 ;;;
17 ;;; This program is free software; you can redistribute it and/or
18 ;;; modify it under the terms of the GNU General Public License as
19 ;;; published by the Free Software Foundation; either version 2, or
20 ;;; (at your option) any later version.
21 ;;;
22 ;;; This program is distributed in the hope that it will be useful,
23 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25 ;;; General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with This program.  If not, write to the Free Software
29 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
30 ;;;
31 ;;; Code:
32
33 (require 'gnus)
34
35
36 ;;; @ variables
37 ;;;
38
39 (defvar tm-gnus/startup-hook nil)
40
41
42 ;;; @ set up
43 ;;;
44
45 (cond ((boundp 'gnus-original-article-buffer)
46        ;; for Gnus 5.2 or later
47        (require 'tm-gnus5)
48        )
49       ((or (string-match
50             "^\\((ding) Gnus\\|Gnus v5\\|September Gnus\\)" gnus-version)
51            (fboundp 'mail-header-from))
52        ;; for Gnus 5.0 .. 5.1.*
53        (require 'tm-gnus4)
54        (cond ((not (boundp 'nnheader-encoded-words-decoding))
55               (require 'tm-ew-d)
56               (defun tm-gnus/decode-summary-from-and-subjects ()
57                 (mapcar (lambda (header)
58                           (let ((from (mail-header-from header))
59                                 (subj (mail-header-subject header))
60                                 )
61                             (mail-header-set-from
62                              header
63                              (if from
64                                  (mime-eword/decode-string from)
65                                ""))
66                             (mail-header-set-subject
67                              header
68                              (if subj
69                                  (mime-eword/decode-string subj)
70                                ""))
71                             ))
72                         gnus-newsgroup-headers))
73               (add-hook 'gnus-select-group-hook
74                         (function tm-gnus/decode-summary-from-and-subjects))
75               ))
76        )
77       ((fboundp 'gnus-article-prepare)
78        ;; for GNUS 3.15 .. 4.*
79        (require 'tm-gd3)
80        (require 'tm-gnus4)
81        (add-hook 'gnus-select-group-hook 'tm-gnus/decode-summary-subjects)
82        (fset 'gnus-article-set-mode-line
83              (function tm-gnus/article-set-mode-line))
84        
85        (or (fboundp 'tm:gnus-article-delete-headers)
86            (fset 'tm:gnus-article-delete-headers
87                  (symbol-function 'gnus-article-delete-headers))
88            )
89        (defun gnus-article-delete-headers ()
90          (or tm-gnus/automatic-mime-preview
91              (tm:gnus-article-delete-headers)
92              ))
93        
94        (require 'gnuspost)
95        (or (fboundp 'tm-gnus/original-news-reply)
96            (fset 'tm-gnus/original-news-reply
97                  (symbol-function 'gnus-news-reply))
98            )
99        (defun gnus-news-reply (&optional yank)
100          (if (eq major-mode 'mime/viewer-mode)
101              (let ((major-mode 'gnus-article-mode))
102                (tm-gnus/original-news-reply yank)
103                )
104            (tm-gnus/original-news-reply yank)
105            ))
106        )
107       ((string-match "^GNUS 3" gnus-version)
108        ;; for GNUS 3.14.*
109        (require 'tm-gnus3)
110        (defvar gnus-article-buffer gnus-Article-buffer)
111        ))
112
113
114 ;;; @ end
115 ;;;
116
117 (provide 'tm-gnus)
118
119 (run-hooks 'tm-gnus-load-hook)
120
121 ;;; tm-gnus.el ends here