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