From b9a15a7eadfc49fbe079c9523ba33a37dfb9d52c Mon Sep 17 00:00:00 2001 From: tmorioka Date: Fri, 28 Feb 1997 05:29:00 +0000 Subject: [PATCH] (defun-maybe): New macro; copied from emu.el. (functionp): New function; copied from emu.el. --- mime-def.el | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/mime-def.el b/mime-def.el index e6c845b..f8d85c3 100644 --- a/mime-def.el +++ b/mime-def.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko -;; Version: $Id: mime-def.el,v 0.33 1997-02-28 05:01:58 tmorioka Exp $ +;; Version: $Id: mime-def.el,v 0.34 1997-02-28 05:29:00 tmorioka Exp $ ;; Keywords: definition, MIME, multimedia, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -558,6 +558,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 ;;; -- 1.7.10.4