[LyX features/cleanup/updateMacros4] Quash error message when we are loading.

Richard Kimberly Heck rikiheck at lyx.org
Fri Nov 13 01:37:27 UTC 2020


The branch, cleanup/updateMacros4, has been updated.

- Log -----------------------------------------------------------------

commit 234c95ef6242402e4bd40f99c21dfbcee65c2402
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Thu Nov 12 21:06:34 2020 -0500

    Quash error message when we are loading.

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index f0df3a1..30f04d8 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<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;
 	}
 

-----------------------------------------------------------------------

Summary of changes:
 src/Buffer.cpp |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list