this post was submitted on 22 Nov 2023
1 points (100.0% liked)

Emacs

311 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I use ripgrep for searching in a project and I want to save the ripgrep buffer with the links.

Simply saving the buffer just removes the links and leaves only plain text.

(The reason for this is, I want to go through several parts of the code which I found with ripgrep. This will take some days, and I want to be able to keep track of my progress by going through the search results and delete the ones I already worked on.)

top 11 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 11 months ago (1 children)

Saving and loading the *rg* buffer works for me as the saved file's first line is -*- mode: rg; default-directory: "/path/to/dir/" -*- to enable rg-mode on load. How are you saving the buffer?

[–] [email protected] 1 points 11 months ago

Thanks for your answer. I just use C-x C-s for saving the buffer.

[–] [email protected] 1 points 11 months ago (1 children)

embark-export is your friend, I use it all the time!

[–] [email protected] 1 points 11 months ago
[–] [email protected] 1 points 11 months ago (1 children)

using embark, you need to set a keybind to embark, then use the ripgrep normally, when the minibuffer returns the results, call the embark via keybind and use embark-export, that is bind to E, then embark will create a buffer with the results from minibuffer

[–] [email protected] 1 points 11 months ago (2 children)

Thanks for your help. Embark looks interesting, although the rg search results are not shown in a mini buffer, but in a normal buffer.

[–] [email protected] 1 points 11 months ago

for rg search, are you using (the amazing) consult-ripgrep?

[–] [email protected] 1 points 11 months ago

* in my emacs configuration at least

[–] [email protected] 1 points 11 months ago

I would use Embark for this:

C-. (embark-act)

follow by

S (embark-collect)

This will convert whatever content you have in the mini-buffer into an ordinary buffer that you can keep, browse and even save.

[–] [email protected] 1 points 11 months ago

Not sure that matches your need, but rg.el (https://github.com/dajva/rg.el) has rg-list-searches, which will list your searches in an "Ibuffer" buffer.

Should be available for as long as Emacs session and saveable if needed.

[–] [email protected] 1 points 11 months ago

I use consult-ripgrep and consult-repeat to run last search again.