tm 7.29.
[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,1994,1995 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.11 1995/12/04 23:55:05 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 (require 'gnus)
32
33
34 ;;; @ variables
35 ;;;
36
37 (defvar tm-gnus/startup-hook nil)
38
39
40 ;;; @ set up
41 ;;;
42
43 (cond ((boundp 'gnus-original-article-buffer)
44        ;; for September Gnus and Gnus 5.2 ..
45        (require 'tm-sgnus)
46        )
47       ((or (string-match
48             "^\\((ding) Gnus\\|Gnus v5\\|September Gnus\\)" gnus-version)
49            (fboundp 'mail-header-from))
50        ;; for Gnus 5.0 .. 5.1.*
51        (require 'tm-gd5)
52        (require 'tm-gnus4)
53        )
54       ((fboundp 'gnus-article-prepare)
55        ;; for GNUS 3.15 .. 4.*
56        (require 'tm-gd3)
57        (require 'tm-gnus4)
58        (add-hook 'gnus-select-group-hook 'tm-gnus/decode-summary-subjects)
59        (fset 'gnus-article-set-mode-line
60              (function tm-gnus/article-set-mode-line))
61        )
62       ((string-match "^GNUS 3" gnus-version)
63        ;; for GNUS 3.14.*
64        (require 'tm-gnus3)
65        (defvar gnus-article-buffer gnus-Article-buffer)
66        ))
67
68
69 ;;; @ for tm-edit
70 ;;;
71 ;; suggested by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
72 ;;      1995/11/08 (c.f. [tm ML:1067])
73 (defun tm-gnus/insert-article (&optional message)
74   (interactive)
75   (let (;; for Emacs 19
76         (mail-citation-hook '(mime-editor/inserted-message-filter))
77         news-reply-header-hook
78         mail-yank-hooks
79         
80         ;; for Emacs 18
81         (mail-yank-ignored-headers mime-editor/yank-ignored-field-regexp)
82         (news-make-reply-yank-header (function
83                                       (lambda (message-id from) "")
84                                       ))
85         (news-yank-original-quoting-indicator "")
86         
87         ;; select raw article buffer
88         (mail-reply-buffer
89          (save-excursion
90            (set-buffer gnus-article-buffer)
91            (if (eq major-mode 'mime/viewer-mode)
92                mime::preview/article-buffer
93              gnus-article-buffer)))
94         )
95     (news-reply-yank-original 0)
96     ))
97
98 (call-after-loaded
99  'tm-edit
100  (function
101   (lambda ()
102     (set-alist
103      'mime-editor/message-inserter-alist
104      'news-reply-mode (function tm-gnus/insert-article))
105     
106     (autoload 'tm-mail/insert-message "tm-mail")
107     (set-alist 'mime-editor/message-inserter-alist
108                'mail-mode (function tm-mail/insert-message))
109     )))
110
111
112 ;;; @ end
113 ;;;
114
115 (provide 'tm-gnus)
116
117 (run-hooks 'tm-gnus-load-hook)