Open monnier opened 6 years ago
It shouldn't be too hard either: a lot of necessary code for detecting the current symbol's type is already there (used now for completion).
One part where I'm not sure about, though, is how to reconcile the auto-detection of the symbol's type with reading its name with completion (which we do even for xref-find-definitions
, in certain non-default configurations).
Hi Stefan! I'm flattered you're trying my package :)
Sorry I didn't respond before: turns out that new GitHub projects don't have the creator watching the repo by default.
elisp-def goes a lot further than elisp-mode for detecting the type of a symbol. It handles anaphora, local variables and docstring references, amongst other things (see the readme for the full list).
The macro expansion and AST walking are sufficiently non-trivial that I wanted to get a good test suite and some users to shake out the bugs.
I'd be willing to look at moving this to elisp-mode in a few months, but I'd like it to have more time baking first :)
Hi Wilfred,
Having rediscovered this package, I'm curious: do you still plan to look into integrating this into Emacs someday? It looks very useful, but it would be easier to integrate it into users' workflows if it were part of, e.g. xref
rather than a separate package that must be discovered, installed, bound, and remembered. :)
Seconding this. It would be a lot more convenient to use if it could integrate into xref
as a backend rather than override the keybinding with itself.
@Wilfred: There might be a misunderstanding. I did not suggest to
integrate this code into elisp-mode.el
or into Emacs (it's probably
not a bad idea either, but I must admit I haven't thought about how this
would go). Instead, I'm suggesting you change your package such that it
presents itself as an Xref backend.
More concretely it means your package would do something like
(add-hook 'emacs-lisp-mode-hook #'elisp-def--setup)
(defun elisp-def--setup ()
(add-hook 'xref-backend-functions #'elisp-def--xref-backend nil t))
(defun elisp-def--xref-backend () 'elisp-def)
And then
(cl-defmethod xref-backend-definitions (_ (eql elisp-def) id) ...)
(cl-defmethod xref-backend-references (_ (eql elisp-def) id) ...)
...
-- Stefan
Any chance this could be integrated with elisp-mode's xref support rather than replacing it?