tm 7.76.
[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.1 1996/08/06 12:00:53 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   (decode-mime-charset-region
40    (point-min)(point-max)
41    (save-excursion
42      (set-buffer gnus-summary-buffer)
43      (let ((rest gnus-newsgroup-default-charset-alist)
44            cell)
45        (catch 'tag
46          (while (setq cell (car rest))
47            (if (string-match (car cell) gnus-newsgroup-name)
48                (throw 'tag
49                       (progn
50                         (make-local-variable 'default-mime-charset)
51                         (setq default-mime-charset (cdr cell))
52                         )))
53            (setq rest (cdr rest))
54            )))
55      default-mime-charset)
56    ))
57
58
59 ;;; @ command functions
60 ;;;
61
62 (defun gnus-summary-preview-mime-message (arg)
63   "MIME decode and play this message."
64   (interactive "P")
65   (let ((gnus-break-pages nil))
66     (gnus-summary-select-article t t)
67     )
68   (pop-to-buffer gnus-original-article-buffer t)
69   (let (buffer-read-only)
70     (if (text-property-any (point-min) (point-max) 'invisible t)
71         (remove-text-properties (point-min) (point-max)
72                                 gnus-hidden-properties)
73       ))
74   (mime/viewer-mode nil nil nil gnus-original-article-buffer
75                     gnus-article-buffer)
76   )
77
78 (defun gnus-summary-scroll-down ()
79   "Scroll down one line current article."
80   (interactive)
81   (gnus-summary-scroll-up -1)
82   )
83
84 (define-key gnus-summary-mode-map "v"
85   (function gnus-summary-preview-mime-message))
86 (define-key gnus-summary-mode-map "\e\r"
87   (function gnus-summary-scroll-down))
88
89
90 ;;; @ end
91 ;;;
92
93 (provide 'gnus-sum-mime)
94
95 ;;; gnus-sum-mime.el ends here