How can I find function Fcopy_sequence in the Emacs C source code?
2 Answers
The function copy-sequence
is written in C
and is contained within the source code file fns.c
. If the source code files are available, they should be in a directory that matches the variable find-function-C-source-directory
(which can be adjusted as needed).
The decision whether to include source code files is generally made at the time Emacs is built from source, but they can be added in the desired location after Emacs is built and the above-mentioned variable can be adjusted accordingly.
See also the variable source-directory
. Keep in mind, however, that the function find-function-C-source
looks for source code files in the path set by the variable find-function-C-source-directory
(rather than the variable source-directory
).

- 18,826
- 5
- 37
- 118
-
I'm looking for the definition of C fuction Fcopy_sequence located in the main source code of emacs. – Quasar999 Apr 09 '22 at 18:48
-
When a function `DEFUN` is written in `C`, there is a common `DEFUN` name such as `copy-sequence` and also an internal function name `Fcopy_sequence`. It looks like this: `DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0, doc: /* Return a copy of a list ... */) (Lisp_Object arg) ...`. It is defined inside the file `.../emacs/src/fns.c` where `emacs` is the root repository. – lawlist Apr 09 '22 at 18:50
-
Here is a link to the Emacs 28 source code file `fns.c` beginning at line 695: http://git.savannah.gnu.org/cgit/emacs.git/tree/src/fns.c?h=emacs-28#n695 – lawlist Apr 09 '22 at 18:56
In the root of the source tree, run make tags
to build the various tags files.
Then in Emacs you can use M-x find-tag
to locate Fcopy_sequence
using the tags
file in the src
directory (where all of the C code lives).

- 48,657
- 3
- 76
- 115