tm 7.32.
[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.13 1995/12/08 22:35:14 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 ;;; modified by Steven L. Baur <steve@miranova.com>
99 ;;;     1995/12/6 (c.f. [tm-en:209])
100 (defun mime-editor/attach-to-news-reply-menu ()
101   "Arrange to attach MIME editor's popup menu to VM's"
102   (if (boundp 'news-reply-menu)
103       (progn
104         (setq news-reply-menu (append news-reply-menu
105                                       '("---")
106                                       mime-editor/popup-menu-for-xemacs))
107         (remove-hook 'news-setup-hook
108                      'mime-editor/attach-to-news-reply-menu)
109         )))
110
111 (call-after-loaded
112  'tm-edit
113  (function
114   (lambda ()
115     (set-alist
116      'mime-editor/message-inserter-alist
117      'news-reply-mode (function tm-gnus/insert-article))
118     
119     (autoload 'tm-mail/insert-message "tm-mail")
120     (set-alist 'mime-editor/message-inserter-alist
121                'mail-mode (function tm-mail/insert-message))
122     (if (string-match "XEmacs\\|Lucid" emacs-version)
123         (add-hook 'news-setup-hook 'mime-editor/attach-to-news-reply-menu)
124       )
125     )))
126
127
128 ;;; @ end
129 ;;;
130
131 (provide 'tm-gnus)
132
133 (run-hooks 'tm-gnus-load-hook)