all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* is subrp/subr-primitive-p ever non-nil?
@ 2022-07-15 10:54 Philip Kaludercic
  2022-07-15 10:59 ` Philip Kaludercic
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Kaludercic @ 2022-07-15 10:54 UTC (permalink / raw)
  To: binarydigitz01 via Users list for the GNU Emacs text editor


Evaluating this code doesn't generate any messages at all

--8<---------------cut here---------------start------------->8---
(mapatoms
 (lambda (sym)
   (when (subrp sym)
     (message "(subrp %s) => t" sym t))
   (when (subr-primitive-p sym)
     (message "(subr-primitive-p %s) => t" sym))))
--8<---------------cut here---------------end--------------->8---

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?



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

* Re: is subrp/subr-primitive-p ever non-nil?
  2022-07-15 10:54 is subrp/subr-primitive-p ever non-nil? Philip Kaludercic
@ 2022-07-15 10:59 ` Philip Kaludercic
  0 siblings, 0 replies; 2+ messages in thread
From: Philip Kaludercic @ 2022-07-15 10:59 UTC (permalink / raw)
  To: binarydigitz01 via Users list for the GNU Emacs text editor

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



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

end of thread, other threads:[~2022-07-15 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-15 10:54 is subrp/subr-primitive-p ever non-nil? Philip Kaludercic
2022-07-15 10:59 ` Philip Kaludercic

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.