New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] consult-grep , consult-ripgrep to specifiled files #407
Comments
Hi, I wrote the following snippet.
|
HI, Unfortunately, I will not use Emacs on Windows. Anyway, I have revised the funcion
Best regards, |
Akira san. I executed the new consult-grep-one-file sample code you provided, unfortunately it doesn't work on Windows Environment. I checked the follwing in scratch buffer.
I put (message "%s" consult-grep-args) in consult-grep-one-file.
Then check if the target file exists in scratch buffer.
Then I executed the grep command which made by consult-grep-one-file with the search word "foo".
I susspect the root cause in consult? |
I download consult tag 0.9. So I believe that consult-grep in consult tag >= 0.1 via own code on Windows Emacs is something wrong. |
Futhrermore, I’m digging into the cause.
“baz” is in both /tmp/log1 and /tmp/log2. I defined the following the function as test.
When provide the file “/tmp/log1” “/tmp/log2” of grep's argument, it works fine. When the files path of grep’s argument is under the msys64, it works. Is there any hint to work when provide the file path “c:/…” ? |
You can look at the hidden |
The issue could be #419. |
@tam17aki Can I use |
No because there is no file for ripgrep to search. Instead use |
@hmelman |
If you're opening I'm a little surprised |
(defun consult-ripgrep-one-file ()
"Call `consult-ripgrep' for the current buffer (a single file)."
(interactive)
(let ((consult-project-root-function (lambda nil nil))
(consult-ripgrep-args
(concat "rg "
"--null "
"--line-buffered "
"--color=never "
"--line-number "
"--smart-case "
"--no-heading "
"--max-columns=1000 "
"--max-columns-preview "
"--search-zip "
"--with-filename "
(shell-quote-argument buffer-file-name))))
(consult-ripgrep))) When I open a single JSON file inside a archive, the value of Turning off font-lock does help, but |
Now I find that |
Now I find that |consult-ripgrep-one-file| works fine on |*.gz| archive
with single compressed file, but not |*.zip| and |*.tar.gz|.
This is not unexpected if you consider how these file formats work. A
gzipped file is a single compressed file, which can be decompressed
transparently by ripgrep. In contrast, zips and tars are archives which
contain more than a single file. I would be astonished if ripgrep
handles archives transparently.
|
Closing due to inactivity. It seems the question has been answered? |
It seems the solution suggested by @tam17aki has been pretty much deprecated. How to search specific (single/multiple) files using the latest version of consult? |
As you can see, you can extend this to an abtrary number of files. |
I want to execute consult-grep or consult-ripgrep to specified files, not directory.
How do I archive that?
The text was updated successfully, but these errors were encountered: