[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is subrp/subr-primitive-p ever non-nil?
From: |
Philip Kaludercic |
Subject: |
Re: is subrp/subr-primitive-p ever non-nil? |
Date: |
Fri, 15 Jul 2022 10:59:21 +0000 |
Philip Kaludercic <philipk@posteo.net> writes:
> Evaluating this code doesn't generate any messages at all
>
> (mapatoms
> (lambda (sym)
> (when (subrp sym)
> (message "(subrp %s) => t" sym t))
^
ignore this typo
> (when (subr-primitive-p sym)
> (message "(subr-primitive-p %s) => t" sym))))
>
> For reference, M-x emacs-version gives me
>
> GNU Emacs 29.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 3.24.34,
> cairo version 1.17.6) of 2022-07-13
>
> and native compilation is enabled.
>
> I am wondering if this is intentional or if it could be a bug?
Never mind, my mistake was assuming that passing the symbol would do the
job, while I actually had to use `symbol-function'. This does what I
wanted
--8<---------------cut here---------------start------------->8---
(mapatoms
(lambda (sym)
(let ((func (symbol-function sym)))
(when (subrp func)
(message "(subrp %s) => t" sym))
(when (subr-primitive-p func)
(message "(subr-primitive-p %s) => t" sym)))))
--8<---------------cut here---------------end--------------->8---