From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Daniel_Mart=C3=ADn?= Newsgroups: gmane.emacs.help Subject: Re: Question about dir-locals c-mode. Date: Sun, 08 Nov 2020 14:39:49 +0100 Message-ID: References: <20201107235056.5lwabkhbflx2gc6o.ref@Ergus> <20201107235056.5lwabkhbflx2gc6o@Ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39025"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) Cc: help-gnu-emacs@gnu.org To: Ergus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 08 14:41:04 2020 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 1kbkwK-000A2f-0m for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 08 Nov 2020 14:41:04 +0100 Original-Received: from localhost ([::1]:34620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbkwJ-00052f-1T for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 08 Nov 2020 08:41:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbkvV-0004zz-Ng for help-gnu-emacs@gnu.org; Sun, 08 Nov 2020 08:40:13 -0500 Original-Received: from sonic301-21.consmr.mail.ir2.yahoo.com ([77.238.176.98]:36801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kbkvJ-0005RZ-V8 for help-gnu-emacs@gnu.org; Sun, 08 Nov 2020 08:40:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1604842794; bh=TEqr/dosGXIRJw4jN0wB/OyWaSyyIvt7hFu7h3jy9MA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject; b=sgwNy1kW/PM8/ISibvIWdi5bxYVWfTRXQzi7N9v6KwJidncOHCzyGuU9NFzLFQScGhZ/CzXGmyVyjo3UnHTPZujc41ZxYR5BT7QD5ckCsPGWuOPdzPhstS52e1eTVLgL9p7Wcn3jhJJZf7PCOW8ROYXJFZMsQlMLj92Ks45Tcz/NXFmIOHPcOKga68L4ON6yzuKKEexVTKtlIGpDFScyu7HwGFMss93kY+CGtBVjpR6/RM5rkg07HO82Ycfg+jNWtEsHDg1qoh40MY1N1mPfel4UHYZOaZktxE4pKjIgHzAJPQcl48tSewn/dtyST+7GZa9Do+Y3fvbw4iue0Fe0oQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1604842794; bh=d5b2YouZPm5vt4wgDXsunOqoJKhNTlnB8VTD3kJeEhM=; h=From:To:Subject:Date; b=VGSj0Ugdy6Zc8gjUcgEQ3V00wfuG6FNkXrPzCbaewbdsm6EBhE986ihdBOHrTTBClutUWfbHJ4yWECe5x7qXdBgTqu2pS4lFa3JYWjqo+KwC74da1AbealqEr/CeSDDzmkWWnTGxpsBRDLmCkIIao+3gwqJSD0YmUEBr1/LM7cS2pcc5ttcq4bhxLoKFLwUaS2GpvLTmKJ4+4V6v+jl7nXHXJZJAHYE0+P3fBw5j5v/UCWsu1dcB+oH9yGeA/uFPS+xlgHy+G0wf5UWrdZg5G6iwFYCPLz/P2mEYejRBdDs7Ojt7mR1Qrk8jMD8aUNvwV6ucQE0sPjJObiw3E0E3oQ== X-YMail-OSG: X3bsvpsVM1l_BLznuRj3l6PDMXgZgG9vPItjQ5doNdYSKfc31rYAXXwk5H5sUs2 jVadklfInXzlZCL9JVyHSB4Mqno9Ir61BtawoFNbPpBTuI.DzKc3V3jrsh609WCwPwmBSKBOsGrN iDd3L.sy90yu.jj86yMYLBfFs2bltzlDXIdVkSLyLrcHXpi0.YwUe2nORhbt9iwsPF5SCQoLQvWE 7p4JOTAq8gHnDmYz32sAmp2AwNJH1ujlKcR1b3l6ggigYq.6evFCS5XkqR0eHFMpxJYxJSr2cnPt EWAcsustzfB9OeNc8PSG.0EkyZicWbiT2GOJjnP1edIytvDS55U6vD.QmeQg.KEi2IYo3X0rSCAL _r2OviS.B5kOutZbVBIiqsG9mVmN3bgYLNMRnxowkjqsUjtDtCxLOQHEflZxo.TG8M5K7izaCUZR Eom2i6ZUoY54xWh7VOpczyen9WEVLBdUOxtTV.DyUg.m_szrgqsBPHNCLwHy7263yjvJrGKbFjWO z5ieKcNaxNJK1.mePiyJILM5dpMfRg0P24PY00.iPb5z4DVXcvlzYR_CMPbT2Iwul.9hRL6vR05k ItXiKghpj2j155irDBElPjCeoaH1bwY9nWjJOjUFMAYKVEwhi.R2rSWWDL0jbermhehpJfPMIsCv jfj_3kiDwtj5K7NoUvAOQhWvmvgi5rSDDxGCg6xm8wIzJKhDUApfC3F163BumsL7GrQdd7VwChmc of07wVMburFN4gRO0JPUXfsmrLSBxG0d40mS4bXHdwSMKokLoXO0u6fF0SghgYMMwlzemkpl5j.L bNF..k9xDqWAZJq.cqyS4ymc0f0qXnS_CVaofkR00C Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Sun, 8 Nov 2020 13:39:54 +0000 Original-Received: by smtp412.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID fc36f82041bb97e0b2fa0203533ea8d9; Sun, 08 Nov 2020 13:39:50 +0000 (UTC) In-Reply-To: <20201107235056.5lwabkhbflx2gc6o@Ergus> (Ergus's message of "Sun, 8 Nov 2020 00:50:56 +0100") X-Mailer: WebService/1.1.16944 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.8) Received-SPF: pass client-ip=77.238.176.98; envelope-from=mardani29@yahoo.es; helo=sonic301-21.consmr.mail.ir2.yahoo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/08 08:39:55 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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.23 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" Xref: news.gmane.io gmane.emacs.help:125101 Archived-At: Ergus writes: > Hi: > > This is probably a basic question, but I don't find any reference. > > I have a .dir-locals.el file a bit long because the project implied is a > bit special regarding indentation. The problem is that the project is > either C and C++ code and the indentation in both cases is retty much > the same; but other files like python, bash or makefiles require > different indentation. > > I am wondering if it is possible in the dir-locals to set a > configuration either for C and C++ without repeating myself. > > Up to now I have: > > (c++-mode . (...Long...)) > (c-mode . (...Long...)) > > But everytime I update the C config I have to copy and paste in the > other... > > is it possible to do something equivalent to: > > ((or c-mode c++-mode) . (...Long...)) > > Thanks in advance, > Ergus There's no special syntax to match several major modes in .dir-locals.el. One alternative is to put your C and C++ configuration under prog-mode and add specific entries for Python, Bash and Makefiles modes. Another alternative may be to use the "eval" variable to call a common function that sets the file-local variables. Something like: ((c++-mode . ((eval . (apply-common-c-configuration)))) (c-mode . ((eval . (apply-common-c-configuration)))))