]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
Revert "Fix Ticket #9741 misleading name for font-encoding setting "default"."
[lyx.git] / src / LyX.cpp
index 66ff6f3dbed227559ab8d99e98aa4ed038bc8a79..047e26515d813d397b1bec419b91441871aae5f8 100644 (file)
@@ -50,7 +50,6 @@
 #include "frontends/alert.h"
 #include "frontends/Application.h"
 
-#include "support/bind.h"
 #include "support/ConsoleApplication.h"
 #include "support/lassert.h"
 #include "support/debug.h"
@@ -65,8 +64,9 @@
 #include "support/unique_ptr.h"
 
 #include <algorithm>
-#include <iostream>
 #include <csignal>
+#include <iostream>
+#include <functional>
 #include <map>
 #include <stdlib.h>
 #include <string>
@@ -92,6 +92,12 @@ namespace os = support::os;
 bool use_gui = true;
 
 
+// Report on the terminal about spawned commands. The default is false
+// and can be changed with the option -v (--verbose).
+
+bool verbose = false;
+
+
 // We default to open documents in an already running instance, provided that
 // the lyxpipe has been setup. This can be overridden either on the command
 // line or through preference settings.
@@ -492,9 +498,8 @@ int LyX::execWithoutGui(int & argc, char * argv[])
                LYXERR(Debug::FILES, "Loading " << fname);
                if (buf && buf->loadLyXFile() == Buffer::ReadSuccess) {
                        ErrorList const & el = buf->errorList("Parse");
-                       if (!el.empty())
-                                       for_each(el.begin(), el.end(),
-                                                                        bind(&LyX::printError, this, _1));
+                       for(ErrorItem const & e : el)
+                               printError(e);
                        command_line_buffers.push_back(buf);
                } else {
                        if (buf)
@@ -826,7 +831,7 @@ bool LyX::init()
 #endif
 
        lyxrc.tempdir_path = package().temp_dir().absFileName();
-       lyxrc.document_path = package().document_dir().absFileName();
+       lyxrc.document_path = ".";
 
        if (lyxrc.example_path.empty()) {
                lyxrc.example_path = addPath(package().system_support().absFileName(),
@@ -1109,7 +1114,7 @@ bool LyX::readEncodingsFile(string const & enc_name,
 namespace {
 
 /// return the the number of arguments consumed
-typedef boost::function<int(string const &, string const &, string &)> cmd_helper;
+typedef function<int(string const &, string const &, string &)> cmd_helper;
 
 int parse_dbg(string const & arg, string const &, string &)
 {
@@ -1162,6 +1167,8 @@ int parse_help(string const &, string const &, string &)
                  "\t-r [--remote]\n"
                  "                  open documents in an already running instance\n"
                  "                  (a working lyxpipe is needed)\n"
+                 "\t-v [--verbose]\n"
+                 "                  report on terminal about spawned commands.\n"
                  "\t-batch    execute commands without launching GUI and exit.\n"
                  "\t-version  summarize version and build info\n"
                               "Check the LyX man page for more details.")) << endl;
@@ -1296,6 +1303,13 @@ int parse_remote(string const &, string const &, string &)
 }
 
 
+int parse_verbose(string const &, string const &, string &)
+{
+       verbose = true;
+       return 0;
+}
+
+
 int parse_force(string const & arg, string const &, string &)
 {
        if (arg == "all") {
@@ -1343,6 +1357,8 @@ void LyX::easyParse(int & argc, char * argv[])
        cmdmap["--no-remote"] = parse_noremote;
        cmdmap["-r"] = parse_remote;
        cmdmap["--remote"] = parse_remote;
+       cmdmap["-v"] = parse_verbose;
+       cmdmap["--verbose"] = parse_verbose;
 
        for (int i = 1; i < argc; ++i) {
                map<string, cmd_helper>::const_iterator it