all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: cdelia@dc.uba.ar
Cc: Emacs-devel <emacs-devel-bounces+psainty=orcon.net.nz@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: mark .dir-locals.el buffer or file as safe instead of variables as safe
Date: Wed, 27 Jun 2018 18:36:23 +1200	[thread overview]
Message-ID: <f88d9967ae33b845fe3e5dbebb1afbe1@webmail.orcon.net.nz> (raw)
In-Reply-To: <ff2cae3a48777bac405fb65e55c35d6b@webmail.orcon.net.nz>

A useful enhancement may be the ability for the user to confirm a
value as trusted only for particular contexts.  If the context was the
directory of the .dir-locals.el file (or dir-locals-directory-cache
entry), then the user could confirm (once) a trusted value for
anything covered by that .dir-locals.el and have it automatically
accepted in future for other files covered by the same .dir-locals.el;
but they would still need to confirm/trust an identical value for the
variable when specified in another .dir-locals.el file elsewhere.

(This is of course different to trusting the .dir-locals.el file
itself.)

This functionality is facilitated to an extent by the user's ability
to assign a custom safe-local-variable predicate to a variable (in
which they could test whatever contexts they wish, and return non-nil
if the context and value are agreeable).  Arguably the `eval' pseudo-
variable also gives them free rein to achieve such goals.

Still, I can see utility in supporting such functionality in a more
direct manner.


Beyond that, I've often wished I could make a particular dir-local
value "ignored" for a particular .dir-locals.el file from some
codebase that I'm working with, without necessarily ignoring it
elsewhere; so I'm now wondering whether as well as callback functions
for "safe", there should be support for callback functions for
"ignored" and "risky" as well?  And similarly, if the aforementioned
direct support for contextually-trusted values were to be added, it
would make sense to allow contextual ignore/risky there too.

(I'm not sure whether contextual-risky makes as much sense, but it
would seem odd to exclude it.)

As it is, unless I've missed something, there are cases where I must
either continually answer "no" to the prompt for accepting local
values (each time I visit a file associated with that .dir-locals.el),
or else get fed up and edit or delete the .dir-locals.el file (which
of course might be under version control, which is then awkward if I
don't actually want my change to be committed).

There are also cases when I'd like to mark *some* of the values as
permanently trusted, but might want to ignore others.

Perhaps as well as the y/n/! options, there could be a new binding to
invoke a more advanced UI for deciding what to do with the values on a
per-variable basis.  Contextual behaviour options could be exposed in
that UI.


-Phil




      reply	other threads:[~2018-06-27  6:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  0:14 mark .dir-locals.el buffer or file as safe instead of variables as safe cdelia
2018-06-27  2:33 ` Eli Zaretskii
2018-06-27  4:24 ` Phil Sainty
2018-06-27  4:34   ` Phil Sainty
2018-06-27  6:36     ` Phil Sainty [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

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

  git send-email \
    --in-reply-to=f88d9967ae33b845fe3e5dbebb1afbe1@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=cdelia@dc.uba.ar \
    --cc=emacs-devel-bounces+psainty=orcon.net.nz@gnu.org \
    --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.