https://stackoverflow.com/questions/4222183/emacs-how-to-jump-to-function-definition-in-el-file and talk about navigation to source of functions. They offer two options:
- M-x find-function
- C-h f then use link in help buffer.
However, for a compiled function, neither work.
M-x find-function compilation-find-file
throws an error:
Debugger entered--Lisp error: (error "Can’t find library /usr/share/emacs/26.1+gg1+7/lisp/progmodes/compile.el")
If I used the help function path, I see:
compilation-find-file is a compiled Lisp function.
How can I fix these?
M-x find-function RET compilation-find-file RET
works fine for me (so long ascompile.el
has been loaded beforehand), despitecompilation-find-file
being a "compiled Lisp function". Does it work if you start withemacs -Q
followed by(require 'compile)
and then thefind-function
call? – Basil Aug 05 '18 at 16:02M-.
(xref-find-definitions
since Emacs 25) for jumping to the definition of the identifier at point, as briefly mentioned in the linked SO post. – Basil Aug 05 '18 at 16:03source-directory' and/or
load-path'. – Realraptor Aug 05 '18 at 16:12/usr/share/emacs/26.1+gg1+7/lisp/progmodes
and also the parent directory. If there is nothing there, thengrep
or manually look around for the.el
and/or.gz
files. There are minimal installations that do not install the Lisp libraries, but that is not very common and is certainly not the default installation method. – lawlist Aug 05 '18 at 16:21(require 'compile)
is needed becausecompilation-find-file
is not autoloaded or otherwise defined at startup. I wasn't suggesting it as a solution to your issue. Have you tried reproducing your issue starting withemacs -Q
? If it still doesn't work, then the problem lies with your installation, as lawlist mentions. – Basil Aug 05 '18 at 16:40apt-get install
) theemacs-el
andemacs25-common-non-dfsg
packages (substituting the version number as appropriate in the latter package name). The former provides the elisp source files, and the latter provides the manuals. You don't want to be lacking either of those things. – phils Aug 06 '18 at 00:04