- inset->read(buf, lex);
-
-// FIXME: hack..
- if (inset->lyxCode() == MATHMACRO_CODE) {
- MathMacroTemplate const * tmpl =
- static_cast<MathMacroTemplate*>(inset.get());
- MacroTable::globalMacros().insert
- (tmpl->name(), tmpl->asMacroData());
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": creating local macro " << to_utf8(tmpl->name())
- << endl;
- }
+ // Set the buffer reference for proper parsing of some insets
+ // (InsetCollapsable for example)
+ inset->setBuffer(const_cast<Buffer &>(buf));
+ inset->read(lex);
+ // Set again the buffer for insets that are created inside this inset
+ // (InsetMathHull for example).
+ inset->setBuffer(const_cast<Buffer &>(buf));