Error loading default calltips file
Brought to you by:
tringali
Error loading default calltips file:
"/home/yooden/.NEdit/calltips/C.tips"
This is an error message I get for some oprations (new
tab, open file, maybe more) with RC2. I get this even for
files not in C mode, which should not be the case. I'm
pretty sure RC2 was silent.
(The file in question really does not exist.)
Logged In: YES
user_id=121553
The code responsible for this hasn't changed since 2002, so it's not a new
thing. The problem is in reapplyLanguageMode (preferences.c:4207).
The issue is that changing language modes should 1) unload the default
tips files of the old language mode and 2) load the default tips files of
the
new mode. Because of the fact that tips files can belong to multiple
language modes, step 1 can unload a tips file that's still in use by
another language mode (or another document with the same language
mode).
If we call tf[i] the set of tips files used by language mode i and lm[j] to
be the language mode of window j, and assume we're changing the mode
of window 0 from lm_old to lm_new, the best thing to do is calculate the
exact set of tips files to unload:
unload_files = tf[lm_new] - (tf[lm_old] - (tf[lm[1]] + tf[lm[2]] + ...))
where "-" is set subtraction. Unfortunately, set operations aren't so easy
to code in an efficient way in C, so as a dirty equivalent I just unload
tf[lm_old] and then "reload" tf[lm_new] and all tf[lm[i]]. I put reload in
quotes becaus if a tips file is already loaded it doesn't get reloaded. If a
file doesn't exist, however, it'll never get loaded and thus *every*
language mode change will trigger an error message. I meant to do this
in a better way eventually, but it never became an issue until now.
It's simple to fix this so you only see the message when you close the
last file of any language mode. This is a clear improvement to the
current code, so it should be done in any case. I'm not sure if we should
do much more than that, since IMHO the benefits wouldn't justify the
added complexity. After all, having a bogus file as the default calltips
file for a language is a problem that the user can easily fix.
I'm attaching a patch that includes the obvious fixes.
Fix obvious inefficiencies in tips file loading/unloading.
Logged In: YES
user_id=618141
Wouldn't managing the set of tip files be best using a
reference count?
Logged In: YES
user_id=121553
Yes, that would work perfectly. Thanks! I can't believe I didn't see it...
Logged In: YES
user_id=119143
Please fix this bug.
Logged In: YES
user_id=943591
should be fixed
Logged In: YES
user_id=119143
Is there a fix or not?
Logged In: YES
user_id=121553
Should be fixed now in CVS.