commit 4a32458e6f46690ec5a23a63f5ed102998a299d8
Author: Enrico Forestieri <[email protected]>
Date:   Fri Jul 4 02:15:50 2025 +0200

    Amend 6ac82190
    
    What said in 6ac82190 is true only when the child is loaded by
    the master. However, if the child is loaded before the master
    (so that the master does not attempt to load it again) the info
    about the macros in the child has to be actually provided. Sigh.
---
 src/Buffer.cpp              | 1 -
 src/insets/InsetInclude.cpp | 8 ++++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 4bc4763698..89a02db449 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1131,7 +1131,6 @@ bool Buffer::readDocument(Lexer & lex)
                for (auto const & m : usermacros)
                        pbuf->usermacros.insert(m);
        }
-       usermacros.clear();
        updateMacros();
        updateMacroInstances(InternalUpdate);
        return res;
diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp
index 8486ee5924..fa526a60e8 100644
--- a/src/insets/InsetInclude.cpp
+++ b/src/insets/InsetInclude.cpp
@@ -506,8 +506,12 @@ Buffer * InsetInclude::loadIfNeeded() const
                        // FIXME: Do something.
                }
        } else {
-               // The file was already loaded, so, simply set the parent
-               child->setParent(&buffer());
+               // The file was already loaded, so, simply
+               // inform parent buffer about local macros
+               Buffer const * parent = &buffer();
+               child->setParent(parent);
+               for (auto const & m : child->usermacros)
+                       parent->usermacros.insert(m);
        }
 
        // Cache the child buffer.
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to