GNU bug report logs - #17949
24.3; .dir-locals.el needs a way to construct paths relative to its own location

Previous Next

Package: emacs;

Reported by: Samuel Bronson <naesten <at> gmail.com>

Date: Sat, 5 Jul 2014 21:14:02 UTC

Severity: wishlist

Tags: wontfix

Found in version 24.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 17949 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Samuel Bronson <naesten <at> gmail.com>, 17949 <at> debbugs.gnu.org
Subject: Re: bug#17949: 24.3; .dir-locals.el needs a way to construct paths
 relative to its own location
Date: Sat, 29 May 2021 07:09:09 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

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

, as syntactic sugar here would be nice, but I'm thinking the added
complexity here wouldn't be worth it (since we already have the `eval'
method here).

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.