From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: googleartist@yahoo.com (Artist) Newsgroups: gmane.emacs.help Subject: Re: Built-in Functions and Special Forms Date: 28 Feb 2003 10:51:07 -0800 Organization: http://groups.google.com/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1046458773 27176 80.91.224.249 (28 Feb 2003 18:59:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 28 Feb 2003 18:59:33 +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 18opjI-000748-00 for ; Fri, 28 Feb 2003 19:59:32 +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 18oph9-0001eJ-05 for gnu-help-gnu-emacs@m.gmane.org; Fri, 28 Feb 2003 13:57:19 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-NNTP-Posting-Host: 208.159.24.160 Original-X-Trace: posting.google.com 1046458267 30337 127.0.0.1 (28 Feb 2003 18:51:07 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 28 Feb 2003 18:51:07 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:110727 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:7228 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7228 Greg Hill wrote in message news:... > >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 > -- Code below works fine. (defun my-special-forms () (let ((internals () )) (mapatoms (lambda (sym) (when (and (functionp sym) (subrp (symbol-function sym)) (eq 'unevalled (cdr (subr-arity (symbol-function sym)))) ) (push sym internals) ) ) ) internals ; (insert (format "%S\n" internals)) ) )