tm 7.21.
[elisp/tm.git] / gnus / tm-gnus4.el
1 ;;;
2 ;;; tm-gnus4.el --- tm-gnus module for GNUS 4.*
3 ;;;
4
5 (require 'tl-str)
6 (require 'tl-misc)
7 (require 'tm-ognus)
8
9
10 ;;; @ version
11 ;;;
12
13 (defconst tm-gnus/RCS-ID
14   "$Id: tm-gnus4.el,v 7.1 1995/10/28 05:44:44 morioka Exp $")
15
16 (defconst tm-gnus/version
17   (concat (get-version-string tm-gnus/RCS-ID) " for GNUS 4"))
18
19
20 ;;; @ for tm-view
21 ;;;
22
23 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
24
25 (defun tm-gnus/view-message (arg)
26   "MIME decode and play this message."
27   (interactive "P")
28   (let ((gnus-break-pages nil))
29     (gnus-summary-select-article t t)
30     )
31   (pop-to-buffer gnus-article-buffer t)
32   (mime/viewer-mode)
33   )
34
35 (defun tm-gnus/summary-scroll-down ()
36   "Scroll down one line current article."
37   (interactive)
38   (gnus-summary-scroll-up -1)
39   )
40
41 (defun mime-viewer/quitting-method-for-gnus4 ()
42   (mime-viewer/kill-buffer)
43   (delete-other-windows)
44   (gnus-article-show-summary)
45   (if (null gnus-have-all-headers)
46       (gnus-summary-select-article nil t)
47     ))
48
49 (call-after-loaded
50  'tm-view
51  (function
52   (lambda ()
53     (set-alist 'mime-viewer/quitting-method-alist
54                'gnus-article-mode
55                (function mime-viewer/quitting-method-for-gnus4))
56     )))
57
58
59 ;;; @ for tm-partial
60 ;;;
61
62 (call-after-loaded
63  'tm-partial
64  (function
65   (lambda ()
66     (set-atype 'mime/content-decoding-condition
67                '((type . "message/partial")
68                  (method . mime-article/grab-message/partials)
69                  (major-mode . gnus-article-mode)
70                  (summary-buffer-exp . gnus-summary-buffer)
71                  ))
72     
73     (set-alist 'tm-partial/preview-article-method-alist
74                'gnus-article-mode
75                (function
76                 (lambda ()
77                   (tm-gnus/view-message (gnus-summary-article-number))
78                   )))
79     )))
80
81
82 ;;; @ Summary decoding
83 ;;;
84
85 (add-hook 'gnus-select-group-hook (function tm-gnus/decode-summary-subjects))
86
87
88 ;;; @ set up
89 ;;;
90
91 (define-key gnus-summary-mode-map
92   "\et" (function tm-gnus/toggle-decoding-mode))
93 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
94 (define-key gnus-summary-mode-map
95   "\e\r" (function tm-gnus/summary-scroll-down))
96
97 (fset 'gnus-article-set-mode-line 'tm-gnus/article-set-mode-line)
98 (add-hook 'gnus-article-mode-hook
99           (function tm-gnus/add-decoding-mode-to-mode-line))
100
101 (defun tm-gnus/decode-encoded-word-if-you-need ()
102   (if (and tm-gnus/decoding-mode (not gnus-have-all-headers))
103       (mime/decode-message-header)
104     ))
105
106 (add-hook 'gnus-article-prepare-hook
107           (function tm-gnus/decode-encoded-word-if-you-need) t)
108
109
110 ;;; @ end
111 ;;;
112
113 (provide 'tm-gnus4)