Wilfred / deadgrep

fast, friendly searching with ripgrep and Emacs
719 stars 46 forks source link

Context awareness doesn't seem to work #45

Open pmiddend opened 5 years ago

pmiddend commented 5 years ago

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?

Wilfred commented 5 years ago

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

pmiddend commented 5 years ago

@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.

Wilfred commented 5 years ago

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

pmiddend commented 5 years ago

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
Wilfred commented 5 years ago

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.