1

I use elpy for python development, and the command M-., elpy-goto-defintion to follow a function to its definition in a python project is a life-saver.

There isn't a TAGS table anywhere in my project, has never been, and this command just works, no TAGS table being created or used.

But sometimes, I do not know why, I start getting a message when I type M-. that emacs needs to find a tags table. And the only thing I can do to stop it from asking that is to restart emacs. I assume it uses a different command to fulfill M-. rather than the elpy default of elpy-goto-defintion.

How can I say, "no, go back to however you were configured a second ago, before you thought you needed a tags table?" What setting is getting changed where sometimes this becomes a requirement?

Is it elpy, projectile, or other?

I'm seeking answers that help me keep the default command working without defining a TAGS table.

Reloading my ~/.emacs.d/init.el file does not work.

Update

Here is my mode information, with C-h m

Enabled minor modes: Async-Bytecomp-Package Auto-Composition
Auto-Compression Auto-Encryption Auto-Revert Blink-Cursor
Column-Number Company Eldoc Electric-Indent Elpy File-Name-Shadow
Flymake Font-Lock Global-Eldoc Global-Font-Lock Global-Git-Commit
Global-Linum Helm Highlight-Indentation Importmagic Line-Number Linum
Magit-Auto-Revert Menu-Bar Mouse-Wheel Override-Global Projectile
Pyvenv Shell-Dirtrack Show-Paren Tool-Bar Tooltip Transient-Mark Yas

(Information about these minor modes follows the major mode info.)

Python mode defined in ‘python.el’:
Major mode for editing Python files.

And after a fresh restart:

Enabled minor modes: Async-Bytecomp-Package Auto-Composition
Auto-Compression Auto-Encryption Blink-Cursor Column-Number Company
Eldoc Electric-Indent Elpy File-Name-Shadow Flymake Font-Lock
Global-Eldoc Global-Font-Lock Global-Git-Commit Global-Linum Helm
Highlight-Indentation Importmagic Line-Number Linum Magit-Auto-Revert
Menu-Bar Mouse-Wheel Override-Global Projectile Pyvenv Shell-Dirtrack
Show-Paren Tool-Bar Tooltip Transient-Mark Yas

(Information about these minor modes follows the major mode info.)

Python mode defined in ‘python.el’:
Major mode for editing Python files.

Only difference I'm seeing is Auto-Revert ?

Update

My goal is to disable the request to tags table with some other function that can goto-definition correctly.

References to other links that have /not worked out/ for this:

12
  • If I could completely delete the notion of TAGS, etags, ctags, global tags, etc. from my emacs altogether I would be happy to. Commented Aug 7, 2021 at 0:23
  • 1
    The first step is to find out if M-. has been rebound, and if so what it’s been rebound to. Use C-h k to find out.
    – db48x
    Commented Aug 7, 2021 at 0:36
  • 1
    It sounds like the buffer is no longer in python-mode, since the binding was found in the global keymap rather than the mode’s keymap. Check what mode(s) the buffer is in using C-h m.
    – db48x
    Commented Aug 7, 2021 at 2:34
  • 1
    I am having the same issue. I found this related issue on github but the workaround listed there doesn't seem to work for me. Commented Dec 4, 2021 at 23:26
  • 1
    And just like on that page's OP, it seems if I manually M-x elpy-goto-definition once, then it works okay. Commented Dec 4, 2021 at 23:27

1 Answer 1

1

It would be useful if you specify what Emacs version do you use. Further I will refer to the package here.

In this package find-tag-marker-ring is used in file elpy.el in two instances, at line 465 and 1765, where it is explained that it is marked as obsolete in Emacs version 25.1 and is not available in Emacs version 27.

But in file docs/customization_tips.rst it is suggested the function elpy-goto-definition-or-rgrep as replacement. Code below:

    (defun elpy-goto-definition-or-rgrep ()
      "Go to the definition of the symbol at point, if found. Otherwise, run `elpy-rgrep-symbol'."
        (interactive)
        (if (version< emacs-version "25.1")
            (ring-insert find-tag-marker-ring (point-marker))
          (xref-push-marker-stack))
        (condition-case nil (elpy-goto-definition)
            (error (elpy-rgrep-symbol
                       (concat "\\(def\\|class\\)\s" (thing-at-point 'symbol) "(")))))
                       
;; You can bind this function:
(define-key elpy-mode-map (kbd "M-.") 'elpy-goto-definition-or-rgrep)

Worth to read the whole explanation in that file. If this will still not work, I suggest to try some new packages, such as eglot or lsp-mode (In the new version 29 coming soon, eglot is built-in).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.