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: Simon Josefsson
Subject: Re: Defcustom write-file-functions and write-contents-functions?
Date: Mon, 05 Jan 2004 01:46:20 +0100
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> You convinced me, thanks for the feedback.  How about this patch,
>> instead?
>
>>      * files.el (before-save-hook): Add.
>>      (basic-save-buffer): Use before-save-hook.
>
> Please don't.  There are already plenty of hooks run at that place
> and the code is hairy enough as it is.

It appears as if none of the existing hooks can support the feature
that was needed here -- unconditionally invoking some code before
saving a buffer.  This seems like a rather simple and useful hook.

Abusing write-file-functions or write-contents-functions for
non-writing related code (like copyright) seems wrong.

>>      * emacs-lisp/copyright.el: Use before-save-hook instead of
>>      write-file-functions.
>
> Better provide a copyright-auto-update-mode that will do the
> hook manipulation.

And still use write-file-functions?  I think Luc demonstrated that
using those hooks are unreliable, so using them might not end up
invoking the copyright code if some other package uses w-f-f or w-c-f.
Anyone using ange-ftp or tramp or something to edit remote files
(which presumable hooks itself into w-f-f?) and use copyright.el too?






reply via email to

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