reddit / emacs
Is there a ripgrep like package that can search and show occurrence previews in a set of pdf files?
kamui78 · 2022-06-19 11:06
I was wondering if anybody knows of a package that can search for occurrences in a set of pdf files and be able to show the previews. Something like ripgrep-all but with live previews.
https://github.com/phiresky/ripgrep-all
Basically, I would like to have a grep content from a bunch of pdf files and would like to be able to go through the results in a similar fashion to the consult-ripgrep command, but I would need it to work with pdf files.
flexibeast · 2022-06-19 11:21
Not quite what you're after, but there's `counsel-recoll`, an interface to documents indexed by [Recoll](https://en.wikipedia.org/wiki/Recoll). i'm also interested if there's something more like what you're describing.
_viz_ · 2022-06-19 11:48
There are two ways to go about it if you have pdf-tools installed:
1. Create a virtual PDF with all the files you want to search in. M-x pdf-virtual-buffer-create and in the virtual PDF buffer, say C-c C-c and M-s o <regexp>.
2. In a dired buffer, mark all the PDF files you want to search in, and say M-x pdf-occur-dired-do-search.
The flexibility with approach (1) is that you can restrict the pages you want to search in. The VPDF buffer should have a comment explaining how to do it but if that wasn't clear to you (like it was for me), then you can take a look at the tests for VPDF for an example.
Edit: C-s should also work with (1)
[deleted] · 2022-06-19 13:23
[removed]
Icommentedtoday · 2022-06-19 15:24
Just change the consult-ripgrep command? https://github.com/minad/consult/blob/4916cda94127ae495f3b1f38e2e9261d0138e439/consult.el#L252
kamui78 · 2022-06-19 15:39
That would be one possibility for grepping the text from the pdf and seeing the locations, but it does not solve the preview. It is a step in the right direction though. Thank you.
kamui78 · 2022-06-19 15:40
Thank you. Will try this and see how it goes.
kamui78 · 2022-06-19 15:41
Didn't know Recall. Thank you.
helm05 · 2022-06-19 16:36
Install pdfgrep with `apt-get install pdfgrep` and from `helm-find-files` mark some files and hit `M-g p`.
Icommentedtoday · 2022-06-19 16:39
Yeah you're right. It should be doable to extend consult with that functionality
kamui78 · 2022-06-20 09:40
Thank you, this could be a starting point. But the preview feature would not be possible.
helm05 · 2022-06-20 10:31
Yes, it is possible with C-j
kamui78 · 2022-06-20 10:34
Just for the record, we are probably talking about two different things. By preview I mean the pdf page, I do not mean the preview of the text excerpt in the mini buffer similar to consult-ripgrep. I already have that with ripgrep-all, although not in emacs.
The difference here is that I get the graphics of the pdf, if there is a graph or some equations I would be able to see them. With the text
excerpts the only thing i get is the text excerpt with the occurrence.
helm05 · 2022-06-20 13:51
No I am talking about the pdf page opened in an external app of your choice configurable with `helm-pdfgrep-default-read-command`.