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: How do I use compilation-transform-file-match-alist? Date: Thu, 15 Aug 2024 21:45:15 +0700 Message-ID: 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="16208"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 15 16:46:11 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 1sebjv-000469-B3 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 15 Aug 2024 16:46:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sebjI-0001EH-HO; Thu, 15 Aug 2024 10:45:32 -0400 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 1sebjG-0001DY-Vl for help-gnu-emacs@gnu.org; Thu, 15 Aug 2024 10:45:31 -0400 Original-Received: from mail-vs1-xe2c.google.com ([2607:f8b0:4864:20::e2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sebjF-0007VA-AA for help-gnu-emacs@gnu.org; Thu, 15 Aug 2024 10:45:30 -0400 Original-Received: by mail-vs1-xe2c.google.com with SMTP id ada2fe7eead31-492a774c807so379113137.3 for ; Thu, 15 Aug 2024 07:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723733128; x=1724337928; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gmCufYg3Hv/MBq3zM4OHaiqzO8pMDpPstfD62W36w+U=; b=RQgEzXLoRI4OMbqlTvF0MEhBEcX5TPpJzjZ59Y3PTLOGux5WJi2dN/xA9X67Al7C3b jsDfQylDQXPsa6cDPgGc2K5iy6L5TSXoqn9j67YWmU3cOSsCvRz9f6m2F3En6hhS2Qht K9ErnsqtvZWnZzwFLCIW0RWZOVEPPvnabwt01I8mwTv1BERPeqOeLQngoH7bsc58X82h XLcFVUC2AoAiihJEG9J9clzcP0O1kGWY47xgvls9iOuURXlIjbDSCKdJFMOg7h+e2wnN uZalXOOJy8BCS+ZXL2ro9N0/kXlL+3hkMFUHpXVIQo6WaPUvB/ODAUe67fscNwk57S1Y MQ2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723733128; x=1724337928; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gmCufYg3Hv/MBq3zM4OHaiqzO8pMDpPstfD62W36w+U=; b=LySLhHkgOfqw3wMYmxy/O9eadTE/aVbME2IRDNYoIwmkhKrOEuzrpVRHCjphO/VK50 wSdYBn9X8iUayQm9b1tGO6GJHxySp3sV3DGvf0HBNMgN5/nYZ+lR0tVsjVzMDoR02fb3 V02gORL8j0ab/67bqNG7JtZsVMbqbQW9byYZInNf2f6Lvol7Gr9OH52PjP7sl8Mc1sUN k1JjYn5E5sYLUd0dAvCntvjfIIDL2kzY261bDf5uP7usDPplCHGSFYkDLzJFhoonswax QxtqZtUx6wZ66orS+CNBypxT5M684Woy2x+mnFaSmk62eyXt5SgH4pWJCiUZlpP1tq6y l3kw== X-Gm-Message-State: AOJu0Ywy3TpGMhnv6VP63ogsV7F8aKmERUpBdRjIHL7dpxyinRxY4qeZ UTEg+dcY8NOqkNgVGm0gvIMZpt5ECHdsqnnKq3eUOSYQjcEj2fBZJG/nFpvvTAIcEAd0XXbCPhe ML4ldEH73/y7AQ0ygiVzVAqCRWX8GzA+NeSc= X-Google-Smtp-Source: AGHT+IGSBnqJFyfnzukaapDmFVeXyb69nGvT7F2uuLWCX8d2kInFjyItxUI840u/rhWnhuekPG65abYx8DF5NjJrWPw= X-Received: by 2002:a05:6102:a4f:b0:494:5b9d:529e with SMTP id ada2fe7eead31-497799ae10bmr23662137.26.1723733127453; Thu, 15 Aug 2024 07:45:27 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::e2c; envelope-from=yurivkhan@gmail.com; helo=mail-vs1-xe2c.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, T_SCC_BODY_TEXT_LINE=-0.01 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:147697 Archived-At: Hello, I have a project that I compile using a Docker container. This part works. I want to have multiple working copies of the project lying on my file system, so that I could work on several branches at the same time without losing context when switching. Each working copy is naturally located under a different directory. I want the working copy on the host to be mounted into a fixed directory name in the container. This greatly simplifies efficient use of ccache. /home/me/work/PROJECT/ master/ -> /home/me/work/PROJECT/_branch foo-branch/ bar-branch/ Compilation will sometimes output warnings and error messages. These refer to files by their full absolute name in the container: /home/me/work/PROJECT/_branch/some/source.cpp:42: error: some_identifier undefined By default, compilation-mode will display those as is, and when I try to visit the offending file, Emacs will not find it, because the directory is different. I have found a variable, compilation-transform-file-match-alist, that looks like it will instruct Emacs to map file names according to a list of regexp/replacement pairs. So I could, in theory, put PROJECT/_branch on the left and PROJECT/master on the right, to get: /home/me/work/PROJECT/master/some/source.cpp:42: error: some_identifier undefined However, I seem to be unable to easily set it for compilation-mode buffers. I cannot set it globally because I want different replacements in PROJECT/master, PROJECT/foo-branch and PROJECT/bar-branch. I naturally try to put it in PROJECT/master/.dir-locals.el: ((nil . ((compilation-transform-file-match-alist . (("/PROJECT/_branch/" . "/PROJECT/master/")))))) But it looks like compilation-mode buffers do not apply directory-local variables. How is the feature intended to be used? I guess I can hook =E2=80=98compilation-mode-hook=E2=80=99 to invoke =E2=80= =98hack-local-variables=E2=80=99?