unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51579: Mark variable as safe only in one file or directory
@ 2021-11-03  4:10 Stefan Kangas
  2021-11-04 18:10 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Kangas @ 2021-11-03  4:10 UTC (permalink / raw)
  To: 51579

Severity: wishlist

I'd like a way to mark a variable as safe only when read from a
particular directory or file.

I create a .dir-locals.el file with some unsafe variable, e.g.

tmp=`mktemp -d`
echo "((nil . ((epa-file-cache-passphrase-for-symmetric-encryption . t))))" \
    > $tmp/.dir-locals.el
echo $tmp

Now I visit a file in the created directory and get this message:

     The local variables list in /tmp/tmp.qakuGgnFPH/
     contains values that may not be safe (*).

     Do you want to apply it?  You can type
     y  -- to apply the local variables list.
     n  -- to ignore the local variables list.
     !  -- to apply the local variables list, and permanently mark these
           values (*) as safe (in the future, they will be set automatically.)
     i  -- to ignore the local variables list, and permanently mark these
           values (*) as ignored

       * epa-file-cache-passphrase-for-symmetric-encryption : t

According to (info "(emacs) Safe File Variables"), hitting "i" means
that:

       You can also tell Emacs to permanently ignore all the variable/value
    pairs in the file, by typing ‘i’ at the confirmation prompt – these
    pairs will thereafter be ignored in this file and in all other files.

I would like to be able to mark this variable/value pair as safe *only*
when read from this file, and not in any file.





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#51579: Mark variable as safe only in one file or directory
  2021-11-03  4:10 bug#51579: Mark variable as safe only in one file or directory Stefan Kangas
@ 2021-11-04 18:10 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-04 18:10 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 51579

Stefan Kangas <stefan@marxist.se> writes:

> I would like to be able to mark this variable/value pair as safe *only*
> when read from this file, and not in any file.

Yes, that sounds like a good idea to me.

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-04 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  4:10 bug#51579: Mark variable as safe only in one file or directory Stefan Kangas
2021-11-04 18:10 ` Lars Ingebrigtsen

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