Stefan Kangas <
stefan@marxist.se> writes:
> Mauro Aranda <
maurooaranda@gmail.com> writes:
>
>> Stefan Kangas <
stefan@marxist.se> writes:
>>
>>> Mauro Aranda <
maurooaranda@gmail.com> writes:
>>>
>>>> Only when I click "too fast" the option doesn't expand,
>>>
>>> That's different from what I'm seeing. I can wait several seconds
>>> between clicks, and as long as I don't move the mouse cursor the option
>>> won't expand.
>>
>> I think I misunderstood your recipe. Does an option that starts as hidden
>> never expand for you in the recipe?
>
> No, it does expand on the first click.
>
> It will not expand on repeated clicks unless I move the mouse cursor
> between clicks. The delay does not matter (except if I click too fast I
> see double-click events).
Then I definitely can't reproduce this. Does it happen with mouse-1 and
mouse-2? I think you didn't mention that in your recipe.
> So I had a quick look, and the defun `custom-toggle-hide-variable' is
> called on the first click. The option then correctly expands.
>
> But that function is not called on subsequent clicks. After moving the
> mouse cursor and clicking, it seems to register again and
> `custom-toggle-hide-variable' is called.
custom-toggle-hide-variable is the :action function for the widget you
are clicking. It should be called if
widget-button--check-and-call-button detects a mouse-1 or mouse-2 event
at that widget. AFAIK, there are 2 reasons why it doesn't
call the :action function: either it gets a mouse-1 event and then a
mouse-movement event, returning t, or it doesn't think the button where
the mouse click ended is the same button where the mouse click started.
I.e., this evaluates to nil:
(and pos (eq (get-char-property pos 'button) button))
In this case, widget-button--check-and-call-button will return nil.
I suspect the former happens and not the latter, but I can't be sure.
Maybe you can test what's the return value of
widget-button--check-and-call-button.