Re: [9fans] acme/sam language question
I write the script like this: /A/+#0;/B/-#0 { g/CC/ s/CC/DD/g } p Mark. On Wed, Nov 6, 2013 at 7:47 PM, Rudolf Sykora wrote: > On 31 October 2013 20:24, Rudolf Sykora wrote: >> On 31 October 2013 16:49, Friedrich Psiorz wrote: >>> It works for me, but I found another inconsistency. >>> >>> I tried it on p9p and 9vx, both in acme and sam. >> >> /A/+#0;/B/-#0 >> g/CC/ s/CC/DD/g >> p >> >> Well. If I use these commands one by one inside p9p acme >> (and probably sam, too), I truly get what I want (and what >> you say). The problem appears when I want to run it from >> a script like this: >> >> sam -d <[2] /dev/null >> /A/+#0;/B/-#0 >> g/CC/ s/CC/DD/g >> p >> EOF >> >> then you get, since the g is on a seperate line, an extra >> output from the line before g. And if you try to join g with >> the match like >> >> sam -d <[2] /dev/null >> /A/+#0;/B/-#0 g/CC/ s/CC/DD/g >> p >> EOF >> >> then you get no output if CC is not between A and B >> (although when it is there, you get what I want). >> In neither case I am fully satisfied. :) >> >> Thanks >> Ruda > > So far I still do not know how to do it properly... > But it seems nobody here proposes anything... > > Thanks for any clue > Ruda >
Re: [9fans] acme/sam language question
What if you specify the address twice like this: /A/+#0;/B/-#0g/CC/ s/CC/DD/g /A/+#0;/B/-#0p That doesn't work if A and B occur more than once in the file or if DD matches A or B. But otherwise, it seems to work for me. Micah On Nov 6, 2013, at 10:47 AM, Rudolf Sykora wrote: > On 31 October 2013 20:24, Rudolf Sykora wrote: >> On 31 October 2013 16:49, Friedrich Psiorz wrote: >>> It works for me, but I found another inconsistency. >>> >>> I tried it on p9p and 9vx, both in acme and sam. >> >> /A/+#0;/B/-#0 >> g/CC/ s/CC/DD/g >> p >> >> Well. If I use these commands one by one inside p9p acme >> (and probably sam, too), I truly get what I want (and what >> you say). The problem appears when I want to run it from >> a script like this: >> >> sam -d <[2] /dev/null >> /A/+#0;/B/-#0 >> g/CC/ s/CC/DD/g >> p >> EOF >> >> then you get, since the g is on a seperate line, an extra >> output from the line before g. And if you try to join g with >> the match like >> >> sam -d <[2] /dev/null >> /A/+#0;/B/-#0 g/CC/ s/CC/DD/g >> p >> EOF >> >> then you get no output if CC is not between A and B >> (although when it is there, you get what I want). >> In neither case I am fully satisfied. :) >> >> Thanks >> Ruda > > So far I still do not know how to do it properly... > But it seems nobody here proposes anything... > > Thanks for any clue > Ruda >
Re: [9fans] acme/sam language question
On 31 October 2013 20:24, Rudolf Sykora wrote: > On 31 October 2013 16:49, Friedrich Psiorz wrote: >> It works for me, but I found another inconsistency. >> >> I tried it on p9p and 9vx, both in acme and sam. > > /A/+#0;/B/-#0 > g/CC/ s/CC/DD/g > p > > Well. If I use these commands one by one inside p9p acme > (and probably sam, too), I truly get what I want (and what > you say). The problem appears when I want to run it from > a script like this: > > sam -d <[2] /dev/null > /A/+#0;/B/-#0 > g/CC/ s/CC/DD/g > p > EOF > > then you get, since the g is on a seperate line, an extra > output from the line before g. And if you try to join g with > the match like > > sam -d <[2] /dev/null > /A/+#0;/B/-#0 g/CC/ s/CC/DD/g > p > EOF > > then you get no output if CC is not between A and B > (although when it is there, you get what I want). > In neither case I am fully satisfied. :) > > Thanks > Ruda So far I still do not know how to do it properly... But it seems nobody here proposes anything... Thanks for any clue Ruda
Re: [9fans] Help with plumbing rules
Tooting my own horn: I explained a few examples of plumbing rules in this post of mine (I posted it on reddit/r/plan9 a while ago) http://www.mostlymaths.net/2013/04/just-as-mario-using-plan9-plumber.html In the end, everything is written down in the various man pages describing plumb and plumber, it just takes a while to figure out how to mix all the pieces. Ruben On Wed, Nov 6, 2013 at 2:02 PM, Mark van Atten wrote: > > PS: Once I get this working I'll tackle the diagnostic messages I get > when > > compiling Java code using maven (not my choice). They look like > > [error] /home/pcanning/src/java/test/PerfTest.java:[66,1] error: reached > end > > of file while parsing > > For lacheck, a Latex checker, I have this in my profile to put its > messages in the right form: > > # for lacheck: format output for acme > fn lacheck $* {builtin lacheck $* | 9 sed 's/"(.*)".*line ([0-9]+): > (.*)/\1:\2:\3/'} > > Can you do something similar? > > Mark. > >
Re: [9fans] Help with plumbing rules
> PS: Once I get this working I'll tackle the diagnostic messages I get when > compiling Java code using maven (not my choice). They look like > [error] /home/pcanning/src/java/test/PerfTest.java:[66,1] error: reached end > of file while parsing For lacheck, a Latex checker, I have this in my profile to put its messages in the right form: # for lacheck: format output for acme fn lacheck $* {builtin lacheck $* | 9 sed 's/"(.*)".*line ([0-9]+): (.*)/\1:\2:\3/'} Can you do something similar? Mark.
Re: [9fans] Help with plumbing rules
Hi, Question 1: a flag '-d' can be useful a bit. Question 2: $file is filled when you check "arg isfile $1" Question 3: I think, the problem is you have to match exact full string is sent to plumber. This variant is working: type is text data matches 'File "([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-]+)", line ([0-9]+)[ ,0-9A-Za-z_]*' arg isfile $1 data set $file attr add addr=$2 plumb to edit plumb client $editor On Wed, Nov 6, 2013 at 9:42 AM, <6o205z...@sneakemail.com> wrote: > I'm trying to create a plumbing rule so that I can right-click (in acme) > on the diagnostic messages produced by Python and get the file opened with > the appropriate line select. Unfortunately my attempts so far have failed. > > Question 1: Is there an easy way to "debug" plumbing rules (I'm using > plan9port on linux)? > > I started by looking at a couple of existing rules from $PLAN9/plumb/basic: > > # existing files tagged by line number:columnumber or > linenumber.columnumber, twice, go to editor > type is text > data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])':$ > twocolonaddr,$twocolonaddr > arg isfile $1 > data set $file > attr add addr=$2-#1+#$3,$4-#1+#$5 > plumb to edit > plumb client $editor > > # existing files tagged by line number:columnumber or > linenumber.columnumber, twice, go to editor > type is text > data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])':$ > twocolonaddr > arg isfile $1 > data set $file > attr add addr=$2-#1+#$3 > plumb to edit > plumb client $editor > > After reading http://plan9.bell-labs.com/sys/doc/plumb.pdf, I think I > understand these rules except for the line > data set $file > > Question2: What does that line do? What is $file? > > Since the Python 2.7 diagnostic messages look like > > File "/home/pcanning/src/python/test/test_cli.py", line 91, in > test_interactive_mode > > I created the following rule that attempts to match the test from "File" > to "line 91", and send plumbing message to edit (acme). > > # Python (2.7) error messages > type is text > data matches File "([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])", line > ([0-9]+) > arg isfile $1 > data set $1 > attr add addr=$2 > plumb to edit > plumb client $editor > > Question 3: How do I change this rule to make acme open > /home/pcanning/src/python/test/test_cli.py and select line 91 (in the > example above)? > > thanks, > Peter Canning > > PS: Once I get this working I'll tackle the diagnostic messages I get when > compiling Java code using maven (not my choice). They look like > [error] /home/pcanning/src/java/test/PerfTest.java:[66,1] error: reached > end of file while parsing > > > -- Best regards, santucco