From: tmorioka Date: Fri, 28 Feb 1997 05:29:00 +0000 (+0000) Subject: (defun-maybe): New macro; copied from emu.el. X-Git-Tag: Hokutetsu-Ishikawa-new~219 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9a15a7eadfc49fbe079c9523ba33a37dfb9d52c;p=elisp%2Fsemi.git (defun-maybe): New macro; copied from emu.el. (functionp): New function; copied from emu.el. --- 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 ;;;