From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Greg Hill Newsgroups: gmane.emacs.help Subject: Re: Built-in Functions and Special Forms Date: Wed, 26 Feb 2003 20:02:04 -0800 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============24651343418856775==" X-Trace: main.gmane.org 1046318573 12694 80.91.224.249 (27 Feb 2003 04:02:53 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 27 Feb 2003 04:02:53 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18oFFz-0003IZ-00 for ; Thu, 27 Feb 2003 05:02:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18oFFK-0000Gl-05 for gnu-help-gnu-emacs@m.gmane.org; Wed, 26 Feb 2003 23:02:10 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18oFEr-00081Q-00 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 23:01:41 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18oFEe-00078u-00 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 23:01:33 -0500 Original-Received: from renfield.synergymicro.com ([153.105.4.30] helo=synergymicro.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18oFEY-0006u3-00 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2003 23:01:22 -0500 Original-Received: from synergy.synergy.encinitas.ca.us ([153.105.4.29]) by synergymicro.com (8.9.3/8.9.3) with ESMTP id UAA04360 for ; Wed, 26 Feb 2003 20:02:11 -0800 Original-Received: from [198.17.100.22] (G-Hill-Mac [198.17.100.22])UAA03552 for ; Wed, 26 Feb 2003 20:07:46 -0800 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7173 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7173 --===============24651343418856775== content-type: multipart/alternative; boundary="============_-1165803971==_ma============" --============_-1165803971==_ma============ Content-Type: text/plain; charset="us-ascii" ; format="flowed" >At 2:38 AM +0100 2/27/03, Pascal Bourguignon wrote: >>I've not found any predicate to distinguish between built-in functions >>and special forms. > >In Emacs-21, the documentation is consistent enough that this seems >to always work. > >(defun special-form-p (symbol) > (string-match "\\.\\.\\.\\|&rest" (documentation symbol))) Of course that should really be: (defun special-form-p (symbol) (and (subrp (symbol-function symbol)) (string-match "\\.\\.\\.\\|&rest" (documentation symbol)))) --Greg --============_-1165803971==_ma============ Content-Type: text/html; charset="us-ascii" Re: Built-in Functions and Special Forms
At 2:38 AM +0100 2/27/03, Pascal Bourguignon wrote:
I've not found any predicate to distinguish between built-in functions
and special forms.

In Emacs-21, the documentation is consistent enough that this seems to always work.

(defun special-form-p (symbol)
    (string-match "\\.\\.\\.\\|&rest" (documentation symbol)))
 
Of course that should really be:

(defun special-form-p (symbol)
    (and (subrp (symbol-function symbol))
         (string-match "\\.\\.\\.\\|&rest" (documentation symbol))))
 
--Greg
--============_-1165803971==_ma============-- --===============24651343418856775== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://mail.gnu.org/mailman/listinfo/help-gnu-emacs --===============24651343418856775==--