]> git.lyx.org Git - lyx.git/blobdiff - src/bufferlist.C
Fix natbib bug spotted by JMarc.
[lyx.git] / src / bufferlist.C
index 51e042724c84f111cb0fb1aa807cdd7589a420dc..caba200f85ed7b21aae441818d0fb35b9ed3d4b9 100644 (file)
@@ -42,6 +42,7 @@
 #include "support/LAssert.h"
 
 #include <boost/bind.hpp>
+#include "BoostFormat.h"
 
 #include <cassert>
 #include <algorithm>
@@ -308,9 +309,14 @@ void BufferList::emergencyWrite(Buffer * buf)
 
        string const doc = buf->isUnnamed()
                ? OnlyFilename(buf->fileName()) : buf->fileName();
-       lyxerr << _("LyX: Attempting to save document ") << doc << endl;
 
+#if USE_BOOST_FORMAT
+       lyxerr << boost::format(_("LyX: Attempting to save document %1$s"))
+               % doc
+              << endl;
+#else
+       lyxerr << _("LyX: Attempting to save document ") << doc << endl;
+#endif
        // We try to save three places:
 
        // 1) Same place as document. Unless it is an unnamed doc.
@@ -330,7 +336,7 @@ void BufferList::emergencyWrite(Buffer * buf)
        // 2) In HOME directory.
        string s = AddName(GetEnvPath("HOME"), buf->fileName());
        s += ".emergency";
-       lyxerr << " " << s << endl;
+       lyxerr << ' ' << s << endl;
        if (buf->writeFile(s)) {
                buf->markClean();
                lyxerr << _("  Save seems successful. Phew.") << endl;
@@ -344,7 +350,7 @@ void BufferList::emergencyWrite(Buffer * buf)
        // drive letter on OS/2
        s = AddName(MakeAbsPath("/tmp/"), buf->fileName());
        s += ".emergency";
-       lyxerr << " " << s << endl;
+       lyxerr << ' ' << s << endl;
        if (buf->writeFile(s)) {
                buf->markClean();
                lyxerr << _("  Save seems successful. Phew.") << endl;
@@ -421,7 +427,7 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
        // not sure if this is the correct place to begin LyXLex
        LyXLex lex(0, 0);
        lex.setFile(ts);
-       if (b->readFile(lex))
+       if (b->readFile(lex, ts))
                return b;
        else {
                bstore.release(b);
@@ -471,7 +477,7 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
                LyXLex lex(0, 0);
                lex.setFile(tname);
                if (lex.isOK()) {
-                       if (b->readFile(lex)) {
+                       if (b->readFile(lex, tname)) {
                                templateok = true;
                        }
                }
@@ -563,3 +569,13 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
 
        return b;
 }
+
+
+void BufferList::setCurrentAuthor(string const & name, string const & email)
+{
+       BufferStorage::iterator it = bstore.begin();
+       BufferStorage::iterator end = bstore.end();
+       for (; it != end; ++it) {
+               (*it)->authors().record(0, Author(name, email));
+       }
+}