From mboxrd@z Thu Jan 1 00:00:00 1970 References: <20130410220136.GA22815@one.invalid.invalid> <20130412122153.GA16785@one.invalid.invalid> In-Reply-To: <20130412122153.GA16785@one.invalid.invalid> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=us-ascii Message-Id: <561BCA1B-A62A-441A-913A-4376457C3963@lsub.org> Content-Transfer-Encoding: quoted-printable From: Francisco J Ballesteros Date: Fri, 12 Apr 2013 14:39:55 +0200 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] International Ispell in Plan9 Topicbox-Message-UUID: 40f7c990-ead8-11e9-9d60-3106f5b1d025 look under /acme for examples.=20 On Apr 12, 2013, at 2:21 PM, trebol wrote: > On Thu, Apr 11, 2013 at 07:57:13PM +0200, Nemo wrote: >> you could put it in sources, if not yet there. >=20 >=20 > I want to put order in this mess before put it in sources. >=20 > I change the for loop to work in the output of ispell instead, and now > ispell works only one time in terse mode. The script is now much faster > thanks to the good design of awk and grep. >=20 > #!/bin/rc >=20 > rm -f /tmp/$pid^'.'aispell* >=20 > args=3D() > spellflags=3D() > for(x){ > switch($x){ > case -d* > spellflags=3D($spellflags $x) > case -p* > spellflags=3D($spellflags $x) > case -T* > spellflags=3D($spellflags $x) > case * > args =3D ($args $x) > } > } >=20 > dir =3D /mnt/wsys > if(! test -f $dir/cons) > dir =3D /mnt/term/$dir > id=3D`{cat $dir/new/ctl} > id=3D$id(1) >=20 > if(~ $#args 1 && ~ $args /*){ > adir =3D `{basename -d $args} > args =3D `{basename $args} > echo 'name '^$adir^/-spell > $dir/$id/ctl > cd $adir > } > if not { > echo 'name '^`{pwd}^/-spell > $dir/$id/ctl > } >=20 > { > echo noscroll > if(~ $#args 0){ > cat > /tmp/$pid^'.'aispell0; i =3D /tmp/$pid^'.'aispell0; winname =3D= `{cat /mnt/acme/$winid/tag | awk '{print $1}'}; for(j in `{cat $i | $home/l= ocal/bin/ispell -a $spellflags | awk '/^[&#]/{gsub(/ /,"_"); print}'}){$home= /local/bin/acme/spout $i | grep `{echo $j | awk -F_ '{print $2}'} | awk -F: '= {OFS=3D":";$1 =3D "'$winname'"; print}' >> /tmp/$pid^'.'aispell } ; sort -u /= tmp/$pid^'.'aispell > $dir/$id/body; rm -f /tmp/$pid^'.'aispell* > } > if not for(i in $args){ > for(j in `{cat $i | $home/local/bin/ispell -a $spellflags | awk '/^= [&#]/{gsub(/ /,"_"); print}'}){$home/local/bin/acme/spout $i | grep `{echo $= j | awk -F_ '{print $2}'} >> /tmp/$pid^'.'aispell } ; sort -u /tmp/$pid^'.'a= ispell > $dir/$id/body; rm -f /tmp/$pid^'.'aispell > } > echo clean > }> $dir/$id/ctl >=20 >=20 > Now you can use it in the tag line to spell check the dot, and the > output begins with the name of the window, so if you select all the > window's body, you can spell check it without save it with the same > commodity. Of course the addresses of the misspelled words don't works > with a common selection. >=20 > To make this work, I need to know how to get the dot address within > the script. Also the functions don't work in acme, but a similar script > works. Why? >=20 > fn aispellen {$home/local/bin/acme/aispell -p$home/lib/pdict_en -damerican= $*} >=20 > Any help?