* lisp/progmodes/grep.el (grep-file-at-point): New function to
return the file name at point (bug#8252).
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
+++
(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)