]> git.lyx.org Git - features.git/commitdiff
Quash error message when we are loading.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Fri, 13 Nov 2020 02:06:34 +0000 (21:06 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Fri, 13 Nov 2020 02:06:37 +0000 (21:06 -0500)
src/Buffer.cpp

index f0df3a1c75d869ccd47aa1a7bea99edf0a160d64..30f04d84eb1559914b045687c5093d4eb05d2ea2 100644 (file)
@@ -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<Buffer const * const, DocIterator> 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;
        }