The feature
Many lookup functions are able to open found definitions in another window that is not the current one. For example, xref-find-definitions-other-window is one of those functions. Would it make sense to modify +lookup/definition so that is can somehow open definitions in other windows?
In normal emacs, calling xref-find-definitions is bound to M-., while xref-find-definitions-other-window is bound to C-x 4 .. In vanilla emacs, the prefix C-x 4 means: do the next thing in another window. I don't know if there is something similar in the evil world.
If this is indeed interesting, I could then spend some time creating the function +lookup/definition-other-window. What do you think Henrik?
+lookup/definition-other-window doesn't exist because some backends are asynchronous, and there is no standardized mechanism to talk to them to see if they succeeded or otherwise. The only option we have is what Spacemacs does: run the backend, open a new window and hope for the best, which I don't think is an acceptable solution. Alternatively, we could bide our time and wait until more major modes/backends support xref (i.e. which provides that standard).
In the meantime, you can employ the naive method with the following added to ~/.doom.d/config.el:
(dolist (fn '(definition references))
(fset (intern (format "+lookup/%s-other-window" fn))
(lambda (identifier &optional arg)
"TODO"
(interactive (list (doom-thing-at-point-or-region)
current-prefix-arg))
(let ((pt (point)))
(switch-to-buffer-other-window (current-buffer))
(goto-char pt)
(funcall (intern (format "+lookup/%s" fn)) identifier arg)))))
Another alternative is to split the window before invoking a lookup command.
I'll leave this open until it is addressed somewhere; in Doom or elsewhere.
Most helpful comment
+lookup/definition-other-windowdoesn't exist because some backends are asynchronous, and there is no standardized mechanism to talk to them to see if they succeeded or otherwise. The only option we have is what Spacemacs does: run the backend, open a new window and hope for the best, which I don't think is an acceptable solution. Alternatively, we could bide our time and wait until more major modes/backends support xref (i.e. which provides that standard).In the meantime, you can employ the naive method with the following added to
~/.doom.d/config.el:Another alternative is to split the window before invoking a lookup command.
I'll leave this open until it is addressed somewhere; in Doom or elsewhere.