From 234c95ef6242402e4bd40f99c21dfbcee65c2402 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Thu, 12 Nov 2020 21:06:34 -0500 Subject: [PATCH] Quash error message when we are loading. --- src/Buffer.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index f0df3a1c75..30f04d84eb 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -202,10 +202,10 @@ public: MacroDefinition() {} MacroDefinition(DocIterator const & s, MacroData const & m) : scope(s), macro(m) {} - // The SCOPE is really just the last position at which the macro - // is in force. This will be the end of the file (if there are no - // children) unless it is in (say) a note, or an inactive branch, - // in which case it will be the end of that construct. + // The scope is the last position at which the macro is in force. + // This will be the end of the file (or of the master Buffer) unless + // the macro it is in (say) a note, or an inactive branch, in which + // case it will be the end of that construct. DocIterator scope; MacroData macro; }; @@ -246,17 +246,18 @@ public: }; MacroTable macro_table; - /// Each child Buffer is listed in this map, together with where - /// it is first included in this Buffer. + /// Each child Buffer is listed in this map, together with a + /// DocIterator that points at the inset where it is first included + /// in this Buffer. typedef map BufferPositionMap; BufferPositionMap children_positions; /// We also have a map from the positions where Buffers are included - /// to those Buffers and their scope (whose point RKH does not yet - /// understand). - // FIXME Surely one of these is enough? The difference is that - // children_positions has one entry for each child Buffer, whereas - // position_to_children has one entry for each InsetInclude (and the - // same Buffer could be included twice). + /// to those Buffers and their 'scope', which is the last point + /// at which macro definitions in the included file apply. (See + /// the comment above in MacroDefinition.) + /// Note that children_positions has one entry for each child Buffer, + /// whereas position_to_children has one entry for each InsetInclude + /// (and the same Buffer could be included twice). struct ScopeBuffer { ScopeBuffer() = default; ScopeBuffer(DocIterator const & s, Buffer const * b) @@ -3746,7 +3747,8 @@ MacroData const * Buffer::getMacro(docstring const & name, // look where the child buffer is included first Impl::BufferPositionMap::iterator it = d->children_positions.find(&child); if (it == d->children_positions.end()) { - LYXERR0("Querying parent for macro when we are not a child!"); + if (d->file_fully_loaded) + LYXERR0("Querying parent for macro when we are not a child!"); return nullptr; } -- 2.39.5