1
votes

sorry for the title, it's difficult to explain the question in a one liner. But here is the use case that I am talking about:

I have 4 buffers open in emacs, each displaying some file and some position. Then I do a grep-find and the grep output is placed into one of the buffers. Then I click on the hits in the grep buffer, and for every click, emacs uses a different buffer to display the hit. If I have more than 4 buffers open, emacs makes sure to use all of those buffers in sequence to display the hits. This really isn't useful for me, because all of those buffers were containing my source files at a certain position and I want to preserve those buffers.

It would be much more useful if clicking the hits in the grep output would be opened in and only in a specific buffer, for example, the next buffer after the grep buffer. That way, I can arrange to keep the next buffer after the grep buffer available and have all grep results be displayed there. And all the other buffers would continue showing my source files at the positions I want...

So, is this something that can be done with some elisp magic, or do I have to change the way I work with emacs?

1
You seem to be confused about buffers and windows. The output of grep-find goes to the *grep* buffer. I'm sure you are confused about the window in which this buffer is displayed.pmr
Thanks for the answer, but I'm not really confused about where the output of grep-find goes. My issue is also not related to buffer/window distinctions. I just wanted emacs to display all grep hits in the same buffer (or window, if you will...)Timur Aydin

1 Answers

2
votes

You may prefer to use next-error and previous-error (bound to M-gM-n and M-gM-p) to cycle through the hits in a single window.