From: umbraticus@prosimetrum.com
To: 9fans@9fans.net
Subject: Re: [9fans] Command to set samterm label
Date: Mon, 19 Jul 2021 23:59:56 +1200 [thread overview]
Message-ID: <EE5ABDF6523EE21245647775170E3371@prosimetrum.com> (raw)
In-Reply-To: <dee2b71c-c012-6aa3-6b52-cb8431536ab5@SDF.ORG>
Sorry, didn't mean to come off as insisting you had to do it
my way (I am guilty of hacking all kinds of things into my
own samterm); just wanted to point out there are other ways
besides adding a new command to sam.
> The next step is add an option (or better an environment variable)
> to use the rio snarf buffer directly.
There is a patch for this floating around somewhere: perhaps
whoever wrote it can chime in.
Below is a quick illustration of the other thought I had,
having label reflect the most recently topped buffer, in
case you are or anyone else is interested.
umbraticus
diff -u /sys/src/cmd/samterm/main.c ./main.c
--- /sys/src/cmd/samterm/main.c Thu Apr 30 10:24:09 2020
+++ ./main.c Mon Jul 19 23:36:12 2021
@@ -150,6 +150,7 @@
current(Flayer *nw)
{
Text *t;
+ int fd;
if(which)
flborder(which, 0);
@@ -160,8 +161,13 @@
buttons(Up);
t = (Text *)nw->user1;
t->front = nw-&t->l[0];
- if(t != &cmd)
+ if(t != &cmd){
work = nw;
+ if((fd = open("/dev/label", OWRITE)) >= 0){
+ fprint(fd, "sam %s", (char*)name[whichmenu(t->tag)] + 1);
+ close(fd);
+ }
+ }
}
which = nw;
}
@@ -170,11 +176,15 @@
closeup(Flayer *l)
{
Text *t=(Text *)l->user1;
- int m;
+ int m, fd;
m = whichmenu(t->tag);
if(m < 0)
return;
+ if((fd = open("/dev/label", OWRITE)) >= 0){
+ write(fd, "sam", 4);
+ close(fd);
+ }
flclose(l);
if(l == which){
which = 0;
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tf1e211daf823c0e0-M2dfbf5d65c86fcf89c315484
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
prev parent reply other threads:[~2021-07-19 11:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-18 18:06 adr via 9fans
2021-07-18 20:26 ` umbraticus
2021-07-18 21:58 ` adr via 9fans
2021-07-18 22:39 ` umbraticus
2021-07-19 0:51 ` adr via 9fans
2021-07-19 11:59 ` umbraticus [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=EE5ABDF6523EE21245647775170E3371@prosimetrum.com \
--to=umbraticus@prosimetrum.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).