GNU bug report logs - #51579
Mark variable as safe only in one file or directory

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Wed, 3 Nov 2021 04:11:02 UTC

Severity: wishlist

Full log


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

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: Mark variable as safe only in one file or directory
Date: Tue, 2 Nov 2021 21:10:03 -0700
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.




This bug report was last modified 3 years and 228 days ago.

Previous Next


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