Questions tagged [occur]

M-x occur provides a buffer containing a list of the matches of a string in the current buffer.

M-x occur provides a buffer containing a list of the matches of a string in the current buffer.

46 questions
36
votes
5 answers

Is there a way to use query-replace from grep/ack/ag output modes?

I'm aware of find-grep-dired, marking the corresponding files and then pressing Q to run dired-do-query-replace-regexp on the marked files. Unfortunately that requires restarting the grep and no longer using git-grep, ack, or ag and switching to use…
dgtized
  • 4,169
  • 20
  • 41
8
votes
2 answers

Does "Occur-at-point" already exist?

I wrote an elisp function for myself at the weekend: (defun rr-occur () …
Realraptor
  • 1,253
  • 6
  • 17
8
votes
1 answer

Can Occur center the found text in the buffer?

When selecting an item from the occur buffer, the highlighted line is at the very bottom of the visible screen. This is less useful than having it 25-50% of the way down the screen(so it's easy to read the text around the found line). Is this…
Aaron Lee
  • 377
  • 2
  • 8
8
votes
1 answer

Can occur display just the matched part?

Or is there an alternative tool (perhaps some option to isearch?) that would show just the matches in a separate buffer linked to the original buffer? Use-case I have a log file with very long lines. When the matching line appears in *occur* buffer,…
wvxvw
  • 11,222
  • 2
  • 30
  • 55
8
votes
1 answer

How to make occur mode select the window of buffer `*Occur*`?

Is it possible to make the occur mode grab the cursor (point)?, right now when I do M-x occur and search anything in a buffer, it will open the new buffer with the findings but the cursor stays in the buffer instead going to the findings. I have to…
Fabman
  • 578
  • 2
  • 14
7
votes
1 answer

Force new window to open to the left or right

I have two frames open with the following window splits: Frame 1 Frame 2 |---+---+ |------| |a |b | |d | | | | | | |---+---+ | | |c | | | |---+---+ |------| Say that I am in window "a" or "b". Sometimes when I call…
Lorem Ipsum
  • 4,327
  • 2
  • 14
  • 35
6
votes
2 answers

Occur with many conditions?

If I want to show only lines that content "Buy" I use command occur: Like this: Nice. But I need to show lines that content "Buy" and 0.00000057 So the result must like this How I can do this by occur command?
a_subscriber
  • 3,854
  • 1
  • 17
  • 47
5
votes
1 answer

Can occur match phrases that stretch across multiple lines?

Q: (how) can I use occur to match a phrase that stretches over multiple lines? Consider the following buffer: Here's a line of text with the phrase "kittens and puppies". Here's an awkward alternative: the phrase "kittens and puppies" stretches…
Dan
  • 32,584
  • 6
  • 98
  • 168
4
votes
2 answers

Remove occurrences in occur mode?

Is there a way to remove occurrences in Occur mode? In particular, this piece of functionality would allow you to remove occurrences in case you are interested in editing only some out of all occurrences in Occur mode. Example: say I have this piece…
4
votes
2 answers

How can I make occur's regexp matching case-sensitive?

By default, occur uses the passed regexp to match lines in a case-insensitive way. Is there a way to make this matching case-sensitive? For example, if I run M-x occur ^function RET, occur will match lines that start with both function and Function.…
Ben
  • 587
  • 4
  • 11
3
votes
4 answers

How to display at the same time occurrences of two different words?

Thanks to helm-swoop, I know how to display occurrences of a single word. Now, I'd like to display at the same time occurrences of many different words (of a given, single buffer). Let me be specific: say, I have a buffer containing multiple…
Denis Bitouzé
  • 398
  • 2
  • 14
3
votes
1 answer

How to tell Occur to show the line in the top of the buffer

I usually use occur to make an index of the beginning of different things. When I jump to the occurrence, Occur shows the line in the middle of the buffer. How can I instruct occur to show the occurrence in the top of the buffer? Thanks.
onlycparra
  • 207
  • 1
  • 8
2
votes
1 answer

Include original position from searched buffer in occur buffer

As an example, let's say I want to search for the word test. When I type M-x occur RET test RET, the current frame is split into two windows, with the current buffer on top and the *Occur* buffer on bottom. If I click a line in the *Occur* buffer…
Håkon Hægland
  • 3,608
  • 1
  • 20
  • 51
2
votes
1 answer

Yank / copy / get into a buffer matching regex search results

I am trying to "extract" my search results into a new buffer, but only the matches - not the whole lines. For example I am trying to get a list of HTML color codes used in a file. I can identify them (in this case) with a search for "#.*?", which…
MT.
  • 145
  • 5
2
votes
1 answer

How save content of *occur* buffer?

windows 10, emacs 26.1 M-x occur Some text to find Result show in Occur buffer. Nice. How I can save content of this buffer in the file?
a_subscriber
  • 3,854
  • 1
  • 17
  • 47
1
2 3 4