// read main text
bool const res = text().read(lex, errorList, d->inset);
+ // inform parent buffer about local macros
+ if (parent()) {
+ Buffer const * pbuf = parent();
+ UserMacroSet::const_iterator cit = usermacros.begin();
+ UserMacroSet::const_iterator end = usermacros.end();
+ for (; cit != end; ++cit)
+ pbuf->usermacros.insert(*cit);
+ }
usermacros.clear();
updateMacros();
updateMacroInstances();
} else {
Alert::error(_("Backup failure"),
bformat(_("Cannot create backup file %1$s.\n"
- "Please check whether the directory exists and is writeable."),
+ "Please check whether the directory exists and is writable."),
from_utf8(backupName.absFileName())));
//LYXERR(Debug::DEBUG, "Fs error: " << fe.what());
}
break;
// scope ends behind pos?
- if (pos < it->second.first) {
+ if (pos < it->second.first
+ && (cloned_buffer_ ||
+ theBufferList().isLoaded(it->second.second))) {
// look for macro in external file
macro_lock = true;
MacroData const * data
}
-void Buffer::getSourceCode(odocstream & os, pit_type par_begin,
- pit_type par_end, bool full_source)
+void Buffer::getSourceCode(odocstream & os, string const format,
+ pit_type par_begin, pit_type par_end,
+ bool full_source) const
{
OutputParams runparams(¶ms().encoding());
runparams.nice = true;
- runparams.flavor = getDefaultOutputFlavor();
+ runparams.flavor = getOutputFlavor(format);
runparams.linelen = lyxrc.plaintext_linelen;
// No side effect of file copying and image conversion
runparams.dryrun = true;
}
-OutputParams::FLAVOR Buffer::getDefaultOutputFlavor()
+OutputParams::FLAVOR Buffer::getOutputFlavor(string const format) const
{
- string const dformat = getDefaultOutputFormat();
+ string const dformat = (format.empty() || format == "default") ?
+ getDefaultOutputFormat() : format;
DefaultFlavorCache::const_iterator it =
default_flavors_.find(dformat);
vector<string> backs = backends();
if (find(backs.begin(), backs.end(), format) == backs.end()) {
// Get shortest path to format
+ theConverters().buildGraph();
Graph::EdgePath path;
for (vector<string>::const_iterator it = backs.begin();
it != backs.end(); ++it) {
if (success) {
if (isReadonly()) {
Alert::warning(_("File is read-only"),
- bformat(_("An emergency file is succesfully loaded, "
+ bformat(_("An emergency file is successfully loaded, "
"but the original file %1$s is marked read-only. "
"Please make sure to save the document as a different "
"file."), from_utf8(d->filename.absFileName())));
if (ret_llf == ReadSuccess) {
if (isReadonly()) {
Alert::warning(_("File is read-only"),
- bformat(_("A backup file is succesfully loaded, "
+ bformat(_("A backup file is successfully loaded, "
"but the original file %1$s is marked read-only. "
"Please make sure to save the document as a "
"different file."),
updateTitles();
markClean();
message(bformat(_("Document %1$s reloaded."), disp_fn));
+ d->undo_.clear();
} else {
message(bformat(_("Could not reload document %1$s."), disp_fn));
}