We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

12

Ah yes. Isearch reads the keys you type, looks them up in isearch-mode-map, and invokes them in the current buffer. Isearch does not, in spite of appearances, use the minibuffer. It uses the echo area. That is, what you see there is actually output messages, including echoes of the characters you type. This should do what you ask: (defun mydelete () "...


11

You can set search-invisible to nil in your .emacs or using Customize. Then, if you do want to show matches in invisible text, press M-s i while using isearch. (I found this by reading the docs of isearch-forward and isearch-toggle-invisible, but it is also documented in the manual: see Special Isearch.) This affects all buffers, not just Org; if you want ...


11

Take a look at the variables isearch-lax-whitespace, isearch-regexp-lax-whitespace, and search-whitespace-regexp. If the first two variables are set to something non-nil (e.g. t) any space character in your search string will match any sequence matched by the regular expression defined by the search-whitespace-regexp variable. To match words across line ...


8

You don't need to define a separate function (command) for this. And even if you did define one, it need not use query-replace-regexp. The standard command query-replace does just what you request, if you provide it with a prefix argument. So just use C-u M-% to query-replace words. C-h f query-replace tells you this (note the part in bold): query-...


8

I can't imagine any such automated behaviour not then causing you pain when that's not what you wanted it to do. To my mind kaushalmodi's recommendation of M-e is the best answer -- making it easy to correct the problem seems preferable to trying to make isearch read your mind. Note that isearch is smart enough to take note of the first character where the ...


7

While using isearch you can toggle the search on invisible text with M-s i. You can also customize this behaviour with M-x customize-group isearch and searching for Search Invisible. Note that this will ignore everything in a folded block, I can't ignore only the text in a commented block.


7

If you use library Icicles then you can use M-. at any time from the minibuffer to insert a thing-at-point from the buffer. You can repeat M-. to either (a) append subsequent such things from the buffer or (b) change the kind of thing, inserting a different kind instead (cycling through thing types). This is explained at Icicles - Inserting Text from Cursor....


7

@legosia's answer is the usual one, and probably what you want. But be aware that there is an alternative Isearch behavior that lets you scroll the buffer being searched without exiting Isearch. If you set (or bind) option isearch-allow-scroll to non-nil then you can scroll without exiting Isearch, as long as the current match is still on screen. This has ...


7

Yes: if you want to search for a literal string, but that string contains special regex characters, it'll require extra escaping on your part. Example text to search: "some*text" C-s some*text matches C-M-s some*text does not match C-M-s some\*text matches


7

Here's one approach: (defun isearch-exit-mark-match () "Exit isearch and mark the current match." (interactive) (isearch-exit) (push-mark isearch-other-end) (activate-mark)) (define-key isearch-mode-map (kbd "<C-return>") #'isearch-exit-mark-match) This binds a different key (C-return) to exit the current isearch and also leave the last ...


6

C-M-s to invoke isearch-forward-regexp then type aaa\|bbb, where aaa is your first word and bbb is your second. Alternatives, just C-s to invoke isearch, then press M-r to toggle to regex.


6

By default, this is not possible (easiest way to see this is with C-h v char-fold-table RET and searching for ß — which you won't find). However, if you modify char-fold-table (the variable responsible for determining how folding occurs), then you can enable this. The structure of char-fold-table char-fold-table is a char-table — quoting the emacs manual:...


6

During Isearch M-e is bound to isearch-edit-string. It pauses Isearch and puts the current search string in the minibuffer so you can edit it. Just use C-s again to resume searching from the current position but with the new search string. (I know it looks like your search string is already always in the minibuffer during Isearch, but it is not. I you use ...


5

Customize option query-replace-from-history-variable (or query-replace-to-history-variable, or both). Point to search-ring or regexp-search-ring instead of query-replace-history.


5

(setq scroll-margin 3) Works everywhere, not just during isearch. scroll-margin. Default: 0. Number of lines of margin at the top and bottom of a window. Recenter the window whenever point gets within this many lines of the top or bottom of the window.


5

If you use swiper and search for snake case, it will match both snake_case and snake-case. swiper is a new isearch alternative that gives you an overview in the minibuffer as you search. In the image above, the input is ivy m that translates to the regex ivy.*m. There are 36 matches for this regex. You can navigate between them with C-s/C-r or C-n/ C-p. ...


5

Here's a rough start, based on the list of combining characters in this answer (and then extended). (Marking this as community wiki — please edit and improve this!) (defconst arabic-diacritics '(#x064b #x064c #x064d #x064e #x064f #x0650 #x0651 #x0652 #x0653 #x0654 #x0655 #x0670) "Unicode codepoints for Arabic combining characters.") (defconst arabic-...


5

You'll want to change (global-set-key (kbd "<backspace>") 'delete-backward-char) either to (global-set-key (kbd "DEL") 'delete-backward-char) or to nothing at all. The definition you use prevents Emacs from remapping backspace to DEL, and the Isearch behavior you want is bound to DEL.


5

Try M-j, which is bound to ivy-yank-word in the ivy minibuffer key map. It's worth reading through the the ivy manual, either in Emacs or online. The relevant key bindings are discussed here: http://oremacs.com/swiper/#key-bindings-that-alter-the-minibuffer-input


5

C-g, possibly repeating it, puts you back where you started and exits Isearch. Not wanting search to start until you've finished typing is not incremental search. It is plain, nonincremental search. In Emacs you do it using C-s RET. See the Emacs manual, node Nonincremental Search. How did I find that help page in the Emacs manual? C-h r to open the ...


5

You can run the command isearch-edit-string pressing M-e. See the documentation for details.


5

It works OK for me. Did you use C-s to repeat the search? C-s repeats Isearch, including to wrap around. You can replace the repeat-search binding: (define-key isearch-mode-map (kbd "<C-f3>") 'isearch-repeat-forward) ;; Define <C-M-f3> similarly so you can use it to repeat regexp Isearches. (define-key isearch-mode-map (kbd "<C-M-f3>") '...


4

The Emacs Manual (section Special Isearch) says this: By default, incremental search performs lax space matching: each space, or sequence of spaces, matches any sequence of one or more spaces in the text. Hence, "foo bar" matches "foo bar", "foo bar", "foo bar", and so on (but not "foobar"). More precisely, Emacs matches each sequence of space ...


4

Yes. Use library Isearch+, specifically file isearch-prop.el. As it says here: You can search the text of THINGS of various kind (sexps, lists, defuns, lines, pages, sentences, filenames, strings, comments, xml/html elements, symbols,…), using command isearchp-thing. This is equivalent to using command isearchp-thing-define-contexts, which marks such ...


4

@Dan provided a good answer to the question. I will add this: As @Adobe indicated in a comment, you can use M-r anytime during Isearch (literal search or regexp search) to toggle between regexp search and literal search. Easy-peasy. This means that it can make sense to start with whichever search mode you expect to use first, or most, and just toggle to ...


4

Run query-replace-regexp with '\bi\b' as the query and 'I' as the replacement. (Update to comment) The function @lawlist linked to should work nicely if you want to replace all instances without questions. To still be prompted for each instance, below should do (defun query-replace-word (word new-word) (interactive "sWord: \nsNew word: ") (query-...


4

This is because normally when you repeat an isearch command it executes the isearch-repeat-forward or isearch-repeat-backward command to save your search string (you can find this out by doing C-h k in the minibuffer). The following should fix this for your keybind: (define-key isearch-mode-map (kbd "C-c r") 'isearch-repeat-backward)


4

With C-s C-s you search the previous word. Then M-p (and M-n) for history.


4

You can change the lazy-highlight face: (custom-set-faces `(lazy-highlight ((t (:foreground "white" :background "SteelBlue"))))) But this face is used in other cases.


4

occur can do this with prefix argument C-u M-x occur.


Only top voted, non community-wiki answers of a minimum length are eligible