9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Acme Edit scriptlets
@ 2013-03-29  0:38 Bence Fábián
  2013-03-29  1:19 ` phineas.pett
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Bence Fábián @ 2013-03-29  0:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 446 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  0:38 [9fans] Acme Edit scriptlets Bence Fábián
@ 2013-03-29  1:19 ` phineas.pett
  2013-03-29  8:22   ` Peter A. Cejchan
  2013-03-29  8:20 ` dexen deVries
  2013-04-04 10:19 ` Mark van Atten
  2 siblings, 1 reply; 18+ messages in thread
From: phineas.pett @ 2013-03-29  1:19 UTC (permalink / raw)
  To: 9fans

> 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: ℄)

#!/bin/rc
# Center text
awk '{l=length();s=int((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.  ← and → for
indentation (used with code), or ⇐ and ⇒ for indentation + a reformat
(used for natural language next).  I find they serve a bit like icons.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  0:38 [9fans] Acme Edit scriptlets Bence Fábián
  2013-03-29  1:19 ` phineas.pett
@ 2013-03-29  8:20 ` dexen deVries
  2013-03-29  8:25   ` Peter A. Cejchan
  2013-03-29  9:50   ` Richard Miller
  2013-04-04 10:19 ` Mark van Atten
  2 siblings, 2 replies; 18+ messages in thread
From: dexen deVries @ 2013-03-29  8:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Friday 29 of March 2013 01:38:06 Bence Fábián 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

[[[↓][→]]]




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  1:19 ` phineas.pett
@ 2013-03-29  8:22   ` Peter A. Cejchan
  0 siblings, 0 replies; 18+ messages in thread
From: Peter A. Cejchan @ 2013-03-29  8:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 2578 bytes --]

Thanks, very nice, mates!
I humbly add some of minebelow.
Best, ++pac

#####
## Latin
äëïñöüÿÄÅËÏÖÜ

## Greek
αβγδεζηθλμνξπρστφψωΓΔΘΛΞΠΣΦΨΩ

## 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, <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: ℄)
>
> #!/bin/rc
> # Center text
> awk '{l=length();s=int((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.  ← and → for
> indentation (used with code), or ⇐ and ⇒ for indentation + a reformat
> (used for natural language next).  I find they serve a bit like icons.
>
>
>

[-- Attachment #2: Type: text/html, Size: 3231 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  8:20 ` dexen deVries
@ 2013-03-29  8:25   ` Peter A. Cejchan
  2013-03-29  8:48     ` dexen deVries
  2013-03-29  9:50   ` Richard Miller
  1 sibling, 1 reply; 18+ messages in thread
From: Peter A. Cejchan @ 2013-03-29  8:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

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 <dexen.devries@gmail.com>wrote:

> On Friday 29 of March 2013 01:38:06 Bence Fábián 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
>
> [[[↓][→]]]
>
>
>

[-- Attachment #2: Type: text/html, Size: 1266 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  8:25   ` Peter A. Cejchan
@ 2013-03-29  8:48     ` dexen deVries
  0 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2013-03-29  8:48 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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 
FILE_PATHNAME:LINE_NUMBER


# ... called in FILE_PATHNAME on line LINE_NUMBER and defined in FILE_PATHNAME 
on line LINE_NUMBER

data matchesmultiline '.*rror.*called in ([^ ]+) on line ([0-9]+) and defined 
in ([^ ]+) on line ([0-9]+).*'
arg isfile $1
data set $file
attr add addr=$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=$2
type is text
plumb to edit


2) display php's function prototypes on right-click on a function name with an 
opening parenthesis. the `W' script greps a flat text file list of functions 
(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 
script outputting definition of indicated table.

type is text
data matches '.*(FROM|JOIN)[ ]+([^ ]+).*'
data set $2
plumb start Wtable --wdir $wdir $data

-- 
dexen deVries

[[[↓][→]]]




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  8:20 ` dexen deVries
  2013-03-29  8:25   ` Peter A. Cejchan
@ 2013-03-29  9:50   ` Richard Miller
  2013-03-29 16:20     ` Skip Tavakkolian
  1 sibling, 1 reply; 18+ messages in thread
From: Richard Miller @ 2013-03-29  9:50 UTC (permalink / raw)
  To: 9fans

> # 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.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  9:50   ` Richard Miller
@ 2013-03-29 16:20     ` Skip Tavakkolian
  0 siblings, 0 replies; 18+ messages in thread
From: Skip Tavakkolian @ 2013-03-29 16:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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.
>
>



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-03-29  0:38 [9fans] Acme Edit scriptlets Bence Fábián
  2013-03-29  1:19 ` phineas.pett
  2013-03-29  8:20 ` dexen deVries
@ 2013-04-04 10:19 ` Mark van Atten
  2013-04-04 12:08   ` dexen deVries
  2013-04-04 12:16   ` Bence Fábián
  2 siblings, 2 replies; 18+ messages in thread
From: Mark van Atten @ 2013-04-04 10:19 UTC (permalink / raw)
  To: 9fans

On Friday, 29 March 2013 01:38:06 UTC+1, Bence Fábián  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



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-04-04 10:19 ` Mark van Atten
@ 2013-04-04 12:08   ` dexen deVries
  2013-04-04 12:16   ` Bence Fábián
  1 sibling, 0 replies; 18+ messages in thread
From: dexen deVries @ 2013-04-04 12:08 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

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ábián  wrote:
> > I did a quick writeup on little Edit scripts


(p9p specific)

attached is my dirty hack for automagic grepping of $% file or recursively %s 
dir or pipe.

a funky goodie:
automatically supplies `.' (dot) between arguments, so for example:

$ G some token here

becomes `grep some.token.here'


-- 
dexen deVries

[[[↓][→]]]


``we, the humanity'' is the greatest experiment we, the humanity, ever 
undertook. 

[-- Attachment #2: G --]
[-- Type: text/plain, Size: 440 bytes --]

#!/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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-04-04 10:19 ` Mark van Atten
  2013-04-04 12:08   ` dexen deVries
@ 2013-04-04 12:16   ` Bence Fábián
  2013-04-04 12:28     ` erik quanstrom
  1 sibling, 1 reply; 18+ messages in thread
From: Bence Fábián @ 2013-04-04 12:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 2487 bytes --]

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 = tolower($0)
upper = toupper($0)
len = length($0)

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




2013/4/4 Mark van Atten <vanattenmark@gmail.com>

> On Friday, 29 March 2013 01:38:06 UTC+1, Bence Fábián  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
>
>

[-- Attachment #2: Type: text/html, Size: 4053 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-04-04 12:16   ` Bence Fábián
@ 2013-04-04 12:28     ` erik quanstrom
  2013-04-04 13:01       ` Bence Fábián
  0 siblings, 1 reply; 18+ messages in thread
From: erik quanstrom @ 2013-04-04 12:28 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-04-04 12:28     ` erik quanstrom
@ 2013-04-04 13:01       ` Bence Fábián
  2013-04-04 13:04         ` [9fans] Acme script request (was: Acme Edit scriptlets) dexen deVries
  2013-04-05 12:32         ` [9fans] Acme Edit scriptlets David Arroyo
  0 siblings, 2 replies; 18+ messages in thread
From: Bence Fábián @ 2013-04-04 13:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

whoa. nice job.



2013/4/4 erik quanstrom <quanstro@quanstro.net>

> 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
>
>

[-- Attachment #2: Type: text/html, Size: 1253 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [9fans] Acme script request (was: Acme Edit scriptlets)
  2013-04-04 13:01       ` Bence Fábián
@ 2013-04-04 13:04         ` dexen deVries
  2013-04-04 13:17           ` Bence Fábián
  2013-04-05 12:32         ` [9fans] Acme Edit scriptlets David Arroyo
  1 sibling, 1 reply; 18+ messages in thread
From: dexen deVries @ 2013-04-04 13:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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 leave 
the other project's windows open.

-- 
dexen deVries

[[[↓][→]]]




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme script request (was: Acme Edit scriptlets)
  2013-04-04 13:04         ` [9fans] Acme script request (was: Acme Edit scriptlets) dexen deVries
@ 2013-04-04 13:17           ` Bence Fábián
  2013-04-05 12:35             ` Martin Kühl
  0 siblings, 1 reply; 18+ messages in thread
From: Bence Fábián @ 2013-04-04 13:17 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

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 <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
> leave
> the other project's windows open.
>
> --
> dexen deVries
>
> [[[↓][→]]]
>
>
>

[-- Attachment #2: Type: text/html, Size: 1089 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme Edit scriptlets
  2013-04-04 13:01       ` Bence Fábián
  2013-04-04 13:04         ` [9fans] Acme script request (was: Acme Edit scriptlets) dexen deVries
@ 2013-04-05 12:32         ` David Arroyo
  1 sibling, 0 replies; 18+ messages in thread
From: David Arroyo @ 2013-04-05 12:32 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

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=val1
    % var2=val2
    ...

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ábián <begnoc@gmail.com> wrote:

> whoa. nice job.
>
>
>
> 2013/4/4 erik quanstrom <quanstro@quanstro.net>
>
>> 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
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 2342 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme script request (was: Acme Edit scriptlets)
  2013-04-04 13:17           ` Bence Fábián
@ 2013-04-05 12:35             ` Martin Kühl
  2013-04-05 12:50               ` dexen deVries
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Kühl @ 2013-04-05 12:35 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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
}



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [9fans] Acme script request (was: Acme Edit scriptlets)
  2013-04-05 12:35             ` Martin Kühl
@ 2013-04-05 12:50               ` dexen deVries
  0 siblings, 0 replies; 18+ messages in thread
From: dexen deVries @ 2013-04-05 12:50 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Friday 05 of April 2013 14:35:58 Martin Kühl wrote:
> 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
> }


thanks, this version supports using two Acmes, each in separate namespace :-)


-- 
dexen deVries

[[[↓][→]]]




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-04-05 12:50 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-29  0:38 [9fans] Acme Edit scriptlets Bence Fábián
2013-03-29  1:19 ` phineas.pett
2013-03-29  8:22   ` Peter A. Cejchan
2013-03-29  8:20 ` dexen deVries
2013-03-29  8:25   ` Peter A. Cejchan
2013-03-29  8:48     ` dexen deVries
2013-03-29  9:50   ` Richard Miller
2013-03-29 16:20     ` Skip Tavakkolian
2013-04-04 10:19 ` Mark van Atten
2013-04-04 12:08   ` dexen deVries
2013-04-04 12:16   ` Bence Fábián
2013-04-04 12:28     ` erik quanstrom
2013-04-04 13:01       ` Bence Fábián
2013-04-04 13:04         ` [9fans] Acme script request (was: Acme Edit scriptlets) dexen deVries
2013-04-04 13:17           ` Bence Fábián
2013-04-05 12:35             ` Martin Kühl
2013-04-05 12:50               ` dexen deVries
2013-04-05 12:32         ` [9fans] Acme Edit scriptlets David Arroyo

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).