From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Clarification on using safe-local-variable-values Date: Thu, 09 Mar 2006 09:39:59 +0100 Message-ID: References: <200603081955.k28JtxHO009985@chls308.ch.intel.com> <87oe0gu1kb.fsf@stupidchicken.com> <17423.16884.499749.8016@chls308.ch.intel.com> <87u0a8a9ki.fsf@stupidchicken.com> <17423.28072.2696.723424@chls308.ch.intel.com> <87zmk05vrz.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1141893726 18871 80.91.229.2 (9 Mar 2006 08:42:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Mar 2006 08:42:06 +0000 (UTC) Cc: "Andrew M. Scott" , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 09 09:42:04 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FHGid-0003O0-5K for ged-emacs-devel@m.gmane.org; Thu, 09 Mar 2006 09:41:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHGic-0006eT-J5 for ged-emacs-devel@m.gmane.org; Thu, 09 Mar 2006 03:41:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FHGiR-0006YF-Gg for emacs-devel@gnu.org; Thu, 09 Mar 2006 03:41:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FHGiQ-0006V7-Oh for emacs-devel@gnu.org; Thu, 09 Mar 2006 03:41:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FHGiQ-0006U9-LN for emacs-devel@gnu.org; Thu, 09 Mar 2006 03:41:46 -0500 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FHGlS-00085a-8U for emacs-devel@gnu.org; Thu, 09 Mar 2006 03:44:54 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepb.post.tele.dk (Postfix) with SMTP id 62567A5001C; Thu, 9 Mar 2006 09:41:40 +0100 (CET) Original-To: Chong Yidong In-Reply-To: <87zmk05vrz.fsf@stupidchicken.com> (Chong Yidong's message of "Wed, 08 Mar 2006 19:03:44 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51402 Archived-At: Chong Yidong 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 WDYT? 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 http://www.cua.dk