From 654c0474f7b6f45f2ee5ef4bdc9846b8a2601e46 Mon Sep 17 00:00:00 2001 From: Enrique Date: Fri, 26 Feb 2016 19:46:36 -0600 Subject: [PATCH 1/2] Default colors update and note/warning/error messages detection --- colormake.pl | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/colormake.pl b/colormake.pl index 696426d..e676893 100755 --- a/colormake.pl +++ b/colormake.pl @@ -43,13 +43,14 @@ $col_default = $col_ltgray; $col_gcc = $col_magenta . $col_brighten; $col_make = $col_cyan; -$col_filename = $col_yellow; -$col_linenum = $col_cyan; +$col_filename = $col_cyan; +$col_linenum = $col_blue; $col_trace = $col_yellow; -$col_warning = $col_green; +$col_note = $col_green . $col_brighten; +$col_warning = $col_yellow . $col_brighten; $col_comment = $col_drkgray; $tag_error = ""; -$col_error = $tag_error . $col_yellow . $col_brighten; +$col_error = $tag_error . $col_red . $col_brighten; $error_highlight = $col_brighten; # read in config files: system first, then user @@ -88,7 +89,7 @@ # I suppose this is bad, but it's better than what less does! if ($cols >= 0) { - $thisline =~ s/^(.{$cols}).....*(.{15})$/$1 .. $2/; + $thisline =~ s/^(.{$cols}).....*(.{15})$/$1 .. $2/; } # make[1]: Entering directory `/blah/blah/blah' @@ -119,24 +120,32 @@ { # Do interesting things if make is compiling something. - if (($thisline !~ /[,:]$/) && ($thisline !~ /warning/)) + if (($thisline !~ /[,:]$/) && ($thisline =~ /^\ /) && ($thisline !~ /note|warning|error/)) + { + # This normally matches the source code snippet. + $thisline = $col_norm . $thisline; + } + elsif ($thisline =~ /note:/) + { + $thisline =~ s|(note:\s+)(.*)$|$col_note$1$2$col_norm|; + } + elsif ($thisline =~ /warning:/) + { + $thisline =~ s|(warning:\s+)(.*)$|$col_warning$1$2$col_norm|; + } + elsif ($thisline =~ /error:/) { - # error? if ($cols >= 0) { # Retruncate line, because we are about to insert "Error:". my $c = $cols - length($tag_error); $thisline = $orgline; - $thisline =~ s/^(.{$c}).....*(.{15})$/$1 .. $2/; + $thisline =~ s/^(.{$c}).....*(.{15})$/$1 .. $2/; } - $thisline =~ s/(\d+:\s+)/$1$col_default$col_error/; + $thisline =~ s/(\d+:\s+)/$1$col_default/; + $thisline =~ s/(error:)/$col_error$col_blink ERROR: $col_norm$col_error/; $thisline = $error_highlight . $thisline . $col_norm; } - else - { - # warning - $thisline =~ s|(warning:\s+)(.*)$|$1$col_warning$2|; - } # In file included from main.cpp:38: # main.cpp: In function int main(...)': From af4a131b216a3b6832a96d7d9c390554496a680e Mon Sep 17 00:00:00 2001 From: Enrique Date: Sat, 27 Feb 2016 00:35:11 -0600 Subject: [PATCH 2/2] Preserve original format setting back to lowecase for blinky error --- colormake.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colormake.pl b/colormake.pl index e676893..ab99568 100755 --- a/colormake.pl +++ b/colormake.pl @@ -143,7 +143,7 @@ $thisline =~ s/^(.{$c}).....*(.{15})$/$1 .. $2/; } $thisline =~ s/(\d+:\s+)/$1$col_default/; - $thisline =~ s/(error:)/$col_error$col_blink ERROR: $col_norm$col_error/; + $thisline =~ s/(error:)/$col_error$col_blink$1$col_norm$col_error/; $thisline = $error_highlight . $thisline . $col_norm; }