all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
Subject: Re: how to use an external dir-locals file?
Date: Tue, 26 Mar 2013 05:22:10 -0400	[thread overview]
Message-ID: <87mwtqv7lp.fsf@lifelogs.com> (raw)
In-Reply-To: jwvppynhtz3.fsf-monnier+emacs@gnu.org

On Mon, 25 Mar 2013 20:46:33 -0400 Stefan Monnier <monnier@iro.umontreal.ca> wrote: 

>> I imagined simply doing a dynamic let-bind around the call initially,
>> but if it's going to be a feature, then I could make it easier to
>> associate a dir-locals override with a file (matched by name).

SM> Hmm... I think I misunderstood the intended usage.
SM> Could you give more details about your use-case?
SM> E.g. why not do something like

SM>    (let ((tmp-foo-setting (lambda () (setq-local foo-indent 5))))
SM>      (unwind-protect
SM>          (progn
SM>            (add-hook 'foo-mode-hook tmp-foo-setting)
SM>            <doit>)
SM>        (remove-hook 'foo-mode-hook tmp-foo-setting)))

In this project, based on guidance from the owner, I want the settings
to be in CHECKOUT_ROOT/contrib/dir-locals.el (note no leading dot) that we use for
indentation, and which the user can optionally link to
CHECKOUT_ROOT/.dir-locals.el for general use.  The project owner does
not want CHECKOUT_ROOT/.dir-locals.el to exist.

In general, it's really nice to hold *reindentation* (not regular
indentation) settings in a .el file, even if it's not used as
.dir-locals.el, instead of file-local variables or custom ELisp hooks
and functions.  I just want a way to override the default choice of "the
nearest .dir-locals.el".  This may be related to the other discussion
about project roots a little bit, but for my purposes a dynamic
let-binding override is more than sufficient.

Ted




  reply	other threads:[~2013-03-26  9:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 18:06 how to use an external dir-locals file? Ted Zlatanov
2013-03-20 22:13 ` Stefan Monnier
2013-03-21 14:02   ` Ted Zlatanov
2013-03-26  0:46     ` Stefan Monnier
2013-03-26  9:22       ` Ted Zlatanov [this message]
2013-03-27 20:00         ` 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=87mwtqv7lp.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    /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.