From: Nick Dokos <ndokos@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Saving results of grep-find in the original interactive format ?
Date: Tue, 19 Nov 2019 17:38:29 -0500 [thread overview]
Message-ID: <8736ejfq56.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: 20191119162155.07105a7b@mistral
jonetsu <jonetsu@teksavvy.com> writes:
> Is it possible to save the results of a grep-find search in such a
> file format that would allow to load it back and have all the results
> clickable again so that instantly it becomes possible to jump to those
> files quickly as it was in the first place right after the search ?
I just saved the grep buffer into a a file and killed the buffer. When
I opened the file again, everything was as before: you can jump to any
of the found places. What makes this possible is the first line of the
buffer that makes sure that when you open the file, it is in grep-mode
and the current directory is set to wherever the search was executed
in the first place:
,----
| -*- mode: grep; default-directory: "~/src/emacs/org/org-mode/worktrees/foo/" -*-
| Grep started at Tue Nov 19 17:29:57
|
| grep --color -nH --null -e foo lisp/*.el
| lisp/ob-core.el^@456:their `org-babel-default-header-args:foo' variable.
| lisp/ob-core.el^@1571:#+PROPERTY: var foo=1, bar=2"
| lisp/ox-texinfo.el^@851: ((org-element-property :footnote-section-p headline) nil)
| ...
|
| Grep finished with 860 matches found at Tue Nov 19 17:29:57
`----
I replaced real NUL chars above with the string "^@" because gnus
warned me of potential problems when sending mail with NULs: in the
real file, they should be real NUL chars.
--
Nick
"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler
next prev parent reply other threads:[~2019-11-19 22:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 21:21 Saving results of grep-find in the original interactive format ? jonetsu
2019-11-19 22:38 ` Nick Dokos [this message]
2019-11-20 12:56 ` jonetsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736ejfq56.fsf@alphaville.usersys.redhat.com \
--to=ndokos@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).