emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Defcustom write-file-functions and write-contents-functions?


From: Simon Josefsson
Subject: Defcustom write-file-functions and write-contents-functions?
Date: Wed, 31 Dec 2003 15:38:07 +0100
User-agent: Gnus/5.1004 (Gnus v5.10.4) Emacs/21.3.50 (gnu/linux)

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  <address@hidden>

        * 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:
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]