all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: [External] : M-. vs C-h o
Date: Fri, 22 Oct 2021 10:43:00 +0800	[thread overview]
Message-ID: <CAGP6PO+TKj3KwVDz2+j9KWUJNt5xLu5SZ3HSxKKYnijVgPaeJw@mail.gmail.com> (raw)
In-Reply-To: <875ytplrid.fsf@telefonica.net>

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



  reply	other threads:[~2021-10-22  2:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-10-22  6:25 ` Eli Zaretskii
2021-10-22  6:56   ` Hongyi Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGP6PO+TKj3KwVDz2+j9KWUJNt5xLu5SZ3HSxKKYnijVgPaeJw@mail.gmail.com \
    --to=hongyi.zhao@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ofv@wanadoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.