each. A similar variable, @code{grep-regexp-alist}, tells Emacs how
to parse output from a @code{grep} command (@pxref{Grep Searching}).
+@vindex compilation-transform-file-match-alist
+@cindex compilation transform file
+@cindex compilation find file
+ Sometimes @code{compilation-error-regexp-alist} doesn't correctly
+determine the filename that is the source of the error. Use user option
+@code{compilation-transform-file-match-alist} to make any necessary
+adjustments, such as adding or changing a directory component.
+
@findex compilation-next-error
@findex compilation-previous-error
@findex compilation-next-file
(defcustom compilation-transform-file-match-alist
'(("/bin/[a-z]*sh\\'" nil))
"Alist of regexp/replacements to alter file names in compilation errors.
-If the replacement is nil, the file will not be considered an
-error after all. If not nil, it should be a regexp replacement
-string."
+If the replacement is nil, the file will not be considered an error
+after all. If not nil, it should be a regexp replacement string.
+
+When a replacement regexp is specified, the value of the file name used
+to locate the error is changed, but the compilation buffer still
+displays the original value.
+
+For example, to prepend a subdirectory \"bar/\" to all file names, add
+an entry matching \"\\\\=`\" and a replacement regexp of \"bar/\", i.e.:
+
+ (\"\\\\=`\" \"bar/\")
+
+Similarly, to remove a prefix \"bar/\", use:
+
+ (\"\\\\=`bar/\" \"\")"
:type '(repeat (list regexp (choice (const :tag "No replacement" nil)
string)))
:version "27.1")