[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clarification on using safe-local-variable-values

From: Kim F. Storm
Subject: Re: Clarification on using safe-local-variable-values
Date: Thu, 09 Mar 2006 09:39:59 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Chong Yidong <address@hidden> writes:

>> # after-save-hook: ((lambda () (build-mail-aliases)))

> That is working as intended.  Emacs does not save after-save-hook
> because that is a risky local variable, and those are never saved.

I don't quite understand...

If the user has said that it is safe to use that specific value
of that variable, why can't you save that value?  The reason why
the user want to save it, is to avoid the question in the future.

Maybe you can [somehow] adjust the spec of safe-local-variable-values to
include either
- the file name where this setting is allowed, or
- a regexp mathings file name where this setting is allowed, or
- the major mode of the buffer where this is a valid setting


A fundamentally different approach is this:

When asked to save local variables+values, make an MD5 hash of the
buffer local variables/values (+ full file-name if any of the 
variables is local-buffer-risky), and add that MD5 to a new
list safe-local-variable-hash which has alists of the form:

("MD5-askdjashdskj" . ALLOW_DENY)

Then, next time file is opened, before asking for confirmation of
local variables, emacs consults this list and if the MD5 is already
there, allow the local variables if ALLOW_DENY is t, reject them (silently)
if ALLOW_DENY is nil

In all other cases ask user for confirmation.

This has the added benefit of allowing a user to permanently
reject executing a given set of buffer-local variables.

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]