help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Built-in Functions and Special Forms


From: Artist
Subject: Re: Built-in Functions and Special Forms
Date: 28 Feb 2003 10:51:07 -0800

Greg Hill <ghill@synergymicro.com> wrote in message 
news:<mailman.2511.1046318512.21513.help-gnu-emacs@gnu.org>...
> >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))
)
)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]