]> git.lyx.org Git - lyx.git/blobdiff - src/bufferlist.C
update no.po
[lyx.git] / src / bufferlist.C
index d8226677a1876c084eed5b46f617db6455eef9fb..10564433367c7c8424de8ab0143dc61ffca6240d 100644 (file)
@@ -41,6 +41,9 @@
 #include "support/lyxfunctional.h"
 #include "support/LAssert.h"
 
+#include <boost/bind.hpp>
+#include "BoostFormat.h"
+
 #include <cassert>
 #include <algorithm>
 #include <functional>
@@ -289,7 +292,7 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
 void BufferList::emergencyWriteAll()
 {
        for_each(bstore.begin(), bstore.end(),
-                lyx::void_class_fun(*this, &BufferList::emergencyWrite));
+                boost::bind(&BufferList::emergencyWrite, this, _1));
 }
 
 
@@ -304,11 +307,16 @@ void BufferList::emergencyWrite(Buffer * buf)
        if (buf->isClean())
                return;
 
-       lyxerr << _("lyx: Attempting to save document ")
-              << (buf->isUnnamed() ? OnlyFilename(buf->fileName())
-                  : buf->fileName())
-              <<  _(" as...") << endl;
+       string const doc = buf->isUnnamed()
+               ? OnlyFilename(buf->fileName()) : buf->fileName();
 
+#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.
@@ -328,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;
@@ -342,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;
@@ -419,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);
@@ -469,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;
                        }
                }