From: trebol <trebol55555@yahoo.es>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] International Ispell in Plan9
Date: Fri, 12 Apr 2013 13:21:53 +0100 [thread overview]
Message-ID: <20130412122153.GA16785@one.invalid.invalid> (raw)
In-Reply-To: <DBB9FD22-5603-4CE7-888D-9E9621ACB438@gmail.com>
On Thu, Apr 11, 2013 at 07:57:13PM +0200, Nemo wrote:
> you could put it in sources, if not yet there.
I want to put order in this mess before put it in sources.
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.
#!/bin/rc
rm -f /tmp/$pid^'.'aispell*
args=()
spellflags=()
for(x){
switch($x){
case -d*
spellflags=($spellflags $x)
case -p*
spellflags=($spellflags $x)
case -T*
spellflags=($spellflags $x)
case *
args = ($args $x)
}
}
dir = /mnt/wsys
if(! test -f $dir/cons)
dir = /mnt/term/$dir
id=`{cat $dir/new/ctl}
id=$id(1)
if(~ $#args 1 && ~ $args /*){
adir = `{basename -d $args}
args = `{basename $args}
echo 'name '^$adir^/-spell > $dir/$id/ctl
cd $adir
}
if not {
echo 'name '^`{pwd}^/-spell > $dir/$id/ctl
}
{
echo noscroll
if(~ $#args 0){
cat > /tmp/$pid^'.'aispell0; i = /tmp/$pid^'.'aispell0; winname = `{cat /mnt/acme/$winid/tag | awk '{print $1}'}; 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}'} | awk -F: '{OFS=":";$1 = "'$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^'.'aispell > $dir/$id/body; rm -f /tmp/$pid^'.'aispell
}
echo clean
}> $dir/$id/ctl
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.
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?
fn aispellen {$home/local/bin/acme/aispell -p$home/lib/pdict_en -damerican $*}
Any help?
next prev parent reply other threads:[~2013-04-12 12:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 22:01 trebol
2013-04-11 6:57 ` Mark van Atten
2013-04-11 17:57 ` Nemo
2013-04-12 12:21 ` trebol [this message]
2013-04-12 12:39 ` Francisco J Ballesteros
2013-04-12 12:56 ` erik quanstrom
2013-04-13 3:36 ` trebol
2013-04-11 12:34 trebol
2013-04-13 6:48 trebol
2013-04-14 2:30 trebol
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130412122153.GA16785@one.invalid.invalid \
--to=trebol55555@yahoo.es \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).