I referenced C-h f apply for the source code of "apply", it prompts

C code is not yet loaded.

but does not hint the destination file.

Execute grep-find within Emacs repo thus return no results.

find . -type f -exec grep --color -nH --null -e 'int apply' \{\} +
Grep finished with no matches found at Thu Jan 16 18:47:40

How could locate the definition of apply in C code?


Your C-h f is not the standard C-h f (M-x describe-function), describe-function doesn't provide "References ..." information at all. To find the source of apply, use C-h f apply, it will say

apply is a built-in function in `src/eval.c'.

src/eval.c will be clickable, then click it to go to the source. If you didn't install Emacs from the source code by yourself, Emacs will ask you to input your "Emacs C source dir", you should enter the path of the Emacs git repo, alternatively, you also can set the variable source-directory or find-function-C-source-directory in your init file

(setq source-directory "/path/to/your-emacs-repo")

;; OR

(setq find-function-C-source-directory "/path/to/your-emacs-repo/src")

find . -type f -exec grep --color -nH --null -e 'int apply' {} +

We can't know whether apply is defined as a plain C function and its return value must be an integer, thus try something different, for example, search apply in all *.c files.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.