diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 8d8b019f22..4908518c74 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2687,7 +2687,8 @@ MacroData const * Buffer::Impl::getBufferMacro(docstring const & name, break; // scope ends behind pos? - if (pos < it->second.first) { + if (pos < it->second.first + && theBufferList().isLoaded(it->second.second)) { // look for macro in external file macro_lock = true; MacroData const * data