Questions tagged [search]

Questions about search mechanics inside of Emacs.

309 questions
23
votes
5 answers

Getting number of occurrences, during incremental search (C-s / isearch-forward)

Inspired by modern browsers, I'd love to be able to see how many occurrences there are of some string, when I search for it – like the "10 of 37" at the top-right corner of the screenshot below. Is there a way of getting this in Emacs? Presumably,…
ShreevatsaR
  • 880
  • 6
  • 19
11
votes
4 answers

How to search in multiple files with Emacs without grep?

There is a folder with many sub-folders, files and I would like to search for a given piece of text in all of these files with Emacs on a Windows 10 machine. (I know about M-x grep, but it does not work in Windows environment.) Is there any way to…
user14685
9
votes
1 answer

Query search and comment out line?

I am hoping to figure out how to do a query search that will comment out a line instead of query replace. That is, do an interactive query search, and if I say yes, comment out the line the match is on. Does this command exist? If not, how would I…
8
votes
2 answers

How to check if a string exists in the current buffer?

I want to know how do you use Emacs lisp to check the content of the current buffer, specially to know if certain string exists within the current buffer.
shackra
  • 2,782
  • 19
  • 49
5
votes
3 answers

Search for text and navigate between the occurrences

I want to be able to search for some text and navigate quickly between the occurrences. What is a convenient way to search for some text, view all the occurrences, and jump quickly to the next/previous occurrence?
programking
  • 7,194
  • 10
  • 42
  • 63
5
votes
1 answer

Gracefully Exiting a While Loop

So, I have this function, which works just fine for me and does what I want it to: (defun mwp-set-grade () (interactive) (save-excursion (while (re-search-forward "- Grade :: \\\(.*\\\)") (org-set-property "GRADE"…
Matt
  • 115
  • 5
4
votes
1 answer

Save search and replace queries for future use

I was wondering if anyone knew of a way or recommend a method to save often use search and replace queries for future use after emacs restarts?
zeltak
  • 1,725
  • 12
  • 28
4
votes
1 answer

How to search for function calls, not just function definitions, with etags?

Edit: Answered my own question. In the past, when working with Emacs, C and etags, I was able to do M-. and find a function definition. But I could also do M-, and find all calls of that function. Very convenient. I've recently started programming…
Gryz
  • 81
  • 6
3
votes
1 answer

How to search and replace, with search starting with the current selection

I would like the "search" from search and replace, to be the selected region. Is there a command doing that already ?
nicolas
  • 177
  • 1
  • 8
3
votes
1 answer

How to extract the weblinks?

I need to get weblinks from a buffer (http....) and put them into scratch buffer. This code partially works, but the weblinks are inserted in the same buffer. I'm new at programming. (defun get-weblinks () "Get weblinks from a buffer" …
3
votes
2 answers

How to cycle through visual-regexp package findings?

With the regular search forward from Emacs if you keep pressing C-s you cycle through all the findings. Right now I'm using visual-regexp package with the visual-regexp-steroids extension that has a forward search too, but using regular expressions…
Fabman
  • 578
  • 2
  • 14
3
votes
2 answers

Narrowing search

I have following file: aaaa1 bbbb cccc dddd aaaa2 eeee ffff aaaa3 I would like to perform 'narrowing search', so if I search for aaaa my original buffer will become: aaaa1 aaaa2 aaaa3 Is there any tool for doing such thing ?
Scony
  • 288
  • 2
  • 6
2
votes
3 answers

Is it possible to limit the scope of function apropos-value?

I've recently started using function apropos-value and have found its output burdensome-ly long, mainly due to a limited number of huge variables that I knew in advance would contain the value I was looking for, but which were not of interest to…
user1404316
  • 789
  • 5
  • 12
2
votes
1 answer

Search for string but ignore acute accent?

I'm trying to search using M-s o or M-x occur. The string that I'm searching for may or may not have an acute accent, eg, "Martín" or "Martin". The output is showing only the terms that has the acute accent (Martín), but I need the term without the…
2
votes
2 answers

Highlight a pattern in a buffer

I use C-s to search a pattern in a buffer. Then when I move the cursor, the highlighted matches lose highlight. Can I keep highlights however I move my cursor, or even edit the buffer? What about when I search using regex? Thanks.
Tim
  • 5,007
  • 7
  • 32
  • 61
1
2 3