9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: umbraticus@prosimetrum.com
To: 9fans@9fans.net
Subject: Re: [9fans] A few more questions about sam
Date: Fri, 06 Aug 2021 07:42:05 +1200	[thread overview]
Message-ID: <674DE2214EA337146FCDA7D4674815E7@prosimetrum.com> (raw)
In-Reply-To: <16281799570.EA8Bba.31857@composer.9fans.topicbox.com>

> Is there a way to customise the starting layout of sam?

I have this patch, which changes the starting geometry of
cmd window and opens files fullscreen immediately instead of
having to sweep a rect:

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    Sat Jan 16 16:08:33 2021
@@ -43,7 +43,7 @@
        scratch = alloc(100*RUNESIZE);
        nscralloc = 100;
        r = screen->r;
-       r.max.y = r.min.y+Dy(r)/5;
+       r.min.x = r.max.x-Dx(r)/4;
        flstart(screen->clipr);
        rinit(&cmd.rasp);
        flnew(&cmd.l[0], gettext, 1, &cmd);
diff -u /sys/src/cmd/samterm/menu.c ./menu.c
--- /sys/src/cmd/samterm/menu.c Wed Jan 18 13:12:54 2012
+++ ./menu.c    Mon Jun 21 21:53:12 2021
@@ -205,7 +205,8 @@
        Rectangle r;
        Text *t;
 
-       if(getr(&r) && (t = malloc(sizeof(Text)))){
+       r = screen->r;
+       if(t = malloc(sizeof(Text))){
                memset((void*)t, 0, sizeof(Text));
                current((Flayer *)0);
                flnew(&t->l[0], gettext, 0, (char *)t);

kvik also has some window placement hacks:

https://git.sr.ht/~kvik/ham

There was a video demo somewhere.

To understand sam's automatic window placement around the
cmd window, resize cmd to a square in the centre and
experiment with creating new windows by clicking in various
regions around the square.  There is afaik no way to save &
reproduce window geometry; as mentioned above, I just open
everything fullscreen.

> http://runjimmyrunrunyoufuckerrun.com/rc/s

I wrote this (improvements welcomed) but it relies on the ^
command and $% and $%dot variables which may not exist in
your version of sam.  I believe it was brought to your attention
for these functions, which load a previous editing session:

# ^d [file] # save unwritten changes and dump sam state to file
fn d{
        rfork e
        switch($#*){
        case 0
                dump = /tmp/sam.dump
        case 1
                dump = $1
        case *
                echo !u d
                exit
        }
        d = `{pwd}
        echo 'X/^''/w'
        echo !rm -f $dump
        echo 'Y/^..\./!echo `{cleanname -d' $d '$%}^'':#''^$%dot(2)^'',#''^$%dot(3) >>' $dump
        echo 'X/^..\./!echo `{cleanname -d' $d '$%}^'':#''^$%dot(2)^'',#''^$%dot(3) >>' $dump
}

# !l [file] # load dump file
fn l{
        switch($#*){
        case 0
                xargs -n1 plumb </tmp/sam.dump
        case 1
                xargs -n1 plumb <$1
        case *
                u l
        }
}

> Can someone point me to a specific resource that explains
> these expressions in more detail than does the sam man and
> sam tut?

http://sam.cat-v.org/ has a cheat sheet & some other
resources.  What is sam_tut.pdf missing that you would like
to understand?

umbraticus

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T3107cd3bc536dc63-M51c4690187627a0d4fc416e0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

  reply	other threads:[~2021-08-05 19:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 16:12 revcomninos
2021-08-05 19:42 ` umbraticus [this message]
2021-08-06  0:22   ` fwrm via 9fans
2021-08-06  7:45     ` revcomninos
2021-08-06  9:20     ` revcomninos
2021-08-06 15:04 ` ori
2021-08-06 17:22   ` revcomninos
2021-08-06 19:20   ` Stuart Morrow

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=674DE2214EA337146FCDA7D4674815E7@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).