Skip to content
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

elpy-goto-definition improve #44

Open
humitos opened this issue Jul 22, 2017 · 2 comments
Open

elpy-goto-definition improve #44

humitos opened this issue Jul 22, 2017 · 2 comments

Comments

@humitos
Copy link
Owner

humitos commented Jul 22, 2017

When hitting M-. I would like to try these options in this order:

  • the backend (jedi or rope)
  • tags for this project
  • tags for other projects

https://elpy.readthedocs.io/en/latest/ide.html#command-elpy-goto-definition

@humitos
Copy link
Owner Author

humitos commented Jul 22, 2017

for the third point, I will need to set the tags-table-list for all the tags files I want to take a look (maybe as a local variable or something like that, since I don't want to keep all the tags files after this command ends)

(setq tags-table-list '("/home/humitos/mozio/ondemand/TAGS" "/home/humitos/mozio/mozio/TAGS" "/home/humitos/mozio/mozio-commons/TAGS"))

When this setting, the normal command C-c h e (helm-etags-select) works out of the box.

@humitos
Copy link
Owner Author

humitos commented Jul 22, 2017

Initial working approach:

(defun meta-dot ()
  "Use elpy-goto-definition first and if it fails, use helm-etags-select."
  (interactive)
  (let ((location (elpy-rpc-get-definition))
        (tags-table-list-orig tags-table-list))
    (if location
        (elpy-goto-location (car location) (cadr location))
      (progn
        (setq-local tags-table-list
                    '("/home/humitos/mozio/ondemand/TAGS"
                      "/home/humitos/mozio/mozio/TAGS"
                      "/home/humitos/mozio/mozio-commons/TAGS"))
        (helm-etags-select nil)
        (setq tags-table-list tags-table-list-orig)))))

(define-key elpy-mode-map (kbd "M-.") 'meta-dot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant