Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions about search mechanics inside of Emacs.
1
vote
Accepted
Text search in directory with live preview
Counsel provides the commands ivy-next/previous-line-and-call for this, which by default are bound under C-M-n and C-M-p.
Also, for counsel this functionality is requested in this, currently still ope …
1
vote
Accepted
limit-of-search to apply search-forward to just current paragraph
For example:
(while (search-forward ". "
(cdr (bounds-of-thing-at-point 'paragraph))
t)
(delete-backward-char 1)
(insert "\n\n")) …
1
vote
How to adjust the search in file behavior in spacemacs?
You can achieve this by advising evil-ex-search as follows:
(advice-add 'evil-ex-search :after #'recenter) …
0
votes
How do I break a large piece of text in to a list of 5-word phrases, and identify the oft-re...
As it looked to me that it would be handy to use word-at-point (or symbol-at-point) and forward-word (or (forward-symbol 1) if you don't like to break words separated by 'dashes') in the solution, I h …
0
votes
Accepted
How do I break a large piece of text in to a list of 5-word phrases, and identify the oft-re...
In response to your request on my first answer, which I would like to preserve (so that users can compare the answers), I am posting here the modified version to get all repeated patterns in one go:
( …
2
votes
Accepted
Search whole ebook in nov
You could use nov's own functionality to search the documents using the following command (obtained by inspecting nov.el's source):
(defun nov-search (pattern)
(interactive "sEnter search pattern: ") … completing-read "Jump to: " (reverse results)) results
nil nil #'string=)
(nov-goto-document index)
(goto-char point))))
Evaluate the code and do M-x nov-search …
3
votes
Accepted
Search in all Org mode headings within a folder
The following function will list all org mode headings in the directories passed to the function (more info in the docstring):
(require 'xref)
(setq my-search-dirs '("~/.emacs.d" "dir-2"))
(defun my-search-heading-across-directories … To search in multiple directories do
M-: (my-search-heading-across-projects "~/dir-1" "dir-2")
To call it with a list of folders, call it using apply. …
2
votes
Need search function to navigate to last line in continuous occurrence range
Finally, you can make a search-backward version by changing eobp to bobp and adding a -1 behind forward-line. …
2
votes
Accepted
How to preserve helm project search results to iterate through them
You can toggle helm-follow-mode using C-c C-f within a helm buffer, then when cycling through helm you will see previews of the results. You can switch to the results buffer by typing M-1 and then swi …
1
vote
Search and Replace for a block on many lines in a dozen files
of how to replace
text in some buffer/file
Then evaluate the following snippet of code:
(dolist (x '("~/test.txt"))
(with-temp-buffer
(insert-file-contents-literally x)
(print (point))
(search-forward … "an")
(let ((start (match-beginning 0)))
(delete-region start (search-forward "replace"))
(goto-char start)
(insert "the result of replacing"))
(write-file x)))
Of course, like …
2
votes
Accepted
How to filter search results by path pattern?
EDIT
A very basic code example to achieve fuzzy search using a single grep would be:
(defun custom-counsel-function (str)
(or
(ivy-more-chars)
(progn
(let ((str (split-string str)) … For example, to filter for files that are located in some-path dir-example/file.ext relative from your initial search directory, you could search for the following:
ripgrep-pattern -- -g dir*/* …
2
votes
Using Emacs to find and copy relevant database records
I am sharing my solution mainly for the comparison with AWK (see comments under NickD's answer), but also because it takes a slightly different approach than the solution by @orgtre:
This solution 'it …