From: Yuri Khan <yuri.v.khan@gmail.com>
To: "Björn Bidar" <bjorn.bidar@thaodan.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Transforming paths in compilation output (containerized builds)
Date: Sun, 8 Dec 2024 13:24:11 +0700 [thread overview]
Message-ID: <CAP_d_8W_Xfm1H49yX1_S8krcbgd0izCSr_Ld5LiqsUA+7-HSvg@mail.gmail.com> (raw)
In-Reply-To: <6754a91d.050a0220.355713.95f8SMTPIN_ADDED_BROKEN@mx.google.com>
On Sun, 8 Dec 2024 at 02:59, Björn Bidar <bjorn.bidar@thaodan.de> wrote:
> I'm looking how to transform the output in the compilation buffer or
> just make Emacs open the correct paths inside builds happen inside
> containerized builds.
>
> The output of the programs ran inside these environments relates
> to the environment they are build in e.g. container in
> /var/tmp/build-root/<name> and output as if /var/tmp/build-root/<name>
> is /.
I’m using this for containerized builds.
(defvar yk-compilation-filter-alist nil
"List of (REGEXP REPLACEMENT) to apply to compilation messages.")
(defun yk-compilation-filter ()
"Apply replacements to compilation messages."
(save-excursion
(pcase-dolist (`(,regexp ,replacement) yk-compilation-filter-alist)
(goto-char compilation-filter-start)
(beginning-of-line)
(while (re-search-forward regexp nil t)
(replace-match replacement nil nil)))))
The variable is set directory-locally on the project root:
((nil . ((yk-compilation-filter-alist
. (("/my/container/root/" "/home/myself/project/"))))))
The filter function is permanently added to the
‘compilation-filter-hook’ variable.
I may have had to work around the bug where a ‘compilation-mode’
buffer that is not visiting a file does not pick up directory-local
variables, by adding ‘hack-local-variables’ to
‘compilation-mode-hook’. I did not file a proper bug report at the
time.
next parent reply other threads:[~2024-12-08 6:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <6754a91d.050a0220.355713.95f8SMTPIN_ADDED_BROKEN@mx.google.com>
2024-12-08 6:24 ` Yuri Khan [this message]
[not found] <87y10rnu37.fsf@>
2024-12-07 20:21 ` Transforming paths in compilation output (containerized builds) Eli Zaretskii
2024-12-07 21:17 ` Björn Bidar
[not found] ` <87plm3nqfr.fsf@>
2024-12-08 5:42 ` Eli Zaretskii
2024-12-08 6:32 ` Yuri Khan
2024-12-08 7:04 ` Eli Zaretskii
2024-12-08 19:45 ` Björn Bidar
[not found] ` <87frmy2c38.fsf@>
2024-12-08 20:44 ` Eli Zaretskii
2024-12-07 19:58 Björn Bidar
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=CAP_d_8W_Xfm1H49yX1_S8krcbgd0izCSr_Ld5LiqsUA+7-HSvg@mail.gmail.com \
--to=yuri.v.khan@gmail.com \
--cc=bjorn.bidar@thaodan.de \
--cc=help-gnu-emacs@gnu.org \
/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.
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).