2

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?

Drew
  • 77,472
  • 10
  • 114
  • 243
Realraptor
  • 1,283
  • 7
  • 17
  • 1
    This sounds like something specific to your installation/setup; M-x find-function RET compilation-find-file RET works fine for me (so long as compile.el has been loaded beforehand), despite compilation-find-file being a "compiled Lisp function". Does it work if you start with emacs -Q followed by (require 'compile) and then the find-function call? – Basil Aug 05 '18 at 16:02
  • Note that there is also M-. (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:03
  • (require 'compile) does not change the observed behaviour. I am wondering if I need to play with source-directory' and/orload-path'. – Realraptor Aug 05 '18 at 16:12
  • 1
    Why not just take a peak inside the directory where Emacs is looking to see what is there? /usr/share/emacs/26.1+gg1+7/lisp/progmodes and also the parent directory. If there is nothing there, then grep 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
  • @Realraptor (require 'compile) is needed because compilation-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 with emacs -Q? If it still doesn't work, then the problem lies with your installation, as lawlist mentions. – Basil Aug 05 '18 at 16:40
  • 1
    In particular, a Debian/Ubuntu/etc installation may not include everything you want, and you may be missing (and hence need to apt-get install) the emacs-el and emacs25-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

1 Answers1

3

It turns out that adding the -el for the emacs version I am using resolves the problem (as suggested by phils).

Realraptor
  • 1,283
  • 7
  • 17