annotate lisp/tm/tm-play.el @ 44:8d2a9b52c682 r19-15prefinal

Import from CVS: tag r19-15prefinal
author cvs
date Mon, 13 Aug 2007 08:55:10 +0200
parents 7e54bd776075
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; tm-play.el --- decoder for tm-view.el
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
3 ;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;; Created: 1995/9/26 (separated from tm-view.el)
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 40
diff changeset
7 ;; Version: $Id: tm-play.el,v 1.8 1997/03/26 04:34:05 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8 ;; Keywords: mail, news, MIME, multimedia
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10 ;; This file is part of tm (Tools for MIME).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 (require 'tm-view)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 ;;; @ content decoder
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 (defvar mime-preview/after-decoded-position nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 (defun mime-preview/decode-content ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 (let ((pc (mime-preview/point-pcinfo (point))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 (if pc
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 (let ((the-buf (current-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 (setq mime-preview/after-decoded-position (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 (set-buffer (mime::preview-content-info/buffer pc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 (mime-article/decode-content
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 (mime::preview-content-info/content-info pc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 (if (eq (current-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 (mime::preview-content-info/buffer pc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 (set-buffer the-buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (goto-char mime-preview/after-decoded-position)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (defun mime-article/decode-content (cinfo)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (let ((beg (mime::content-info/point-min cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 (end (mime::content-info/point-max cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 (ctype (or (mime::content-info/type cinfo) "text/plain"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (params (mime::content-info/parameters cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (encoding (mime::content-info/encoding cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 ;; Check for VM
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 (if (< beg (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (setq beg (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (if (< (point-max) end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 (setq end (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (let (method cal ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 (setq cal (list* (cons 'type ctype)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (cons 'encoding encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 (cons 'major-mode major-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 params))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 (if mime-viewer/decoding-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (setq cal (cons
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (cons 'mode mime-viewer/decoding-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 (setq ret (mime/get-content-decoding-alist cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (setq method (cdr (assq 'method ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (cond ((and (symbolp method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (fboundp method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 (funcall method beg end ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 ((and (listp method)(stringp (car method)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 (mime-article/start-external-method-region beg end ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (mime-article/show-output-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 "No method are specified for %s\n" ctype)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (defun field-unifier-for-mode (a b)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (let ((va (cdr a)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 (if (if (consp va)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 (member (cdr b) va)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (equal va (cdr b))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (list nil b nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (defun mime/get-content-decoding-alist (al)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 (get-unified-alist mime/content-decoding-condition al)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 ;;; @ external decoder
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 (defun mime-article/start-external-method-region (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (narrow-to-region beg end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (goto-char beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 (let ((method (cdr (assoc 'method cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (name (mime-article/get-filename cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 (if method
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (let ((file (make-temp-name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (expand-file-name "TM" mime/tmp-dir)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 b args)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (if (nth 1 method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 (setq b beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (setq b
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 (if (re-search-forward "^$" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (1+ (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (point-min)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 (goto-char b)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (write-region b end file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (message "External method is starting...")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 (setq cal (put-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 'name (replace-as-filename name) cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 (setq cal (put-alist 'file file cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (setq args (nconc
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 (list (car method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 mime/output-buffer-name (car method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 (mime-article/make-method-args cal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 (cdr (cdr method)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (apply (function start-process) args)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (mime-article/show-output-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (defun mime-article/make-method-args (cal format)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (mapcar (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (lambda (arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (if (stringp arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 arg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 (let* ((item (eval arg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 (ret (cdr (assoc item cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 (if (eq item 'encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 "7bit"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161 ""))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164 format))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166 (defun mime-article/show-output-buffer (&rest forms)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 (get-buffer-create mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 (let ((the-win (selected-window))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 (win (get-buffer-window mime/output-buffer-name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (or win
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 (if (and mime/output-buffer-window-is-shared-with-bbdb
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 (boundp 'bbdb-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174 (setq win (get-buffer-window bbdb-buffer-name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 (set-window-buffer win mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 (select-window (get-buffer-window mime::article/preview-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 (setq win (split-window-vertically (/ (* (window-height) 3) 4)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 (set-window-buffer win mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 (select-window win)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 (if forms
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 (insert (apply (function format) forms))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (select-window the-win)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 ;;; @ file name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 (defvar mime-viewer/file-name-char-regexp "[A-Za-z0-9+_-]")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 (defvar mime-viewer/file-name-regexp-1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 (concat mime-viewer/file-name-char-regexp "+\\."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 mime-viewer/file-name-char-regexp "+"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 (defvar mime-viewer/file-name-regexp-2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 (concat (regexp-* mime-viewer/file-name-char-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 "\\(\\." mime-viewer/file-name-char-regexp "+\\)*"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 (defun mime-article/get-original-filename (param &optional encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204 (or (mime-article/get-uu-filename param encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 (let (ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 (or (if (or (and (setq ret (mime/Content-Disposition))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207 (setq ret (assoc "filename" (cdr ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 (setq ret (assoc "name" param))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 (setq ret (assoc "x-name" param))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212 (std11-strip-quoted-string (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
214 (if (setq ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
215 (std11-find-field-body '("Content-Description"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
216 "Subject")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
217 (if (or (string-match mime-viewer/file-name-regexp-1 ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
218 (string-match mime-viewer/file-name-regexp-2 ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219 (substring ret (match-beginning 0)(match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
221 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224 (defun mime-article/get-filename (param)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 (replace-as-filename (mime-article/get-original-filename param))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
226 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
227
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
228
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
229 ;;; @ mail/news message
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
230 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
231
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
232 (defun mime-viewer/quitting-method-for-mime/show-message-mode ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
233 (let ((mother mime::preview/mother-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
234 (win-conf mime::preview/original-window-configuration)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236 (kill-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237 (mime::preview-content-info/buffer (car mime::preview/content-list)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238 (mime-viewer/kill-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239 (set-window-configuration win-conf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
240 (pop-to-buffer mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
241 ;;(goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
242 ;;(mime-viewer/up-content)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
243 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
244
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
245 (defun mime-article/view-message/rfc822 (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246 (let* ((cnum (mime-article/point-content-number beg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 (cur-buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248 (new-name (format "%s-%s" (buffer-name) cnum))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 (mother mime::article/preview-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 (code-converter
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 (or (cdr (assq major-mode mime-viewer/code-converter-alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252 'mime-viewer/default-code-convert-region))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254 (setq str (buffer-substring beg end))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 (switch-to-buffer new-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 (insert str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259 (if (re-search-forward "^\n" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260 (delete-region (point-min) (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262 (setq major-mode 'mime/show-message-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 (setq mime::article/code-converter code-converter)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 (mime/viewer-mode mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 ;;; @ message/partial
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271 (defvar mime-article/coding-system-alist
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
272 (list (cons 'mh-show-mode *noconv*)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
273 (cons t (mime-charset-to-coding-system default-mime-charset))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
274 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275
40
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
276 (cond ((boundp 'MULE) ; for MULE 2.3 or older
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
277 (defun mime-article::write-region (start end file)
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
278 (let ((file-coding-system
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
279 (cdr
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
280 (or (assq major-mode mime-article/coding-system-alist)
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
281 (assq t mime-article/coding-system-alist)
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
282 ))))
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
283 (write-region start end file)
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
284 ))
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
285 )
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
286 ((featurep 'mule) ; for Emacs/mule and XEmacs/mule
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
287 (defun mime-article::write-region (start end file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
288 (let ((coding-system-for-write
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
289 (cdr
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
290 (or (assq major-mode mime-article/coding-system-alist)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
291 (assq t mime-article/coding-system-alist)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
292 ))))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
293 (write-region start end file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
294 ))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
295 )
40
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
296 ((boundp 'NEMACS) ; for NEmacs
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
297 (defun mime-article::write-region (start end file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
298 (let ((kanji-fileio-code
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
299 (cdr
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
300 (or (assq major-mode mime-article/kanji-code-alist)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
301 (assq t mime-article/kanji-code-alist)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
302 ))))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
303 (write-region start end file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
304 ))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
305 )
40
7e54bd776075 Import from CVS: tag r19-15b103
cvs
parents: 32
diff changeset
306 (t ; for Emacs 19 or older and XEmacs without mule
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
307 (defalias 'mime-article::write-region 'write-region)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
308 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
309
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310 (defun mime-article/decode-message/partial (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
311 (goto-char beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
312 (let* ((root-dir (expand-file-name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
313 (concat "m-prts-" (user-login-name)) mime/tmp-dir))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
314 (id (cdr (assoc "id" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
315 (number (cdr (assoc "number" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
316 (total (cdr (assoc "total" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
317 file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
318 (mother mime::article/preview-buffer)
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
319 )
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
320 (or (file-exists-p root-dir)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
321 (make-directory root-dir)
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
322 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
323 (setq id (replace-as-filename id))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
324 (setq root-dir (concat root-dir "/" id))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
325 (or (file-exists-p root-dir)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
326 (make-directory root-dir)
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
327 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
328 (setq file (concat root-dir "/FULL"))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
329 (if (file-exists-p file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
330 (let ((full-buf (get-buffer-create "FULL"))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
331 (pwin (or (get-buffer-window mother)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
332 (get-largest-window)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
333 )
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
334 (save-window-excursion
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
335 (set-buffer full-buf)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
336 (erase-buffer)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
337 (as-binary-input-file (insert-file-contents file))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
338 (setq major-mode 'mime/show-message-mode)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
339 (mime/viewer-mode mother)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
340 )
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
341 (set-window-buffer pwin
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
342 (save-excursion
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
343 (set-buffer full-buf)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
344 mime::article/preview-buffer))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
345 (select-window pwin)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
346 )
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
347 (re-search-forward "^$")
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
348 (goto-char (1+ (match-end 0)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
349 (setq file (concat root-dir "/" number))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
350 (mime-article::write-region (point) (point-max) file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
351 (let ((total-file (concat root-dir "/CT")))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
352 (setq total
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
353 (if total
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
354 (progn
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
355 (or (file-exists-p total-file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
356 (save-excursion
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
357 (set-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
358 (get-buffer-create mime/temp-buffer-name))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
359 (erase-buffer)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
360 (insert total)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
361 (write-file total-file)
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
362 (kill-buffer (current-buffer))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
363 ))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
364 (string-to-number total)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
365 )
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
366 (and (file-exists-p total-file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
367 (save-excursion
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
368 (set-buffer (find-file-noselect total-file))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
369 (prog1
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
370 (and (re-search-forward "[0-9]+" nil t)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
371 (string-to-number
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
372 (buffer-substring (match-beginning 0)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
373 (match-end 0)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
374 )
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
375 (kill-buffer (current-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
376 )))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
377 )))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
378 (if (and total (> total 0))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
379 (catch 'tag
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
380 (save-excursion
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
381 (set-buffer (get-buffer-create mime/temp-buffer-name))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
382 (let ((full-buf (current-buffer)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
383 (erase-buffer)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
384 (let ((i 1))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
385 (while (<= i total)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
386 (setq file (concat root-dir "/" (int-to-string i)))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
387 (or (file-exists-p file)
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
388 (throw 'tag nil)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
389 )
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
390 (as-binary-input-file (insert-file-contents file))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
391 (goto-char (point-max))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
392 (setq i (1+ i))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
393 ))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
394 (as-binary-output-file (write-file (concat root-dir "/FULL")))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
395 (let ((i 1))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
396 (while (<= i total)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
397 (let ((file (format "%s/%d" root-dir i)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
398 (and (file-exists-p file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
399 (delete-file file)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
400 ))
18
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
401 (setq i (1+ i))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
402 ))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
403 (let ((file (expand-file-name "CT" root-dir)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
404 (and (file-exists-p file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
405 (delete-file file)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
406 ))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
407 (save-window-excursion
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
408 (setq major-mode 'mime/show-message-mode)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
409 (mime/viewer-mode mother)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
410 )
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
411 (let ((pwin (or (get-buffer-window mother)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
412 (get-largest-window)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
413 ))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
414 (pbuf (save-excursion
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
415 (set-buffer full-buf)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
416 mime::article/preview-buffer)))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
417 (set-window-buffer pwin pbuf)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
418 (select-window pwin)
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
419 )))))
d95e72db5c07 Import from CVS: tag r19-15b92
cvs
parents: 8
diff changeset
420 )))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
421
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
422
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
423 ;;; @ rot13-47
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
424 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
425
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 40
diff changeset
426 (unless (boundp 'view-mode-map)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 40
diff changeset
427 (require 'view))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
428
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
429 (defconst mime-view-text/plain-mode-map (copy-keymap view-mode-map))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
430 (define-key mime-view-text/plain-mode-map
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
431 "q" (function mime-view-text/plain-exit))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
432
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
433 (defun mime-view-text/plain-mode ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
434 "\\{mime-view-text/plain-mode-map}"
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
435 (setq buffer-read-only t)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
436 (setq major-mode 'mime-view-text/plain-mode)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
437 (setq mode-name "MIME-View text/plain")
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
438 (use-local-map mime-view-text/plain-mode-map)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
439 )
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
440
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
441 (defun mime-view-text/plain-exit ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
442 (interactive)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
443 (kill-buffer (current-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
444 )
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
445
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
446 (defun mime-article/decode-caesar (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
447 (let* ((cnum (mime-article/point-content-number beg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
448 (cur-buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
449 (new-name (format "%s-%s" (buffer-name) cnum))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
450 (mother mime::article/preview-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
451 (charset (cdr (assoc "charset" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
452 (encoding (cdr (assq 'encoding cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
453 (mode major-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
454 str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
455 (setq str (buffer-substring beg end))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
456 (let ((pwin (or (get-buffer-window mother)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
457 (get-largest-window)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
458 (buf (get-buffer-create new-name))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
459 )
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
460 (set-window-buffer pwin buf)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
461 (set-buffer buf)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
462 (select-window pwin)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
463 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
464 (setq buffer-read-only nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
465 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
466 (insert str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
467 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
468 (if (re-search-forward "^\n" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
469 (delete-region (point-min) (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
470 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
471 (let ((m (cdr (or (assq mode mime-viewer/code-converter-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
472 (assq t mime-viewer/code-converter-alist)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
473 (and (functionp m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
474 (funcall m charset encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
475 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
476 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
477 (set-mark (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
478 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
479 (tm:caesar-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
480 )
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
481 (set-buffer-modified-p nil)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 18
diff changeset
482 (mime-view-text/plain-mode)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
483 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
484
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
485
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
486 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
487 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
488
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
489 (provide 'tm-play)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
490
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
491 ;;; tm-play.el ends here