public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] emacs compile window support for checkpatch version .10
@ 2007-09-17 19:32 Mike Day
  2007-09-21 14:34 ` Andy Whitcroft
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Day @ 2007-09-17 19:32 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: Randy Dunlap, Joel Schopp, Andy Whitcroft, linux-kernel

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@ncultra.org>

--- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-21 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-17 19:32 [PATCH] emacs compile window support for checkpatch version .10 Mike Day
2007-09-21 14:34 ` Andy Whitcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox