From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <8533-1383720139-778543@sneakemail.com> References: <8533-1383720139-778543@sneakemail.com> Date: Wed, 6 Nov 2013 14:08:56 +0300 Message-ID: From: Alexander Sychev To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=089e013cbde2da6c1a04ea802c38 Subject: Re: [9fans] Help with plumbing rules Topicbox-Message-UUID: 89ca9184-ead8-11e9-9d60-3106f5b1d025 --089e013cbde2da6c1a04ea802c38 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2=A1-=EF=BF= =BF0-9_/\-]+)", line ([0-9]+)[ ,0-9A-Za-z_]*' arg isfile $1 data set $file attr add addr=3D$2 plumb to edit plumb client $editor On Wed, Nov 6, 2013 at 9:42 AM, <6o205zd02@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 wit= h > the appropriate line select. Unfortunately my attempts so far have faile= d. > > 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/basi= c: > > # existing files tagged by line number:columnumber or > linenumber.columnumber, twice, go to editor > type is text > data matches '([.a-zA-Z=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2=A1-=EF=BF=BF0-= 9_/\-])':$ > twocolonaddr,$twocolonaddr > arg isfile $1 > data set $file > attr add addr=3D$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=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2=A1-=EF=BF=BF0-= 9_/\-])':$ > twocolonaddr > arg isfile $1 > data set $file > attr add addr=3D$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=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2=A1-=EF=BF= =BF0-9_/\-])", line > ([0-9]+) > arg isfile $1 > data set $1 > attr add addr=3D$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 whe= n > 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 > > > --=20 Best regards, santucco --089e013cbde2da6c1a04ea802c38 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

Question 1:=A0
a flag '-d' can be useful a bit.=A0

Quest= ion 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.

Thi= s variant is working:

type is text
data = matches 'File "([.a-zA-Z=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2=A1-=EF= =BF=BF0-9_/\-]+)", line ([0-9]+)[ ,0-9A-Za-z_]*'
arg isfile $1
data set $file
attr add addr=3D$2
plumb to edit
plumb client $editor



On Wed, Nov 6, = 2013 at 9:42 AM, <6o205zd02@sneakemail.com> wrote:
I'm trying to create a plumbing rule so that I can rig= ht-click (in acme) on the diagnostic messages produced by Python and get th= e file opened with the appropriate line select. =A0Unfortunately my attempt= s 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.columnumbe= r, twice, go to editor
type is text
data matches '([.a-zA-Z=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2=A1-= =EF=BF=BF0-9_/\-])':$twocolonaddr,$twocolonaddr
arg isfile $1
data set $file
attr add addr=3D$2-#1+#$3,$4-#1+#$5
plumb to edit
plumb client $editor

# existing files tagged by line number:columnumber or linenumber.columnumbe= r, twice, go to editor
type is text
data matches '([.a-zA-Z=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2=A1-= =EF=BF=BF0-9_/\-])':$twocolonaddr
arg isfile $1
data set $file
attr add addr=3D$2-#1+#$3
plumb to edit
plumb client $editor

After reading http://plan9.bell-labs.com/sys/doc/plumb.pdf, I th= ink I understand these rules except for the line
data set $file

Question2: What does that line do? =A0What 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 "Fil= e" to "line 91", and send plumbing message to edit (acme).
# Python (2.7) error messages
type is text
data matches File "([.a-zA-Z=C2=A1-=EF=BF=BF0-9_/\-]*[a-zA-Z=C2= =A1-=EF=BF=BF0-9_/\-])", line ([0-9]+)
arg isfile $1
data set $1
attr add addr=3D$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)?
=A0 =A0 thanks,
=A0 =A0 Peter Canning

PS: Once I get this working I'll tackle the diagnostic messages I get w= hen compiling Java code using maven (not my choice). =A0They look like
[error] /home/pcanning/src/java/test/PerfTest.java:[66,1] error: rea= ched end of file while parsing





--
Best regards= ,
=A0 santucco
--089e013cbde2da6c1a04ea802c38--