Require cl.
[elisp/semi.git] / mime-def.el
index 4cf573f..28f7ef1 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: mime-def.el,v 0.32 1997-02-28 04:57:30 tmorioka Exp $
+;; Version: $Id: mime-def.el,v 0.35 1997-02-28 06:46:48 tmorioka Exp $
 ;; Keywords: definition, MIME, multimedia, mail, news
 
 ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
@@ -25,6 +25,9 @@
 
 ;;; Code:
 
+(require 'cl)
+
+
 ;;; @ variables
 ;;;
 
@@ -277,7 +280,7 @@ FUNCTION.")
       )))
 
 (defun field-unify (a b)
-  (let ((sym (intern (concat "field-unifier-for-" (symbol-value (car a))))))
+  (let ((sym (intern (concat "field-unifier-for-" (symbol-name (car a))))))
     (or (fboundp sym)
        (setq sym (function field-unifier-for-default))
        )
@@ -558,6 +561,28 @@ it is used as hook to set."
     (add-hook hook-name func)
     ))
 
+(defmacro defun-maybe (name &rest everything-else)
+  (or (and (fboundp name)
+          (not (get name 'defun-maybe))
+          )
+      `(or (fboundp (quote ,name))
+          (progn
+            (defun ,name ,@everything-else)
+            (put (quote ,name) 'defun-maybe t)
+            ))
+      ))
+
+(put 'defun-maybe 'lisp-indent-function 'defun)
+
+(defun-maybe functionp (obj)
+  "Returns t if OBJ is a function, nil otherwise.
+\[XEmacs emulating function]"
+  (or (subrp obj)
+      (byte-code-function-p obj)
+      (and (symbolp obj)(fboundp obj))
+      (and (consp obj)(eq (car obj) 'lambda))
+      ))
+
 
 ;;; @ end
 ;;;