bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8252: Please add a function to get files in *grep*


From: Lars Ingebrigtsen
Subject: bug#8252: Please add a function to get files in *grep*
Date: Sat, 17 Jul 2021 16:54:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]