From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Transforming paths in compilation output (containerized builds) Date: Sun, 8 Dec 2024 13:24:11 +0700 Message-ID: References: <6754a91d.050a0220.355713.95f8SMTPIN_ADDED_BROKEN@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26672"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: =?UTF-8?B?QmrDtnJuIEJpZGFy?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 08 07:25:20 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tKAjI-0006m9-3b for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 08 Dec 2024 07:25:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKAib-0002Ey-EF; Sun, 08 Dec 2024 01:24:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKAiS-0002EZ-TU for help-gnu-emacs@gnu.org; Sun, 08 Dec 2024 01:24:29 -0500 Original-Received: from mail-vs1-xe34.google.com ([2607:f8b0:4864:20::e34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKAiP-0002cX-K9 for help-gnu-emacs@gnu.org; Sun, 08 Dec 2024 01:24:27 -0500 Original-Received: by mail-vs1-xe34.google.com with SMTP id ada2fe7eead31-4aff31b77e8so89563137.1 for ; Sat, 07 Dec 2024 22:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733639064; x=1734243864; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jev9hHv/7h1e+OBaWrNhwBYkICBl6PicHIn0If/N1fU=; b=HSSV5WQOMVSd6GiQdn0W3seu4SVzDS8zofeOO+IiDhq27THGnT4NC/p0ZLowGAoZak S4UamK7uGlqQu5g9P/csElJaPe7SyKue+bKwWxWWRICSYHFylmALQxv4Q9QMoGqGb8QB IA6azV+ShN9ovTMBzkpgJmxqq60KJWM8p2eNaJcGqk5oFcoHvqFNT3lL095Cmn2BuqSo BzPl2Tgw9P6kd7SxLv5LFSPpPoPSQ3J6o2sk+UofqnqcRjfmF9TiPNoMS1i9yxmErdFF tuU+nmKkijWwm+F3Qzo9OdcaKwFsiBEdnqpe6KEd+tCTUe5kQdCD6ODLu9v0pnXbBHHx oV9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733639064; x=1734243864; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jev9hHv/7h1e+OBaWrNhwBYkICBl6PicHIn0If/N1fU=; b=vio3RxDoeQbUkHMm8/R4XMhl2IOgxdP20uINm+x7t4IfG4IyVMEFijhdHY3m0nx7Ge AyoE94ugptys2VR23KrfnCOdOs5ztu+IBc/durz14tDeceHbbWypq/30iCEMLlve76oU 0ClEAGjarzhOueL9lwfOW2bel+EKvWwXzsI1n8DUbT8mV2uh1eznB0H5Lpz2POTt8JWc ecmC1iKAwdrcDjfaacn2SH9pWqxhWGr/y6tm6sWKZjDd0vyJow+ritVpp/UQru59pDoO 8RECcYkTCpiyUBalsgSNPE/fb9gLrIIGgwM3DXPevteoh+vNwGtC88pSvd6XMR2Jbvua t0SA== X-Gm-Message-State: AOJu0YxThiJriHlf/6N/M/aitByoEbJ48OJfFykv0jlSYMppQ+3HlnIq /EFd/AYxlQCRffNEh4A97S+jlI5ehXzgDbYN6/oXLY5/6hTcJlz5MRDPEE3RtwlvkXCS/DcmKOh rohx035TWjth4NTW8HbPrnratsht9NFsq X-Gm-Gg: ASbGncuUl/qSHJXDYEhr6GjRUCSivp/T9AqnqUnAkDjXa7rwQRHruSDxW1p1lYL38qp weI/kN9UHJGS0YAaTdYd4Z5kTihzAW4s= X-Google-Smtp-Source: AGHT+IHo3WCm5BDOuKwlr26wMf+126j9cAXKQ45WTIFIRpd8ptLIwqkL8OIam5X18SYyqLZPOHIO9ZJNESDCH7TxBzs= X-Received: by 2002:a05:6102:32c6:b0:4af:ea3b:7b31 with SMTP id ada2fe7eead31-4afea3b87a9mr1911677137.14.1733639062734; Sat, 07 Dec 2024 22:24:22 -0800 (PST) In-Reply-To: <6754a91d.050a0220.355713.95f8SMTPIN_ADDED_BROKEN@mx.google.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::e34; envelope-from=yurivkhan@gmail.com; helo=mail-vs1-xe34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148670 Archived-At: On Sun, 8 Dec 2024 at 02:59, Bj=C3=B6rn Bidar wrot= e: > 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/ and output as if /var/tmp/build-root/ > is /. I=E2=80=99m 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 =E2=80=98compilation-filter-hook=E2=80=99 variable. I may have had to work around the bug where a =E2=80=98compilation-mode=E2= =80=99 buffer that is not visiting a file does not pick up directory-local variables, by adding =E2=80=98hack-local-variables=E2=80=99 to =E2=80=98compilation-mode-hook=E2=80=99. I did not file a proper bug report= at the time.