ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/urxvt.pm
(Generate patch)

Comparing rxvt-unicode/src/urxvt.pm (file contents):
Revision 1.90 by root, Thu Jan 12 12:15:10 2006 UTC vs.
Revision 1.93 by root, Fri Jan 13 07:03:48 2006 UTC

120 120
121For example, the following will transform selections of the form 121For example, the following will transform selections of the form
122C<filename:number>, often seen in compiler messages, into C<vi +$filename 122C<filename:number>, often seen in compiler messages, into C<vi +$filename
123$word>: 123$word>:
124 124
125 URxvt.selection-autotransform.0: s/^(\\S+):(\\d+):?$/vi +$2 \\Q$1\\E\\x0d/ 125 URxvt.selection-autotransform.0: s/^([^:[:space:]]+):(\\d+):?$/vi +$2 \\Q$1\\E\\x0d/
126 126
127And this example matches the same,but replaces it with vi-commands you can 127And this example matches the same,but replaces it with vi-commands you can
128paste directly into your (vi :) editor: 128paste directly into your (vi :) editor:
129 129
130 URxvt.selection-autotransform.0: s/^(S+):(d+):?$/\\x1b:e \\Q$1\\E\\x0d:$2\\x0d/ 130 URxvt.selection-autotransform.0: s/^([^:[:space:]]+(\\d+):?$/\\x1b:e \\Q$1\\E\\x0d:$2\\x0d/
131 131
132Of course, this can be modified to suit your needs and your editor :) 132Of course, this can be modified to suit your needs and your editor :)
133
134To expand the example above to typical perl error messages ("XXX at
135FILENAME line YYY."), you need a slightly more elaborate solution:
136
137 URxvt.selection.pattern-0: ( at .*? line \\d+\\.)
138 URxvt.selection-autotransform.0: s/^ at (.*?) line (\\d+)\\.$/\x1b:e \\Q$1\E\\x0d:$2\\x0d/
139
140The first line tells the selection code to treat the unchanging part of
141every error message as a selection pattern, and the second line transforms
142the message into vi commands to load the file.
133 143
134=item mark-urls 144=item mark-urls
135 145
136Uses per-line display filtering (C<on_line_update>) to underline urls and 146Uses per-line display filtering (C<on_line_update>) to underline urls and
137make them clickable. When middle-clicked, the program specified in the 147make them clickable. When middle-clicked, the program specified in the
361 371
362Called whenever the user presses a key combination that has a 372Called whenever the user presses a key combination that has a
363C<perl:string> action bound to it (see description of the B<keysym> 373C<perl:string> action bound to it (see description of the B<keysym>
364resource in the @@RXVT_NAME@@(1) manpage). 374resource in the @@RXVT_NAME@@(1) manpage).
365 375
376=item on_x_event $term, $event
377
378Called on every X event received on the vt window (and possibly other
379windows). Should only be used as a last resort. Most event structure
380members are not passed.
381
366=item on_focus_in $term 382=item on_focus_in $term
367 383
368Called whenever the window gets the keyboard focus, before rxvt-unicode 384Called whenever the window gets the keyboard focus, before rxvt-unicode
369does focus in processing. 385does focus in processing.
370 386
480=item urxvt::CurrentTime 496=item urxvt::CurrentTime
481 497
482=item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, 498=item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask,
483Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, 499Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask,
484Button4Mask, Button5Mask, AnyModifier 500Button4Mask, Button5Mask, AnyModifier
501
502=item urxvt::NoEventMask, KeyPressMask, KeyReleaseMask,
503ButtonPressMask, ButtonReleaseMask, EnterWindowMask, LeaveWindowMask,
504PointerMotionMask, PointerMotionHintMask, Button1MotionMask, Button2MotionMask,
505Button3MotionMask, Button4MotionMask, Button5MotionMask, ButtonMotionMask,
506KeymapStateMask, ExposureMask, VisibilityChangeMask, StructureNotifyMask,
507ResizeRedirectMask, SubstructureNotifyMask, SubstructureRedirectMask,
508FocusChangeMask, PropertyChangeMask, ColormapChangeMask, OwnerGrabButtonMask
509
510=item urxvt::KeyPress, KeyRelease, ButtonPress, ButtonRelease, MotionNotify,
511EnterNotify, LeaveNotify, FocusIn, FocusOut, KeymapNotify, Expose,
512GraphicsExpose, NoExpose, VisibilityNotify, CreateNotify, DestroyNotify,
513UnmapNotify, MapNotify, MapRequest, ReparentNotify, ConfigureNotify,
514ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify,
515CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest,
516SelectionNotify, ColormapNotify, ClientMessage, MappingNotify
485 517
486Various constants for use in X calls and event processing. 518Various constants for use in X calls and event processing.
487 519
488=back 520=back
489 521
557 delete $ENV{CDPATH}; 589 delete $ENV{CDPATH};
558 delete $ENV{BASH_ENV}; 590 delete $ENV{BASH_ENV};
559 $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; 591 $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin";
560} 592}
561 593
562my @hook_count;
563my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; 594my $verbosity = $ENV{URXVT_PERL_VERBOSITY};
564 595
565sub verbose { 596sub verbose {
566 my ($level, $msg) = @_; 597 my ($level, $msg) = @_;
567 warn "$msg\n" if $level <= $verbosity; 598 warn "$msg\n" if $level <= $verbosity;
655 verbose 11, "$HOOKNAME[$htype] returning <$retval>" 686 verbose 11, "$HOOKNAME[$htype] returning <$retval>"
656 if $verbosity >= 11; 687 if $verbosity >= 11;
657 } 688 }
658 689
659 if ($htype == 1) { # DESTROY 690 if ($htype == 1) { # DESTROY
660 if (my $hook = delete $TERM->{_hook}) {
661 for my $htype (0..$#$hook) {
662 $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} }
663 or set_should_invoke $htype, 0;
664 }
665 }
666
667 # clear package objects 691 # clear package objects
668 %$_ = () for values %{ $TERM->{_pkg} }; 692 %$_ = () for values %{ $TERM->{_pkg} };
669 693
670 # clear package 694 # clear package
671 %$TERM = (); 695 %$TERM = ();
697 while (my ($name, $cb) = each %hook) { 721 while (my ($name, $cb) = each %hook) {
698 my $htype = $HOOKTYPE{uc $name}; 722 my $htype = $HOOKTYPE{uc $name};
699 defined $htype 723 defined $htype
700 or Carp::croak "unsupported hook type '$name'"; 724 or Carp::croak "unsupported hook type '$name'";
701 725
726 $self->set_should_invoke ($htype, +1)
702 unless (exists $self->{term}{_hook}[$htype]{$pkg}) { 727 unless exists $self->{term}{_hook}[$htype]{$pkg};
703 $hook_count[$htype]++
704 or urxvt::set_should_invoke $htype, 1;
705 }
706 728
707 $self->{term}{_hook}[$htype]{$pkg} = $cb; 729 $self->{term}{_hook}[$htype]{$pkg} = $cb;
708 } 730 }
709} 731}
710 732
715 for my $name (@hook) { 737 for my $name (@hook) {
716 my $htype = $HOOKTYPE{uc $name}; 738 my $htype = $HOOKTYPE{uc $name};
717 defined $htype 739 defined $htype
718 or Carp::croak "unsupported hook type '$name'"; 740 or Carp::croak "unsupported hook type '$name'";
719 741
742 $self->set_should_invoke ($htype, -1)
720 if (delete $self->{term}{_hook}[$htype]{$pkg}) { 743 if delete $self->{term}{_hook}[$htype]{$pkg};
721 --$hook_count[$htype]
722 or urxvt::set_should_invoke $htype, 0;
723 }
724 } 744 }
725} 745}
726 746
727our $AUTOLOAD; 747our $AUTOLOAD;
728 748
1133 1153
1134=item $windowid = $term->vt 1154=item $windowid = $term->vt
1135 1155
1136Return the window id of the terminal window. 1156Return the window id of the terminal window.
1137 1157
1158=item $term->vt_emask_add ($x_event_mask)
1159
1160Adds the specified events to the vt event mask. Useful e.g. when you want
1161to receive pointer events all the times:
1162
1163 $term->vt_emask_add (urxvt::PointerMotionMask);
1164
1138=item $window_width = $term->width 1165=item $window_width = $term->width
1139 1166
1140=item $window_height = $term->height 1167=item $window_height = $term->height
1141 1168
1142=item $font_width = $term->fwidth 1169=item $font_width = $term->fwidth

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines