This commit was generated by cvs2svn to compensate for changes in r200,
[elisp/tm.git] / tm-def.el
index 8a5e8d1..b7b7f39 100644 (file)
--- a/tm-def.el
+++ b/tm-def.el
@@ -1,8 +1,19 @@
 ;;;
-;;; $Id: tm-def.el,v 6.1 1995/09/20 14:44:49 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
     ))
 
 
+;;; @ constants
+;;;
+
+(defconst mime/output-buffer-name "*MIME-out*")
+(defconst mime/decoding-buffer-name "*MIME-decoding*")
+
+
 ;;; @ for various Emacs variants
 ;;;
 
       (t               (require 'tm-orig))
       )
 
-(cond ((string-match "XEmacs\\|Lucid" emacs-version)
-       (defun tm:set-face-region (b e face)
-        (let ((overlay (make-extent b e)))
-          (set-extent-property overlay 'face face)
-          ))
-       )
-      ((and (>= emacs-major-version 19) window-system)
-       (defun tm:set-face-region (b e face)
-        (let ((overlay (make-overlay b e)))
-          (overlay-put overlay 'face face)
-          ))
-       )
-      ((and (boundp 'NEMACS) NEMACS)
-       (setq tm:available-face-attribute-alist
-            '((bold      . inversed-region)
-              (italic    . underlined-region)
-              (underline . underlined-region)
-              ))
-       (defun tm:set-face-region (beg end face)
-        (attribute-add-narrow-attribute
-         (cdr (assq face mime/available-face-attribute-alist))
-         beg end))
-       )
-      (t
-       (defun tm:set-face-region (beg end sym)
-        )
-       ))
+
+;;; @ 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
 ;;;