Sticking to built-in Emacs commands, you can use multi-occur or multi-occur-in-matching-buffers (M-x multi-occur- TAB RET). multi-occur gives you fine control by prompting for each buffer to use, but it's tedious. multi-occur-in-matching-buffers lets you enter a regexp to match file names (it only searches in buffers that are visiting files); enter . as the ...
Project based searching within Emacs can be done using projectile.
It allows for per-project configuration of ignore files (in a <projectroot>\.projectile file), or specify subdirectories to monitor and ignore all others.
It can run grep, ack (requires ack-and-a-half.el) and ag (ag.el) on files within the defined project (either based on the ....
Use M-s SPC during Isearch to toggle matching whitespace literally. When matching literally, each SPC char you type is matched individually. (This used to be the default Emacs behavior, BTW.)
To configure this as the default behavior customize option search-whitespace-regexp to nil. (M-x customize-option search-whitespace-regexp.)
See the GNU Emacs manual,...
ivy-initial-inputs-alist is a variable that controls the default minibuffer contents when using ivy (which is used by counsel).
The default "^" string means that if you type something immediately after this string only completion candidates that begin with what you typed are shown.
You can remove this default string in counsel-M-x command with:
The manual is your friend!
The basic search capability is incremental search. Press C-s and enter the string to search (C-r to search backwards). Press C-s/C-r again to go to the next/previous occurrence. Any command other than typing text, backspace and a few others exits search mode; in particular, press RET to continue editing where the occurrence was ...
You can use helm-occur as a tool that comes with the basic helm module for this.
But to me, one of the best helm based tools for buffer searching is Shingo Fukuyama's helm-swoop. You can get it from github and via MELPA. It has your required functionality of being able to drop your point at the position of the match (which can be a regexp). But you can also ...
The project-wide search of only relevant files can be done using ag aka the_silver_searcher.
It ignores file patterns from your .gitignore, .hgignore, svn:ignore. You can choose for your searches to NOT use the ignore list from the version-control ignore lists by using the -U switch.
If there are files in your source repo you don't want to search, ...
Here are some possibilities that aren't very slick, that have the advantage of working with a stock Emacs.
If you press M-s o (isearch-occur) during an incremental search, an Occur buffer pops up with the current search expression. At the top of the *Occur* buffer is the number of matching lines.
The command how-many displays the number of occurrences of a ...
Does apropos-value do what you're looking for?
(apropos-value PATTERN &optional DO-ALL)
Show all symbols whose value’s printed representation matches PATTERN.
PATTERN can be a word, a list of words (separated by spaces),
or a regexp (using some regexp special characters). If it is a word,
search for matches for that word as a substring. If it is a ...
In addition to what others have mentioned - here are two other resources for this.
M-x multi-isearch-buffers or M-x multi-isearch-buffers-regexp (vanilla Emacs) - Incremental search across multiple buffers.
If you use Icicles then you can use icicle-search (or icicle-occur, or any number of other icicle-search specializations) to search across multiple ...
This can be done with helm via the command helm-multi-occur. You can install helm from melpa and then call the command as follows:
M-x helm-multi-occur RET M-a RET
This will open helm-multi-occur and then select all buffers. Instead of using M-a to mark all buffers, you can optionally select the buffers of interest one at a time. Navigate up and down the ...
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 ...
EDIT: I just found the wonderful M-x info-apropos which searches full text over all info documents and returns the relevant nodes. Seems this gem is relatively unknown.
If you use helm package from MELPA with helm-mode on, using either i (info-index) or I (info-virtual-index) pops up a helm window with the index terms. You can then use typical helm ...
Alternatively to query replace you can go with multiple-cursors:
Also consider using something like this:
(defun wrap-html-tag (tagName)
"Add a tag to beginning and ending of current word or text selection."
(interactive "sEnter tag name: ")
(let (p1 p2 inputText)
(setq p1 (region-beginning) )
Instead of just providing a link to the manual section section about searching, the real "the manual is your friend" answer is to tell you how to look this up in the manual yourself: C-h r i searching RET or C-h r i search TAB ing RET.
If someone is really at this basic a level with Emacs, then the real question is how to look something up in the manual, ...
I have run the following benchmarks on
GNU Emacs 27.0.50
(build 14, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
without customisations, i.e. by starting Emacs with the -Q flag.
Is there a more efficient alternative to search-forward when searching for a single character?
Does something like search-forward-char exist and would ...
On systems that provide GNU find utility, you can use helm-find (by default bound to C-x c /) to get the desired behavior. Starting helm-find with a prefix argument C-u C-x c / prompts for the directory (emacs24.3 in the example) first and then for the pattern (dired el in the example). Without the prefix argument, it uses the default directory of the ...
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):
re-search-forward has an option for not causing an error:
(re-search-forward REGEXP &optional BOUND NOERROR COUNT)
You should call (re-search-forward "..." nil t) and your while will receive a nil value when no match found.
As Jordon notes in the comments, there is a more general way of ignoring errors, which is the ignore-errors macro:
Isearch is quite flexible and if you become tired of constantly
narrowing the buffer (as was suggested), you may want to have a
dedicated command for this, e.g.
(defun isearch-line-forward (&optional regexp-p)
(let* ((beg (line-beginning-position))
evil has two search implementations, one is its own, the other one is a wrapper around emacs isearch. evil-search-forward wraps isearch-forward, evil-ex-search-forward invokes the internal search.
Which one is used is governed by the variable evil-search-module, the default is isearch. In this mode, evil's search behaves exactly like emacs' (because it is.) ...