[latexila] Latex pp: don't display useless warning



commit 47ebfdedbd32f1235225962ab2011f895752f0fc
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Thu Jun 23 00:10:27 2011 +0200

    Latex pp: don't display useless warning
    
    "There were undefined references."
    
    It has annoyed me several times.

 src/latex_post_processor.vala |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)
---
diff --git a/src/latex_post_processor.vala b/src/latex_post_processor.vala
index 9781a56..5872347 100644
--- a/src/latex_post_processor.vala
+++ b/src/latex_post_processor.vala
@@ -100,7 +100,7 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
                     new Regex ("(.*)has occurred while \\output is active");
 
                 reg_warning =
-                    new Regex ("^(((! )?(La|pdf)TeX)|Package|Class) .*Warning[^:]*:(.*)",
+                    new Regex ("^(((! )?(La|pdf)TeX)|Package|Class) .*Warning[^:]*:[[:space:]]*(.*)",
                     RegexCompileFlags.CASELESS);
                 reg_warning_no_file = new Regex ("(No file .*)");
                 reg_warning_line = new Regex ("(.*) on input line ([0-9]+)\\.$");
@@ -122,10 +122,7 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
             }
         }
 
-        msg = BuildIssue ();
-        msg.message_type = BuildMessageType.OTHER;
-        msg.start_line = NO_LINE;
-        msg.end_line = NO_LINE;
+        reset_msg ();
     }
 
     public void process (File file, string output, int status)
@@ -205,7 +202,6 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
                     return false;
 
                 msg.message_type = BuildMessageType.BADBOX;
-                nb_badboxes++;
 
                 if (detect_badbox_line (line, false))
                     add_msg ();
@@ -295,7 +291,6 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
             case FilterStatus.START:
                 if (reg_warning.match (line))
                 {
-                    nb_warnings++;
                     msg.message_type = BuildMessageType.WARNING;
 
                     string[] strings = reg_warning.split (line);
@@ -313,7 +308,6 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
 
                 else if (reg_warning_no_file.match (line))
                 {
-                    nb_warnings++;
                     msg.message_type = BuildMessageType.WARNING;
                     string[] strings = reg_warning_no_file.split (line);
                     msg.message = strings[1];
@@ -411,7 +405,6 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
 
                 if (found)
                 {
-                    nb_errors++;
                     nb_lines++;
                     msg.message_type = BuildMessageType.ERROR;
 
@@ -801,6 +794,14 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
 
     private void add_msg (bool set_filename = true)
     {
+        // exclude some useless messages here
+        if (msg.message_type == BuildMessageType.WARNING
+            && msg.message == "There were undefined references.")
+        {
+            reset_msg ();
+            return;
+        }
+
         if (set_filename)
             msg.filename = get_current_filename ();
 
@@ -815,8 +816,28 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
             stderr.printf ("Latex post processor warning: %s\n", e.message);
         }
 
+        switch (msg.message_type)
+        {
+            case BuildMessageType.BADBOX:
+                nb_badboxes++;
+                break;
+
+            case BuildMessageType.WARNING:
+                nb_warnings++;
+                break;
+
+            case BuildMessageType.ERROR:
+                nb_errors++;
+                break;
+        }
+
         issues.add (msg);
+        reset_msg ();
+    }
 
+    private void reset_msg ()
+    {
+        msg = BuildIssue ();
         msg.message = null;
         msg.message_type = BuildMessageType.OTHER;
         msg.filename = null;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]