From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Date: Fri, 29 Mar 2013 01:38:06 +0100 Message-ID: From: =?UTF-8?B?QmVuY2UgRsOhYmnDoW4=?= To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7bd75cee1ad0de04d9057ce4 Subject: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 389f4548-ead8-11e9-9d60-3106f5b1d025 --047d7bd75cee1ad0de04d9057ce4 Content-Type: text/plain; charset=UTF-8 Hi! I did a quick writeup on little Edit scripts (well basicly sam(1) scripts) If anyone have more feel free to contribute. Maybe someone could put them on the wiki even. http://bencef.com/blog/4/ bencef --047d7bd75cee1ad0de04d9057ce4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi!

I did a quick writeup on litt= le Edit scripts
(well basicly sam(1) scripts)
If anyone have more feel free to contribute.
Maybe someo= ne could put them on the wiki even.

http:= //bencef.com/blog/4/

bencef

--047d7bd75cee1ad0de04d9057ce4-- From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@9fans.net Date: Fri, 29 Mar 2013 01:19:38 +0000 From: phineas.pett@gmail.com In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 38a57cd8-ead8-11e9-9d60-3106f5b1d025 > Hi! >=20 > I did a quick writeup on little Edit scripts > (well basicly sam(1) scripts) > If anyone have more feel free to contribute. > Maybe someone could put them on the wiki even. Nice idea... Here's a simple awk bit I use in Acme for centering text (its name is the center-line rune: =E2=84=84) #!/bin/rc # Center text awk '{l=3Dlength();s=3Dint((70-l)/2); printf "%"(s+l)"s\n",$0}' It doesn't seem to be common practice, but I like to name editing commands with unicode runes to save room: i.e. =E2=86=90 and =E2=86=92 f= or indentation (used with code), or =E2=87=90 and =E2=87=92 for indentation = + a reformat (used for natural language next). I find they serve a bit like icons. From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Fri, 29 Mar 2013 09:20:56 +0100 Message-ID: <3156962.ug0YdxJUKR@coil> User-Agent: KMail/4.10.1 (Linux/3.9.0-rc3-l50; KDE/4.10.1; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 38b6afee-ead8-11e9-9d60-3106f5b1d025 On Friday 29 of March 2013 01:38:06 Bence F=C3=A1bi=C3=A1n wrote: > I did a quick writeup on little Edit scripts > (well basicly sam(1) scripts) > If anyone have more feel free to contribute. > Maybe someone could put them on the wiki even. stuff i use: # clear whole window -- usefull with +Errors Edit ,d=20 # decrease TAB indentation of selection Edit s,^TAB,,g # increase TAB indentation of selection # the ^. part ensures we indent only lines with content # and leave empty lines undisturbed Edit s,^.,TAB&,g --=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 29 Mar 2013 09:22:25 +0100 Message-ID: From: "Peter A. Cejchan" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=089e010d8dde958a4604d90bf8a5 Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 38c2b1ae-ead8-11e9-9d60-3106f5b1d025 --089e010d8dde958a4604d90bf8a5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, very nice, mates! I humbly add some of minebelow. Best, ++pac ##### ## Latin =C3=A4=C3=AB=C3=AF=C3=B1=C3=B6=C3=BC=C3=BF=C3=84=C3=85=C3=8B=C3=8F=C3=96=C3= =9C ## Greek =CE=B1=CE=B2=CE=B3=CE=B4=CE=B5=CE=B6=CE=B7=CE=B8=CE=BB=CE=BC=CE=BD=CE=BE=CF= =80=CF=81=CF=83=CF=84=CF=86=CF=88=CF=89=CE=93=CE=94=CE=98=CE=9B=CE=9E=CE=A0= =CE=A3=CE=A6=CE=A8=CE=A9 ## select text :; # select all text :;25 # select from start to line 25 (inclusive) :25; # select from line 25 (inclusive) to EOF Edit /;[ ]*\/\// # select from ; to // comments ## edit text Edit s/^/ /g # increase indentation Edit s,^ ,,g # decrease indentation Edit s/^/\/\/ /g #comment out using // Edit s/\n\n\n+/\n\n/g # remove redundant newlines, keep max two Edit s/^[ ]+//g # remove leading whitespace Edit s/[ ]+$//g # remove trailing whitespace Edit s/ +/ /g # remove multiple spaces Edit s/;$//g # remove trailing semicolon Edit s/\*+\///g # comments Edit s/\/\*+/\/\//g Edit s/[\(\)]/ /g # remove () Edit s/.*/(&)/g # add () Edit s/.*/float64(&)/g # float64() Edit s/.*/} & {/g # add } { Edit s/^/\/\/ /g # // comment out Edit /;[ ]*\/\// Edit s/;// # find and remove semicolon before // comments Edit s/\+\+[a-zA-Z]+[0-9a-zA-Z]*/&++/ Edit s/\+\+/d # NOT WORKING prefix to postfix operator Edit s/->/./g # struct pointer Edit ,s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/g# prefix to postfix operator: ++ Edit ,s/\-\-([A-Za-z]+[A-Za-z0-9]*)/\1--/g# prefix to postfix operator: -- # prefix to postfix operator: ++i --> i++ Edit /\+\+[a-zA-Z_]+[0-9a-zA-Z_]*/{ x/\+\+/d a/++/ } Edit s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/ # prefix to postfix operator: ++i --> i++ | 9 sed 's/\(//; s/(.*)\)/\1/' # remove outermost pair of parentheses Edit s:\((.*)\):\1:g # remove outermost pair of parentheses On Fri, Mar 29, 2013 at 2:19 AM, wrote: > > Hi! > > > > I did a quick writeup on little Edit scripts > > (well basicly sam(1) scripts) > > If anyone have more feel free to contribute. > > Maybe someone could put them on the wiki even. > > Nice idea... > > Here's a simple awk bit I use in Acme for centering text (its name is > the center-line rune: =E2=84=84) > > #!/bin/rc > # Center text > awk '{l=3Dlength();s=3Dint((70-l)/2); printf "%"(s+l)"s\n",$0}' > > It doesn't seem to be common practice, but I like to name editing > commands with unicode runes to save room: i.e. =E2=86=90 and =E2=86=92 f= or > indentation (used with code), or =E2=87=90 and =E2=87=92 for indentation = + a reformat > (used for natural language next). I find they serve a bit like icons. > > > --089e010d8dde958a4604d90bf8a5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, very nice, mates!
I humbly add some of minebelow.
Best, ++pac=

#####
## Latin
=C3=A4=C3=AB=C3=AF=C3=B1=C3=B6=C3=BC=C3=BF=C3= =84=C3=85=C3=8B=C3=8F=C3=96=C3=9C

## Greek
=CE=B1=CE=B2=CE=B3=CE= =B4=CE=B5=CE=B6=CE=B7=CE=B8=CE=BB=CE=BC=CE=BD=CE=BE=CF=80=CF=81=CF=83=CF=84= =CF=86=CF=88=CF=89=CE=93=CE=94=CE=98=CE=9B=CE=9E=CE=A0=CE=A3=CE=A6=CE=A8=CE= =A9

## select text

:;=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # = select all text
:;25=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # select from start to line 25 (i= nclusive)
:25;=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # select from line 2= 5 (inclusive) to EOF
Edit /;[ =C2=A0=C2=A0=C2=A0 ]*\/\//=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 # select from ; to // comments


## edit te= xt
Edit s/^/=C2=A0=C2=A0=C2=A0 /g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #= increase indentation
Edit s,^=C2=A0=C2=A0=C2=A0 ,,g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # decre= ase indentation
Edit s/^/\/\/ /g=C2=A0=C2=A0=C2=A0 #comment out using //=

Edit s/\n\n\n+/\n\n/g=C2=A0=C2=A0=C2=A0 # remove redundant newlines= , keep max two
Edit s/^[ =C2=A0=C2=A0=C2=A0 ]+//g=C2=A0=C2=A0=C2=A0 # re= move leading whitespace
Edit s/[ =C2=A0=C2=A0=C2=A0 ]+$//g=C2=A0=C2=A0=C2=A0 # remove trailing whit= espace
Edit s/ +/ /g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # remove multi= ple spaces
Edit s/;$//g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # remove tr= ailing semicolon
Edit s/\*+\///g=C2=A0=C2=A0=C2=A0 # comments
Edit s/= \/\*+/\/\//g
Edit s/[\(\)]/ /g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # re= move ()
Edit s/.*/(&)/g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # add ()
Edit s= /.*/float64(&)/g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # float64()
Ed= it s/.*/} & {/g=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # add }=C2=A0 {Edit s/^/\/\/ /g=C2=A0=C2=A0=C2=A0 # // comment out
Edit /;[ =C2=A0=C2= =A0=C2=A0 ]*\/\// Edit s/;//=C2=A0=C2=A0=C2=A0 # find and remove semicolon = before // comments
Edit s/\+\+[a-zA-Z]+[0-9a-zA-Z]*/&++/ Edit s/\+\+/d=C2=A0=C2=A0=C2=A0 #= NOT WORKING prefix to postfix operator
Edit s/->/./g=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 # struct pointer

Edit ,s/\+\+([A-Za-z]+[A-Za-= z0-9]*)/\1++/g# prefix to postfix operator: ++
Edit ,s/\-\-([A-Za-z]+[A-Za-z0-9]*)/\1--/g# prefix to postfix operator: --<= br>
# prefix to postfix operator: ++i --> i++
Edit /\+\+[a-zA-Z_]+= [0-9a-zA-Z_]*/{
x/\+\+/d
a/++/
}

Edit s/\+\+([A-Za-z]+[A-Za= -z0-9]*)/\1++/ # prefix to postfix operator: ++i --> i++

| 9 sed 's/\(//; s/(.*)\)/\1/' # remove outermost pair of paren= theses
Edit s:\((.*)\):\1:g=C2=A0=C2=A0=C2=A0 # remove outermost pair of= parentheses





On Fri, Mar = 29, 2013 at 2:19 AM, <phineas.pett@gmail.com> wrote:
> Hi!
>
> I did a quick writeup on little Edit scripts
> (well basicly sam(1) scripts)
> If anyone have more feel free to contribute.
> Maybe someone could put them on the wiki even.

Nice idea...

Here's a simple awk bit I use in Acme for centering text (its name is the center-line rune: =E2=84=84)

#!/bin/rc
# Center text
awk '{l=3Dlength();s=3Dint((70-l)/2); printf "%"(s+l)"s\= n",$0}'

It doesn't seem to be common practice, but I like to name editing
commands with unicode runes to save room: i.e. =C2=A0=E2=86=90 and =E2=86= =92 for
indentation (used with code), or =E2=87=90 and =E2=87=92 for indentation + = a reformat
(used for natural language next). =C2=A0I find they serve a bit like icons.=



--089e010d8dde958a4604d90bf8a5-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <3156962.ug0YdxJUKR@coil> References: <3156962.ug0YdxJUKR@coil> Date: Fri, 29 Mar 2013 09:25:47 +0100 Message-ID: From: "Peter A. Cejchan" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=e89a8fb1fd749e5b4204d90c048b Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 38cc5c2c-ead8-11e9-9d60-3106f5b1d025 --e89a8fb1fd749e5b4204d90c048b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Maybe it's time for an Acme wiki page? Also, could you share the plumbing rules you use (for my inspiration/learning)? Happy Easter, folks! ++pac On Fri, Mar 29, 2013 at 9:20 AM, dexen deVries wro= te: > On Friday 29 of March 2013 01:38:06 Bence F=C3=A1bi=C3=A1n wrote: > > I did a quick writeup on little Edit scripts > > (well basicly sam(1) scripts) > > If anyone have more feel free to contribute. > > Maybe someone could put them on the wiki even. > > stuff i use: > > # clear whole window -- usefull with +Errors > Edit ,d > > # decrease TAB indentation of selection > Edit s,^TAB,,g > > > # increase TAB indentation of selection > # the ^. part ensures we indent only lines with content > # and leave empty lines undisturbed > Edit s,^.,TAB&,g > > -- > dexen deVries > > [[[=E2=86=93][=E2=86=92]]] > > > --e89a8fb1fd749e5b4204d90c048b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Maybe it's time for an Acme wiki page?
Also, could you share the plu= mbing rules you use (for my inspiration/learning)?

Happy Easter, fol= ks!
++pac

On Fri, Mar 29, 2013 at 9:20= AM, dexen deVries <dexen.devries@gmail.com> wrote:
On Friday 29 of March 2013= 01:38:06 Bence F=C3=A1bi=C3=A1n wrote:
> I did a quick writeup on little Edit scripts
> (well basicly sam(1) scripts)
> If anyone have more feel free to contribute.
> Maybe someone could put them on the wiki even.

stuff i use:

# clear whole window -- usefull with +Errors
Edit ,d

# decrease TAB indentation of selection
Edit s,^TAB,,g


# increase TAB indentation of selection
# the ^. part ensures we indent only lines with content
# and leave empty lines undisturbed
Edit s,^.,TAB&,g

--
dexen deVries

[[[=E2=86=93][=E2=86=92]]]



--e89a8fb1fd749e5b4204d90c048b-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Fri, 29 Mar 2013 09:48:06 +0100 Message-ID: <2449539.RSB6coPKl3@coil> User-Agent: KMail/4.10.1 (Linux/3.9.0-rc3-l50; KDE/4.10.1; x86_64; ; ) In-Reply-To: References: <3156962.ug0YdxJUKR@coil> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 38d470a6-ead8-11e9-9d60-3106f5b1d025 On Friday 29 of March 2013 09:25:47 Peter A. Cejchan wrote: > Also, could you share the plumbing rules you use (for my > inspiration/learning)? 1) re-format PHP's strange error mesages into standard=20 FILE_PATHNAME:LINE_NUMBER # ... called in FILE_PATHNAME on line LINE_NUMBER and defined in FILE_P= ATHNAME=20 on line LINE_NUMBER data matchesmultiline '.*rror.*called in ([^ ]+) on line ([0-9]+) and d= efined=20 in ([^ ]+) on line ([0-9]+).*' arg isfile $1 data set $file attr add addr=3D$2 type is text plumb to edit #file / line in PHP format data matchesmultiline '(.+) on line ([0-9]+).*' arg isfile $1 data set $file attr add addr=3D$2 type is text plumb to edit 2) display php's function prototypes on right-click on a function name = with an=20 opening parenthesis. the `W' script greps a flat text file list of func= tions=20 (with arguments and return types) and outputs to +Errors window. type is text data matches '[a-zA-Z_][a-zA-Z_0-9]*[(]' plumb start W --wdir $wdir $data * * * a half-hearted support for displaying SQL table schema; again, `Wtable'= is a=20 script outputting definition of indicated table. type is text data matches '.*(FROM|JOIN)[ ]+([^ ]+).*' data set $2 plumb start Wtable --wdir $wdir $data --=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@9fans.net From: Richard Miller <9fans@hamnavoe.com> Date: Fri, 29 Mar 2013 09:50:51 +0000 In-Reply-To: <3156962.ug0YdxJUKR@coil> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 38f6e6a4-ead8-11e9-9d60-3106f5b1d025 > # increase TAB indentation of selection > # the ^. part ensures we indent only lines with content > # and leave empty lines undisturbed > Edit s,^.,TAB&,g Very nice. From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <3156962.ug0YdxJUKR@coil> Date: Fri, 29 Mar 2013 09:20:12 -0700 Message-ID: From: Skip Tavakkolian To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 39c42506-ead8-11e9-9d60-3106f5b1d025 this also works: # indent Edit ,x/^./ y/./ c/ / # outdent Edit ,x/^ / c// -Skip On Fri, Mar 29, 2013 at 2:50 AM, Richard Miller <9fans@hamnavoe.com> wrote: >> # increase TAB indentation of selection >> # the ^. part ensures we indent only lines with content >> # and leave empty lines undisturbed >> Edit s,^.,TAB&,g > > Very nice. > > From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@9fans.net Date: Thu, 4 Apr 2013 10:19:23 +0000 From: Mark van Atten Message-ID: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable References: Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 3d598756-ead8-11e9-9d60-3106f5b1d025 On Friday, 29 March 2013 01:38:06 UTC+1, Bence F=E1bi=E1n wrote: > I did a quick writeup on little Edit scripts Many thanks, this thread is very useful. There is also Jason Catena's list of Edit idioms at https://raw.github.com/catenate/acme-fonts/master/test/1/acme/Edit/sam When editing and re-editing latex, I regularly pipe selections through a simple-minded script called `chunk' which does most of the work for obtaining semantic linebreaks. That goes back to a recommendation by Kernighan in his paper `Unix for beginners' of 1974; see the quotation, comments and link at [1]. #!/usr/local/plan9/bin/rc=20 # chunk up (to prepare) for semantic linebreaks # do not break within \cite=20 # do not break within $$ math=20 # break after closing parentheses ),]=20 # break before an opening parentheses (,[ ssam -e 'x/(^[^%].+\n)+/ y/\\cite[^{]*{(\n|.)*}/ y/\$.*\$/ x/(([^A-Z]\.)|[,;:!?]|\)|\]) | (\(|\[)/ s/ /\n/' \ | 9 fmt -w 60 -j For batch processing probably something more sophisticated would be needed to leave various environments unchunked. But I don't use it that way, and just apply it to selections where I know its use makes sense. Usually these are areas where I have just been doing a lot of rewriting. There's no point in chunking up commented material, and sometimes it is actually convenient to have a place where I can keep things unchunked for reference. The original chunk command in Writer's Workbench [2], for troff not latex, was based on a parser for English, I think. I find I don't want that (because I write in other languages as well), and that even in English I don't need it (because the chunking based on interpunction is always fine with me, and where I care about the remaining cases, I prefer to do it myself; but see [3]). Mark. [1] http://rhodesmill.org/brandon/2012/one-sentence-per-line/ [2] http://man.cat-v.org/unix_WWB/1/chunk [3] https://github.com/waldir/semantic-linebreaker From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Thu, 4 Apr 2013 14:08:02 +0200 Message-ID: <1884737.3LQvsnlhqy@coil> User-Agent: KMail/4.10.1 (Linux/3.9.0-rc3-l50; KDE/4.10.1; x86_64; ; ) In-Reply-To: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> References: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart97509986.ibg9XCoh9X" Content-Transfer-Encoding: 7Bit Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 3d68c70c-ead8-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --nextPart97509986.ibg9XCoh9X Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On Thursday 04 of April 2013 10:19:23 Mark van Atten wrote: > On Friday, 29 March 2013 01:38:06 UTC+1, Bence F=C3=A1bi=C3=A1n wrot= e: > > I did a quick writeup on little Edit scripts (p9p specific) attached is my dirty hack for automagic grepping of $% file or recursiv= ely %s=20 dir or pipe. a funky goodie: automatically supplies `.' (dot) between arguments, so for example: $ G some token here becomes `grep some.token.here' --=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] ``we, the humanity'' is the greatest experiment we, the humanity, ever=20= undertook.=20 --nextPart97509986.ibg9XCoh9X Content-Disposition: attachment; filename="G" Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8"; name="G" #!/usr/bin/env rc . 9.rc s=() arg=() fn addS { if (~ $#s 0) s=$1 if not s=$s.$1 } while (! ~ $#* 0) { if (~ $1 -*) arg=($arg $1) if not addS $1 shift } if (u test -p /dev/stdin) { grep -n $arg $s exit } if (test -f $%) grep -n $arg $s /dev/null `{basename $%} if not find . -type f | grep -v '[.]/share/doc/doxygen/|/[.]git/|/[.]svn/|[.](mo|pot)$' | xargs grep -n $arg $s /dev/null --nextPart97509986.ibg9XCoh9X-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> References: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> Date: Thu, 4 Apr 2013 14:16:10 +0200 Message-ID: From: =?UTF-8?B?QmVuY2UgRsOhYmnDoW4=?= To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=14dae9340ee796118b04d987ef87 Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 3d6d237e-ead8-11e9-9d60-3106f5b1d025 --14dae9340ee796118b04d987ef87 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cool. Here's a script i use to generate case insensitive regexes. It turns FooBar into [Ff][Oo][Oo][Bb][Aa][Rr] term% cat /bin/uncase #!/bin/rc exec awk '{ lower =3D tolower($0) upper =3D toupper($0) len =3D length($0) for( i =3D 1 ; i <=3D len ; i++ ) printf "[" substr(upper, i, 1) substr(lower, i, 1) "]" printf "\n" }' 2013/4/4 Mark van Atten > On Friday, 29 March 2013 01:38:06 UTC+1, Bence F=C3=A1bi=C3=A1n wrote: > > > I did a quick writeup on little Edit scripts > > Many thanks, this thread is very useful. > > There is also Jason Catena's list of Edit idioms at > https://raw.github.com/catenate/acme-fonts/master/test/1/acme/Edit/sam > > When editing and re-editing latex, I regularly pipe selections > through a simple-minded script called `chunk' which does most of > the work for obtaining semantic linebreaks. That goes back to a > recommendation by Kernighan in his paper `Unix for beginners' of > 1974; see the quotation, comments and link at [1]. > > > > #!/usr/local/plan9/bin/rc > # chunk up (to prepare) for semantic linebreaks > > # do not break within \cite > # do not break within $$ math > # break after closing parentheses ),] > # break before an opening parentheses (,[ > > ssam -e 'x/(^[^%].+\n)+/ y/\\cite[^{]*{(\n|.)*}/ y/\$.*\$/ > x/(([^A-Z]\.)|[,;:!?]|\)|\]) | (\(|\[)/ s/ /\n/' \ | 9 fmt -w 60 > -j > > > For batch processing probably something more sophisticated would > be needed to leave various environments unchunked. But I don't use > it that way, and just apply it to selections where I know its use > makes sense. Usually these are areas where I have just been doing > a lot of rewriting. > > There's no point in chunking up commented material, and sometimes > it is actually convenient to have a place where I can keep things > unchunked for reference. > > The original chunk command in Writer's Workbench [2], for troff not > latex, was based on a parser for English, I think. I find I don't > want that (because I write in other languages as well), and that > even in English I don't need it (because the chunking based on > interpunction is always fine with me, and where I care about the > remaining cases, I prefer to do it myself; but see [3]). > > Mark. > > > [1] http://rhodesmill.org/brandon/2012/one-sentence-per-line/ > > [2] http://man.cat-v.org/unix_WWB/1/chunk > > [3] https://github.com/waldir/semantic-linebreaker > > --14dae9340ee796118b04d987ef87 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Cool.


Here's a= script i use to generate case
insensitive regexes. It turn= s

FooBar

into

[Ff][Oo][Oo][Bb][Aa][Rr]
=
term% cat /bin/uncase
#!/bin/rc

exec awk '{
lower =3D tolower($0)
upper =3D toupper($= 0)
len =3D len= gth($0)

for( i =3D 1 ; i <=3D len ; i++ )
printf "[&quo= t; substr(upper, i, 1) substr(lower, i, 1) "]"
printf "\n"
= }'



2013/4/4 Mark van Atten <= vanattenmark@gm= ail.com>
On Friday, 29 March 2013 01:38:06 UTC+1,= Bence F=C3=A1bi=C3=A1n =C2=A0wrote:

> I did a quick writeup on little Edit scripts

Many thanks, this thread is very useful.

There is also Jason Catena's list of Edit idioms at
https://raw.github.com/catenate/acme-fonts/master= /test/1/acme/Edit/sam

When editing and re-editing latex, I regularly pipe selections
through a simple-minded script called `chunk' which does most of
the work for obtaining semantic linebreaks. That goes back to a
recommendation by Kernighan in his paper `Unix for beginners' of
1974; see the quotation, comments and link at [1].



#!/usr/local/plan9/bin/rc
# chunk up (to prepare) for semantic linebreaks

# do =C2=A0not break within \cite
# do not break within $$ math
# break after closing parentheses ),]
# break before an opening parentheses (,[

ssam -e 'x/(^[^%].+\n)+/ =C2=A0y/\\cite[^{]*{(\n|.)*}/ y/\$.*\$/
x/(([^A-Z]\.)|[,;:!?]|\)|\]) | (\(|\[)/ s/ /\n/' \ | 9 fmt -w 60
-j


For batch processing probably something more sophisticated would
be needed to leave various environments unchunked. But I don't use
it that way, and just apply it to selections where I know its use
makes sense. Usually these are areas where I have just been doing
a lot of rewriting.

There's no point in chunking up commented material, and sometimes
it is actually convenient to have a place where I can keep things
unchunked for reference.

The original chunk command in Writer's Workbench [2], for troff not
latex, was =C2=A0based on a parser for English, I think. I find I don't=
want that (because I write in other languages as well), and that
even in English I don't need it (because the chunking based on
interpunction is always fine with me, and where I care about the
remaining cases, I prefer to do it myself; but see [3]).

Mark.


[1] http://rhodesmill.org/brandon/2012/one-sentence-per-line/<= /a>

[2]
htt= p://man.cat-v.org/unix_WWB/1/chunk

[3] https://github.com/waldir/semantic-linebreaker


--14dae9340ee796118b04d987ef87-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 4 Apr 2013 08:28:14 -0400 To: 9fans@9fans.net Message-ID: <8dccd34ac2758fcedaf1481352b73342@brasstown.quanstro.net> In-Reply-To: References: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 3d71a0ca-ead8-11e9-9d60-3106f5b1d025 On Thu Apr 4 08:17:13 EDT 2013, begnoc@gmail.com wrote: > Cool. > > > Here's a script i use to generate case > insensitive regexes. It turns > > FooBar > > into > > [Ff][Oo][Oo][Bb][Aa][Rr] see also rune(1), http://9atom.org/magic/man2html/1/rune which generalizes this idea to all of unicode (rune/case), and also to diacritical and other markers (rune/fold; rune/unfold). for the latter also see grep(1)'s -I flag, http://9atom.org/magic/man2html/1/grep - erik From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <8dccd34ac2758fcedaf1481352b73342@brasstown.quanstro.net> References: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> <8dccd34ac2758fcedaf1481352b73342@brasstown.quanstro.net> Date: Thu, 4 Apr 2013 15:01:31 +0200 Message-ID: From: =?UTF-8?B?QmVuY2UgRsOhYmnDoW4=?= To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7bdc1c0cd004af04d9889186 Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 3d8a8f54-ead8-11e9-9d60-3106f5b1d025 --047d7bdc1c0cd004af04d9889186 Content-Type: text/plain; charset=UTF-8 whoa. nice job. 2013/4/4 erik quanstrom > On Thu Apr 4 08:17:13 EDT 2013, begnoc@gmail.com wrote: > > > Cool. > > > > > > Here's a script i use to generate case > > insensitive regexes. It turns > > > > FooBar > > > > into > > > > [Ff][Oo][Oo][Bb][Aa][Rr] > > see also rune(1), http://9atom.org/magic/man2html/1/rune > which generalizes this idea to all of unicode (rune/case), > and also to diacritical and other markers (rune/fold; rune/unfold). > for the latter also see grep(1)'s -I flag, > http://9atom.org/magic/man2html/1/grep > > - erik > > --047d7bdc1c0cd004af04d9889186 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
whoa. nice job.



2013/4/4 erik quanstrom <qua= nstro@quanstro.net>
On Thu Apr =C2=A04 08:17:1= 3 EDT 2013, begnoc@gmail.com wrote:=

> Cool.
>
>
> Here's a script i use to generate case
> insensitive regexes. It turns
>
> FooBar
>
> into
>
> [Ff][Oo][Oo][Bb][Aa][Rr]

see also rune(1), http://9atom.org/magic/man2html/1/rune
which generalizes this idea to all of unicode (rune/case),
and also to diacritical and other markers (rune/fold; rune/unfold).
for the latter also see grep(1)'s -I flag, http://9atom.org/magic/man2html/1/= grep

- erik


--047d7bdc1c0cd004af04d9889186-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Thu, 4 Apr 2013 15:04:38 +0200 Message-ID: <7077422.iSNQ4AhyB3@coil> User-Agent: KMail/4.10.1 (Linux/3.9.0-rc3-l50; KDE/4.10.1; x86_64; ; ) In-Reply-To: References: <8dccd34ac2758fcedaf1481352b73342@brasstown.quanstro.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Subject: [9fans] Acme script request (was: Acme Edit scriptlets) Topicbox-Message-UUID: 3d904f7a-ead8-11e9-9d60-3106f5b1d025 an Edit script, or an Rc script for Acme, to close all windows which na= mes=20 start with given (literal) prefix. use case: several files and directories of two projects open in one Acm= e=20 instance. want to close all windows related to one of the projects, and= leave=20 the other project's windows open. --=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <7077422.iSNQ4AhyB3@coil> References: <8dccd34ac2758fcedaf1481352b73342@brasstown.quanstro.net> <7077422.iSNQ4AhyB3@coil> Date: Thu, 4 Apr 2013 15:17:38 +0200 Message-ID: From: =?UTF-8?B?QmVuY2UgRsOhYmnDoW4=?= To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=bcaec50fe26b728d3e04d988cb50 Subject: Re: [9fans] Acme script request (was: Acme Edit scriptlets) Topicbox-Message-UUID: 3d949378-ead8-11e9-9d60-3106f5b1d025 --bcaec50fe26b728d3e04d988cb50 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable for (dir in `{grep -l '^'$pattern /mnt/acme/[0-9]*/tag | sed 's/tag//'}){ echo delete >$dir/ctl } where $pattern is the pattern you want to match 2013/4/4 dexen deVries > an Edit script, or an Rc script for Acme, to close all windows which name= s > start with given (literal) prefix. > > use case: several files and directories of two projects open in one Acme > instance. want to close all windows related to one of the projects, and > leave > the other project's windows open. > > -- > dexen deVries > > [[[=E2=86=93][=E2=86=92]]] > > > --bcaec50fe26b728d3e04d988cb50 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
for (dir in `{grep -l '^'$pattern /mnt/acme/[= 0-9]*/tag | sed 's/tag//'}){
echo delete >$dir/ctl
}

<= /div>
where $pattern is the pattern you want to match


2013/4/4 dexen deV= ries <dexen.devries@gmail.com>
an Edit script, or an Rc script for Acme, to= close all windows which names
start with given (literal) prefix.

use case: several files and directories of two projects open in one Acme instance. want to close all windows related to one of the projects, and lea= ve
the other project's windows open.

--
dexen deVries

[[[=E2=86=93][=E2=86=92]]]



--bcaec50fe26b728d3e04d988cb50-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> <8dccd34ac2758fcedaf1481352b73342@brasstown.quanstro.net> Date: Fri, 5 Apr 2013 08:32:27 -0400 Message-ID: From: David Arroyo To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7b2edc09ade6a304d99c47f9 Subject: Re: [9fans] Acme Edit scriptlets Topicbox-Message-UUID: 3ebe8ec0-ead8-11e9-9d60-3106f5b1d025 --047d7b2edc09ade6a304d99c47f9 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I took the template.awk script from werc[0] and use it in acme all the time. I've a collection of template files beginning with Edit ,|tpl % var1=3Dval1 % var2=3Dval2 ... I can execute line 1 to generate stuff like Makefiles, man pages, puppet manifests, etc.[1] [0]: http://hg.cat-v.org/werc/file/50a9b770bb43/bin/template.awk#l1 [1]: http://aqwari.us/notes/werctpl On Thu, Apr 4, 2013 at 9:01 AM, Bence F=E1bi=E1n wrote: > whoa. nice job. > > > > 2013/4/4 erik quanstrom > >> On Thu Apr 4 08:17:13 EDT 2013, begnoc@gmail.com wrote: >> >> > Cool. >> > >> > >> > Here's a script i use to generate case >> > insensitive regexes. It turns >> > >> > FooBar >> > >> > into >> > >> > [Ff][Oo][Oo][Bb][Aa][Rr] >> >> see also rune(1), http://9atom.org/magic/man2html/1/rune >> which generalizes this idea to all of unicode (rune/case), >> and also to diacritical and other markers (rune/fold; rune/unfold). >> for the latter also see grep(1)'s -I flag, >> http://9atom.org/magic/man2html/1/grep >> >> - erik >> >> > --047d7b2edc09ade6a304d99c47f9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I took the template.awk script from werc[0] and use it in = acme all the time. I've a collection of template files beginning with
=A0 =A0 Edit ,|tpl
=A0 =A0 % var1= =3Dval1
=A0 =A0 % var2=3Dval2
=A0 =A0 ...

I can execute line 1 to generate stuff like Makefile= s, man pages, puppet manifests, etc.[1]



On Thu, Apr 4, 2013 at 9:01 AM, Bence F=E1bi=E1n <begnoc= @gmail.com> wrote:
whoa. nice job.



2013/4/4 erik quanstrom <quanstro@quanstro.= net>
On Thu Apr =A04 08:17:13 EDT 2013, begnoc@gmail.com wrot= e:

> Cool.
>
>
> Here's a script i use to generate case
> insensitive regexes. It turns
>
> FooBar
>
> into
>
> [Ff][Oo][Oo][Bb][Aa][Rr]

see also rune(1), http://9atom.org/magic/man2html/1/rune
which generalizes this idea to all of unicode (rune/case),
and also to diacritical and other markers (rune/fold; rune/unfold).
for the latter also see grep(1)'s -I flag, http://9atom.org/magic/man2html/1/= grep

- erik



--047d7b2edc09ade6a304d99c47f9-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <8dccd34ac2758fcedaf1481352b73342@brasstown.quanstro.net> <7077422.iSNQ4AhyB3@coil> From: =?UTF-8?B?TWFydGluIEvDvGhs?= Date: Fri, 5 Apr 2013 14:35:58 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] Acme script request (was: Acme Edit scriptlets) Topicbox-Message-UUID: 3ec392b2-ead8-11e9-9d60-3106f5b1d025 or using 9p(1): for (num in `{9p ls acme | grep '^[0-9]'}) { if (9p read acme/$num/tag | grep -s '^'$pattern) echo delete | 9p write acme/$num/ctl } From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Fri, 5 Apr 2013 14:50:25 +0200 Message-ID: <3580130.8HutxtePHo@coil> User-Agent: KMail/4.10.1 (Linux/3.9.0-rc3-l50; KDE/4.10.1; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Subject: Re: [9fans] Acme script request (was: Acme Edit scriptlets) Topicbox-Message-UUID: 3ec8149a-ead8-11e9-9d60-3106f5b1d025 On Friday 05 of April 2013 14:35:58 Martin K=C3=BChl wrote: > or using 9p(1): >=20 > for (num in `{9p ls acme | grep '^[0-9]'}) { > if (9p read acme/$num/tag | grep -s '^'$pattern) > echo delete | 9p write acme/$num/ctl > } thanks, this version supports using two Acmes, each in separate namespa= ce :-) --=20 dexen deVries [[[=E2=86=93][=E2=86=92]]]