From adc8ebfe975c42c23c339ec00d5524d2d8ccf048 Mon Sep 17 00:00:00 2001 From: "jwalczak@int.jumio.com" Date: Wed, 1 Sep 2021 14:49:42 +0200 Subject: [PATCH] Customization tips: allow `rgrep` to search properly for the symbols This commit aims to introduce proper mechanism of seeking for symbol in `elpy` mode while `elpy-goto-definition` fails at finding given symbol. `rgrep` although works properly in cases like: ``` class Dog(Animal): ... ``` but fails at: ``` class Dog: ... ``` where class has no parentheses after its name definition. --- docs/customization_tips.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/customization_tips.rst b/docs/customization_tips.rst index 0493b65b..9f6b0217 100644 --- a/docs/customization_tips.rst +++ b/docs/customization_tips.rst @@ -73,7 +73,7 @@ You may sometimes find when you try to navigate to a function/class definition w (ring-insert find-tag-marker-ring (point-marker)) (condition-case nil (elpy-goto-definition) (error (elpy-rgrep-symbol - (concat "\\(def\\|class\\)\s" (thing-at-point 'symbol) "("))))) + (concat "\\(def\\|class\\)\s" (thing-at-point 'symbol) "\\((\\|:\\)"))))) This function will try to find the definition of the symbol at point using ``elpy-goto-definition``, but will do elpy-rgrep-symbol_ instead, if the former function fails to return a result. You can bind this function to the key combination of your choice, or you can bind it to ``M-.`` to use it as a replacement for the the default ``goto-definition`` function: