This commit was manufactured by cvs2svn to create branch 'wemi'.
[elisp/semi.git] / semi-def.el
index 0a17b0d..fd7dac1 100644 (file)
@@ -1,11 +1,11 @@
-;;; semi-def.el --- definition module for SEMI
+;;; semi-def.el --- definition module for WEMI
 
 ;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;; Keywords: definition, MIME, multimedia, mail, news
 
-;; This file is part of SEMI (Sample of Emacs MIME Implementation).
+;; This file is part of WEMI (Widget based Emacs MIME Interfaces).
 
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -28,9 +28,8 @@
 
 (eval-when-compile (require 'cl))
 
-(require 'custom)
 
-(defconst mime-user-interface-version '("SEMI" "Takaoka" 1 8 4)
+(defconst mime-user-interface-version '("WEMI" "Katahama" 1 8 2)
   "Implementation name, version name and numbers of MIME-kernel package.")
 
 (autoload 'mule-caesar-region "mule-caesar"
   :group 'mime
   :type 'face)
 
-(defsubst mime-add-button (from to function &optional data)
-  "Create a button between FROM and TO with callback FUNCTION and DATA."
-  (let ((overlay (make-overlay from to)))
-    (and mime-button-face
-        (overlay-put overlay 'face mime-button-face))
-    (and mime-button-mouse-face
-        (overlay-put overlay 'mouse-face mime-button-mouse-face))
-    (add-text-properties from to (list 'mime-button-callback function))
-    (and data
-        (add-text-properties from to (list 'mime-button-data data)))
-    ))
-
 (defsubst mime-insert-button (string function &optional data)
   "Insert STRING as button with callback FUNCTION and DATA."
   (save-restriction
     (narrow-to-region (point)(point))
-    (insert (concat "[" string "]\n"))
-    (mime-add-button (point-min)(point-max) function data)
+    (mapcar #'(lambda (line)
+               (widget-create
+                'push-button
+                :action `(lambda (widget &optional event)
+                           (,function)
+                           )
+                :mouse-down-action `(lambda (widget event)
+                                      (let (buf point)
+                                        (save-window-excursion
+                                          (mouse-set-point event)
+                                          (setq buf (current-buffer)
+                                                point (point)))
+                                        (save-excursion
+                                          (set-buffer buf)
+                                          (goto-char point)
+                                          (,function)
+                                          )))
+                line)
+               (insert "\n")
+               )
+           (split-string string "\n"))
+    ;;(mime-add-button (point-min)(point-max) function data)
     ))
 
 (defvar mime-button-mother-dispatcher nil)
   (while (re-search-forward mime-browse-url-regexp nil t)
     (let ((beg (match-beginning 0))
          (end (match-end 0)))
-      (mime-add-button beg end mime-browse-url-function
-                      (list (buffer-substring beg end))))))
+      (widget-convert-text 'url-link beg end)
+      )))
 
 
 ;;; @ menu