bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17949: 24.3; .dir-locals.el needs a way to construct paths relative


From: Stefan Monnier
Subject: bug#17949: 24.3; .dir-locals.el needs a way to construct paths relative to its own location
Date: Tue, 08 Jul 2014 14:17:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> Sometimes, I want to use .dir-locals.el to set a variable to refer to a
> specific file within the tree in question, independantly of how deep in
> that tree the file in question actually is.

You could use something like:

   (eval (setq-local my-var
                     (expand-file-name "etc/foo"
                                       (locate-dominating-file
                                        default-directory ".dir-locals.el"))))

> Perhaps using a form something like:
>     ,(expand-file-name "etc/foo.bar" dir-locals-directory)

Problem is security: the .dir-local.el file might not be under your
control, so we don't want to run arbitrary code.  The "eval" option
above of course suffers from the same problem, but at least it's the
official existing way to run arbitrary code, which means it doesn't run
that code silently unless you've previous accepted it as "safe".

This said, it might indeed be handy to be able to use , like you suggest
(tho it too would need to go though some "security check", of course).


        Stefan





reply via email to

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