comparison lisp/tm/tm-def.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents e04119814345
children 54cc21c15cbb
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;;; tm-def.el --- definition module for tm 1 ;;; tm-def.el --- definition module for tm
2 2
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
4 4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> 5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Version: $Id: tm-def.el,v 1.6 1997/03/16 05:55:41 steve Exp $ 6 ;; Version: $Id: tm-def.el,v 1.1.1.1 1996/12/18 22:43:37 steve Exp $
7 ;; Keywords: mail, news, MIME, multimedia, definition 7 ;; Keywords: mail, news, MIME, multimedia, definition
8 8
9 ;; This file is part of tm (Tools for MIME). 9 ;; This file is part of tm (Tools for MIME).
10 10
11 ;; This program is free software; you can redistribute it and/or 11 ;; This program is free software; you can redistribute it and/or
102 (defun tm:set-face-region (b e face) 102 (defun tm:set-face-region (b e face)
103 (let ((overlay (tl:make-overlay b e))) 103 (let ((overlay (tl:make-overlay b e)))
104 (tl:overlay-put overlay 'face face) 104 (tl:overlay-put overlay 'face face)
105 )) 105 ))
106 106
107 (defvar tm:button-face 'bold 107 (setq tm:button-face 'bold)
108 "Face used for content-button or URL-button of MIME-Preview buffer. 108 (setq tm:mouse-face 'highlight)
109 \[tm-def.el]")
110
111 (defvar tm:mouse-face 'highlight
112 "Face used for MIME-preview buffer mouse highlighting. [tm-def.el]")
113
114 (defvar tm:warning-face nil
115 "Face used for invalid encoded-word.")
116 109
117 (defun tm:add-button (from to func &optional data) 110 (defun tm:add-button (from to func &optional data)
118 "Create a button between FROM and TO with callback FUNC and data DATA." 111 "Create a button between FROM and TO with callback FUNC and data DATA."
119 (and tm:button-face 112 (and tm:button-face
120 (tl:overlay-put (tl:make-overlay from to) 'face tm:button-face)) 113 (tl:overlay-put (tl:make-overlay from to) 'face tm:button-face))
121 (add-text-properties from to 114 (tl:add-text-properties from to
122 (append (and tm:mouse-face 115 (append (and tm:mouse-face
123 (list 'mouse-face tm:mouse-face)) 116 (list 'mouse-face tm:mouse-face))
124 (list 'tm-callback func) 117 (list 'tm-callback func)
125 (and data (list 'tm-data data)) 118 (and data (list 'tm-data data))
126 )) 119 ))
127 ) 120 )
128 121
129 (defvar tm:mother-button-dispatcher nil) 122 (defvar tm:mother-button-dispatcher nil)
130 123
131 (defun tm:button-dispatcher (event) 124 (defun tm:button-dispatcher (event)
168 (call-interactively tm:mother-button-dispatcher) 161 (call-interactively tm:mother-button-dispatcher)
169 ) 162 )
170 )) 163 ))
171 164
172 165
173 ;;; @ PGP
174 ;;;
175
176 (defvar pgp-function-alist
177 '(
178 ;; for tm-pgp
179 (verify mc-verify "mc-toplev")
180 (decrypt mc-decrypt "mc-toplev")
181 (fetch-key mc-pgp-fetch-key "mc-pgp")
182 (snarf-keys mc-snarf-keys "mc-toplev")
183 ;; for tm-edit
184 (mime-sign tm:mc-pgp-sign-region "tm-edit-mc")
185 (traditional-sign mc-pgp-sign-region "mc-pgp")
186 (encrypt tm:mc-pgp-encrypt-region "tm-edit-mc")
187 (insert-key mc-insert-public-key "mc-toplev")
188 )
189 "Alist of service names vs. corresponding functions and its filenames.
190 Each element looks like (SERVICE FUNCTION FILE).
191
192 SERVICE is a symbol of PGP processing. It allows `verify', `decrypt',
193 `fetch-key', `snarf-keys', `mime-sign', `traditional-sign', `encrypt'
194 or `insert-key'.
195
196 Function is a symbol of function to do specified SERVICE.
197
198 FILE is string of filename which has definition of corresponding
199 FUNCTION.")
200
201 (defmacro pgp-function (method)
202 "Return function to do service METHOD."
203 (` (car (cdr (assq (, method) (symbol-value 'pgp-function-alist)))))
204 )
205
206 (mapcar (function
207 (lambda (method)
208 (autoload (second method)(third method))
209 ))
210 pgp-function-alist)
211
212
213 ;;; @ definitions about MIME 166 ;;; @ definitions about MIME
214 ;;; 167 ;;;
215 168
216 (defconst mime/tspecials "][\000-\040()<>@,\;:\\\"/?.=") 169 (defconst mime/tspecials "][\000-\040()<>@,\;:\\\"/?.=")
217 (defconst mime/token-regexp (concat "[^" mime/tspecials "]+")) 170 (defconst mime/token-regexp (concat "[^" mime/tspecials "]+"))
224 177
225 178
226 ;;; @@ Base64 179 ;;; @@ Base64
227 ;;; 180 ;;;
228 181
229 (defconst base64-token-regexp "[A-Za-z0-9+/]") 182 (defconst base64-token-regexp "[A-Za-z0-9+/=]")
230 (defconst base64-token-padding-regexp "[A-Za-z0-9+/=]")
231 183
232 (defconst mime/B-encoded-text-regexp 184 (defconst mime/B-encoded-text-regexp
233 (concat "\\(\\(" 185 (concat "\\("
234 base64-token-regexp 186 base64-token-regexp
235 base64-token-regexp 187 base64-token-regexp
236 base64-token-regexp 188 base64-token-regexp
237 base64-token-regexp 189 base64-token-regexp
238 "\\)*" 190 "\\)+"))
239 base64-token-regexp
240 base64-token-regexp
241 base64-token-padding-regexp
242 base64-token-padding-regexp
243 "\\)"))
244
245 (defconst mime/B-encoding-and-encoded-text-regexp 191 (defconst mime/B-encoding-and-encoded-text-regexp
246 (concat "\\(B\\)\\?" mime/B-encoded-text-regexp)) 192 (concat "\\(B\\)\\?" mime/B-encoded-text-regexp))
247 193
248 194
249 ;;; @@ Quoted-Printable 195 ;;; @@ Quoted-Printable