Re: [9fans] assigning acme windows to columns programmatically

2011-01-18 Thread Arvindh Rajesh Tamilmani
the inferno sh script below shows a rather terrible way to
open a file in a given acme column.

arvindh

#!/dis/sh

load std expr string

usage := 'usage: bcol colnum file'

fn xcmd{
(cwin cmd) := $*

q0 := `{wc -c  /mnt/acme/$cwin/tag
echo Mx$q0 $q1 > /mnt/acme/$cwin/event
}

if{! ~ $#* 2}{
echo $usage >[1=2]
raise fail:usage
}
(col file) := $*
(d0 d1) := /tmp/bcol ^ (0 1) ^ .${pid}

(cwin _) := `{cat /mnt/acme/new/ctl}
xcmd $cwin (Dump $d0)
{sed 4q $d0
echo f^${padr 11 $col}^'   0   0   0   0 '
echo '  0   0   0   0   0 ' ^
$file ^
' Del Snarf | Look '
} > $d1
xcmd $cwin (Load $d1)

rm $d0 $d1
echo delete > /mnt/acme/$cwin/ctl



Re: [9fans] Acme-sac integration with Windows NT

2010-05-21 Thread Arvindh Rajesh Tamilmani
> If you are using cygwin, you can use sh from acme-sac:

it is possible to b3 on a relative file name in a
cygwin window and get it opened in acme-sac.
you'll need the label patch to win[1], bin/awd and
bin/label from plan9port and a cd wrapper as
described in the example section of label(1)[2].
also, the default cygdrive path prefix should be
changed from /cygdrive to /n.

many little conventions like this could be found
in the archives and web ([3] comes to mind), which
make working with acme a delight :-)

arvindh

[1] http://code.google.com/p/acme-sac/source/detail?r=640287ed62
[2] http://swtch.com/plan9port/man/man1/label.html
[3] http://www.cse.yorku.ca/~oz/wily/idioms.html



Re: [9fans] Acme-sac integration with Windows NT

2010-05-19 Thread Arvindh Rajesh Tamilmani
> How do you folks using acme-sac on Windows deal with the line-ending
> issue?

pipefs(4) can be used to filter windows directory trees:
http://groups.google.com/group/acme-sac/msg/973e8c67b33a7976

and also to filter /chan/snarf (in $home/lib/profile):
http://groups.google.com/group/acme-sac/msg/cf5b3107e0d00d49

os commands can be filtered through dcr:
http://code.google.com/p/acme-sac/source/browse/man/1/dcr
for an example, see the ant wrapper i posted in this thread.

/n/sources/rsc/contrib/scripts:
http://groups.google.com/group/acme-sac/msg/15378eee84e15052

arvindh



Re: [9fans] Acme-sac integration with Windows NT

2010-05-18 Thread Arvindh Rajesh Tamilmani
acme-sac on windows is my development environment too.

b2 on 'win os cmd' gives a cmd.exe window.  i prefer sh(1),
so i use just 'win' and access the windows files from /n/C.
i have shell functions defined in $home/lib/functions to
invoke specific windows commands.

for example:

fn ant {
{os -T ant.bat $* | dcr} $* |[2] dcr >[1=2]
}

and the following rule in $home/lib/plumbing to enable b3 on
windows file names output by ant.

# Microsoft Windows file names, possibly tagged by line number, go to acme
kind is text
data matches 
'(^[a-zA-Z]):([.a-zA-Z0-9_/\-\\]+[a-zA-Z0-9_/\-\\])(:(((#?[0-9]+)|(/[A-Za-z0-9_\^]+/?)|[.$])([,;+\-]((#?[0-9]+)|(/[A-Za-z0-9_\^]+/?)|[.$]))*))?'
plumb alwaysstart acme
plumb start /dis/sh.dis -c 'plumb -d edit -a action showfile -a addr
$4 /n/^`{echo $1 | tr A-Z a-z}^`{echo $2 | tr ''\\ '' /␣}'

arvindh



Re: [9fans] Binary File split

2010-05-10 Thread Arvindh Rajesh Tamilmani
i had a similar need some time back and used inferno's sh:
http://a-30.net/inferno/dis/split

arvindh



Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Arvindh Rajesh Tamilmani
> You can double-click at the beginning of the line and then execute
>
> s//\n/g
> .-0+1000
> u
>
> that will show you what the 1000th word is

it is useful to note down the address here.

s//\n/g
.-0+1000
=#
u

the output of '=#' can then be 'sent' to the
sam window to reach the 1000th word.

setting the address mark (k) doesn't
seem to work in this case.

arvindh