From 96ffb70cd521f397a4ac0f9912e67506f99accf8 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 11 Jan 2017 09:21:13 +0100 Subject: [PATCH] Command line option to ignore error msgs Needed by the test framework --- src/LaTeX.cpp | 6 ++++-- src/LyX.cpp | 22 ++++++++++++++++++++++ src/LyX.h | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index c4f987014d..9faf20102e 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -18,6 +18,7 @@ #include "BufferList.h" #include "LaTeX.h" #include "LyXRC.h" +#include "LyX.h" #include "DepTable.h" #include "support/debug.h" @@ -899,8 +900,9 @@ int LaTeX::scanLogFile(TeXErrors & terr) from_local8bit("pdfTeX Error"), from_local8bit(token), child_name); - } else if (prefixIs(token, "Missing character: There is no ") - && !contains(token, "nullfont")) { + } else if (!ignore_missing_glyphs + && prefixIs(token, "Missing character: There is no ") + && !contains(token, "nullfont")) { // Warning about missing glyph in selected font // may be dataloss (bug 9610) // but can be ignored for 'nullfont' (bug 10394). diff --git a/src/LyX.cpp b/src/LyX.cpp index b10b60b122..259aeb6657 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -98,6 +98,13 @@ bool use_gui = true; bool verbose = false; +// Do not treat the "missing glyphs" warning of fontspec as an error message. +// The default is false and can be changed with the option +// --ignore-error-message missing_glyphs +// This is used in automated testing. +bool ignore_missing_glyphs = 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. @@ -1161,6 +1168,10 @@ int parse_help(string const &, string const &, string &) " specifying whether all files, main file only, or no files,\n" " respectively, are to be overwritten during a batch export.\n" " Anything else is equivalent to `all', but is not consumed.\n" + "\t--ignore-error-message which\n" + " allows you to ignore specific LaTeX error messages.\n" + " Do not use for final documents! Currently supported values:\n" + " * missing_glyphs: Fontspec `missing glyphs' error.\n" "\t-n [--no-remote]\n" " open documents in a new instance\n" "\t-r [--remote]\n" @@ -1309,6 +1320,16 @@ int parse_verbose(string const &, string const &, string &) } +int parse_ignore_error_message(string const & arg1, string const &, string &) +{ + if (arg1 == "missing_glyphs") { + ignore_missing_glyphs = true; + return 1; + } + return 0; +} + + int parse_force(string const & arg, string const &, string &) { if (arg == "all") { @@ -1358,6 +1379,7 @@ void LyX::easyParse(int & argc, char * argv[]) cmdmap["--remote"] = parse_remote; cmdmap["-v"] = parse_verbose; cmdmap["--verbose"] = parse_verbose; + cmdmap["--ignore-error-message"] = parse_ignore_error_message; for (int i = 1; i < argc; ++i) { map::const_iterator it diff --git a/src/LyX.h b/src/LyX.h index 4b9c201e25..11c67a3118 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -52,6 +52,7 @@ enum OverwriteFiles { extern bool use_gui; extern bool verbose; +extern bool ignore_missing_glyphs; extern RunMode run_mode; extern OverwriteFiles force_overwrite; -- 2.39.5