如何在emacs中跳转到光标下的函数

How to jump to a function under the cursor in emacs

我有两个文件:A.el 和 B.el

我在 A.el 中的光标下是 B.el 中定义的函数。如何跳转到B.el中的函数?

M-x find-function 这样做。

Finds the source file containing the definition of the function near point (selected by ‘function-called-at-point’) in a buffer and places point before the definition.

您似乎专门询问原生 Emacs Lisp;您需要将该函数加载到 Emacs 中才能运行。

在一般情况下,这取决于文件的模式,但传统的解决方案是使用etags. 在 Emacs 25 中引入了一个更现代的替代品,称为 xref;尝试 M-.