Re: Non-nil default value in hook variables

2011-04-16 Thread Roland Winkler
On Fri Apr 15 2011 Leo wrote: When people use add-hook they think they are adding another function to a hook so if this isn't the case it will surprise them. People who are setting hook to nil is in a different thinking. There are add-hook and remove-hook. The latter fails (now) if you want to

Re: Non-nil default value in hook variables

2011-04-15 Thread Ted Zlatanov
On Thu, 14 Apr 2011 21:15:12 -0500 Roland Winkler wink...@gnu.org wrote: RW What should someone do who simply wants the hook to be nil? IMHO you should never set a hook to nil outside the file scope that created it. Do you have such a use case? Ted

Non-nil default value in hook variables

2011-04-14 Thread Leo
Hello, I have been bitten more than once by non-nil default values in hook variables such as: (defcustom bbdb-create-hook 'bbdb-creation-date :group 'bbdb :type 'hook) Then if one does (add-hook 'bbdb-create-hook 'bbdb-add-uuid) in one's .emacs, the default value may be ignored. I suggest

Re: Non-nil default value in hook variables

2011-04-14 Thread Roland Winkler
On Fri Apr 15 2011 Leo wrote: I suggest change all these defcustom instances something like: (defcustom bbdb-create-hook nil :group 'bbdb :type 'hook) (add-hook 'bbdb-create-hook 'bbdb-creation-date) Agreed and thanks, that looks much cleaner! Roland

Re: Non-nil default value in hook variables

2011-04-14 Thread Stefan Monnier
I suggest change all these defcustom instances something like: (defcustom bbdb-create-hook nil :group 'bbdb :type 'hook) (add-hook 'bbdb-create-hook 'bbdb-creation-date) Agreed and thanks, that looks much cleaner! But then don't define them as defcustom but just defvars since Custom gets

Re: Non-nil default value in hook variables

2011-04-14 Thread Roland Winkler
On Thu Apr 14 2011 Stefan Monnier wrote: I suggest change all these defcustom instances something like: (defcustom bbdb-create-hook nil :group 'bbdb :type 'hook) (add-hook 'bbdb-create-hook 'bbdb-creation-date) Agreed and thanks, that looks much cleaner! But then don't define

Re: Non-nil default value in hook variables

2011-04-14 Thread Roland Winkler
On Thu Apr 14 2011 Stefan Monnier wrote: I suggest change all these defcustom instances something like: (defcustom bbdb-create-hook nil :group 'bbdb :type 'hook) (add-hook 'bbdb-create-hook 'bbdb-creation-date) Agreed and thanks, that looks much cleaner! But then don't define

Re: Non-nil default value in hook variables

2011-04-14 Thread Leo
On 2011-04-15 10:15 +0800, Roland Winkler wrote: One more thought on this: What should someone do who simply wants the hook to be nil? If add-hook is called explicitly in bbdb.el such people are stuck: their setting is lost when bbdb.el is loaded (whereas there was no such problem with the