mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
Fix bug #7183 (User math macros defined in child documents are shadowed on loading)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36930 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1d03cfa8c0
commit
280f7a7ced
@ -820,7 +820,6 @@ bool Buffer::readDocument(Lexer & lex)
|
|||||||
// read main text
|
// read main text
|
||||||
bool const res = text().read(lex, errorList, d->inset);
|
bool const res = text().read(lex, errorList, d->inset);
|
||||||
|
|
||||||
usermacros.clear();
|
|
||||||
updateMacros();
|
updateMacros();
|
||||||
updateMacroInstances();
|
updateMacroInstances();
|
||||||
return res;
|
return res;
|
||||||
|
@ -542,10 +542,6 @@ public:
|
|||||||
/// Return macro defined before the inclusion of the child
|
/// Return macro defined before the inclusion of the child
|
||||||
MacroData const * getMacro(docstring const & name, Buffer const & child, bool global = true) const;
|
MacroData const * getMacro(docstring const & name, Buffer const & child, bool global = true) const;
|
||||||
|
|
||||||
/// Collect user macro names at loading time
|
|
||||||
typedef std::set<docstring> UserMacroSet;
|
|
||||||
UserMacroSet usermacros;
|
|
||||||
|
|
||||||
/// Replace the inset contents for insets which InsetCode is equal
|
/// Replace the inset contents for insets which InsetCode is equal
|
||||||
/// to the passed \p inset_code.
|
/// to the passed \p inset_code.
|
||||||
void changeRefsIfUnique(docstring const & from, docstring const & to,
|
void changeRefsIfUnique(docstring const & from, docstring const & to,
|
||||||
|
@ -1060,9 +1060,6 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
cell->push_back(MathAtom(new MathMacroTemplate(buf,
|
cell->push_back(MathAtom(new MathMacroTemplate(buf,
|
||||||
name, nargs, 0, MacroTypeDef,
|
name, nargs, 0, MacroTypeDef,
|
||||||
vector<MathData>(), def, display)));
|
vector<MathData>(), def, display)));
|
||||||
|
|
||||||
if (buf && (mode_ & Parse::TRACKMACRO))
|
|
||||||
buf->usermacros.insert(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "newcommand" ||
|
else if (t.cs() == "newcommand" ||
|
||||||
@ -1108,9 +1105,6 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
cell->push_back(MathAtom(new MathMacroTemplate(buf,
|
cell->push_back(MathAtom(new MathMacroTemplate(buf,
|
||||||
name, nargs, optionals, MacroTypeNewcommand,
|
name, nargs, optionals, MacroTypeNewcommand,
|
||||||
optionalValues, def, display)));
|
optionalValues, def, display)));
|
||||||
|
|
||||||
if (buf && (mode_ & Parse::TRACKMACRO))
|
|
||||||
buf->usermacros.insert(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "newcommandx" ||
|
else if (t.cs() == "newcommandx" ||
|
||||||
@ -1229,9 +1223,6 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
cell->push_back(MathAtom(new MathMacroTemplate(buf,
|
cell->push_back(MathAtom(new MathMacroTemplate(buf,
|
||||||
name, nargs, optionals, MacroTypeNewcommandx,
|
name, nargs, optionals, MacroTypeNewcommandx,
|
||||||
optionalValues, def, display)));
|
optionalValues, def, display)));
|
||||||
|
|
||||||
if (buf && (mode_ & Parse::TRACKMACRO))
|
|
||||||
buf->usermacros.insert(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "(") {
|
else if (t.cs() == "(") {
|
||||||
@ -1830,14 +1821,14 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs().size()) {
|
else if (t.cs().size()) {
|
||||||
bool const no_mhchem =
|
|
||||||
(t.cs() == "ce" || t.cs() == "cf") && buf
|
|
||||||
&& buf->params().use_mhchem == BufferParams::package_off;
|
|
||||||
bool const is_user_macro = no_mhchem ||
|
|
||||||
(buf && (mode_ & Parse::TRACKMACRO
|
|
||||||
? buf->usermacros.count(t.cs()) != 0
|
|
||||||
: buf->getMacro(t.cs(), false) != 0));
|
|
||||||
latexkeys const * l = in_word_set(t.cs());
|
latexkeys const * l = in_word_set(t.cs());
|
||||||
|
|
||||||
|
if (buf && (mode_ & Parse::TRACKMACRO) && l)
|
||||||
|
buf->updateMacros();
|
||||||
|
|
||||||
|
bool const is_user_macro =
|
||||||
|
(buf && buf->getMacro(t.cs(), false) != 0);
|
||||||
|
|
||||||
if (l && !is_user_macro) {
|
if (l && !is_user_macro) {
|
||||||
if (l->inset == "big") {
|
if (l->inset == "big") {
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
|
Loading…
Reference in New Issue
Block a user