* [9fans] rectangle dot in acme
@ 2006-10-21 22:05 Arvindh Rajesh Tamilmani
0 siblings, 0 replies; only message in thread
From: Arvindh Rajesh Tamilmani @ 2006-10-21 22:05 UTC (permalink / raw)
To: 9fans
The script below (called rect) partially implements kill-rectangle and
string-rectangle commands from emacs. For example, select :/-a/,/-b/
in an acme window containing the following lines:
/bin/bind -a '#L' /dev >/dev/null >[2=1]
/bin/bind -a '#w1' /dev >/dev/null >[2=1]
/bin/bind -a '#t' /dev >/dev/null >[2=1]
/bin/bind -b '#A' /dev >/dev/null >[2=1]
Now 2-1 chord on rect deletes the options to bind. 2-1 on "rect -b"
replaces the options to bind with -b. This can be achieved using Edit
but I found these shortcuts quite handy in emacs while extracting
columns of data from log files.
Comments welcome.
Thanks.
Arvindh
P.S. The script doesn't work in an unnamed acme window - $acmeaddr is
unset in that case.
#!/bin/rc
if(~ $acmeaddr '')
exit 'nil acmeaddr'
if(~ $#* 2)
repl=$1
cd /mnt/acme/$winid
p=`{echo $acmeaddr | sed 's/.*#(.*),#(.*)/\1 \2/'}
p1=$p(1)
p2=$p(2)
q=`{sam -d body >[2=1] <<! | tr -d '.body;#-'}
#$p1-+x/^/=
#$p2-+x/^/=
!
pre=`{echo $p1-$q(2) | bc}
row=`{echo $p2-$q(4)-$pre | bc}
prere=`{seq -f. 1 $pre | tr -d $ifs}
rowre=`{seq -f. 1 $row | tr -d $ifs}
echo -n '0,$' >addr
sed $q(1)^,$q(3)^'s/(^'$"prere')(.*|('$"rowre'(.*)))/\1'$"repl'\4/' body >data
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-10-21 22:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-21 22:05 [9fans] rectangle dot in acme Arvindh Rajesh Tamilmani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).