unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Samuel Bronson <naesten@gmail.com>, 17949@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <874kemt9ca.fsf@gnus.org> (raw)
In-Reply-To: <jwvtx6rracm.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Tue, 08 Jul 2014 14:17:41 -0400")

Stefan Monnier <monnier@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





      reply	other threads:[~2021-05-29  5:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 21:12 bug#17949: 24.3; .dir-locals.el needs a way to construct paths relative to its own location Samuel Bronson
2014-07-08 18:17 ` Stefan Monnier
2021-05-29  5:09   ` Lars Ingebrigtsen [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kemt9ca.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=17949@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=naesten@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).