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
538 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
468 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
309 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
409 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
314 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
300 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
57 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
77 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
125 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
232 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
409 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
73 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
358 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
389 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
98 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
1answer
455 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
2answers
247 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
133 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
193 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
335 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
1answer
265 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
94 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
320 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
303 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
935 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
60 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
58 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
84 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
43 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
113 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
635 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
218 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 ...
3
votes
1answer
72 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
0answers
54 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
189 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
59 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
184 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
37 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
67 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
49 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
152 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
95 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
61 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
70 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 ...
2
votes
1answer
82 views

Customize isearch to start from buffer start

Ctrl-s, isearch-forward is not appealing to me and so, i wrote a wrapper around it to search from the beginning of the buffer always. (defun sk-isearch-forward (original) (interactive "sEnter ...
2
votes
1answer
223 views

Searching for multi-line text in many files

I have a phrase, e.g. This is an example phrase, and a collection of text files (coll.d/a.txt, coll.d/b.txt, etc.), and I'm looking for the former in the latter. The thing is, maybe my pattern is ...
2
votes
1answer
43 views

Add multiple predicates to isearch-filter-predicate

I wrote a set of predicates to filter matches in my ìsearch-* and query-replace* routines. I also wrote a macro to bind the isearch-filter-predicate variable to multiple predicates: (defmacro with-...
2
votes
1answer
92 views

How can i keep the case when I am using select and paste to C-s input field?

I see a word in buffer1. I want to look for it in buffer2. I select the word in buffer1. I select buffer2 as my current buffer, hit C-s, and press mouse-2 (the middle mouse button). Emacs converts ...