Questions tagged [isearch]

is the incremental search facility that highlights matching text as characters are typed. isearch-forward and isearch-backward support searching characters, strings, and regexp.

Filter by
Sorted by
Tagged with
11
votes
1answer
561 views

Delete portion of Isearch string that does not match, or last char if complete match

I have the following (defun isearch-del-fail-or-char () "Delete failed isearch text, or if there is none, a single character." (interactive) (if (isearch-fail-pos) (delete-region (isearch-...
11
votes
1answer
501 views

Search for string ignoring new lines

I am used to writing files where paragraphs are split into several lines, e.g. with fill-column. When I search for a string (C-s) such as this is a long text, the search results would not return the ...
11
votes
1answer
2k views

How to search an Arabic word in text without its diacritics/accents?

In Arabic as with some other languages there is what is called diacritics to enhance pronunciation. There is no convention on how many diacritics should be written for a single word. Some use the ...
9
votes
2answers
337 views

Make isearch skip folded content in org-mode

Q: How can I tell isearch to ignore the contents of folded blocks by default in org-mode buffers? More specifically, I'd like isearch to ignore contents of comment blocks and drawers: When authoring ...
9
votes
2answers
457 views

Selecting (i.e., as the region) the current match in incremental search

When searching for a string with C-s, I want to be able to hit some key to exit search mode but still maintain the selection of the match. That way I can immediately start typing and replace the last ...
8
votes
2answers
341 views

How can I match “snake_case” automatically when I search for “snake-case” by mistake?

I frequently mistype "_" as "-" when doing a quick isearch-forward. E.g. I'm looking for snake_case and accidentally type C-s snake-case and get no results. Best case I notice quickly enough and don'...
7
votes
2answers
304 views

When to use normal incremental search in place of the regex version?

Assuming familiarity with regex, is there ever any reason to use the normal incremental search (C-s) over regex (C-M-s)?
7
votes
2answers
106 views

When searching, how to always ensure that a few lines after the highlighted word are visible?

When performing search/isearch in a text, sometimes it would be desirable to see a few lines after the highlighted searched string, it other words to avoid that the highlighted word to be at the ...
7
votes
1answer
64 views

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....
6
votes
1answer
102 views

edit search string and begin search from current location

I use C-s to start an incremental search. Sometimes I want to change the search string and either restart the search entirely from the beginning of the document or (other times) just change the search ...
6
votes
1answer
162 views

char-fold-search match for German eszett (ß)?

In emacs 25.1, if I customize search-default-mode to "Char-Fold Search", then an isearch-forward for u matches ü and one for o matches ö. But what character should I type to match ß ?
6
votes
2answers
267 views

How to search/isearch just comments?

Is it possible to perform a search/isearch just in comment regions of the text?
6
votes
1answer
420 views

how to customize the secondary highlighting in searches

When I search for text in my buffer, the cursor moves to the first occurrence but all occurrences beyond the first are also lit. E.g. "jumped" in the screenshot below: Unfortunately, this particular ...
5
votes
2answers
92 views

Incremental Search after opening file

Being fairly new to GNU Emacs and intend to use it as a replacement to vi/vim where possible, I came across an obstacle, I seem not be able to overcome. In vim (similar to less) you can provide a ...
5
votes
1answer
378 views

Use thing-at-point for isearch and minibuffer commands

How can I insert some text (thing) at point from the buffer into the minibuffer at a text prompt or during an incremental search? Is there a convenient way to insert, e.g., the sexp around point?
4
votes
2answers
417 views

Scrolling during isearch stops searching, losing matches

I use C-s to search for a string. All matches are highlighted. Then I would like to scroll down by C-v, but all matches disappear. I know keeping C-s will move to the next match, but it is too slow. ...
4
votes
2answers
114 views

Move cursor left/right while entering isearch

How can I move my cursor left and right while entering my isearch text? isearch-forward Enter some text Press cursor left to edit the search text Argh! Emacs returns the cursor to the main buffer. ...
4
votes
2answers
416 views

Non-greedy regex not working

I can't seem to get the non-greedy regex to work. Sample String: ABCD,E《F》、《GH》、《XYIJ》、《KL》、《MN》。 Regex Code: 《.+?IJ》 Search Result: Because .+? is a non-greedy input, I was expecting the ...
4
votes
1answer
472 views

How to use backspace to erase last character in search string?

When I am using incremental search, a backspace erases the character from the matched string in the buffer, instead of erasing the character from the search string I am typing. I saw that this is not ...
4
votes
1answer
388 views

Search and replace invisible url link in org-mode

I have following content in a org file: * test [[file:foo1.pdf][test file1]] [[file:foo2.pdf][test file2]] [[file:foo3.pdf][test file3]] Normally, the file name (eg foo1.pdf) is folded and invisible....
4
votes
2answers
275 views

Search and Mark

How would I be able to mark a specific occurrence of a searched phrase? In other words, I can use incremental search to search for a phrase, but would like to be able to mark that phrase once I found ...
4
votes
2answers
172 views

Incremental search in all visible buffers

Here's a feature I always wanted: I have two buffers opened side-by-side and I'd like to be able to start an incremental search in one of those buffers, but in a way which highlights results in both ...
4
votes
1answer
218 views

use isearch to search the search-ring?

In the minibuffer, M-p (previous-history-element) is useful, but I find C-r (isearch-backward) to be even better, as it lets me recall a specific history element without going through them one by one. ...
4
votes
1answer
237 views

How can I make Org expand sections while searching?

I search Org files with C-s or isearch-forward. However, when the match is hidden inside a code block in a child several levels deep, and everything is collapsed, it takes a lot of extra keystrokes to ...
4
votes
1answer
54 views

Searching Greek and Hebrew texts in Emacs with isearch while ignoring accents and diacritics

I have a number of text and org documents that contain Greek and Hebrew text. I want to be able to search these in Emacs using isearch but I also want Emacs to ignore all accents and diacritics. I ...
4
votes
1answer
312 views

multiple-cursors + isearch (or phi-search) with Emacs 24+?

For several years, I've been happily using multiple-cursors with phi-search to run interactive searches with several cursors at once with Emacs 23. I would create my multiple cursors, then run phi-...
3
votes
3answers
218 views

Get Emacs to jump to the start of a word after isearch

If I use isearch to search for the word "accommodating" in my document, I have to type acc before the cursor jumps to the word. When I press enter the cursor is on the the second "c" as in ...
3
votes
1answer
354 views

Extending word search selection in swiper

I have been using helm from some time and am now trying ivy, counsel and swiper. Regarding swiper I am wondering if there is a way of extending the word search selection. Just like hitting C-w after ...
3
votes
1answer
327 views

How to combine the history of isearch and query-replace?

I often use isearch (C-s normally or / in evil) and then want to use that query (or part of it) for replacing. This answer explains how to cycle history, but M-p cycles the history for each mode ...
3
votes
3answers
1k views

Ringing Bell in Macro with Search

It throws the error After 0 kbd macro iterations: isearch-search: Keyboard macro terminated by a command ringing the bell and I have no idea why, nor can I find anything about it by searching. Any ...
3
votes
2answers
65 views

How can I search for bolded text?

My reasons for doing so are exactly like https://unix.stackexchange.com/questions/271550/how-can-i-search-for-bolded-or-underlined-text , but the accepted solution there is to use vim. I don't fancy ...
3
votes
1answer
64 views

Repeated isearch when rebound to compound key

I don't isearch backwards frequently enough to justify giving it such a valuable keybinding, so I rebound isearch-backward-regexp to C-c r and I noticed that something strange started happening. ...
3
votes
2answers
96 views

Make region(s) invisible (not evaluated) to query-replacy and similar commands

Is there a way to make some regions of the buffer invisible (I mean not evaluated by) to query-replace and similar commands? Let me better explain with an example. Let's take a piece of LaTeX code .....
3
votes
1answer
44 views

isearch, but not past the nth line of the buffer

I'm doing an Isearch on a large file. I'm on line 30, starting the isearch. Is it possible to tell Emacs to do the Isearch but consider line 343000 as the end of the file. The file has 1,000,000 ...
3
votes
1answer
125 views

Limiting Emacs incremental search to a function definition

Any existing package that can do incremental search inside a function definition instead of the whole buffer? Now the best I can do is to turn on semantic-mode along with semantic-stickyfunc-mode and ...
3
votes
1answer
716 views

How can I specify the background color for matching search results?

When I incrementally search for a phrase with C-S, emacs usually highlights all matching results visible in the buffer by giving them a different background color. However, my current theme apparently ...
3
votes
1answer
77 views

Make region(s) invisible (not evaluated) to “string-match”, “occur” and similar commands

In a previous question, Make region(s) invisible (not evaluated) to query-replacy and similar commands, I learned about isearch-filter-predicate. Now, I wonder if is there a similar method to make ...
3
votes
1answer
79 views

Can't switch input sources in the minibuffer during Isearch

Incremental search doesn't allow me to switch between different input sources, e.g. US English to French, when I'm typing my search string into the minibuffer. Is there a way to fix this? It happens ...
3
votes
0answers
56 views

Ignoring curly braces in search

Journal article titles in my BibTeX appear as follows: Title="{{E}nsure {C}onsistence {C}apitalization in {T}itles}", This produces consistence output, which I am happy with. However, searching for ...
2
votes
1answer
204 views

Search for either of two words using isearch

Is there a way to use isearch (only search i think that works in pdf-tools)? to search for either of two words at the same time? It would search in the pdf for 'eval' or 'valid' and move forward in ...
2
votes
1answer
233 views

Wraparound search with `isearch-mode`

I found this function in this site: (defun search-selection (beg end) "search for selected text" (interactive "r") (let ((selection (buffer-substring-no-properties beg end))) (deactivate-...
2
votes
1answer
68 views

isearch but don't move the cursor until I ask to search

In a large file, I would isearch for the word byebug but as soon as I type by, my cursor is moved to a line containing the word bystander. (The file actually does not have the word byebug.) But now ...
2
votes
1answer
39 views

isearch looses focus when trying to paste into the isearch buffer

strange issue. when i launch isearh and want to paste text into it, after pressing C-s the paste (S-insert) always pastes the text to the current edited buffer and not the isearch window. has anyone ...
2
votes
1answer
72 views

How can I configure incremental search to put my cursor at the start of whitespace rather than the end?

I just installed a new version of Emacs (24.3.1 through Fedora). For some reason, when I use C-s to search for a single space character, it jumps my cursor to the end of contiguous spaces rather than ...
2
votes
1answer
51 views

Implementing my own incremental search

What would be the best way to implement an Emacs Lisp command that pops up the minibuffer, lets the user edit a search string there, and runs code to update the search results after each keystroke (or ...
2
votes
1answer
54 views

How go to prev search text in minibuffer?

Emacs 26.1, Ido , smex, Open scratch buffer. C-s to find text file Here result: C-g Now I want to find another text: text Here result: Nice. It's work fine. But now I want to backward in search ...
2
votes
2answers
171 views

Search only within an Org Sparse Tree

I use org-mode to write a huge research diary with thousands of entries. I'm trying to organize them by tags. I make only the relevant entries appear via org-sparse-tree and that works perfectly. Now, ...
2
votes
2answers
111 views

What is the best way to search forward/backward for a token?

Sometimes I want to search for a specific word but I don't want to find words which have my search string as a substring. For example, if I search for "pan" (bread, in Spanish), I don't want to find ...
2
votes
1answer
66 views

How to make DEL in isearch always delete character?

In Isearch, after hitting C-s a few times, you have to hit DEL a few times to get back to editing the search string. How can I disable this behavior? I'd like it so that DEL always deletes a ...
2
votes
1answer
74 views

How can I bind a key to M-x C-r (isearch extended command)?

I am a fiend for C-r (isearch-backward), and I often will enter the minibuffer with M-x (execute-extended-command), then use C-r to search for a previous command. I'd like to bind a key that drops me ...