From: "Drew Adams" <drew.adams@oracle.com>
To: <help-gnu-emacs@gnu.org>
Subject: RE: How to avoid loading file when just testing if function
Date: Mon, 2 Apr 2012 08:00:11 -0700 [thread overview]
Message-ID: <9828C4CD4E1249CA8A313DAE15343F49@us.oracle.com> (raw)
In-Reply-To: <F326B9A37B353A449FC7A09B36835F82F4E847@MACE.sppdg.ad>
FWIW - I believe that someone else has already pointed out that the test for
whether a symbol is bound to a function and not just to an autoloaded object
(which is a promise of loading a function) is this:
(defun funp (symbol)
"SYMBOL's function definition is non-void and not an autoload object."
(and (fboundp symbol)
(not (eq 'autoload (car-safe (symbol-function symbol))
Such a function should perhaps be predefined for Emacs, but it is not. There
are at least three things to keep in mind when testing whether a symbol is
defined as an Emacs-Lisp "function", depending on what you need: `fboundp',
`functionp', and the above test (`funp').
Other tests are sometimes relevant too: `subrp' and `byte-code-functionp'. And
remember that `functionp' returns non-nil also for some non-symbols: lambda
forms, closures, and byte-code functions. And `fboundp' returns non-nil for
some non-functions such as macros and special forms.
Then there's the fact that a Lisp "function" does not necessarily implement a
(mathematical) function... Yes, the terminology can be confusing. The Elisp
manual is your friend, as is the Emacs source code.
prev parent reply other threads:[~2012-04-02 15:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 14:24 How to avoid loading file when just testing if function Buchs, Kevin
2012-04-02 15:00 ` Drew Adams [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9828C4CD4E1249CA8A313DAE15343F49@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).