🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.emacs
Article #8238

Re: Is a GNUemacs function defined?

#8238
From: Ashwin Ram
Date: Fri, 06 Jan 1989 15:30
28 lines
1735 bytes
In article <2941@uhccux.uhcc.hawaii.edu>, lupton@uhccux.uhcc.hawaii.edu (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.

I think the "right" way to do this is to have your package of utilities
"provide" a "feature" that you can then "require" wherever you need it.  For
example, you might put the following line in your c-utils.el file:

        (provide 'c-utils)

Then you can ensure that the c-utils feature is present by saying:

        (require 'c-utils)
or      (require 'c-utils "file-to-load-from")

This line will automatically load "c-utils" (or "file-to-load-from" in the
second case) if the feature c-utils has not yet been provided.

-- Ashwin.
Technical Details
Message-ID: <47034@yale-celray.yale.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!yale!Ram-Ashwin
References: <2941@uhccux.uhcc.hawaii.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!yale!Ram-Ashwin
From: Ram-Ashwin@cs.yale.edu (Ashwin Ram)
Newsgroups: comp.emacs
Subject: Re: Is a GNUemacs function defined?
Keywords: GNU lisp
Message-ID: <47034@yale-celray.yale.UUCP>
Date: 6 Jan 89 15:30:42 GMT
References: <2941@uhccux.uhcc.hawaii.edu>
Sender: root@yale.UUCP
Reply-To: Ram-Ashwin@cs.yale.edu (Ashwin Ram)
Organization: Computer Science, Yale University, New Haven, CT 06520-2158
Lines: 28
In-reply-to: lupton@uhccux.uhcc.hawaii.edu (Robert Lupton)