PJ Weisberg<pj@irregularexpressions.net> writes:
It looks to me like what's happening is that in the hook it switches
to cpp-omnet-mode, and since that's derived from c++-mode it results
in c++-mode-hooks getting run again, so it again switches to
cpp-omnet-mode and runs c++-mode-hooks, ad infinitum.
I'm not an expert and I'm sure there's a better way to do it, but one
way I could suggest is to set a buffer-local variable to mark that
you're switching to cpp-omnet-mode, and don't switch to cpp-omnet-mode
again if it's already set.
That's exactly what happens, and also the solutions from Andreas doesn't
work, it still loops forever.
But I don't understand why, since if the OR is short circuiting...
But probably I never really pass to cpp-omnet UNTIL all the hooks in
c++-mode have been executed.
I don't see how the variable could help me with that, maybe an example?
Another non related thing, I made a ned-file mode derivate of cc-mode,
because it comes handy for many things, but now is there a way to tell
yasnippet to expand ONLY the snippets for ned-mode?
Otherwise I also see all the snippets for C and C++ which I don't need
at all in this case..
Thanks,
Andrea