Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)
I’ve started toying with that very idea Lucio, but I haven’t had much time to really vet the ideas. My work has been specifically for 9front and rcpu > On Jul 18, 2021, at 9:53 PM, Lucio De Re wrote: > > On 7/19/21, adr via 9fans <9fans@9fans.net> wrote: >> [ ...]. Running samterm locally is way more efficient than >> using X forwarding. >> > I have adopted on my Linux (Mint) workstations - plural - the paradigm: > > ssh -fX remote acme -l lib/task.acme # for different tasks > > and it works even remotely pretty adequately. The remotes tend to be > pretty slick Debian servers, but even locally that is a boon (NetBSD > rules the Posix roost in my office). > > What I can't do is to do the same from the Plan 9 workstation that I > still prefer for development. I was bemoaning this in some notes to > myself just before reading the exchange. > > Now, it is very common, even after all these years of Plan 9 use, for > me to miss the wood for the trees. I think, not very deeply, that P9P > "cpu" running on the remote Posix server might be what I need - Plan 9 > SSH and I seem to be sworn enemies and X-fdorwarding is not even a > twinkle in SSH's eye - and here I note that Steve Simon's cpu server > for Windows has not been included in P9P (I heard Steve bring that up, > but I have never explored it as I don't own a Windows platform). > > In short, is it out of the question to cpu into a Posix server to > initiate an acme session, rather than using SSH to forward X? > > Lucio. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M6851a6eec7243162cd9dc1d7 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)
On 7/19/21, adr via 9fans <9fans@9fans.net> wrote: > [ ...]. Running samterm locally is way more efficient than > using X forwarding. > I have adopted on my Linux (Mint) workstations - plural - the paradigm: ssh -fX remote acme -l lib/task.acme # for different tasks and it works even remotely pretty adequately. The remotes tend to be pretty slick Debian servers, but even locally that is a boon (NetBSD rules the Posix roost in my office). What I can't do is to do the same from the Plan 9 workstation that I still prefer for development. I was bemoaning this in some notes to myself just before reading the exchange. Now, it is very common, even after all these years of Plan 9 use, for me to miss the wood for the trees. I think, not very deeply, that P9P "cpu" running on the remote Posix server might be what I need - Plan 9 SSH and I seem to be sworn enemies and X-fdorwarding is not even a twinkle in SSH's eye - and here I note that Steve Simon's cpu server for Windows has not been included in P9P (I heard Steve bring that up, but I have never explored it as I don't own a Windows platform). In short, is it out of the question to cpu into a Posix server to initiate an acme session, rather than using SSH to forward X? Lucio. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M980f0728c312f6f6ca5623f2 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Command to set samterm label
Ok, Let me explain this a little. I don't like this "One X to rule them all" concept, recreating complete interfaces. I would prefer to use one gui, and make the programs integrate in it, rethinking some concepts if necessary. Been able to modify the label is fundamental for this. It's a way to identify the program and show its state. Just the same sam does inside its own duplicated interface. The correct way to do this is respecting the program design. That's why the label must be changed in the samterm side. This little change allows you to open a file with one instance of sam, another file with another instance (just not use plumb to edit...) and be able to identify them, using the gui you already have, rio. And if for example you open another file because you need them stuck side by side (but this should be done by gui, not by the editor...) you still can rename the label manually to reflect the change. The next step is add an option (or better an environment variable) to use the rio snarf buffer directly. If you don't see the point of this, just ignore this thread. I'm sharing this patch just in case someone is so frustrated as me with this design, nothing more. By the way, sam -r allows you to edit remotely a file in a unix system, not only with p9p sam, samterm will drive even the old sam from pkgsrc. Running samterm locally is way more efficient than using X forwarding. Regards, adr. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tf1e211daf823c0e0-M4075dd8b5bd996932f445643 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Command to set samterm label
> That's run by sam, not samterm. Ah, I see; /dev/label is not available to the remote end of sam -r. Do people use sam -r a lot, instead of [r]cpu -c sam? Is it appreciably faster? surely having /mnt/term & local /dev in the namespace is nice? Anyway, I see your point. Still not convinced setting the window label belongs inside the editor (or the editor's wm) since it is a feature of rio... If you use winwatch some have patched it to make setting label more convenient, or you could have a script that does: ; label sam $files; bind /dev/null /dev/label; sam $files I discovered this trick when I wanted my persistent page always to be labeled as such rather than change based on whatever it is displaying. > It's for using multimple instances of sam. Sure, was just pointing out if !label was sufficient you could simplify your patch to just tweaking the initdraw call. (Maybe it would be nice to print all files listed on the command line) On the odd occasion I have multiple sams, I prefer to set the label myself to project1, project2 but having the filename(s) there initially might be nice. You could even get clever and have the label change to reflect the most recently active buffer. umbraticus -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tf1e211daf823c0e0-M1e8dc73ec3b6f44f7e047e5b Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Command to set samterm label
On Mon, 19 Jul 2021, umbrati...@prosimetrum.com wrote: This patch adds a command 'l' to set the label, and sets it at startup as described above. meh; you can already run !label blah from inside sam That's run by sam, not samterm. not sure the label-on-startup adds much? It's for using multimple instances of sam. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tf1e211daf823c0e0-M1b37b0e9f704fadce4e61f64 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Command to set samterm label
> This patch adds a command 'l' to set the label, and sets it at > startup as described above. meh; you can already run !label blah from inside sam not sure the label-on-startup adds much… but I guess you could just add that at the call to initdraw. umbraticus -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tf1e211daf823c0e0-M8c02d90b20788e858568ad92 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] Command to set samterm label
Hi, I was hacking sam to set /dev/label to 'sam filename' when one is given to be opened but then I thought that it would be better to make samterm do it, so it'll work when using sam remotely. This patch adds a command 'l' to set the label, and sets it at startup as described above. Regards, adr. --- sys/src/cmd/sam/cmd.c Wed Apr 24 00:06:05 2013 +++ /sys/src/cmd/sam/cmd.c Sun Jul 18 18:23:06 2021 @@ -17,6 +17,7 @@ 'g',0, 1, 0, 'p',aDot, 0, 0, g_cmd, 'i',1, 0, 0, 0, aDot, 0, 0, i_cmd, 'k',0, 0, 0, 0, aDot, 0, 0, k_cmd, + 'l',0, 0, 0, 0, aNo,0, linex, l_cmd, 'm',0, 0, 1, 0, aDot, 0, 0, m_cmd, 'n',0, 0, 0, 0, aNo,0, 0, n_cmd, 'p',0, 0, 0, 0, aDot, 0, 0, p_cmd, --- sys/src/cmd/sam/mesg.h Fri Mar 18 22:33:33 2005 +++ /sys/src/cmd/sam/mesg.h Sun Jul 18 18:25:36 2021 @@ -67,6 +67,7 @@ Hack, /* request acknowledgement */ Hexit, Hplumb, /* return plumb message to terminal - version 1 */ + Hlabel, /* change /dev/label */ HMAX, }Hmesg; typedef struct Header{ --- sys/src/cmd/sam/parse.h Thu Oct 27 15:36:34 2005 +++ /sys/src/cmd/sam/parse.hSat Jul 17 19:55:51 2021 @@ -55,13 +55,12 @@ int nl_cmd(File*, Cmd*), a_cmd(File*, Cmd*), b_cmd(File*, Cmd*); int c_cmd(File*, Cmd*), cd_cmd(File*, Cmd*), d_cmd(File*, Cmd*); -intD_cmd(File*, Cmd*), e_cmd(File*, Cmd*); -intf_cmd(File*, Cmd*), g_cmd(File*, Cmd*), i_cmd(File*, Cmd*); -intk_cmd(File*, Cmd*), m_cmd(File*, Cmd*), n_cmd(File*, Cmd*); -intp_cmd(File*, Cmd*), q_cmd(File*, Cmd*); -ints_cmd(File*, Cmd*), u_cmd(File*, Cmd*), w_cmd(File*, Cmd*); -intx_cmd(File*, Cmd*), X_cmd(File*, Cmd*), plan9_cmd(File*, Cmd*); -inteq_cmd(File*, Cmd*); +intD_cmd(File*, Cmd*), e_cmd(File*, Cmd*), f_cmd(File*, Cmd*); +intg_cmd(File*, Cmd*), i_cmd(File*, Cmd*), k_cmd(File*, Cmd*); +intl_cmd(File*, Cmd*), m_cmd(File*, Cmd*), n_cmd(File*, Cmd*); +intp_cmd(File*, Cmd*), q_cmd(File*, Cmd*), s_cmd(File*, Cmd*); +intu_cmd(File*, Cmd*), w_cmd(File*, Cmd*), x_cmd(File*, Cmd*); +intX_cmd(File*, Cmd*), plan9_cmd(File*, Cmd*), eq_cmd(File*, Cmd*); String*getregexp(int); --- sys/src/cmd/sam/sam.c Tue Dec 6 17:05:45 2005 +++ /sys/src/cmd/sam/sam.c Sat Jul 17 17:01:44 2021 @@ -98,6 +98,8 @@ seq++; if(file.nused) current(file.filepptr[0]); + if(curfile) + outTS(Hlabel, &(curfile->name)); setjmp(mainloop); cmdloop(); trytoquit();/* if we already q'ed, quitok will be TRUE */ --- sys/src/cmd/sam/xec.c Tue Jun 6 02:55:54 2000 +++ /sys/src/cmd/sam/xec.c Sat Jul 17 20:20:41 2021 @@ -154,6 +154,14 @@ } int +l_cmd(File *f, Cmd *cp) +{ + USED(f); + outTS(Hlabel, cp->ctext); + return TRUE; +} + +int m_cmd(File *f, Cmd *cp) { Address addr2; --- sys/src/cmd/samterm/mesg.c Thu Mar 29 19:35:49 2012 +++ /sys/src/cmd/samterm/mesg.c Sat Jul 17 20:28:26 2021 @@ -97,6 +97,7 @@ int i, m; long l; Flayer *lp; + char *str, c; m = inshort(0); l = inlong(2); @@ -106,6 +107,16 @@ default: fprint(2, "type %d\n", type); panic("rcv unknown"); + + case Hlabel: + str = (char *)indata; + if((i = open("/dev/label", OWRITE)) >= 0){ + while((c=*str) == ' ' || c=='\t') + str++; + fprint(i, "%s %s", "sam", str); + close(i); + } + break; case Hversion: hversion = m; -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tf1e211daf823c0e0-M6011c83bf34acbf24c11966a Delivery options: https://9fans.topicbox.com/groups/9fans/subscription