9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Ben Hancock <ben@benghancock.com>
To: 9fans@9fans.net
Subject: [9fans] Plumber rule for Python tracebacks
Date: Mon, 30 Aug 2021 19:21:34 -0700	[thread overview]
Message-ID: <20210831022134.GA25301@kestrel.bayshore.home> (raw)

Hi 9fans,

I work with Python a lot, and after beginning to write code in acme, I
thought it would be neat to have a plumber rule to easily jump to the
origin of errors with Mouse-3. Here's what I came up with:

  # Easily jump to the origin of Python Tracebacks
  type is text
  data matches 'File \"([A-Za-z_\-\/]+\.py)\", line ([0-9]+)'
  arg isfile $1
  data set $file
  attr add addr=$2
  plumb to edit
  plumb client $editor

This may be obvious to many who are more experienced with acme, but I
figured I would share in case it's helpful. So far it works pretty well!
I don't often come across modules with numbers in the filename, but one
could add a 0-9 in the first regex to handle that as well.

I put this in $HOME/lib/plumber and make sure to start the plumber
before firing up acme.

Anyone else have any good tips for working with Python in acme?

Cheers,

- Ben

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T96499166b9ef2245-M07ba4887b2862957c74d6126
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

                 reply	other threads:[~2021-08-31  2:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831022134.GA25301@kestrel.bayshore.home \
    --to=ben@benghancock.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).