Wilfred / elisp-def

Find Emacs Lisp definitions
64 stars 6 forks source link

Compare to elisp-slime-nav and xref #3

Open seagle0128 opened 6 years ago

seagle0128 commented 6 years ago

What's the difference among elisp-def, elisp-slime-nav and xref, please? It seems elisp-def is unable to handle the case of use-package.

e.g.

(use-package elisp-refs)

M-. is unable to jump to elisp-refs.el.

Wilfred commented 6 years ago

elisp-def handles local variables, package references and interactively defined functions. elisp-def and xref both handle global definitions. README.md has examples of code snippets that only elisp-def can help you with.

elisp-slime-nav is a thin wrapper around xref these days, with some great keybindings.

Wilfred commented 6 years ago

Regarding (use-package elisp-ref), do you have a package installed with that name? I know of elisp-def and elisp-refs, but no elisp-ref.

It's also worth confirming that you're calling the correct command. M-x . is not a standard Emacs keybinding. I suggest you try calling elisp-def directly to confirm it's working correctly.

All that elisp-def-mode does is set up the keybindings M-. and M-,.

seagle0128 commented 6 years ago

Sorry, my typo. I corrected. I use (use-package elisp-refs) and install elisp-refs. M-. cannot find the package or file correctly.

Wilfred commented 6 years ago

I can't reproduce I'm afraid.

Have you tried M-x elisp-def? What does C-h k M-. show?

seagle0128 commented 6 years ago

Let me provide a screenshot for the example. I got the error: Couldn’t identify where eldoc is defined.

emacs

Wilfred commented 6 years ago

Thanks, that's helpful.

I have an idea what this might be. Since elisp-def expands macros, if use-package hasn't been loaded yet then this won't work.

If you do M-: (require 'use-package) and try again, do it work?

seagle0128 commented 6 years ago

No, it doesn't unfortunately.

Wilfred commented 6 years ago

That's really odd. OK, does elisp-def work when you run it on an explicit require call? If you have an elisp buffer with the contents:

(require 'eldoc)

does M-x elisp-def on the eldoc work?

seagle0128 commented 5 years ago

I am back to this topic now. Sorry for missing this.

It works better now. But I am still confused, what's the advantage of elisp-def than xref? xref works well for me and it's built-in. If people don't understand the advantages people don't choose it.