I am working with python
using Emacs 26.3
. My goal is to jump to definition of the function and jump back, for that I am using https://github.com/jacktasia/dumb-jump, which runs elpy-goto-definition
on the background.
I am starting emacs on startup using crontab using (&>/dev/null emacsclient -t -q &)
. On that case, elpy-goto-definition
never works. I have to restart emacs. But after the restart, it takes around 30 seconds for elpy
to launch, sometimes it does not launch (I do not know why).
- What may be the main reason that let
elpy-goto-definition
to fail. Can I forceelpy-goto-definition
to work if it fails? or restartelpy
withinemacs
if possible?
My setup:
(setq elpy-rpc-backend "jedi")
(add-hook 'elpy-mode-hook (lambda () (highlight-indentation-mode -1)))
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
;; https://emacs.stackexchange.com/a/19194/18414
(defun goto-def-or-rgrep ()
"Go to definition of thing at point or do an rgrep in project if that fails"
(interactive)
(condition-case nil (elpy-goto-definition)
(error (elpy-rgrep-symbol (thing-at-point 'symbol)))))
(global-set-key "\C-x\C-j" 'goto-def-or-rgrep)