emacs-devel
[Top][All Lists]
Advanced

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

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


From: Luc Teirlinck
Subject: Re: Defcustom write-file-functions and write-contents-functions?
Date: Wed, 31 Dec 2003 13:27:08 -0600 (CST)

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.




reply via email to

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