tm 7.77.
[elisp/tm.git] / gnus / gnus-sum-mime.el
1 ;;;
2 ;;; gnus-sum-mime.el --- MIME extension for summary mode of Gnus
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Created: 1996/8/6
9 ;;; Version:
10 ;;;     $Id: gnus-sum-mime.el,v 0.2 1996/08/09 12:29:10 morioka Exp $
11 ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
12 ;;;
13 ;;; This file is not part of GNU Emacs yet.
14 ;;;
15 ;;; This program is free software; you can redistribute it and/or
16 ;;; modify it under the terms of the GNU General Public License as
17 ;;; published by the Free Software Foundation; either version 2, or
18 ;;; (at your option) any later version.
19 ;;;
20 ;;; This program is distributed in the hope that it will be useful,
21 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 ;;; General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with This program.  If not, write to the Free Software
27 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 ;;;
29 ;;; Code:
30
31 (require 'gnus-mime)
32 (require 'gnus-art-mime)
33
34
35 ;;; @ summary filter
36 ;;;
37
38 (defun gnus-set-summary-default-charset ()
39   (let ((charset
40          (save-excursion
41            (set-buffer gnus-summary-buffer)
42            (let ((rest gnus-newsgroup-default-charset-alist)
43                  cell)
44              (catch 'tag
45                (while (setq cell (car rest))
46                  (if (string-match (car cell) gnus-newsgroup-name)
47                      (throw 'tag
48                             (progn
49                               (make-local-variable 'default-mime-charset)
50                               (setq default-mime-charset (cdr cell))
51                               )))
52                  (setq rest (cdr rest))
53                  )))
54            default-mime-charset)))
55     (goto-char (point-min))
56     (while (< (point)(point-max))
57       (decode-mime-charset-region (point)
58                                   (progn
59                                     (end-of-line)
60                                     (point))
61                                   default-mime-charset)
62       (forward-char)
63       )))
64
65
66 ;;; @ command functions
67 ;;;
68
69 (defun gnus-summary-preview-mime-message (arg)
70   "MIME decode and play this message."
71   (interactive "P")
72   (let ((gnus-break-pages nil))
73     (gnus-summary-select-article t t)
74     )
75   (pop-to-buffer gnus-original-article-buffer t)
76   (let (buffer-read-only)
77     (if (text-property-any (point-min) (point-max) 'invisible t)
78         (remove-text-properties (point-min) (point-max)
79                                 gnus-hidden-properties)
80       ))
81   (mime/viewer-mode nil nil nil gnus-original-article-buffer
82                     gnus-article-buffer)
83   )
84
85 (defun gnus-summary-scroll-down ()
86   "Scroll down one line current article."
87   (interactive)
88   (gnus-summary-scroll-up -1)
89   )
90
91 (define-key gnus-summary-mode-map "v"
92   (function gnus-summary-preview-mime-message))
93 (define-key gnus-summary-mode-map "\e\r"
94   (function gnus-summary-scroll-down))
95
96
97 ;;; @ end
98 ;;;
99
100 (provide 'gnus-sum-mime)
101
102 ;;; gnus-sum-mime.el ends here