--- rxvt-unicode/src/perl/matcher 2012/06/10 17:39:54 1.11 +++ rxvt-unicode/src/perl/matcher 2014/05/17 13:34:35 1.14 @@ -1,7 +1,7 @@ #! perl # Author: Tim Pope -# Bob Farrell +# Bob Farrell #:META:X_RESOURCE:%.launcher:string:default launcher command #:META:X_RESOURCE:%.button:string:the button, yeah @@ -11,7 +11,7 @@ =head1 NAME - matcher - match strings in terminal output and change their rendition +matcher - match strings in terminal output and change their rendition =head1 DESCRIPTION @@ -33,9 +33,12 @@ from the keyboard. Simply bind a keysym to "perl:matcher:last" or "perl:matcher:list" as seen in the example below. -Example configuration: +Example: load and use the matcher extension with defaults. URxvt.perl-ext: default,matcher + +Example: use a custom configuration. + URxvt.url-launcher: sensible-browser URxvt.keysym.C-Delete: perl:matcher:last URxvt.keysym.M-Delete: perl:matcher:list @@ -49,10 +52,10 @@ my $url = qr{ (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) - [a-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27,~#]* + [\w\-\@;\/?:&=%\$.+!*\x27,~#]* ( - \([a-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27,~#]*\)| # Allow a pair of matched parentheses - [a-zA-Z0-9\-\@;\/?:&=%\$_+*~] # exclude some trailing characters (heuristic) + \([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\)| # Allow a pair of matched parentheses + [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) )+ }x; @@ -75,29 +78,28 @@ $self->exec_async( $self->{launcher}, @args ); } +# backwards compat sub on_user_command { my ($self, $cmd) = @_; - if($cmd =~ s/^matcher:list\b//) { - $self->matchlist(); + if ($cmd =~ s/^matcher:list\b//) { + $self->matchlist; } else { - if($cmd =~ s/^matcher:last\b//) { + if ($cmd =~ s/^matcher:last\b//) { $self->most_recent; - } - # For backward compatibility - else { - if($cmd =~ s/^matcher\b//) { + } elsif ($cmd =~ s/^matcher\b//) { + # for backward compatibility $self->most_recent; } } - } + () } sub matchlist { my ($self) = @_; if ( $self->{showing} ) { - $self->{url_overlay}->hide(); + $self->{url_overlay}->hide; $self->{showing} = 0; return; }