unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Checking if a function is built-in
@ 2008-06-10 21:08 Nordlöw
  2008-06-10 21:18 ` Marc Tfardy
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Nordlöw @ 2008-06-10 21:08 UTC (permalink / raw)
  To: help-gnu-emacs

Is there a predicate that can check if a function is built-in?

Thanks,
Nordlöw


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Checking if a function is built-in
  2008-06-10 21:08 Checking if a function is built-in Nordlöw
@ 2008-06-10 21:18 ` Marc Tfardy
  2008-06-10 21:46   ` Lennart Borgman (gmail)
  2008-06-10 21:50 ` Drew Adams
       [not found] ` <mailman.13020.1213134665.18990.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 9+ messages in thread
From: Marc Tfardy @ 2008-06-10 21:18 UTC (permalink / raw)
  To: help-gnu-emacs

Nordlöw schrieb:
> Is there a predicate that can check if a function is built-in?

,----[ C-h f fboundp RET ]
| fboundp is a built-in function in `C source code'.
| (fboundp symbol)
|
| Return t if symbol's function definition is not void.
|
| [back]
`----

regards
marc




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Checking if a function is built-in
  2008-06-10 21:18 ` Marc Tfardy
@ 2008-06-10 21:46   ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 9+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-10 21:46 UTC (permalink / raw)
  Cc: help-gnu-emacs

Marc Tfardy wrote:
> Nordlöw schrieb:
>> Is there a predicate that can check if a function is built-in?
> 
> ,----[ C-h f fboundp RET ]
> | fboundp is a built-in function in `C source code'.
> | (fboundp symbol)
> |
> | Return t if symbol's function definition is not void.
> |
> | [back]
> `----


This does not check if a function is built-in, but it gives a hint actually.

Look at the code for `describe-function'. Somewhere it writes "built-in".




^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: Checking if a function is built-in
  2008-06-10 21:08 Checking if a function is built-in Nordlöw
  2008-06-10 21:18 ` Marc Tfardy
@ 2008-06-10 21:50 ` Drew Adams
  2008-06-10 22:08   ` Drew Adams
       [not found] ` <mailman.13020.1213134665.18990.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-06-10 21:50 UTC (permalink / raw)
  To: 'Nordlöw', help-gnu-emacs

> Is there a predicate that can check if a function is built-in?

subrp 





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Checking if a function is built-in
       [not found] ` <mailman.13020.1213134665.18990.help-gnu-emacs@gnu.org>
@ 2008-06-10 22:06   ` Nordlöw
  2008-06-10 22:29   ` Nordlöw
  1 sibling, 0 replies; 9+ messages in thread
From: Nordlöw @ 2008-06-10 22:06 UTC (permalink / raw)
  To: help-gnu-emacs

On 10 Juni, 23:50, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > Is there a predicate that can check if a function is built-in?
>
> subrp

Thanks again, Drew!

I wonder why there isn't an alias builtinp() for this? I will create
one ;)

Thanks,
Nordlöw


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: Checking if a function is built-in
  2008-06-10 21:50 ` Drew Adams
@ 2008-06-10 22:08   ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2008-06-10 22:08 UTC (permalink / raw)
  To: 'Drew Adams', 'Nordlöw', help-gnu-emacs

> > Is there a predicate that can check if a function is built-in?
> 
> subrp 

I should have added that `i' in the Elisp manual, then typing `built-in TAB'
gets you to node `What Is a Function', which describes `subrp'.

`i' is your friend in Info. The indexes have improved a good deal in recent
releases, thanks in particular to Eli's efforts.

If you find something that you think should be indexed but is not, please point
it out here or via `M-x report-emacs-bug'. 





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Checking if a function is built-in
       [not found] ` <mailman.13020.1213134665.18990.help-gnu-emacs@gnu.org>
  2008-06-10 22:06   ` Nordlöw
@ 2008-06-10 22:29   ` Nordlöw
  2008-06-10 22:51     ` Drew Adams
       [not found]     ` <mailman.13025.1213138324.18990.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 9+ messages in thread
From: Nordlöw @ 2008-06-10 22:29 UTC (permalink / raw)
  To: help-gnu-emacs

On 10 Juni, 23:50, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > Is there a predicate that can check if a function is built-in?
>
> subrp

I thought this was the way to use it
  (subrp 'cons)
but it returns nil even though cons is a built-in function.

Have I missed something?

Thanks,
Nordlöw


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: Checking if a function is built-in
  2008-06-10 22:29   ` Nordlöw
@ 2008-06-10 22:51     ` Drew Adams
       [not found]     ` <mailman.13025.1213138324.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2008-06-10 22:51 UTC (permalink / raw)
  To: 'Nordlöw', help-gnu-emacs

> > > Is there a predicate that can check if a function is built-in?
> >
> > subrp
> 
> I thought this was the way to use it (subrp 'cons)
> but it returns nil even though cons is a built-in function.
> Have I missed something?

(subrp (symbol-function 'cons))

`cons' is just a symbol. What you want to test is the function that the symbol
refers to. 

This is not the value of the symbol but the value of its function cell, which is
a function (a subr, in this case).





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Checking if a function is built-in
       [not found]     ` <mailman.13025.1213138324.18990.help-gnu-emacs@gnu.org>
@ 2008-06-10 23:11       ` Nordlöw
  0 siblings, 0 replies; 9+ messages in thread
From: Nordlöw @ 2008-06-10 23:11 UTC (permalink / raw)
  To: help-gnu-emacs

On 11 Juni, 00:51, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > > Is there a predicate that can check if a function is built-in?
>
> > > subrp
>
> > I thought this was the way to use it (subrp 'cons)
> > but it returns nil even though cons is a built-in function.
> > Have I missed something?
>
> (subrp (symbol-function 'cons))
>
> `cons' is just a symbol. What you want to test is the function that the symbol
> refers to.
>
> This is not the value of the symbol but the value of its function cell, which is
> a function (a subr, in this case).

Great!

Now I got it!

Many Thanks,
Nordlöw


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-06-10 23:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-10 21:08 Checking if a function is built-in Nordlöw
2008-06-10 21:18 ` Marc Tfardy
2008-06-10 21:46   ` Lennart Borgman (gmail)
2008-06-10 21:50 ` Drew Adams
2008-06-10 22:08   ` Drew Adams
     [not found] ` <mailman.13020.1213134665.18990.help-gnu-emacs@gnu.org>
2008-06-10 22:06   ` Nordlöw
2008-06-10 22:29   ` Nordlöw
2008-06-10 22:51     ` Drew Adams
     [not found]     ` <mailman.13025.1213138324.18990.help-gnu-emacs@gnu.org>
2008-06-10 23:11       ` Nordlöw

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).