9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Help with plumbing rules
@ 2013-11-06  6:42 6o205zd02
  2013-11-06  6:56 ` Bruce Ellis
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: 6o205zd02 @ 2013-11-06  6:42 UTC (permalink / raw)
  To: 9fans

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




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

* Re: [9fans] Help with plumbing rules
  2013-11-06  6:42 [9fans] Help with plumbing rules 6o205zd02
@ 2013-11-06  6:56 ` Bruce Ellis
  2013-11-06 11:08 ` Alexander Sychev
  2013-11-06 13:02 ` Mark van Atten
  2 siblings, 0 replies; 5+ messages in thread
From: Bruce Ellis @ 2013-11-06  6:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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

The diagnostic on the last line should be:

Unexpected End of File at EOF

That's the memorable diagnostic from a CDC compiler.

brucee


On 6 November 2013 17:42, <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 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
>
>
>

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

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

* Re: [9fans] Help with plumbing rules
  2013-11-06  6:42 [9fans] Help with plumbing rules 6o205zd02
  2013-11-06  6:56 ` Bruce Ellis
@ 2013-11-06 11:08 ` Alexander Sychev
  2013-11-06 13:02 ` Mark van Atten
  2 siblings, 0 replies; 5+ messages in thread
From: Alexander Sychev @ 2013-11-06 11:08 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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

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

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

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

* Re: [9fans] Help with plumbing rules
  2013-11-06  6:42 [9fans] Help with plumbing rules 6o205zd02
  2013-11-06  6:56 ` Bruce Ellis
  2013-11-06 11:08 ` Alexander Sychev
@ 2013-11-06 13:02 ` Mark van Atten
  2013-11-06 13:06   ` Rubén Berenguel
  2 siblings, 1 reply; 5+ messages in thread
From: Mark van Atten @ 2013-11-06 13:02 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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



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

* Re: [9fans] Help with plumbing rules
  2013-11-06 13:02 ` Mark van Atten
@ 2013-11-06 13:06   ` Rubén Berenguel
  0 siblings, 0 replies; 5+ messages in thread
From: Rubén Berenguel @ 2013-11-06 13:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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

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 <vanattenmark@gmail.com>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.
>
>

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

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

end of thread, other threads:[~2013-11-06 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-06  6:42 [9fans] Help with plumbing rules 6o205zd02
2013-11-06  6:56 ` Bruce Ellis
2013-11-06 11:08 ` Alexander Sychev
2013-11-06 13:02 ` Mark van Atten
2013-11-06 13:06   ` Rubén Berenguel

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