0

Example code:

typedef int my_type_t;

my_type_t a;

my_type_t my_function(my_type_t in)
{
    return (my_type_t) 0;
}

int main(void)
{
    my_type_t b;
    a = my_function(b);
    return 0;
}

When I run dump-jump-go on my_type_t, it finds all references to the type, instead of the type definition:

enter image description here

This is not what I expect after reading the documentation. The same happens with functions: definitions, declarations, and calls pop up.


Installing the dumb-jump package from elpa gave the following warnings, but I'm not sure they matter:

dumb-jump.el:1475:1:Warning: Unused lexical argument `proj'
dumb-jump.el:1622:1:Warning: Unused lexical argument `config'
dumb-jump.el:2251:1:Warning: Unused lexical argument `cur-file'
dumb-jump.el:2300:1:Warning: Unused lexical argument `exclude-paths'
dumb-jump.el:2300:1:Warning: Unused lexical argument `lang'

In end of data:
dumb-jump.el:2372:1:Warning: the following functions are not known to be defined: ivy-read,
    helm-build-sync-source
1

It looks like there is no regex to find type definitions like this in the c/c++ dumb-jump rules. So dumb-jump-fallback-search is kicking in, which by default will just look for the symbol. You can undo this behavior by using (setq dumb-jump-fallback-search nil).

There is more context on related things in this dumb-jump GitHub issue.

  • I'm the creator of the issue, are you jacktasia? – Gauthier Nov 29 '18 at 8:49
  • Yup, I am the dumb-jump guy. I came across this question randomly. I added the link purely for other people that come across this issue since they're related. – Jack Nov 29 '18 at 16:15
0

This:

(setq dumb-jump-prefer-searcher 'ag)

seemed to help, although dumb-jump's manual mentions it should use git-grep anyway:

(setq dumb-jump-prefer-searcher 'rg) to let Dumb Jump know your searcher preference. If set this will still use git-grep if it's a git project (because it's the fastest), but will you use whatever you set here in any other situation. If not set Dumb Jump will follow the same order as mentioned in the dumb-jump-force-searcher description. At this time setting this value is only necessary if you prefer rg but have ag installed too.

Not manually setting up dumb-jump to use ag also seemed to choose an alternative file definition aggressively, discarding the definition in the same file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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