jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.57k stars 150 forks source link

root project error #329

Closed cool0looc closed 4 years ago

cool0looc commented 4 years ago

Hi,

I'm using dumb-jump with doom-emacs. I enabled dumb-jump-debug and using "ag as the default searcher". But some git project works fine, some are not. I created also ".dumbjump" file in the root directory. The debug info always indicates the search directory is in the current directory. " \ag --nocolor --nogroup --cc --cpp \bsht2x_init(\?![a-zA-Z0-9\\?\*-]) /home/coollooc/RIOT/examples/hello-world" How can I change the default search directory?

Thanks,

jacktasia commented 4 years ago

Thanks for opening this and sorry for the delay in responding.

But some git project works fine, some are not. I created also ".dumbjump" file in the root directory.

Can you provide an example of a publically available git project that doesn't work for you? By default it will look at each parent directory until it sees a project denoter: https://github.com/jacktasia/dumb-jump/blob/90369d93cacf6efc1bf9a619439abef5ea957e26/dumb-jump.el#L1608

So it's possible it's finding one of those before your .dumbjump file. You may also want to look at the options dumb-jump-default-project and dumb-jump-project

cool0looc commented 4 years ago

Hi Jacktasia, Thanks for replying. Just check the project: https://github.com/RIOT-OS/RIOT. In the root folder: root_folder

There is .git directory. Now my emacs is working in example/hello-world/main.c hello

Just made a request on "RIOT_BOARD", the debug window is: debug There is no any project denoter ".git .dumbjump" in the directory dir

But the search in still in the current directory.

bgwines commented 4 years ago

+1, I am experiencing this same issue

bgwines commented 4 years ago

ah, my issue was actually different. It recognized the project root correctly, but when navigating to a file, it would navigate relative to the current directory instead of relative to the project root.

I think this is probably a different bug with dumb-jump when it is configured to use git grep, since the output of git grep uses relative paths (relative to project root), not absolute. So it would attempt to navigate to directory_of_current_buffer/path/relative/to/project/root, even though the grep had indeed identified the correct path.

I can file another issue for this if you want, @cool0looc, but it's low priority to me since I was able to fix it with (setq dumb-jump-force-searcher 'ag), which is recommended anyway, so it's probably not common for people to encounter this issue. That fix works because the output of ag is an absolute path.

jacktasia commented 4 years ago

@cool0looc

There is no any project denoter ".git .dumbjump" in the directory

This is not true, because Makefile is a project denoter.

Are you trying to jump out of your example project and into RIOT for a function declaration?

cool0looc commented 4 years ago

@jacktasia

Thanks, you are right.

I didn't pay attention to Makefile is also a project denoter.