Subject: Re: bug#15692: 24.3.50; rcirc activity mode-line indicator gets cleared automatically

From: Tassilo Horn <[email-masked]>
Date: Wed, 23 Oct 2013 16:00:31 +0200

Stefan Monnier <[email-masked]> writes:

>> The only function doing that in rcirc should be
>> `rcirc-update-activity-string'.  So I've edebugged that, but
>> sometimes it occurs that the activity string changes without me being
>> put in the debugger.
>
> Better put a `message' in there, in case the function is called from a
> context where debugging is inhibited (e.g. redisplay).

Ok, within a few minutes and without ever switching to any of the rcirc
buffers, I get

Setting rcirc-activity-string from [] to [#git].
Setting rcirc-activity-string from [#git] to [].
Setting rcirc-activity-string from [] to [#git].
Setting rcirc-activity-string from [#git] to [].
Setting rcirc-activity-string from [] to [#git].
Setting rcirc-activity-string from [#git] to [].
Setting rcirc-activity-string from [] to [#git].
Setting rcirc-activity-string from [#git] to [].
Setting rcirc-activity-string from [] to [#git].
Setting rcirc-activity-string from [#git] to [].
Setting rcirc-activity-string from [] to [#ema].
Setting rcirc-activity-string from [#ema] to [#git,#ema].
Setting rcirc-activity-string from [#git,#ema] to [].

The switches from [<something>] to [] should never have happened.

Hm, debugging a bit further, the problem is that `rcirc-activity' is
already wrong, i.e., it's oftentimes set to nil although there should
still be buffers with unseen activity.  So then I tried to edebug
`rcirc-record-activity', and I got an error about a void-function
`pushnew'.  I guess that edebugging interprets the function, so pushnew
is undefined because cl was only required at compile-time.  Ok, now I
did (require 'cl)...

I also added a message in there plus a (debug) when rcirc-activity turns
nil, but of course since I've done that it's working properly for a much
too long time...  Really strange.  Is there any chance that the bug
occurs only in compiled code?

>> Is there a way to be put into the debugger whenever a variable is
>> set, no matter what function does it?
>
> No.  It wouldn't be very hard to add, tho.

It's definititely not the first time where I could need something like
that.  Maybe it could also be a bit more general, e.g., one could add a
watcher function to a symbol that's called whenever the symbol-value is
set.

Bye,
Tassilo