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: Defcustom write-file-functions and write-contents-functions? Date: Wed, 31 Dec 2003 15:38:07 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1072881606 6651 80.91.224.253 (31 Dec 2003 14:40:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 31 Dec 2003 14:40:06 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Dec 31 15:39:56 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 1AbhVs-0008Sh-00 for ; Wed, 31 Dec 2003 15:39:56 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AbhVs-0005ZQ-00 for ; Wed, 31 Dec 2003 15:39:56 +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 1AbiSj-0001Pi-7Q for emacs-devel@quimby.gnus.org; Wed, 31 Dec 2003 10:40:45 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AbiSG-0001Nu-C9 for emacs-devel@gnu.org; Wed, 31 Dec 2003 10:40:16 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AbiRj-00018e-NN for emacs-devel@gnu.org; Wed, 31 Dec 2003 10:40:14 -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 1AbiRj-00017O-6x for emacs-devel@gnu.org; Wed, 31 Dec 2003 10:39:43 -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 hBVEcBAU024724 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 31 Dec 2003 15:38:11 +0100 Original-To: emacs-devel@gnu.org X-Hashcash: 0:031231:emacs-devel@gnu.org:8fe4e7e74e01f4d1 User-Agent: Gnus/5.1004 (Gnus v5.10.4) 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:18925 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18925 Shouldn't these two variables be customizable? I add copyright-update to w-f-f, as per the comment in copyright.el. However, while making this patch, it occurred to me that adding copyright-update to write-contents-functions is probably more appropriate, so this also change fixed the copyright.el commentary. Ok to install? 2003-12-31 Simon Josefsson * files.el (write-file): New defgroup. (write-file-functions): Customize, add to write-file defgroup. (write-contents-functions): Likewise. * emacs-lisp/copyright.el: Use write-contents-functions instead of write-file-functions. Index: files.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/files.el,v retrieving revision 1.673 diff -u -p -u -w -r1.673 files.el --- files.el 29 Dec 2003 19:14:03 -0000 1.673 +++ files.el 31 Dec 2003 14:36:55 -0000 @@ -38,6 +38,9 @@ "Finding files." :group 'files) +(defgroup write-file nil + "Writing files." + :group 'files) (defcustom delete-auto-save-files t "*Non-nil means delete auto-save file when a buffer is saved or killed. @@ -366,7 +369,7 @@ functions are called." (defvaralias 'find-file-hooks 'find-file-hook) (make-obsolete-variable 'find-file-hooks 'find-file-hook "21.4") -(defvar write-file-functions nil +(defcustom write-file-functions nil "List of functions to be called before writing out a buffer to a file. If one of them returns non-nil, the file is considered already written and the rest are not called. @@ -375,7 +378,10 @@ So any buffer-local binding of this vari the visited file name with \\[set-visited-file-name], but not when you change the major mode. -See also `write-contents-functions'.") +See also `write-contents-functions'." + :type 'hook + :options '(copyright-update) + :group 'write-file) (put 'write-file-functions 'permanent-local t) (defvaralias 'write-file-hooks 'write-file-functions) (make-obsolete-variable 'write-file-hooks 'write-file-functions "21.4") @@ -385,7 +391,7 @@ See also `write-contents-functions'.") (put 'local-write-file-hooks 'permanent-local t) (make-obsolete-variable 'local-write-file-hooks 'write-file-functions "21.4") -(defvar write-contents-functions nil +(defcustom write-contents-functions nil "List of functions to be called before writing out a buffer to a file. If one of them returns non-nil, the file is considered already written and the rest are not called. @@ -395,7 +401,10 @@ buffer's contents, not to the particular `set-visited-file-name' does not clear this variable; but changing the major mode does clear it. -See also `write-file-functions'.") +See also `write-file-functions'." + :type 'hook + :options '(copyright-update) + :group 'write-file) (make-variable-buffer-local 'write-contents-functions) (defvaralias 'write-contents-hooks 'write-contents-functions) (make-obsolete-variable 'write-contents-hooks 'write-contents-functions "21.4") Index: copyright.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/copyright.el,v retrieving revision 1.43 diff -u -p -u -w -r1.43 copyright.el --- copyright.el 1 Sep 2003 15:45:20 -0000 1.43 +++ copyright.el 31 Dec 2003 14:36:29 -0000 @@ -27,7 +27,8 @@ ;; Allows updating the copyright year and above mentioned GPL version manually ;; or when saving a file. -;; Do (add-hook 'write-file-functions 'copyright-update). +;; Do (add-hook 'write-contents-functions 'copyright-update), or use +;; M-x customize-variable RET write-contents-functions RET. ;;; Code: