[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defcustom and :set functions dependencies
From: |
hjuvi |
Subject: |
Re: defcustom and :set functions dependencies |
Date: |
Tue, 24 May 2011 20:01:42 -0000 |
User-agent: |
G2/1.0 |
> That's not a problem. The byte-compiler may give you a warning, but
> that's all. You can silence the warning by adding
>
> (defvar v2)
You're right. I thought I had tried it and that it gave another
warning for the variable being defined twice, but it seems to work.
I try to have no warning !... (like I'm used to when I write in C
language :))
> To solve this real problem, two solutions:
> 1- in setf1, use (boundp 'v2) to check whether v2 has been defined
> already or not.
> 2- use an :initializer for v1 which does not depend on v2 (the :set
> function will then only be called when modifying the variable, which
> should only happen much later, at which point both v1 and v2 already
> exist).
I believe the second solution is the proper way to do it. At
initialization time, I should not test other variables.
Then, in the end of initialization, when everything is defined, I can
start setting things correctly according to all options.
Thanks a lot.