9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Philip Silva <philip.silva@protonmail.com>
To: "9front@9front.org" <9front@9front.org>
Subject: [9front] Re: [Patch] acme open filenames with at
Date: Tue, 02 Mar 2021 21:09:28 +0000	[thread overview]
Message-ID: <hoR0Dnw6W3EqAFpxbRHJU9KJoN4myORuV5hnM0RdD4_MfDeXJvkUiOy-miwBNsUDhuYIP9smM4h8zjhwkkWLUTsp5qviK0rZ6As5jSYho2g=@protonmail.com> (raw)
In-Reply-To: <cl-jVnm8iFr764Z07D5pOIH80pFa4Qv4SRYZdbt2N_l9lvBxJOmGpX7IMPDx9MIVDRLvPO3gZEzkpTPdzRqufOs0TSkj0G8ekJgrCYgMLNs=@protonmail.com>

Sorry, I forgot to actually test this! Like this it doesn't do much because it interferes with the plumber rule for mails, so here would be an updated patch.

Generally I would find it very really useful because it allows to quickly right-click through references in Go stack traces with modules. (And Go modules seem to replace GOPATH from Go 1.17 on. [1])

E.g.:

github.com/mjl-/duit.(*DUI).Key(0x28220000, 0xa)
        /usr/glenda/go/pkg/mod/github.com/mjl-/duit@v0.0.0-20200330125617-580cb0b2843f/duit.go:578 +0x108
github.com/mjl-/duit.(*DUI).Input(0x28220000, 0x1, 0x0, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0)
        /usr/glenda/go/pkg/mod/github.com/mjl-/duit@v0.0.0-20200330125617-580cb0b2843f/duit.go:684 +0x169

Without the patch I find it really hard to navigate to the referenced code. (Cloning github.com/mjl-/duit.git and navigating there seems simpler to me) The other use case would be browsing through the Go modules directory with acme. E.g. when in directory /usr/glenda/go/pkg/mod/github.com/mjl-/, then there is:

duit@v0.0.0-20200330125617-580cb0b2843f/

And I can just right-click it instead of trying to cd into it. Since it ends with '/' I thought it might make sense to just add a '$' to the end of the email address matcher. The downside is that right-clicking just duit@v0.0.0-20200330125617-580cb0b2843f without trailing slash still applies the mail plumber rule. (Same goes for normal files containing @s but no slash)

So here would be an updated patch that allows to navigate paths containing @s (and /s :-)):

diff -r 100ce3da6613 sys/lib/plumb/basic
--- a/sys/lib/plumb/basic       Tue Mar 02 10:03:25 2021 +0100
+++ b/sys/lib/plumb/basic       Tue Mar 02 21:39:50 2021 +0100
@@ -29,7 +29,7 @@

 # email addresses get a new mail window
 type is text
-data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
+data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*$'
 plumb to sendmail
 plumb start window rc -c '''echo % mail '''$0'; mail '$0

diff -r 100ce3da6613 sys/src/cmd/acme/look.c
--- a/sys/src/cmd/acme/look.c   Tue Mar 02 10:03:25 2021 +0100
+++ b/sys/src/cmd/acme/look.c   Tue Mar 02 21:39:50 2021 +0100
@@ -314,7 +314,7 @@
 {
        if(isalnum(r))
                return TRUE;
-       if(runestrchr(L".-+/:", r))
+       if(runestrchr(L".-+/:@", r))
                return TRUE;
        return FALSE;
 }

In any case I'll try this out for a while, maybe there's a better solution that also works without trailing slashes.

Greetings, Philip


[1] https://blog.golang.org/go116-module-changes


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Am Montag, 22. Februar 2021 20:37 schrieb Philip Silva <philip.silva@protonmail.com>:

> Hi!
>
> I've seen in plan9port there's a commit allowing @s in filenames:
>
> commit ac487c754e009b0f3c01c2a8ad5bda2143da4a6b
> Author: Russ Cox rsc@swtch.com
> Date: Wed Dec 30 14:42:47 2020 -0500
>
> acme: allow @ in file names
>
> For upspin and other tools that put email addresses in names.
>
> diff --git a/src/cmd/acme/look.c b/src/cmd/acme/look.c
> index 35667c6c..a7172b50 100644
> --- a/src/cmd/acme/look.c
> +++ b/src/cmd/acme/look.c
> @@ -378,7 +378,7 @@ search(Text *ct, Rune *r, uint n)
> int
> isfilec(Rune r)
> {
>
> -         static Rune Lx[] = { '.', '-', '+', '/', ':', 0 };
>
>
>
> -         static Rune Lx[] = { '.', '-', '+', '/', ':', '@', 0 };
>           if(isalnum(r))
>                   return TRUE;
>           if(runestrchr(Lx, r))
>
>
>
> In the Go module paths this is used in path names actually to delimit the version. Here's a patch for this, would be great if it could get merged!
>
> diff -r 318117d314ad sys/src/cmd/acme/look.c
> --- a/sys/src/cmd/acme/look.c Mon Feb 22 19:27:49 2021 +0100
> +++ b/sys/src/cmd/acme/look.c Mon Feb 22 20:23:07 2021 +0100
> @@ -314,7 +314,7 @@ isfilec(Rune r)
> {
> if(isalnum(r))
> return TRUE;
>
> -         if(runestrchr(L".-+/:", r))
>
>
>
> -         if(runestrchr(L".-+/:@", r))
>                   return TRUE;
>           return FALSE;
>
>
>
> }
>
> Greetings, Philip



      reply	other threads:[~2021-03-02 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22 19:37 [9front] " Philip Silva
2021-03-02 21:09 ` Philip Silva [this message]

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='hoR0Dnw6W3EqAFpxbRHJU9KJoN4myORuV5hnM0RdD4_MfDeXJvkUiOy-miwBNsUDhuYIP9smM4h8zjhwkkWLUTsp5qviK0rZ6As5jSYho2g=@protonmail.com' \
    --to=philip.silva@protonmail.com \
    --cc=9front@9front.org \
    /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).