emacs-devel
[Top][All Lists]
Advanced

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

Re: find-file-hook as illustration of Custom problems


From: Luc Teirlinck
Subject: Re: find-file-hook as illustration of Custom problems
Date: Sat, 5 Feb 2005 21:16:21 -0600 (CST)

>From my previous message:
   
   Code that runs later will override the user's veto and add
   the stuff back anyway.

Note that this is not a problem that would be a consequence of the
discussed changes.  It is a problem that exists right now.  If, in
present code, a non-preloaded Lisp file adds elements to a defcustomed
hook, list or alist, then there is no way that you can presently
override that in your `custom-set-variables' form.  To override it in
your .emacs you have to use `eval-after-load' or similar.

To avoid this, I believe that the following conventions should be
documented and followed.  Is there any objection against any of the
following conventions?

In the following "changing" a defcustomed variable means _changing the
global default value_.  Changing buffer local values or `let' bindings
are OK.

Just _loading_ a non-preloaded file should not change any defcustomed
variable unless "harmless" (like a hook function only used to gather
info and without user visible consequences).  Currently, just loading
autorevert.el adds a function to find-file-hook, but that function is
"harmless" in the above sense.

When changing a defcustomed variable from a function, that function
should be interactively called by the user and either the _only_
effect should be to implement the documented behavior of the function
(for instance by adding a function to a hook that implements that
behavior and does not interfere with anything else), or the fact that
elements are going to be added to the defcustom should be clearly
documented in the docstring and in any manual where the function is
described.

Sincerely,

Luc.




reply via email to

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