From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.devel Subject: Re: Defcustom write-file-functions and write-contents-functions? Date: Mon, 05 Jan 2004 01:46:20 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <200312311657.hBVGvD428945@raven.dms.auburn.edu> <200312311927.hBVJR8H29112@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1073263696 18369 80.91.224.253 (5 Jan 2004 00:48:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Jan 2004 00:48:16 +0000 (UTC) Cc: Luc Teirlinck , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jan 05 01:48:13 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AdIuj-0001XA-00 for ; Mon, 05 Jan 2004 01:48:13 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AdIui-0007os-00 for ; Mon, 05 Jan 2004 01:48:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AdJs5-0001oX-Ql for emacs-devel@quimby.gnus.org; Sun, 04 Jan 2004 20:49:33 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AdJrU-0001P4-SX for emacs-devel@gnu.org; Sun, 04 Jan 2004 20:48:56 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AdJqr-0000EB-Rg for emacs-devel@gnu.org; Sun, 04 Jan 2004 20:48:49 -0500 Original-Received: from [217.13.230.178] (helo=yxa.extundo.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AdJqq-000065-EO for emacs-devel@gnu.org; Sun, 04 Jan 2004 20:48:16 -0500 Original-Received: from latte.josefsson.org (yxa.extundo.com [217.13.230.178]) (authenticated bits=0) by yxa.extundo.com (8.12.10/8.12.10) with ESMTP id i050kVAU010806 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 5 Jan 2004 01:46:34 +0100 Original-To: Stefan Monnier X-Hashcash: 0:040105:monnier@iro.umontreal.ca:b76e833a7c9838dd X-Hashcash: 0:040105:teirllm@dms.auburn.edu:fb8849367aff532b X-Hashcash: 0:040105:emacs-devel@gnu.org:f24c2ee72115696f In-Reply-To: (Stefan Monnier's message of "04 Jan 2004 18:33:45 -0500") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19004 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19004 Stefan Monnier writes: >> You convinced me, thanks for the feedback. How about this patch, >> instead? > >> * files.el (before-save-hook): Add. >> (basic-save-buffer): Use before-save-hook. > > Please don't. There are already plenty of hooks run at that place > and the code is hairy enough as it is. It appears as if none of the existing hooks can support the feature that was needed here -- unconditionally invoking some code before saving a buffer. This seems like a rather simple and useful hook. Abusing write-file-functions or write-contents-functions for non-writing related code (like copyright) seems wrong. >> * emacs-lisp/copyright.el: Use before-save-hook instead of >> write-file-functions. > > Better provide a copyright-auto-update-mode that will do the > hook manipulation. And still use write-file-functions? I think Luc demonstrated that using those hooks are unreliable, so using them might not end up invoking the copyright code if some other package uses w-f-f or w-c-f. Anyone using ange-ftp or tramp or something to edit remote files (which presumable hooks itself into w-f-f?) and use copyright.el too?