dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
484 stars 41 forks source link

Default "all" mode doesn't include same results as command-line default behavior #40

Closed binary132 closed 6 years ago

binary132 commented 6 years ago

OS: macOS 10.13.5

When I invoke rg from zsh, the default behavior includes search results in ASCII data files having no suffix, but when I invoke it from Emacs using this package, with file type "all" (*), the search results do not include these files.

In particular, the files in question are ASCII-encoded data files containing text:

❯ file -I --apple ./deploy-scripts/env/stg
./deploy-scripts/env/stg: application/octet-stream; charset=us-ascii

❯ rg 'myBootstrapAction' .
<snip>
deploy-scripts/env/stg
27:myBootstrapAction=<snip>
dajva commented 6 years ago

Thanks for the report.

all has its origin in the rg command line tool and means "all defined file types", i.e. all internally defined types as well as those defined by the --type-add command line flags. So the command line corresponding to chosing all in rg.el would be something like: rg --type all search-term.

See https://github.com/dajva/rg.el#type-aliases for the "special" file types used in rg.el.

Now the "*" in when all is selected as the default type (if no known type can be determined for the current file) is misleading and I think that should be fixed.

Also, one may debate if all or everything should be the default for unknown files. Personally I'd prefer all but I guess it could be made configurable if there is s demand for other defaults.

dajva commented 6 years ago

Closing this. Please reopen if you think configuring the default is needed.

haqle314 commented 5 years ago

I was confused by the file type all as well, especially when everything doesn't really stand out among the >100 other file types. IMO, it's not necessary to make the default configurable. But I think it doesn't hurt to be a bit more explicit and use all-defined-file-types instead of all. Since it's the default selection anyway, the longer name doesn't change much for the user and it's more in line with the naming style of lisp/elisp.

dajva commented 5 years ago

FWIW, the default is now configurable. As stated above, all was really just a using what ripgrep provided. You have a point in making the choice stand out a bit more. Personally I find the "all defined type aliases" description of the all choice clear enough. But that's only is showing when it's choosen as the default. It's not seen when going through the list in order to select a type.

I wish completing-read could have both the keyword and description in the selection list. Maybe there are options for that...