From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] allow function values for `enable-local-eval' Date: 29 Jun 2002 02:55:23 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <5xit42rjic.fsf@kfs2.cua.dk> References: <200206281741.g5SHfAa04345@santafe.santafe.edu> <87u1nnnqlp.fsf@floss.i-did-not-set--mail-host-address--so-shoot-me> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1025308641 18617 127.0.0.1 (28 Jun 2002 23:57:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 28 Jun 2002 23:57:21 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17O5c9-0004qA-00 for ; Sat, 29 Jun 2002 01:57:21 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17O5fR-0004Ox-00 for ; Sat, 29 Jun 2002 02:00:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17O5c0-0000LT-00; Fri, 28 Jun 2002 19:57:12 -0400 Original-Received: from mail.filanet.dk ([195.215.206.179]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 17O5Ze-0000B9-00; Fri, 28 Jun 2002 19:54:46 -0400 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id 5F2B27C01A; Fri, 28 Jun 2002 23:54:44 +0000 (GMT) Original-To: kfogel@red-bean.com In-Reply-To: <87u1nnnqlp.fsf@floss.i-did-not-set--mail-host-address--so-shoot-me> Original-Lines: 42 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:5254 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:5254 Karl Fogel writes: > Richard Stallman writes: > > That is a general basis for a solution, but it has no specific > > knowledge; it requires that to be provided by the user. I'm not > > necessarily rejecting it, but it would be more helpful to do something > > that embody specific knowledge, and does the right thing (for some > > cases) without requiring user customization. > > Yeah, we could provide such functionality if we can think of it, but I > think it's still necessary to offer the general solution. I agree with Karl that allowing the user to fully customize this would be very useful. I'm working on a project where the files belonging to one of the modules have a rather complicated -- but harmless -- eval: which I would really like to be able to allow without confirmation whenever I open one of those files (which I do fairly often). And as Karl says, emacs cannot possibly treat this as "standard knowledge". For this, user customization is a good thing! But maybe it would be better to have a more hook-like approach such as having a special hook like enable-local-eval-functions which are run until success (i.e. any of the functions may return true to allow a specific eval to be executed), and if all of them returns false, the default method is used according to enable-local-eval (i.e. ignore or ask user for confirmation). Something like (if (or (run-hook-with-args-until-success 'enable-local-eval-functions val) (eq enable-local-eval t) (and enable-local-eval (y-or-n-p ...))) (eval ...)) -- Kim F. Storm http://www.cua.dk