From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: How to avoid loading file when just testing if function Date: Mon, 2 Apr 2012 08:00:11 -0700 Message-ID: <9828C4CD4E1249CA8A313DAE15343F49@us.oracle.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1333378834 4156 80.91.229.3 (2 Apr 2012 15:00:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 Apr 2012 15:00:34 +0000 (UTC) To: Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 02 17:00:34 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SEikB-0003YW-2h for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Apr 2012 17:00:31 +0200 Original-Received: from localhost ([::1]:41827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEikA-0003ig-Hi for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Apr 2012 11:00:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEik2-0003iB-8Y for help-gnu-emacs@gnu.org; Mon, 02 Apr 2012 11:00:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEijx-0001GA-G0 for help-gnu-emacs@gnu.org; Mon, 02 Apr 2012 11:00:21 -0400 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]:46585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEijx-0001Fk-9K for help-gnu-emacs@gnu.org; Mon, 02 Apr 2012 11:00:17 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q32F0DXU016887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 2 Apr 2012 15:00:14 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q32F0CGr001875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 2 Apr 2012 15:00:13 GMT Original-Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q32F0CeT018731 for ; Mon, 2 Apr 2012 10:00:12 -0500 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 02 Apr 2012 08:00:12 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 thread-index: Ac0Q25/my3zWwwlUSW2ITyU7hssS1AAAOikg X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-CT-RefId: str=0001.0A090203.4F79BEFE.0064,ss=1,re=0.000,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 148.87.113.117 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84255 Archived-At: 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.