+# Enable debug.
+# Global debug if the keyword "all" is given, or just for the
+# current window otherwise
+#
+sub _cmd_debug {
+ my $event = shift;
+ my $scope = shift;
+
+ if (defined($scope) and (lc($scope) eq 'all')) {
+ _io("Global debug enabled");
+ $debug = 1;
+ } else {
+ _io("Debug for this window enabled");
+ $debugwindows{$event->{window}} = 1;
+ }
+
+ _io("keys in debugwindows: %s", join(", ", keys(%debugwindows)));
+}
+
+#
+# Disable debug
+# Disable global debug if the keyword "all" is given (this will
+# also disable all per-window debugs) or just for the current
+# window
+#
+sub _cmd_nodebug {
+ my $event = shift;
+ my $scope = shift;
+
+ if (defined($scope) and (lc($scope) eq 'all')) {
+ $debug = 0;
+ %debugwindows = ();
+ _io("Global debug disabled");
+ } else {
+ delete($debugwindows{$event->{window}});
+ _io("Debug for this window disabled");
+ }
+
+ _io("keys in debugwindows: %s", join(", ", keys(%debugwindows)));
+}
+
+
+#