in reply to Re: Emacs shows xrefs in code but needs an interface that's good for humans
in thread Emacs shows xrefs in code but needs an interface that's good for humans

Hey that's neat! Here's an example for anyone that's watching. I'd never seen occur before and had to try it out.

Typing M-x occur "current_balance" gets me a new pane of info. If I move the cursor to any and hit enter, the source pane will automatically seek there.

5 lines matching "current_balance" in buffer RBCUWatcher2. 23:my $current_balance = eval { 39:exit unless length $current_balance; 41:write_file( BALANCE_FILE, $current_balance ); 43:my $difference = $current_balance - $old_balance; 45: my $message = "\$$current_balance "

~/bin/BankBalanceWatcher

#!... package main; use strict; use warnings; use WWW::Mechanize (); use File::Slurp qw( read_file write_file ); use Mail::Sendmail qw( sendmail ); use constant BALANCE_LOGIN => ...; use constant USERID => ...; use constant USERPIN => ...; use constant BALANCE_FILE => ...; use constant BALANCE_URL => ...; use constant PHONENUMBER => ...; use constant NOTIFY_URL => ...; my $old_balance = eval { return read_file(BALANCE_FILE) }; my $current_balance = eval { my $agent = WWW::Mechanize->new( autocheck => 1 ); $agent->env_proxy(); $agent->get(BALANCE_LOGIN); my $form = $agent->current_form; $form->value( SignOnID => USERID ); $form->value( Password => USERPIN ); $agent->submit(); $agent->get(BALANCE_URL); local ($_) = $agent->content =~ /\$([\d.,]+)/mx; tr/,//d; return $_; }; exit unless length $current_balance; write_file( BALANCE_FILE, $current_balance ); my $difference = $current_balance - $old_balance; if ( 0 != $difference ) { my $message = "\$$current_balance " . ( $difference > 0 ? "+$difference" : $difference ); print "$message\n"; my $agent = WWW::Mechanize->new; $agent->get(NOTIFY_URL); $agent->form_name('composeForm'); my $form = $agent->current_form; $form->value( phoneNumber => PHONENUMBER ); $form->value( message => $message ); $agent->submit(); }

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊