Throughout the day I am constantly using C-h f
or C-h v
(describe-function
and describe-variable
) to look up documentation for functions and variables. More often than not, if I don't get all the information I need, I will click on the file link at the end of:
some-random-command is an interactive compiled Lisp function in `some-mode.el'.
and navigate to the source code. This works for installed packages, but doesn't seem to work for built-in ones. For example, at the top of the help page for the command describe-function
all I get is:
describe-function is an interactive compiled Lisp function.
with no link to the source code. Is there any way to quickly navigate to the source code of a built in package?
I know I can find source code in e.g., /usr/share/emacs/24.5/lisp
, and come up with any number of ways to access that directory quickly, but I am curious if there is a quick and easy way to navigate to a built-in function/variable definition in the source code. Thank you!
M-x find-function
;M-x find-variable
;M-x find-face
;M-x find-library
. I always use a full installation of Emacs so that I have access to everything, and just after building my own Emacs I copy over the C-source code and set its location so that I can find C-Source code definitions also. See the variablefind-function-C-source-directory
to set the location of the C-source code after you copy it over. – lawlist Jan 06 '16 at 05:31M-x describe-function
: describe-function is an interactive autoloaded compiled Lisp function in ‘help-fns.el’. And from there I can click on (or press enter on)help-fns.el
and am then transported to the applicable section of the code. Perhaps you have multiple Emacs versions, and the one your using at the moment doesn't have all the source code installed? – lawlist Jan 06 '16 at 05:48emacs -Q
(no init file), or if you can repro it with a recipe that starts withemacs -Q
(e.g. saying what libraries you load and how you load them etc.), then please consider filing a bug report:M-x report-emacs-bug
. – Drew Jan 06 '16 at 07:19.el
files (treated as optional) from the.elc
files (mandatory), such that you need to install one or more additional packages to get them. If you obtained Emacs from your OS package manager, perhaps this explains it. – phils Jan 06 '16 at 09:59describe-function
, butM-x describe-function
still works, so I don't think it is the case that the version I am using at the moment doesn't have all the source code installed. However, it still might be related to multiple versions as you suggest, so I will investigate in that direction when I get home. Also, thanks for bringing thefind-*
commands to my attention. If I just want to go right to source, these are great (but still need to try at home)! – elethan Jan 06 '16 at 15:31.elc
files do contain docstrings, so lacking source code would be consistent with the symptoms you describe. – npostavs Jan 06 '16 at 18:48.elc
file produced by byte-compiling the original source code. – npostavs Jan 06 '16 at 19:00/usr/bin/emacs
and/usr/bin/emacsclient
, and I have a version nicely packaged in an OSX application folder ending in .app -- i.e.,/Applications/Emacs.app
(inside that Emacs.app, are the binaries and all the source-code files). – lawlist Jan 07 '16 at 03:28