2 ;;; tm-def.el --- definition module for tm
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: tm-def.el,v 6.3 1995/09/21 00:12:52 morioka Exp $
10 ;;; Keywords: mail, news, MIME, multimedia, definition
12 ;;; This file is part of tm (Tools for MIME).
21 (defvar mime/tmp-dir (or (getenv "TM_TMP_DIR") "/tmp/"))
23 (defvar mime/use-multi-frame
24 (and (>= emacs-major-version 19) window-system))
26 (defvar mime/find-file-function
27 (if mime/use-multi-frame
28 (function find-file-other-frame)
33 ;;; @ for various Emacs variants
36 (cond ((boundp 'MULE) (require 'tm-mule))
37 ((boundp 'NEMACS)(require 'tm-nemacs))
38 (t (require 'tm-orig))
41 (defun tm:set-face-region (b e face)
42 (let ((overlay (tl:make-overlay b e)))
43 (tl:overlay-put overlay 'face face)
46 (setq tm:button-face 'bold)
47 (setq tm:mouse-face 'highlight)
49 (defun tm:add-button (from to func &optional data)
50 "Create a button between FROM and TO with callback FUNC and data DATA."
52 (tl:overlay-put (tl:make-overlay from to) 'face tm:button-face))
53 (tl:add-text-properties from to
54 (append (and tm:mouse-face
55 (list 'mouse-face tm:mouse-face))
56 (list 'tm-callback func)
57 (and data (list 'tm-data data))
61 (defun tm:button-dispatcher (event)
62 "Select the button under point."
64 (mouse-set-point event)
65 (let ((func (get-text-property (point) 'tm-callback)))
67 (call-interactively func)
71 ;;; @ definitions about MIME
74 (defconst mime/tspecials "][\000-\040()<>@,\;:\\\"/?.=")
75 (defconst mime/token-regexp (concat "[^" mime/tspecials "]+"))
76 (defconst mime/charset-regexp mime/token-regexp)
82 (defconst base64-token-regexp "[A-Za-z0-9+/=]")
84 (defconst mime/B-encoded-text-regexp
91 (defconst mime/B-encoding-and-encoded-text-regexp
92 (concat "\\(B\\)\\?" mime/B-encoded-text-regexp))
95 ;;; @@ Quoted-Printable
98 (defconst quoted-printable-hex-chars "0123456789ABCDEF")
99 (defconst quoted-printable-octet-regexp
100 (concat "=[" quoted-printable-hex-chars
101 "][" quoted-printable-hex-chars "]"))
103 (defconst mime/Q-encoded-text-regexp
104 (concat "\\([^=?]\\|" quoted-printable-octet-regexp "\\)+"))
105 (defconst mime/Q-encoding-and-encoded-text-regexp
106 (concat "\\(Q\\)\\?" mime/Q-encoded-text-regexp))