From: "Daniel Martín" <mardani29@yahoo.es>
To: Ergus <spacibba@aol.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Question about dir-locals c-mode.
Date: Sun, 08 Nov 2020 14:39:49 +0100 [thread overview]
Message-ID: <m15z6gm0gq.fsf@yahoo.es> (raw)
In-Reply-To: <20201107235056.5lwabkhbflx2gc6o@Ergus> (Ergus's message of "Sun, 8 Nov 2020 00:50:56 +0100")
Ergus <spacibba@aol.com> 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)))))
next prev parent reply other threads:[~2020-11-08 13:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20201107235056.5lwabkhbflx2gc6o.ref@Ergus>
2020-11-07 23:50 ` Question about dir-locals c-mode Ergus
2020-11-08 6:22 ` Jean Louis
2020-11-08 13:39 ` Daniel Martín [this message]
2020-11-08 14:50 ` Stefan Monnier
2020-11-08 16:16 ` Ergus
2020-11-08 17:58 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m15z6gm0gq.fsf@yahoo.es \
--to=mardani29@yahoo.es \
--cc=help-gnu-emacs@gnu.org \
--cc=spacibba@aol.com \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.