[PATCH] emacs compile window support for checkpatch version .10

From: Mike Day
Date: Mon Sep 17 2007 - 15:33:27 EST


Adds support to checkpatch.pl for running in the emacs compile window.
This allows emacs users to jump from the error in the compile window
directly to the offending line in the patch.

Use a script like the following to run in emacs:

(defun checkpatch()
(interactive)
(compile (concat "checkpatch.pl --emacs " (buffer-file-name))))

Signed-off-by: Mike D. Day <ncmike@xxxxxxxxxxx>

--- checkpatch.pl-0.10 2007-09-17 15:24:21.000000000 -0400
+++ checkpatch.emacs.pl 2007-09-17 14:48:38.000000000 -0400
@@ -18,12 +18,16 @@
my $chk_signoff = 1;
my $chk_patch = 1;
my $tst_type = 0;
+my $emacs = 0;
+my $linenr = 0;
+
GetOptions(
'q|quiet' => \$quiet,
'tree!' => \$tree,
'signoff!' => \$chk_signoff,
'patch!' => \$chk_patch,
'test-type!' => \$tst_type,
+ 'emacs!' => \$emacs,
) or exit;

my $exit = 0;
@@ -33,6 +37,7 @@
print "version: $V\n";
print "options: -q => quiet\n";
print " --no-tree => run without a kernel tree\n";
+ print " --emacs => emacs compile window format\n";
exit(1);
}

@@ -306,15 +311,27 @@
@report;
}
sub ERROR {
+ if ($emacs) {
+ report("$ARGV:$linenr: ERROR: $_[0]\n");
+ } else {
report("ERROR: $_[0]\n");
- our $clean = 0;
+ }
+ our $clean = 0;
}
sub WARN {
+ if ($emacs) {
+ report("$ARGV:$linenr: WARNING: $_[0]\n");
+ } else {
report("WARNING: $_[0]\n");
+ }
our $clean = 0;
}
sub CHK {
+ if ($emacs) {
+ report("$ARGV:$linenr: CHECK: $_[0]\n");
+ } else {
report("CHECK: $_[0]\n");
+ }
our $clean = 0;
}

@@ -322,7 +339,6 @@
my $filename = shift;
my @lines = @_;

- my $linenr=0;
my $prevline="";
my $stashline="";


--
Mike Day
http://www.ncultra.org
AIM: ncmikeday | Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/