From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#12259: Add delete-trailing-whitespace to list of safe eval forms Date: Wed, 22 Aug 2012 10:36:29 -0400 Message-ID: References: <87r4r1e7i1.fsf@santiago.tweag.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1345646281 10522 80.91.229.3 (22 Aug 2012 14:38:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Aug 2012 14:38:01 +0000 (UTC) Cc: 12259@debbugs.gnu.org To: Mathieu Boespflug Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 22 16:37:58 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T4C4B-0003Qj-JA for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Aug 2012 16:37:55 +0200 Original-Received: from localhost ([::1]:52095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4C49-0004j1-Re for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Aug 2012 10:37:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4C43-0004io-L0 for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2012 10:37:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4C3t-0004Zq-Ox for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2012 10:37:47 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4C3t-0004Zi-LA for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2012 10:37:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T4C4I-0000jz-CM for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2012 10:38:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2012 14:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12259 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12259-submit@debbugs.gnu.org id=B12259.13456462292685 (code B ref 12259); Wed, 22 Aug 2012 14:38:02 +0000 Original-Received: (at 12259) by debbugs.gnu.org; 22 Aug 2012 14:37:09 +0000 Original-Received: from localhost ([127.0.0.1]:43482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T4C3P-0000hC-OM for submit@debbugs.gnu.org; Wed, 22 Aug 2012 10:37:09 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:8937) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T4C3D-0000gY-V5 for 12259@debbugs.gnu.org; Wed, 22 Aug 2012 10:36:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCpcJ/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLDiYSFBgNHgaIHAW6CZBEA6MzgViDBYFD X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="196432317" Original-Received: from 76-10-151-9.dsl.teksavvy.com (HELO pastel.home) ([76.10.151.9]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Aug 2012 10:36:29 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 684B74EA3D; Wed, 22 Aug 2012 10:36:29 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:63394 Archived-At: > It seems as though, if evaluation forms that add 'time-stamp to various > hooks that all run around the time a file is saved are deemed safe by > default, surely evaluation forms that add 'delete-trailing-whitespace > should equally be deemed safe by default. Agreed, thanks. > I have attached a patch at the end of this email that considers eval > forms that add 'delete-trailing-whitespace to various hooks safe by > default. Actually, I wonder whether we want to accept/encourage those uses instead of (add-hook 'before-save-hook 'delete-trailing-whitespace). IOW I think we should only add the before-save-hook version but not the others (and I guess the same holds for time-stamp, tho we'll probably keep the other ones for time-stamp for backward-compatibility reasons). > But ideally this patch would be superseded by adding a mechanism that > allows .dir-locals.el to add predefined functions to hooks (at least > buffer local ones) without having to use eval. Why? > That way we wouldn't have to write patches such as this one for every > new sensible stock function that people want to have executed on > file saves. You don't have to write patches like this one. You can just customize safe-local-eval-forms. There is a problem, indeed, tho: if you customize this var and we later add things to it, you'll keep using your customized version and won't benefit from the expanded list. So we should keep the default value of safe-local-eval-forms as nil, and allow things like those add-hook some other way (e.g. a new var). Stefan