Commit 9ee418b7 authored by Lennart Borgman's avatar Lennart Borgman Committed by Lars Ingebrigtsen
Browse files

Add new function 'grep-file-at-point'

* lisp/progmodes/grep.el (grep-file-at-point): New function to
return the file name at point (bug#8252).
parent b4b0c219
Pipeline #11449 failed with stages
in 56 seconds
......@@ -1153,6 +1153,11 @@ any directory names on the 'find' command lines end in a slash.
This change is for better compatibility with old versions of non-GNU
'find', such as the one used on macOS.
---
*** New utility function 'grep-file-at-point'.
This returns the name of the file at point (if any) in 'grep-mode'
buffers.
** Help
+++
......
......@@ -1345,6 +1345,13 @@ command before it's run."
(grep-highlight-matches 'always))
(rgrep regexp files dir confirm)))
(defun grep-file-at-point (point)
"Return the name of the file at POINT a `grep-mode' buffer.
The returned file name is relative."
(when-let ((msg (get-text-property (point) 'compilation-message))
(loc (compilation--message->loc msg)))
(caar (compilation--loc->file-struct loc))))
;;;###autoload
(defalias 'rzgrep 'zrgrep)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment