[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to use an external dir-locals file?

From: Ted Zlatanov
Subject: Re: how to use an external dir-locals file?
Date: Tue, 26 Mar 2013 05:22:10 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

On Mon, 25 Mar 2013 20:46:33 -0400 Stefan Monnier <address@hidden> 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 
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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]