Fixed and documented matcher/on_user_command
authortpope <tpope>
Sun, 10 Jun 2007 23:42:36 +0000 (23:42 +0000)
committertpope <tpope>
Sun, 10 Jun 2007 23:42:36 +0000 (23:42 +0000)
Changes
src/perl/matcher
src/urxvt.pm

diff --git a/Changes b/Changes
index 849abcd7f9e76f1551863980fab6b2229a6d529a..1743a1d0f1e849258c25adbc8ad1a35ea85f2222 100644 (file)
--- a/Changes
+++ b/Changes
@@ -38,7 +38,8 @@ TODO: rid of global dpy variable.
           digit.
         - better option handling, support more than 30 options (exg).
        - nuke reconf script, serves no purpose anymore.
-        - disabled matcher/on_user_command processing in matcher extension.
+       - fixed and documented matcher/on_user_command processing in matcher
+         extension.
 
 8.2  Sat Feb 17 21:35:28 CET 2007
        - fix make depend in src/, reported by exg.
index a440daf34441ed52434617d64d960b4f110b039b..4cd25de09128f93da234dd99da7af7dce109bc34 100644 (file)
@@ -12,29 +12,29 @@ my $url =
       )+
    }x;
 
-#sub on_user_command {
-#   my ($self, $cmd) = @_;
-#   if($cmd =~ s/^matcher\b//) {
-#      $self->most_recent;
-#   }
-#   my $row = $self->nrow;
-#   my @exec;
-#   while($row-- > $self->top_row) {
-#      #my $line = $self->line ($row);
-#      #my $text = $line->t;
-#      @exec = $self->command_for($row);
-#      last if(@exec);
-#   }
-#   if(@exec) {
-#      return $self->exec_async (@exec);
-#   }
-#   ()
-#}
-#
-#sub most_recent {
-#   my ($self) = shift;
-#   ()
-#}
+sub on_user_command {
+   my ($self, $cmd) = @_;
+   if($cmd =~ s/^matcher\b//) {
+      $self->most_recent;
+   }
+   ()
+}
+
+sub most_recent {
+   my ($self) = shift;
+   my $row = $self->nrow;
+   my @exec;
+   while($row-- > $self->top_row) {
+      #my $line = $self->line ($row);
+      #my $text = $line->t;
+      @exec = $self->command_for($row);
+      last if(@exec);
+   }
+   if(@exec) {
+      return $self->exec_async (@exec);
+   }
+   ()
+}
 
 sub my_resource {
    my $self = shift;
index 87a010672dbeb5ebef6e45ce0737f18ac00378db..7c65698d84f43acaf5e1dc15473ca042db53da3b 100644 (file)
@@ -261,6 +261,9 @@ C<matcher.pattern.0> resource, and additional patterns can be specified
 with numbered patterns, in a manner similar to the "selection" extension.
 The launcher can also be overridden on a per-pattern basis.
 
+It is possible to activate the most recently seen match from the keyboard.
+Simply bind a keysym to "perl:matcher" as seen in the example below.
+
 Example configuration:
 
     URxvt.perl-ext:           default,matcher