unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: 8252@debbugs.gnu.org
Subject: bug#8252: Please add a function to get files in *grep*
Date: Sat, 17 Jul 2021 16:54:56 +0200	[thread overview]
Message-ID: <877dhp3s8v.fsf@gnus.org> (raw)
In-Reply-To: <AANLkTinY+5GXLREt2cDBf_y5jiv4S_VY7xwXFGy4vaZb@mail.gmail.com> (Lennart Borgman's message of "Mon, 14 Mar 2011 22:46:05 +0100")

Lennart Borgman <lennart.borgman@gmail.com> writes:

> For example something like this (which I just added to
> ourcomments-util.el in nXhtml) works now:
>
> (defun grep-grepped-file (pt)
>   "Return grepped file at PT in a `grep-mode' buffer.
> The returned file name is relative."
>   (let* ((msg (get-text-property (point) 'compilation-message))
>          (loc (when msg (compilation--message->loc msg)))
>          (file (when loc (caar (compilation--loc->file-struct loc)))))
>     file))

I think that sounds generally useful -- writing things on top of grep
mode is quite popular, and it isn't obvious how to get at the file name
(which is what people generally want).  So I've added your function to
Emacs 28 (with some minor tweaks) under the name `grep-file-at-point'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





      parent reply	other threads:[~2021-07-17 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14 21:46 bug#8252: Please add a function to get files in *grep* Lennart Borgman
2011-03-15  2:16 ` Stefan Monnier
2011-03-15  9:31   ` Lennart Borgman
2021-07-17 14:54 ` Lars Ingebrigtsen [this message]

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=877dhp3s8v.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=8252@debbugs.gnu.org \
    --cc=lennart.borgman@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).