Sync up with the latest semi-1_13 branch.
[elisp/semi.git] / semi-def.el
index 93804ae..4292f0c 100644 (file)
@@ -1,8 +1,8 @@
-;;; semi-def.el --- definition module for REMI
+;;; semi-def.el --- definition module for SEMI -*- coding: iso-8859-4; -*-
 
-;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
 
-;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Author: MORIOKA Tomohiko <tomo@m17n.org>
 ;; Keywords: definition, MIME, multimedia, mail, news
 
 ;; This file is part of SEMI (Sample of Emacs MIME Implementation).
 
 ;;; Code:
 
-(require 'emu)
+(require 'poe)
 
 (eval-when-compile (require 'cl))
 
 (require 'custom)
 
-(defconst mime-user-interface-version '("SEMI" "Higashi-Toyama" 1 7 1)
-  "Implementation name, version name and numbers of MIME-kernel package.")
+(defconst mime-user-interface-product ["REMI" (1 13 2) "Òike-Ikoinomori"]
+  "Product name, version number and code name of MIME-kernel package.")
 
 (autoload 'mule-caesar-region "mule-caesar"
   "Caesar rotation of current region." t)
          (apply func data)
        (if (fboundp mime-button-mother-dispatcher)
            (funcall mime-button-mother-dispatcher event)
-         )
-       ))))
+         )))))
+
+
+;;; @ for URL
+;;;
+
+(defcustom mime-browse-url-regexp
+  (concat "\\(http\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):"
+         "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?"
+         "[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
+  "*Regexp to match URL in text body."
+  :group 'mime
+  :type 'regexp)
+
+(defcustom mime-browse-url-function (function browse-url)
+  "*Function to browse URL."
+  :group 'mime
+  :type 'function)
+
+(defsubst mime-add-url-buttons ()
+  "Add URL-buttons for text body."
+  (goto-char (point-min))
+  (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))))))
 
 
 ;;; @ menu
 ;;; @ PGP
 ;;;
 
+(defcustom pgp-version 'pgp
+  "Version of PGP or GnuPG command to be used for encryption or sign.
+The value should be a symbol.  Allowed versions are:
+
+  gpg   - GnuPG.
+  pgp50 - PGP version 5.0i.
+  pgp   - PGP version 2.6."
+  :group 'mime
+  :type '(radio (choice-item :tag "GnuPG" gpg)
+               (choice-item :tag "PGP 5.0i" pgp50)
+               (choice-item :tag "PGP 2.6" pgp)))
+
 (defvar pgp-function-alist
   '(
     ;; for mime-pgp
-    (verify            mc-verify                       "mc-toplev")
-    (decrypt           mc-decrypt                      "mc-toplev")
-    (fetch-key         mc-pgp-fetch-key                "mc-pgp")
-    (snarf-keys                mc-snarf-keys                   "mc-toplev")
+    (verify            mime-mc-verify                  "mime-mc")
+    (decrypt           mime-mc-decrypt                 "mime-mc")
+    (fetch-key         mime-mc-fetch-key               "mime-mc")
+    (snarf-keys                mime-mc-snarf-keys              "mime-mc")
     ;; for mime-edit
-    (mime-sign         mime-mc-pgp-sign-region         "mime-mc")
-    (traditional-sign  mc-pgp-sign-region              "mc-pgp")
-    (encrypt           mime-mc-pgp-encrypt-region      "mime-mc")
-    (insert-key                mc-insert-public-key            "mc-toplev")
+    (mime-sign         mime-mc-sign-region             "mime-mc")
+    (traditional-sign  mime-mc-traditional-sign-region "mime-mc")
+    (encrypt           mime-mc-encrypt-region          "mime-mc")
+    (insert-key                mime-mc-insert-public-key       "mime-mc")
     )
   "Alist of service names vs. corresponding functions and its filenames.
 Each element looks like (SERVICE FUNCTION FILE).
@@ -179,73 +216,6 @@ FUNCTION.")
        pgp-function-alist)
 
 
-;;; @ field
-;;;
-
-(defun tm:set-fields (sym field-list &optional regexp-sym)
-  (or regexp-sym
-      (setq regexp-sym
-           (let ((name (symbol-name sym)))
-             (intern
-              (concat (if (string-match "\\(.*\\)-list" name)
-                          (substring name 0 (match-end 1))
-                        name)
-                      "-regexp")
-              )))
-      )
-  (set sym field-list)
-  (set regexp-sym
-       (concat "^" (apply (function regexp-or) field-list) ":"))
-  )
-
-(defun tm:add-fields (sym field-list &optional regexp-sym)
-  (or regexp-sym
-      (setq regexp-sym
-           (let ((name (symbol-name sym)))
-             (intern
-              (concat (if (string-match "\\(.*\\)-list" name)
-                          (substring name 0 (match-end 1))
-                        name)
-                      "-regexp")
-              )))
-      )
-  (let ((fields (eval sym)))
-    (mapcar (function
-            (lambda (field)
-              (or (member field fields)
-                  (setq fields (cons field fields))
-                  )
-              ))
-           (reverse field-list)
-           )
-    (set regexp-sym
-        (concat "^" (apply (function regexp-or) fields) ":"))
-    (set sym fields)
-    ))
-
-(defun tm:delete-fields (sym field-list &optional regexp-sym)
-  (or regexp-sym
-      (setq regexp-sym
-           (let ((name (symbol-name sym)))
-             (intern
-              (concat (if (string-match "\\(.*\\)-list" name)
-                          (substring name 0 (match-end 1))
-                        name)
-                      "-regexp")
-              )))
-      )
-  (let ((fields (eval sym)))
-    (mapcar (function
-            (lambda (field)
-              (setq fields (delete field fields))
-              ))
-           field-list)
-    (set regexp-sym
-        (concat "^" (apply (function regexp-or) fields) ":"))
-    (set sym fields)
-    ))
-
-
 ;;; @ Other Utility
 ;;;