deadgrep icon indicating copy to clipboard operation
deadgrep copied to clipboard

Context awareness doesn't seem to work

Open pmiddend opened this issue 6 years ago • 5 comments

Hi! In your readme, you write that if I'm in a git project, this will be used for the directory (instead of the current file's directory). This doesn't seem to work, however. What could be wrong?

pmiddend avatar Feb 06 '19 15:02 pmiddend

What happens? What's the output of M-x deadgrep?

Wilfred avatar Feb 14 '19 01:02 Wilfred

@Wilfred Sorry for the late answer. The output is fine, except the directory is the directory of the current file, not the project (e.g. git) root.

pmiddend avatar Feb 16 '19 08:02 pmiddend

What's the output for M-x deadgrep-debug? (Woops, that's what I meant to write in my last comment.)

Wilfred avatar Feb 16 '19 15:02 Wilfred

Ah, I see. The output is (in subdir):

About your environment:
Platform: gnu/linux
Emacs version: 26.1
Command: nil
default-directory: "/home/philipp/project/subdir"

Initial output from ripgrep:
nil

pmiddend avatar Feb 16 '19 19:02 pmiddend

Unless you've changed the value of deadgrep-project-root-function, you'll be using deadgrep--project-root. This calls (project-current), an Emacs built-in function that has presumably decided that subdir is the project root.

If so, project-find-functions is returning the subdirectory. Do you have any version control things in there? The default value for project-find-functions is project-try-vc.

Wilfred avatar Mar 20 '19 01:03 Wilfred