-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add smart-jump-go-other-window
#26
Comments
You can probably define something like this that uses the other- type functions.
I'm not sure how it'd be done generically though (or even feasible). |
How about this? It works for me. (defun smart-jump-go-other-window (&optional smart-list continue)
"Show the function/variable declartion for thing at point in another window.
SMART-LIST will be set (or nil) if this is a continuation of a
previous jump.
CONTINUE will be non nil if this is a continuation of a previous jump."
(interactive)
(let ((old (current-buffer)))
(smart-jump-go smart-list continue)
(let ((new (current-buffer)))
;; If old and new are the same then `xref' has popped up another window
;; listing multiple definitions and we bail.
(unless (eq new old)
(switch-to-buffer old)
(switch-to-buffer-other-window new))))) Only caveat is if xref finds multiple definitions then xref opens another window midway through the process and there doesn't seem to be a good way to react to that so the command just gives up. A way around that would be to use a lower level xref function to actually get a list of references like this (using (funcall (xref--create-fetcher 'use-package 'definitions 'use-package)) And then use That would require re-plumbing the xref-find-definitions fallback but shouldn't be too terrible to implement. Are you interested in a PR along those lines? Or have other suggestions? |
What's the best way to implement a version of
smart-jump-go
that pops open in a new/other window, likexref-find-definitions-other-window
? Should:before-jump-fn
be used, or wouldsmart-jump-run
need to be modified?Thanks!
The text was updated successfully, but these errors were encountered: