Is there a way to check the implementation of a builtin function (e.g. load-file
) without cloning the Emacs repository?
3 Answers
For load-file
C-h f load-file
then follow the link from the first line, in this case:
load-file is an interactive compiled Lisp function in ‘files.el’.
will open the elisp function definition, C source code, AFAIK, will require the repo.
On debian, and I guess on Ubuntu as well, the elisp sources (.el files as opposed to byte compiled .elc files) are available in the emacs-el
package.
The elisp sources are not provided in the basic emacs package since they're not necessary to run emacs, only usefull if, like you do, you want to look at the source.
So absolutely don't need to clone the emacs repo, you just need to install that emacs-el package, eg
sudo apt-get install emacs-el
If you are interested in looking at a file from a computer that Emacs isn't even installed on, you can take the filename it's found in from help (C-h f load-file RET), then browse the source at Emacs's GNU Savannah repository, or the Github mirror.
This code will be later than the version of Emacs you're using, and it may be different in important ways.
.el
(or.el.gz
) sources, Emacs will take you to the definitions by default when you ask for help about a function (or variable) and follow the link provided.