all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: dir-local vs major-mode setting
Date: Thu, 15 Nov 2018 14:18:08 +1300	[thread overview]
Message-ID: <0d33ce0eeef685fe5e02725fcf99e563@webmail.orcon.net.nz> (raw)
In-Reply-To: <jwvftw38fxn.fsf-monnier+emacs@gnu.org>

On 2018-11-15 11:19, Stefan Monnier wrote:
> I'm thinking of a case where the project says "you should use TABs" so
> it sets
> 
>     ((nil . ((indent-tabs-mode . t))))
> 
> in the .dir-locals.el file.  But TABs in TeX files tend to behave
> funny, so tex-mode.el sets indent-tabs-mode to nil.  Assuming the
> .dir-locals.el setting was meant for "the majority of the files"
> and those aren't .tex files, it would make sense to favor the major
> mode's setting for the few .tex files.

If the project is expected to contain .tex files then the above would
constitute a bug in the .dir-locals.el file (which should contain mode-
specific entries for exceptions to the global settings).

Users could either fix the .dir-locals.el file, or add their own
custom .dir-locals-2.el file with the necessary overrides.

They can also use `hack-local-variables-hook'.


> I guess sometimes you want one and sometimes you want the other.
> So maybe to handle that case we'd want to introduce another wildcard
> that works like the `nil` above but implies it's applied before running
> the major mode's setup function.

If a "hack certain local vars before running hooks" facility was added,
I wouldn't think it should be constrained to the nil case?

Perhaps add something like the string path syntax, under which you
can provide a complete dir-locals spec, which should run early.  The
key might be a keyword like :early or some such.


-Phil




  reply	other threads:[~2018-11-15  1:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 18:30 dir-local vs major-mode setting Stefan Monnier
2018-11-14 21:58 ` Phil Sainty
2018-11-14 22:19   ` Stefan Monnier
2018-11-15  1:18     ` Phil Sainty [this message]
2018-11-15  3:00       ` Stefan Monnier
2018-11-15  3:12         ` Phil Sainty
2018-11-15  3:27           ` Stefan Monnier
2018-11-16  9:36             ` Phil Sainty

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=0d33ce0eeef685fe5e02725fcf99e563@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.