annotate lisp/tm/tm-play.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents
children 4b173ad71786
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
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1994,1995,1996 Free Software Foundation, Inc.
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)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Version: $Id: tm-play.el,v 1.1.1.1 1996/12/18 03:55:32 steve Exp $
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 (defvar mime-viewer/external-progs "/usr/local/share/tm"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 "*Directory containing tm external methods.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 (add-to-list 'exec-path mime-viewer/external-progs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 (let ((paths (parse-colon-path (getenv "PATH"))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 (or (member mime-viewer/external-progs paths)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 (setenv "PATH"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 (mapconcat (function identity)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 (append paths (list mime-viewer/external-progs))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 path-separator))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 ;;; @ content decoder
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 (defvar mime-preview/after-decoded-position nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (defun mime-preview/decode-content ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 (let ((pc (mime-preview/point-pcinfo (point))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 (if pc
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (let ((the-buf (current-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (setq mime-preview/after-decoded-position (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 (set-buffer (mime::preview-content-info/buffer pc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 (mime-article/decode-content
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (mime::preview-content-info/content-info pc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (if (eq (current-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 (mime::preview-content-info/buffer pc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 (set-buffer the-buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (goto-char mime-preview/after-decoded-position)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (defun mime-article/decode-content (cinfo)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (let ((beg (mime::content-info/point-min cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 (end (mime::content-info/point-max cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (ctype (or (mime::content-info/type cinfo) "text/plain"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 (params (mime::content-info/parameters cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (encoding (mime::content-info/encoding cinfo))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 ;; Check for VM
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (if (< beg (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (setq beg (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 (if (< (point-max) end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (setq end (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (let (method cal ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 (setq cal (list* (cons 'type ctype)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 (cons 'encoding encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 (cons 'major-mode major-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 params))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 (if mime-viewer/decoding-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 (setq cal (cons
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (cons 'mode mime-viewer/decoding-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (setq ret (mime/get-content-decoding-alist cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 (setq method (cdr (assq 'method ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 (cond ((and (symbolp method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (fboundp method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (funcall method beg end ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 ((and (listp method)(stringp (car method)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (mime-article/start-external-method-region beg end ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 (mime-article/show-output-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 "No method are specified for %s\n" ctype)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 )
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 (defun field-unifier-for-mode (a b)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (let ((va (cdr a)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (if (if (consp va)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 (member (cdr b) va)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 (equal va (cdr b))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (list nil b nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 (defun mime/get-content-decoding-alist (al)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (get-unified-alist mime/content-decoding-condition al)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 ;;; @ external decoder
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 (defun mime-article/start-external-method-region (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (narrow-to-region beg end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (goto-char beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (let ((method (cdr (assoc 'method cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 (name (mime-article/get-filename cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (if method
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (let ((file (make-temp-name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 (expand-file-name "TM" mime/tmp-dir)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 b args)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 (if (nth 1 method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (setq b beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 (setq b
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 (if (re-search-forward "^$" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 (1+ (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 (point-min)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (goto-char b)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (write-region b end file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (message "External method is starting...")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (setq cal (put-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 'name (replace-as-filename name) cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (setq cal (put-alist 'file file cal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (setq args (nconc
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (list (car method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 mime/output-buffer-name (car method)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 (mime-article/make-method-args cal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 (cdr (cdr method)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (apply (function start-process) args)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 (mime-article/show-output-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 (defun mime-article/make-method-args (cal format)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 (mapcar (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164 (lambda (arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 (if (stringp arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166 arg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 (let* ((item (eval arg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 (ret (cdr (assoc item cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 (if (eq item 'encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 "7bit"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174 ""))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 format))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 (defun mime-article/show-output-buffer (&rest forms)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 (get-buffer-create mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 (let ((the-win (selected-window))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (win (get-buffer-window mime/output-buffer-name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 (or win
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 (if (and mime/output-buffer-window-is-shared-with-bbdb
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (boundp 'bbdb-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (setq win (get-buffer-window bbdb-buffer-name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 (set-window-buffer win mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 (select-window (get-buffer-window mime::article/preview-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 (setq win (split-window-vertically (/ (* (window-height) 3) 4)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192 (set-window-buffer win mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 (select-window win)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 (if forms
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 (insert (apply (function format) forms))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 (select-window the-win)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 ;;; @ file name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 (defvar mime-viewer/file-name-char-regexp "[A-Za-z0-9+_-]")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 (defvar mime-viewer/file-name-regexp-1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 (concat mime-viewer/file-name-char-regexp "+\\."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 mime-viewer/file-name-char-regexp "+"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212 (defvar mime-viewer/file-name-regexp-2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213 (concat (regexp-* mime-viewer/file-name-char-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
214 "\\(\\." mime-viewer/file-name-char-regexp "+\\)*"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
215
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
216 (defun mime-article/get-original-filename (param &optional encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
217 (or (mime-article/get-uu-filename param encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
218 (let (ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219 (or (if (or (and (setq ret (mime/Content-Disposition))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220 (setq ret (assoc "filename" (cdr ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
221 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222 (setq ret (assoc "name" param))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223 (setq ret (assoc "x-name" param))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 (std11-strip-quoted-string (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
226 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
227 (if (setq ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
228 (std11-find-field-body '("Content-Description"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
229 "Subject")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
230 (if (or (string-match mime-viewer/file-name-regexp-1 ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
231 (string-match mime-viewer/file-name-regexp-2 ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
232 (substring ret (match-beginning 0)(match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
233 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
234 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237 (defun mime-article/get-filename (param)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238 (replace-as-filename (mime-article/get-original-filename param))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
240
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
241
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
242 ;;; @ mail/news message
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-viewer/quitting-method-for-mime/show-message-mode ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246 (let ((mother mime::preview/mother-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 (win-conf mime::preview/original-window-configuration)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 (kill-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 (mime::preview-content-info/buffer (car mime::preview/content-list)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 (mime-viewer/kill-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252 (set-window-configuration win-conf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 (pop-to-buffer mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254 ;;(goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 ;;(mime-viewer/up-content)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258 (defun mime-article/view-message/rfc822 (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259 (let* ((cnum (mime-article/point-content-number beg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260 (cur-buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 (new-name (format "%s-%s" (buffer-name) cnum))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262 (mother mime::article/preview-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 (code-converter
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 (or (cdr (assq major-mode mime-viewer/code-converter-alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 'mime-viewer/default-code-convert-region))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 (setq str (buffer-substring beg end))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 (switch-to-buffer new-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270 (insert str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
272 (if (re-search-forward "^\n" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
273 (delete-region (point-min) (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275 (setq major-mode 'mime/show-message-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276 (setq mime::article/code-converter code-converter)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 (mime/viewer-mode mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281 ;;; @ message/partial
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284 (defvar mime-article/coding-system-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285 (and (boundp 'MULE)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
286 '((mh-show-mode . *noconv*)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
287 (t . *ctext*)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
288 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
289
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
290 (defvar mime-article/kanji-code-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
291 (and (boundp 'NEMACS)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
292 '((mh-show-mode . nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
293 (t . 2)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
294 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
295
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
296 (defun mime-article/decode-message/partial (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
297 (goto-char beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
298 (let* ((root-dir (expand-file-name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
299 (concat "m-prts-" (user-login-name)) mime/tmp-dir))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
300 (id (cdr (assoc "id" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
301 (number (cdr (assoc "number" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
302 (total (cdr (assoc "total" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
303 (the-buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
304 file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
305 (mother mime::article/preview-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
306 (win-conf (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
307 (set-buffer mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
308 mime::preview/original-window-configuration))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
309 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310 (if (not (file-exists-p root-dir))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
311 (make-directory root-dir)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
312 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
313 (setq id (replace-as-filename id))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
314 (setq root-dir (concat root-dir "/" id))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
315 (if (not (file-exists-p root-dir))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
316 (make-directory root-dir)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
317 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
318 (setq file (concat root-dir "/FULL"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
319 (if (not (file-exists-p file))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
320 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
321 (re-search-forward "^$")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
322 (goto-char (1+ (match-end 0)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
323 (setq file (concat root-dir "/" number))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
324 (let ((file-coding-system
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
325 (cdr
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
326 (or (assq major-mode mime-article/coding-system-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
327 (assq t mime-article/coding-system-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
328 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
329 (kanji-fileio-code
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
330 (cdr
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
331 (or (assq major-mode mime-article/kanji-code-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
332 (assq t mime-article/kanji-code-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
333 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
334 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
335 (write-region (point) (point-max) file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
336 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
337 (if (get-buffer mime/temp-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
338 (kill-buffer mime/temp-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
339 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
340 (switch-to-buffer mime/temp-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
341 (let ((i 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
342 (max (string-to-int total))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
343 (file-coding-system-for-read (if (boundp 'MULE)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
344 *noconv*))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
345 kanji-fileio-code)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
346 (catch 'tag
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
347 (while (<= i max)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
348 (setq file (concat root-dir "/" (int-to-string i)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
349 (if (not (file-exists-p file))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
350 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
351 (switch-to-buffer the-buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
352 (throw 'tag nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
353 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
354 (insert-file-contents file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
355 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
356 (setq i (1+ i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
357 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
358 ;;(delete-other-windows)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
359 (let ((buf (current-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
360 (write-file (concat root-dir "/FULL"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
361 (set-window-configuration win-conf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
362 (let ((win (get-buffer-window mother)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
363 (if win
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
364 (select-window win)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
365 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
366 (set-window-buffer (selected-window) buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
367 ;;(set-window-buffer buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
368 (setq major-mode 'mime/show-message-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
369 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
370 (mime/viewer-mode mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
371 (pop-to-buffer (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
372 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
373 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
374 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
375 ;;(delete-other-windows)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
376 (set-window-configuration win-conf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
377 (select-window (or (get-buffer-window mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
378 (get-buffer-window
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
379 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
380 (set-buffer mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
381 mime::preview/article-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
382 (get-largest-window)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
383 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
384 (as-binary-input-file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
385 (set-buffer (get-buffer-create "FULL"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
386 (insert-file-contents file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
387 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
388 (setq major-mode 'mime/show-message-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
389 (mime/viewer-mode mother)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
390 ;;(pop-to-buffer (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
391 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
392 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
393
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
394
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
395 ;;; @ rot13-47
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
396 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
397
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
398 (defun mime-article/decode-caesar (beg end cal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
399 (let* ((cnum (mime-article/point-content-number beg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
400 (cur-buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
401 (new-name (format "%s-%s" (buffer-name) cnum))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
402 (mother mime::article/preview-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
403 (charset (cdr (assoc "charset" cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
404 (encoding (cdr (assq 'encoding cal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
405 (mode major-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
406 str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
407 (setq str (buffer-substring beg end))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
408 (switch-to-buffer new-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
409 (setq buffer-read-only nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
410 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
411 (insert str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
412 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
413 (if (re-search-forward "^\n" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
414 (delete-region (point-min) (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
415 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
416 (let ((m (cdr (or (assq mode mime-viewer/code-converter-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
417 (assq t mime-viewer/code-converter-alist)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
418 (and (functionp m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
419 (funcall m charset encoding)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
420 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
421 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
422 (set-mark (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
423 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
424 (tm:caesar-region)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
425 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
426 (view-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
427 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
428
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
429
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
430 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
431 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
432
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
433 (provide 'tm-play)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
434
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
435 ;;; tm-play.el ends here