* M-. vs C-h o
@ 2021-10-22 0:28 Hongyi Zhao
2021-10-22 0:33 ` Emanuel Berg via Users list for the GNU Emacs text editor
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Hongyi Zhao @ 2021-10-22 0:28 UTC (permalink / raw)
To: help-gnu-emacs
See the following returned info, with point indicated by | on mapc:
M-. map|c
DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
doc: /* Apply FUNCTION to each element of SEQUENCE for side effects only.
Unlike `mapcar', don't accumulate the results. Return SEQUENCE.
SEQUENCE may be a list, a vector, a bool-vector, or a string. */)
C-h o mapc RET
mapc is a built-in function in ‘src/fns.c’.
(mapc FUNCTION SEQUENCE)
Apply FUNCTION to each element of SEQUENCE for side effects only.
Unlike ‘mapcar’, don’t accumulate the results. Return SEQUENCE.
SEQUENCE may be a list, a vector, a bool-vector, or a string.
So, I want to know the correspondence of the following two descriptions:
DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
and
(mapc FUNCTION SEQUENCE)
Regards
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-. vs C-h o
2021-10-22 0:28 M-. vs C-h o Hongyi Zhao
@ 2021-10-22 0:33 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-22 1:06 ` [External] : " Drew Adams
2021-10-22 6:25 ` Eli Zaretskii
2 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-22 0:33 UTC (permalink / raw)
To: help-gnu-emacs
Hongyi Zhao wrote:
> See the following returned info, with point indicated by | on mapc:
>
> M-. map|c
>
> DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
> doc: /* Apply FUNCTION to each element of SEQUENCE for side effects only.
> Unlike `mapcar', don't accumulate the results. Return SEQUENCE.
> SEQUENCE may be a list, a vector, a bool-vector, or a string. */)
>
> C-h o mapc RET
>
> mapc is a built-in function in ‘src/fns.c’.
>
> (mapc FUNCTION SEQUENCE)
>
> Apply FUNCTION to each element of SEQUENCE for side effects only.
> Unlike ‘mapcar’, don’t accumulate the results. Return SEQUENCE.
> SEQUENCE may be a list, a vector, a bool-vector, or a string.
>
> So, I want to know the correspondence of the following two descriptions:
>
> DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
>
> and
>
> (mapc FUNCTION SEQUENCE)
Not following?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [External] : M-. vs C-h o
2021-10-22 0:28 M-. vs C-h o Hongyi Zhao
2021-10-22 0:33 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-22 1:06 ` Drew Adams
2021-10-22 1:17 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-22 6:25 ` Eli Zaretskii
2 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2021-10-22 1:06 UTC (permalink / raw)
To: Hongyi Zhao, help-gnu-emacs
> mapc is a built-in function in ‘src/fns.c’.
That tells you that it's a Lisp function that's
"built-in", meaning that it's implemented in C.
And it points you to the C definition in fns.c.
That C code provides the complete definition,
including the doc string.
> DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
That tells you that Lisp function `mapc' is
defined using C definition Fmapc, and the
function takes two arguments. Someone else
can provide or point you to more info about
this.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [External] : M-. vs C-h o
2021-10-22 1:06 ` [External] : " Drew Adams
@ 2021-10-22 1:17 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-22 1:58 ` Hongyi Zhao
0 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-22 1:17 UTC (permalink / raw)
To: help-gnu-emacs
Drew Adams wrote:
>> mapc is a built-in function in ‘src/fns.c’.
>
> That tells you that it's a Lisp function that's "built-in",
> meaning that it's implemented in C.
A so-called Lisp primitive ...
"Lisp primitives are Lisp functions implemented in C"
http://www.gnu.org/software/emacs/manual/html_node/elisp/Writing-Emacs-Primitives.html
(info "(elisp)Writing Emacs Primitives")
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [External] : M-. vs C-h o
2021-10-22 1:17 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-22 1:58 ` Hongyi Zhao
2021-10-22 2:31 ` Óscar Fuentes
0 siblings, 1 reply; 9+ messages in thread
From: Hongyi Zhao @ 2021-10-22 1:58 UTC (permalink / raw)
To: Emanuel Berg, help-gnu-emacs
On Fri, Oct 22, 2021 at 9:18 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Drew Adams wrote:
>
> >> mapc is a built-in function in ‘src/fns.c’.
> >
> > That tells you that it's a Lisp function that's "built-in",
> > meaning that it's implemented in C.
>
> A so-called Lisp primitive ...
>
> "Lisp primitives are Lisp functions implemented in C"
>
> http://www.gnu.org/software/emacs/manual/html_node/elisp/Writing-Emacs-Primitives.html
> (info "(elisp)Writing Emacs Primitives")
Thank you for pointing this out. I've `rg'ed the local Emacs git
source code repo, and it seems still difficult to pinpoint the
corresponding C source code implementation of DEFUN.
HZ
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [External] : M-. vs C-h o
2021-10-22 1:58 ` Hongyi Zhao
@ 2021-10-22 2:31 ` Óscar Fuentes
2021-10-22 2:43 ` Hongyi Zhao
0 siblings, 1 reply; 9+ messages in thread
From: Óscar Fuentes @ 2021-10-22 2:31 UTC (permalink / raw)
To: help-gnu-emacs
Hongyi Zhao <hongyi.zhao@gmail.com> writes:
> Thank you for pointing this out. I've `rg'ed the local Emacs git
> source code repo, and it seems still difficult to pinpoint the
> corresponding C source code implementation of DEFUN.
>
> HZ
DEFUN is a macro. If you search for
#define DEFUN
you will find it in src/lisp.h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [External] : M-. vs C-h o
2021-10-22 2:31 ` Óscar Fuentes
@ 2021-10-22 2:43 ` Hongyi Zhao
0 siblings, 0 replies; 9+ messages in thread
From: Hongyi Zhao @ 2021-10-22 2:43 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: help-gnu-emacs
On Fri, Oct 22, 2021 at 10:31 AM Óscar Fuentes <ofv@wanadoo.es> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > Thank you for pointing this out. I've `rg'ed the local Emacs git
> > source code repo, and it seems still difficult to pinpoint the
> > corresponding C source code implementation of DEFUN.
> >
> > HZ
>
> DEFUN is a macro. If you search for
>
> #define DEFUN
>
> you will find it in src/lisp.h
Do you mean the following search result?
$ rg -A17 -B27 -uu '#define DEFUN\(lname' src/
src/lisp.h
3022-/* Define a built-in function for calling from Lisp.
3023- `lname' should be the name to give the function in Lisp,
3024- as a null-terminated C string.
3025- `fnname' should be the name of the function in C.
3026- By convention, it starts with F.
3027- `sname' should be the name for the C constant structure
3028- that records information on this function for internal use.
3029- By convention, it should be the same as `fnname' but with S
instead of F.
3030- It's too bad that C macros can't compute this from `fnname'.
3031- `minargs' should be a number, the minimum number of arguments allowed.
3032- `maxargs' should be a number, the maximum number of arguments allowed,
3033- or else MANY or UNEVALLED.
3034- MANY means pass a vector of evaluated arguments,
3035- in the form of an integer number-of-arguments
3036- followed by the address of a vector of Lisp_Objects
3037- which contains the argument values.
3038- UNEVALLED means pass the list of unevaluated arguments
3039- `intspec' says how interactive arguments are to be fetched.
3040- If the string starts with a `(', `intspec' is evaluated and
the resulting
3041- list is the list of arguments.
3042- If it's a string that doesn't start with `(', the value should follow
3043- the one of the doc string for `interactive'.
3044- A null string means call interactively with no arguments.
3045- `doc' is documentation for the user. */
3046-
3047-/* This version of DEFUN declares a function prototype with the right
3048- arguments, so we can catch errors with maxargs at compile-time. */
3049:#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
3050- SUBR_SECTION_ATTRIBUTE \
3051- static union Aligned_Lisp_Subr sname = \
3052- {{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
3053- { .a ## maxargs = fnname }, \
3054- minargs, maxargs, lname, {intspec}, 0}}; \
3055- Lisp_Object fnname
3056-
3057-/* defsubr (Sname);
3058- is how we define the symbol for function `name' at start-up time. */
3059-extern void defsubr (union Aligned_Lisp_Subr *);
3060-
3061-enum maxargs
3062- {
3063- MANY = -2,
3064- UNEVALLED = -1
3065- };
3066-
HZ
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-. vs C-h o
2021-10-22 0:28 M-. vs C-h o Hongyi Zhao
2021-10-22 0:33 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-22 1:06 ` [External] : " Drew Adams
@ 2021-10-22 6:25 ` Eli Zaretskii
2021-10-22 6:56 ` Hongyi Zhao
2 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2021-10-22 6:25 UTC (permalink / raw)
To: help-gnu-emacs
> From: Hongyi Zhao <hongyi.zhao@gmail.com>
> Date: Fri, 22 Oct 2021 08:28:48 +0800
>
> So, I want to know the correspondence of the following two descriptions:
>
> DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
>
> and
>
> (mapc FUNCTION SEQUENCE)
'mapc' is a "primitive", i.e. a Lisp-callable function that's
implemented in C. I suggest to read the node "Writing Emacs
Primitives" in the ELisp manual, it will explain that to you.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-. vs C-h o
2021-10-22 6:25 ` Eli Zaretskii
@ 2021-10-22 6:56 ` Hongyi Zhao
0 siblings, 0 replies; 9+ messages in thread
From: Hongyi Zhao @ 2021-10-22 6:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Fri, Oct 22, 2021 at 2:26 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Hongyi Zhao <hongyi.zhao@gmail.com>
> > Date: Fri, 22 Oct 2021 08:28:48 +0800
> >
> > So, I want to know the correspondence of the following two descriptions:
> >
> > DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
> >
> > and
> >
> > (mapc FUNCTION SEQUENCE)
>
> 'mapc' is a "primitive", i.e. a Lisp-callable function that's
> implemented in C. I suggest to read the node "Writing Emacs
> Primitives" in the ELisp manual, it will explain that to you.
Thank you. Emanuel Berg has told me the following:
(info "(elisp)Writing Emacs Primitives")
HZ
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-10-22 6:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-22 0:28 M-. vs C-h o Hongyi Zhao
2021-10-22 0:33 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-22 1:06 ` [External] : " Drew Adams
2021-10-22 1:17 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-22 1:58 ` Hongyi Zhao
2021-10-22 2:31 ` Óscar Fuentes
2021-10-22 2:43 ` Hongyi Zhao
2021-10-22 6:25 ` Eli Zaretskii
2021-10-22 6:56 ` Hongyi Zhao
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).