9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] A few questions about sam 
@ 2021-07-22 13:38 revcomninos
  2021-07-22 13:57 ` Sigrid Solveig Haflínudóttir
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: revcomninos @ 2021-07-22 13:38 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]

I have a few questions about sam which have not thus far been answered for me as I am reading the documentation. I thought that instead of putting them in separate posts, I could just put them into one.  I hope this is acceptable. Please let me know if is not. 

 * The sam window is not always responsive to commands. Under what specific conditions is this the case?
 * Must every sam file end with a newline? I.e. even files with simple text? I sometimes get the "?newline expected" error, which I would like to avoid if possible.
 * Is there a way to repeat the last entered command in sam without having to snarf and paste? I know one can repeat the last search with //.
 * The sam tutorial speaks of sam being "downloaded". (*A tutorial for the sam language*.) I am not exactly sure what "downloaded" means in this context.
 * In ed the "e" command allows one to switch files. It replaces the current file with another. To add a file to the list in sam, one should use B not e. Is that correct? I.e. it would seem "e" is allowed but not sam's natural way of doing things?
 * Is there a way of saving the state of one's windows in sam?
I have used "Emacs" for the last 8 years, but must confess that *sam* is very special. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Mf1461873910abb65e9700e7e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2119 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 13:38 [9fans] A few questions about sam revcomninos
@ 2021-07-22 13:57 ` Sigrid Solveig Haflínudóttir
  2021-07-22 14:59   ` revcomninos
  2021-07-22 19:10 ` mcz
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2021-07-22 13:57 UTC (permalink / raw)
  To: 9fans

>  * Is there a way of saving the state of one's windows in sam?

For that (and many more sam goodness) I recommend checking out
http://runjimmyrunrunyoufuckerrun.com/rc/s


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Mbe8f11cfb24cbd1f30a024a0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 13:57 ` Sigrid Solveig Haflínudóttir
@ 2021-07-22 14:59   ` revcomninos
  0 siblings, 0 replies; 13+ messages in thread
From: revcomninos @ 2021-07-22 14:59 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

That's awesome. Thanks so much Sigrid. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-M0d532c7bf38e59584f0e7d52
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 764 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 13:38 [9fans] A few questions about sam revcomninos
  2021-07-22 13:57 ` Sigrid Solveig Haflínudóttir
@ 2021-07-22 19:10 ` mcz
  2021-07-22 19:18   ` Charles Forsyth
  2021-07-22 19:24 ` Charles Forsyth
  2021-07-27  0:56 ` Ethan Gardener
  3 siblings, 1 reply; 13+ messages in thread
From: mcz @ 2021-07-22 19:10 UTC (permalink / raw)
  To: 9fans

>  * Must every sam file end with a newline? I.e. even files with simple text?

No, I don't think sam cares.

> I sometimes get the "?newline expected" error,

In sam version I use, it's just a warning. The file is saved without newline at
the end, unless I add it there.

> which I would like to avoid if possible.

The best way to avoid the warning about the missing newline character is to add
the missing newline character.

Some programs (POSIX world, ANSI C) assume that every line ends with newline
character, so most editors add it for you if it's missing. Sam apparently 
thinks it's good to have it, but doesn't get in your way if you don't add it.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Md2dae2641e7441d4522a6ff9
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 19:10 ` mcz
@ 2021-07-22 19:18   ` Charles Forsyth
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Forsyth @ 2021-07-22 19:18 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

>/tmp/x: ?warning: last char not newline

is a warning you get when you try to write a file that doesn't end with a
newline, the other message:

> I sometimes get the "?newline expected" error,

is provoked by a syntax error in a command in the sam (command) window. For
instance, try typing
   qx
(and a newline)
it expects nl after q

On Thu, Jul 22, 2021 at 8:14 PM mcz <emcze@ya.ru> wrote:

> >  * Must every sam file end with a newline? I.e. even files with simple
> text?
>
> No, I don't think sam cares.
>
> > I sometimes get the "?newline expected" error,
>
> In sam version I use, it's just a warning. The file is saved without
> newline at
> the end, unless I add it there.
>
> > which I would like to avoid if possible.
> 
> The best way to avoid the warning about the missing newline character is
> to add
> the missing newline character.
> 
> Some programs (POSIX world, ANSI C) assume that every line ends with
> newline
> character, so most editors add it for you if it's missing. Sam apparently
> thinks it's good to have it, but doesn't get in your way if you don't add
> it.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Mee00a57a34c332edd0a4e2a0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 3091 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 13:38 [9fans] A few questions about sam revcomninos
  2021-07-22 13:57 ` Sigrid Solveig Haflínudóttir
  2021-07-22 19:10 ` mcz
@ 2021-07-22 19:24 ` Charles Forsyth
  2021-07-22 20:18   ` revcomninos
  2021-07-27  0:56 ` Ethan Gardener
  3 siblings, 1 reply; 13+ messages in thread
From: Charles Forsyth @ 2021-07-22 19:24 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

>
>
>    - The sam tutorial speaks of sam being "downloaded". (*A tutorial for
>    the sam language*.) I am not exactly sure what "downloaded" means in
>    this context.
>
> sam originally ran on a terminal that had its own little operating system
and applications could be downloaded into each terminal window.
sam ran in two parts: sam on the host and samterm (downloaded) on the
terminal. they communicate using a unique protocol.
Here's a video about the original Blit terminal and how that works:
https://www.youtube.com/watch?v=emh22gT5e9k
(The original editor on the Blit was jim.)
sam is described in detail in a paper:
https://docs.google.com/viewer?url=https%3A%2F%2F9p.io%2Fsys%2Fdoc%2Fsam%2Fsam.pdf

Permalink
> <https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Mf1461873910abb65e9700e7e>
>

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-M20b73a1d7ea627a04a463cef
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2039 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 19:24 ` Charles Forsyth
@ 2021-07-22 20:18   ` revcomninos
  2021-07-22 23:45     ` Silas McCroskey
  0 siblings, 1 reply; 13+ messages in thread
From: revcomninos @ 2021-07-22 20:18 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

Thank you both for your responses. I am going to consider them more carefully and revert back. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-M88470c3bf339d908722912b9
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 816 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 20:18   ` revcomninos
@ 2021-07-22 23:45     ` Silas McCroskey
  2021-07-23  4:47       ` revcomninos
  0 siblings, 1 reply; 13+ messages in thread
From: Silas McCroskey @ 2021-07-22 23:45 UTC (permalink / raw)
  To: 9fans

> The sam window is not always responsive to commands. Under what specific conditions is this the case?

I can think of a few cases:

* You issued an I/O command (shell, read file, write file, etc.) and
it's still in progress (there will always be output you can wait for
in these cases, e.g. the second '!' for shell commands). There's no
way I know of to kill an issued command from within sam (e.g. del key
doesn't work); if you launched something that's infinite looping or
the like you'd have to find it via ps and send a signal/note.
* You're entering commands on something other than the last line
("history" is editable, as in normal plan 9 terminals, which can be
particularly confusing in sam, as there's no prompt).
* You've started a compound command spanning multiple lines (e.g. with
{ } braces) and haven't completed it yet.

> is there a way to repeat the last entered command in sam without having to snarf and paste? I know one can repeat the last search with //.

Not that I know of, sadly. Bare 's' to repeat is one of the things I
miss most about ed. Samterm's 'send' (send the highlighted text (or
the current snarf buffer) for execution) might be a slightly faster
idiom than snarf+paste+enter, though.

> In ed the "e" command allows one to switch files. It replaces the current file with another. To add a file to the list in sam, one should use B not e. Is that correct? I.e. it would seem "e" is allowed but not sam's natural way of doing things?

B and b are both useful for this, yes. The former will load a new file
if that path isn't already in the menu, the latter will only switch to
already-loaded files.

'b' can be combined with X to good effect, in spite of that clearly
not being an anticipated case:
X/pathregex/b

will print "?blank expected" but still switch to the file matching
pathregex, so you don't need to type (or copy+paste) the full path.

- Silas

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Mf5cfe43f0a56bf959f4d436a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 23:45     ` Silas McCroskey
@ 2021-07-23  4:47       ` revcomninos
  2021-07-23  5:42         ` Silas McCroskey
  0 siblings, 1 reply; 13+ messages in thread
From: revcomninos @ 2021-07-23  4:47 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

Thanks to all!

* As far as sam windows being unresponsive, of the reasons suggested, it seems that in my case I am not always entering commands on the last line. When this happens, the sam window does not respond to commands and gets stuck and I am only thereafter able to enter a command if I save the current file. This also sometimes happens after I hit "u". Not sure why.
* X/pathregex/b is a great tip. Thanks. 
* I did try using 'send' but it gives me a ?bad delimiter `e' error.
* Thank you for the clarification and resources Charles. I will go through the paper you recommended. Thanks too for helping me distinguish the newline errors. I had not noticed the difference between them.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-M45339cfb4058e4988db3acd3
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1544 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-23  4:47       ` revcomninos
@ 2021-07-23  5:42         ` Silas McCroskey
  2021-07-23  9:53           ` revcomninos
  0 siblings, 1 reply; 13+ messages in thread
From: Silas McCroskey @ 2021-07-23  5:42 UTC (permalink / raw)
  To: 9fans

> * I did try using 'send' but it gives me a ?bad delimiter `e' error.
send is a command on the middle-click menu in samterm, not part of the
sam language.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Ma800732a0dcfc142af454d8d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-23  5:42         ` Silas McCroskey
@ 2021-07-23  9:53           ` revcomninos
  0 siblings, 0 replies; 13+ messages in thread
From: revcomninos @ 2021-07-23  9:53 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

Oh, that's great! Missed that. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-M33b4088e798ae012e12808ef
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 756 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam
  2021-07-22 13:38 [9fans] A few questions about sam revcomninos
                   ` (2 preceding siblings ...)
  2021-07-22 19:24 ` Charles Forsyth
@ 2021-07-27  0:56 ` Ethan Gardener
  2021-07-27  6:34   ` revcomninos
  3 siblings, 1 reply; 13+ messages in thread
From: Ethan Gardener @ 2021-07-27  0:56 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 924 bytes --]

On Thu, Jul 22, 2021, at 2:38 PM, revcomninos@gmail.com wrote:
> The sam window is not always responsive to commands. Under what specific conditions is this the case?

For completeness, one specific case not mentioned is opening a huge file. For each file you open, Sam creates and initializes a temporary file several times larger. If you open a gigabyte-size file, the initialization takes a while. This may have been optimized away in 9front, but I don't know if they ever saw a need to. It's more of an issue in Acme. For instance, working with virtual machine files, I used to accidentally click on ISO or HD images instead of tiny Qemu launcher scripts and Acme would freeze for minutes.
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Mada1f497c4007f10452d40de
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1747 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] A few questions about sam 
  2021-07-27  0:56 ` Ethan Gardener
@ 2021-07-27  6:34   ` revcomninos
  0 siblings, 0 replies; 13+ messages in thread
From: revcomninos @ 2021-07-27  6:34 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

On Tuesday, 27 July 2021, at 2:56 AM, Ethan Gardener wrote:
> For completeness, one specific case not mentioned is opening a huge file. For each file you open, Sam creates and initializes a temporary file several times larger. If you open a gigabyte-size file, the initialization takes a while. This may have been optimized away in 9front, but I don't know if they ever saw a need to. It's more of an issue in Acme. For instance, working with virtual machine files, I used to accidentally click on ISO or HD images instead of tiny Qemu launcher scripts and Acme would freeze for minutes.
This is helpful to know. Thanks. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T60b5c1929a63b077-Mcfff4958853483d175ba7d06
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1444 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-07-27  6:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 13:38 [9fans] A few questions about sam revcomninos
2021-07-22 13:57 ` Sigrid Solveig Haflínudóttir
2021-07-22 14:59   ` revcomninos
2021-07-22 19:10 ` mcz
2021-07-22 19:18   ` Charles Forsyth
2021-07-22 19:24 ` Charles Forsyth
2021-07-22 20:18   ` revcomninos
2021-07-22 23:45     ` Silas McCroskey
2021-07-23  4:47       ` revcomninos
2021-07-23  5:42         ` Silas McCroskey
2021-07-23  9:53           ` revcomninos
2021-07-27  0:56 ` Ethan Gardener
2021-07-27  6:34   ` revcomninos

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).