From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: Defcustom write-file-functions and write-contents-functions? Date: Wed, 31 Dec 2003 13:27:08 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200312311927.hBVJR8H29112@raven.dms.auburn.edu> References: <200312311657.hBVGvD428945@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1072898993 2777 80.91.224.253 (31 Dec 2003 19:29:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 31 Dec 2003 19:29:53 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Dec 31 20:29:50 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Abm2Q-0005NT-00 for ; Wed, 31 Dec 2003 20:29:50 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Abm2Q-0000kJ-00 for ; Wed, 31 Dec 2003 20:29:50 +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 1AbmyQ-0008LC-PH for emacs-devel@quimby.gnus.org; Wed, 31 Dec 2003 15:29:46 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Abmxs-0008Jx-Vr for emacs-devel@gnu.org; Wed, 31 Dec 2003 15:29:12 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AbmxL-0008DT-6b for emacs-devel@gnu.org; Wed, 31 Dec 2003 15:29:11 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AbmxK-0008DH-VF for emacs-devel@gnu.org; Wed, 31 Dec 2003 15:28:39 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id hBVJRSKk008917; Wed, 31 Dec 2003 13:27:28 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id hBVJR8H29112; Wed, 31 Dec 2003 13:27:08 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: jas@extundo.com In-reply-to: (message from Simon Josefsson on Wed, 31 Dec 2003 18:26:08 +0100) 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:18930 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18930 Simon Josefsson wrote: The example I gave, copyright-update, appear to be intended for users. This does not contradict what I said. From its documentation, `write-contents-functions' seems to be a mode-specific way to save files, `write-file-functions' appears to be a file-specific way to do so. Custom can not really handle either buffer-local or file-local customization. Personally, I believe you need a new _normal_ hook, intended to be called unconditionally. This could work too. My reason for choosing w-f-f was that copyright.el suggested it, and I want to use custom to enable that package. That suggestion was wrong, because w-f-f is _not_ unconditionally run. It is the third of a bunch of hooks called in an `or' form in `basic-save-buffer'. If any of the two prior hooks in the or form takes care of saving the file, w-f-f is _not_ run. (I personally believe that the docstring and the definition in he Elisp manual should mention this.) Your patch replaced it with w-c-f. This is better, because that is the first hook in the `or' form. But major modes would seem free to override anything the user customized using your defcustom, because the variable is intended to be set buffer-locally by major modes. Again, I personally believe that for what you want to do, one needs a new normal hook, to be called unconditionally, _before_ the `or' form in `basic-save-buffer'. Sincerely, Luc.