This commit was generated by cvs2svn to compensate for changes in r200,
[elisp/tm.git] / tm-def.el
index 7c2b6e7..b7b7f39 100644 (file)
--- a/tm-def.el
+++ b/tm-def.el
@@ -1,14 +1,44 @@
 ;;;
-;;; $Id: tm-def.el,v 4.1 1995/09/04 10:17:02 morioka Exp $
+;;; tm-def.el --- definition module for tm
+;;;
+;;; Copyright (C) 1995 Free Software Foundation, Inc.
+;;; Copyright (C) 1995 MORIOKA Tomohiko
+;;;
+;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; Version:
+;;;    $Id: tm-def.el,v 7.0 1995/10/05 13:27:34 morioka Exp $
+;;; Keywords: mail, news, MIME, multimedia, definition
+;;;
+;;; This file is part of tm (Tools for MIME).
 ;;;
 
+(require 'emu)
+(require 'tl-822)
+
+
 ;;; @ variables
 ;;;
 
-(defvar mime/tmp-dir (or (getenv "TM_TMPDIR") "/tmp/"))
+(defvar mime/tmp-dir (or (getenv "TM_TMP_DIR") "/tmp/"))
+
+(defvar mime/use-multi-frame
+  (and (>= emacs-major-version 19) window-system))
+
+(defvar mime/find-file-function
+  (if mime/use-multi-frame
+      (function find-file-other-frame)
+    (function find-file)
+    ))
+
+
+;;; @ constants
+;;;
+
+(defconst mime/output-buffer-name "*MIME-out*")
+(defconst mime/decoding-buffer-name "*MIME-decoding*")
 
 
-;;; @ compatible module among Mule, NEmacs and NEpoch 
+;;; @ for various Emacs variants
 ;;;
 
 (cond ((boundp 'MULE)  (require 'tm-mule))
       )
 
 
+;;; @ button
+;;;
+
+(defun tm:set-face-region (b e face)
+  (let ((overlay (tl:make-overlay b e)))
+    (tl:overlay-put overlay 'face face)
+    ))
+
+(setq tm:button-face 'bold)
+(setq tm:mouse-face 'highlight)
+
+(defun tm:add-button (from to func &optional data)
+  "Create a button between FROM and TO with callback FUNC and data DATA."
+  (and tm:button-face
+       (tl:overlay-put (tl:make-overlay from to) 'face tm:button-face))
+  (tl:add-text-properties from to
+                         (append (and tm:mouse-face
+                                      (list 'mouse-face tm:mouse-face))
+                                 (list 'tm-callback func)
+                                 (and data (list 'tm-data data))
+                                 ))
+  )
+
+(defvar tm:mother-button-dispatcher nil)
+
+(defun tm:button-dispatcher (event)
+  "Select the button under point."
+  (interactive "e")
+  (mouse-set-point event)
+  (let ((func (get-text-property (point) 'tm-callback))
+       (data (get-text-property (point) 'tm-data))
+       )
+    (if func
+       (apply func data)
+      (if (fboundp tm:mother-button-dispatcher)
+         (funcall tm:mother-button-dispatcher event)
+       )
+      )))
+
+
+;;; @ for URL
+;;;
+
+(defvar tm:URL-regexp
+  "\\(http\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
+
+(defvar browse-url-browser-function nil)
+
+(defun tm:browse-url ()
+  (if (fboundp browse-url-browser-function)
+      (call-interactively browse-url-browser-function)
+    (if (fboundp tm:mother-button-dispatcher)
+       (call-interactively tm:mother-button-dispatcher)
+      )
+    ))
+
+
 ;;; @ definitions about MIME
 ;;;
 
 (defconst mime/token-regexp (concat "[^" mime/tspecials "]+"))
 (defconst mime/charset-regexp mime/token-regexp)
 
+(defconst mime/content-type-subtype-regexp
+  (concat mime/token-regexp "/" mime/token-regexp))
+(defconst mime/content-parameter-value-regexp
+  (concat "\\("
+         rfc822/quoted-string-regexp
+         "\\|[^; \t\n]*\\)"))
+
 
 ;;; @@ Base64
 ;;;