unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tom@tromey.com>
Cc: 18721@debbugs.gnu.org
Subject: bug#18721: patch
Date: Sun, 15 Jan 2017 17:33:30 +0200	[thread overview]
Message-ID: <83o9z89w39.fsf@gnu.org> (raw)
In-Reply-To: <87vath2gl1.fsf@tromey.com> (message from Tom Tromey on Sat, 14 Jan 2017 19:38:02 -0700)

> 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)))))





  reply	other threads:[~2017-01-15 15:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14 20:06 bug#18721: 25.0.50; choose major mode from .dir-locals.el Tom Tromey
2014-10-14 23:54 ` Stefan Monnier
2014-10-16 13:23   ` Ted Zlatanov
2017-01-15  2:38 ` bug#18721: patch Tom Tromey
2017-01-15 15:33   ` Eli Zaretskii [this message]
2017-01-15 19:22     ` Eli Zaretskii
2017-01-16 19:17     ` Tom Tromey
2021-05-29  4:07       ` bug#18188: Please make it possible to have a directory-local setting for auto-mode-alist Lars Ingebrigtsen
2021-05-29 15:13         ` Tom Tromey
2021-07-23 14:00           ` bug#18188: bug#18721: 25.0.50; choose major mode from .dir-locals.el Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83o9z89w39.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=18721@debbugs.gnu.org \
    --cc=tom@tromey.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).