From: Simon Josefsson <jas@extundo.com>
Subject: Defcustom write-file-functions and write-contents-functions?
Date: Wed, 31 Dec 2003 15:38:07 +0100 [thread overview]
Message-ID: <ilu65fxxdbk.fsf@latte.josefsson.org> (raw)
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 <jas@extundo.com>
* 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:
next reply other threads:[~2003-12-31 14:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-31 14:38 Simon Josefsson [this message]
2003-12-31 16:57 ` Defcustom write-file-functions and write-contents-functions? Luc Teirlinck
2003-12-31 17:26 ` Simon Josefsson
2003-12-31 19:27 ` Luc Teirlinck
2003-12-31 19:56 ` Simon Josefsson
2003-12-31 20:10 ` Luc Teirlinck
2004-01-01 5:52 ` Eli Zaretskii
2004-01-01 12:22 ` Simon Josefsson
2004-01-01 14:45 ` Eli Zaretskii
2004-01-04 23:33 ` Stefan Monnier
2004-01-05 0:14 ` Luc Teirlinck
2004-01-05 0:31 ` Miles Bader
2004-01-05 0:46 ` Simon Josefsson
2004-01-05 17:56 ` Richard Stallman
2004-01-05 18:38 ` Simon Josefsson
2004-01-04 14:54 ` Per Abrahamsen
2004-01-05 4:41 ` Luc Teirlinck
2004-01-07 2:07 ` Luc Teirlinck
2004-01-07 3:03 ` Luc Teirlinck
2004-01-07 15:05 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ilu65fxxdbk.fsf@latte.josefsson.org \
--to=jas@extundo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).