Path: utzoo!utgpu!attcan!uunet!lll-winken!ames!mailrus!cornell!uw-beaver!blake!ogccse!littlei!omepd!merlyn From: merlyn@intelob.biin.com (Randal L. Schwartz @ Stonehenge) Newsgroups: comp.emacs Subject: fboundp/provide/require (was Re: Is a GNUemacs function defined?) Keywords: GNU lisp Message-ID: <4032@omepd.UUCP> Date: 6 Jan 89 21:20:05 GMT References: <2941@uhccux.uhcc.hawaii.edu> Sender: news@omepd.UUCP Reply-To: merlyn@intelob.biin.com (Randal L. Schwartz @ Stonehenge) Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA Lines: 41 In-reply-to: lupton@uhccux.uhcc.hawaii.edu (Robert Lupton) In article <2941@uhccux.uhcc.hawaii.edu>, lupton@uhccux (Robert Lupton) writes: | If I want to find if a name is defined as a function how do I do it? | Specifically, I have a package of utilities that define functions | like malloc (to produce a template for mallocing stuff), fopen, ... | and I want to put a line in my c-mode-hook that looks like | | (if (= malloc nil) | (load-file "c-utils.elc")) | | but it doesn't work (and 'malloc doesn't work either). I don't want to | use auto-load as I want to load on any of the functions in the file, | and I don't want to wrap all the definitions in a defun and auto-load on that. You can use `fboundp' like so: (if (not (fboundp 'malloc)) (load-file "c-utils.elc")) although provide/require might be better. To use that, stick: (provide 'c-utils) in the beginning of the c-utils.el[c] file, and: (require 'c-utils) in place of your 'if' test; it replaces the whole test, not just the `if' predicate. Note that "c-utils.elc" must now be in your load-path (set with EMACSLOADPATH environment variable or `set[q]'). If not, you can cheat, and say: (require 'c-utils "/usr/you/very/long/path/c-utils.elc") See doc-strings on these functions for details. Your mileage may vary. :-) -- Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 on contract to BiiN Technical Information Services (for now :-), in a former Intel building in Hillsboro, Oregon, USA. or ...!tektronix!inteloa[!intelob]!merlyn SOME MAILERS REQUIRE GRRRRR! Standard disclaimer: I *am* my employer!