[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18721: patch
From: |
Eli Zaretskii |
Subject: |
bug#18721: patch |
Date: |
Sun, 15 Jan 2017 17:33:30 +0200 |
> From: Tom Tromey <tom@tromey.com>
> Date: Sat, 14 Jan 2017 19:38:02 -0700
>
> This patch adds the feature described in this bug. There are a few
> possible ways to do it, this picks a simple one: mimic auto-mode-alist
> directly.
>
> Let me know what you think.
Thanks. This will need a NEWS entry. Also, I have a comment/concern:
> +The special key @code{auto-mode-alist} in a @file{.dir-locals.el} lets
> +you set a file's major mode. It works much like the variable
> address@hidden (@pxref{Choosing Modes}). For example, here is
> +how you can tell Emacs that @file{.def} source files in this directory
> +should be in C mode:
> +
> +@example
> +((auto-mode-alist . (("\\.def\\'" . c-mode))))
> +@end example
I'm concerned that this syntax deviates from the current syntax of
.dir-locals.el, which is this:
(KEY . ((VARIABLE1 . VALUE1) (VARIABLE2 . VALUE2) ...))
where KEY can be:
. nil, meaning it's applicable to any file in the directory tree;
. a major mode (not relevant to this discussion)
. a subdirectory name, meaning the setting is applicable to files in
that subdirectory
Your suggestion uses a form of just (VARIABLE . VALUE), effectively
using the variable name as KEY, which differs from the above, and also
loses the capability of specifying a value only for some subdirectory.
So I'm asking why not keep the current syntax for this feature, and
avoid introducing a new kind of special key? This would mean your
example above will look like this:
(nil . ((auto-mode-alist . (("\\.def\\'" . c-mode)))))