diff options
Diffstat (limited to 'docs/fs.md')
| -rw-r--r-- | docs/fs.md | 56 |
1 files changed, 39 insertions, 17 deletions
@@ -62,8 +62,10 @@ private namespace: A `9ns --unix` mount lives in the private namespace of the command it runs, and nothing outside that command sees it. The mount everyone on the machine shares is the registry one, `9ns --mntgen` (default `/mnt/9p`): every running -editor posts itself there, so `/mnt/9p/pardes/<pid>/` is that editor's tree -for any process. A new pane made through `pane/new` is a scratch named +editor posts itself there, so `$NINE_MOUNT/pardes/<pid>/` is that editor's tree +for any process. 9ns exports `$NINE_MOUNT` to everything it starts, so a +script checks that variable to know the mount is there, and takes `<pid>` from +the name of `$PARDES_9P` (`pardes-9p-<pid>.sock`). A new pane made through `pane/new` is a scratch named `<dir>/+New` until it is given a name, and closing a column's last pane leaves such a `+New` in its place (`Delcol` closes the column). @@ -110,12 +112,15 @@ which quits the editor as acme's does (it refuses once, naming each pane with unsaved text, `<name>: Modified (Exit again to discard)`, and a second `Exit` with nothing edited since quits, throwing that text away; a scratch under 100 bytes is not asked about; `Restore`, which replaces every pane, -asks the same first -- `Dump` writes `pardes-<date>-<time>.zon` in +asks the same first -- `Dump` writes `pardes-<date>-<time>.zon` (UTC) in `DumpDir` (default `$XDG_DATA_HOME/pardes`, else `~/.local/share/pardes`) and logs `dump <path>`, and `Restore` with no path takes the last one; a Restore puts a new editor under every client, so the write of it is answered and then every connection is hung up, their fids naming the old -editor's panes: dial again, and the new log names the restored panes and +editor's panes (through a 9ns mount the write usually fails with +ECONNRESET all the same: 9ns fails a request whose reply is already in once +the hang-up breaks its next send, so trust the log): dial again, and the new +log names the restored panes and `restore <path>`. The answer has 200 ms to leave before the cut, so a slow client may see only the cut; the log's `restore <path>` is what says the Restore happened. Keeping connections across it would mean carrying serials @@ -130,7 +135,8 @@ start mark (C) to its end mark (D), where Kill sends its foreground job SIGTERM "kill" note, which ends a process -- and never signals the shell itself; in a shell running without job control (`set +m`) the job shares the shell's group, so there is none to signal: Kill says `Kill: no job to -signal`, and a write of it to `ctl` fails with that; and only the +signal`, and a write of it to `ctl` fails with that; with nothing running +it says `Kill: nothing running`; and only the foreground job, so of `sleep 30; echo done` the `echo` still runs once the `sleep` is stopped -- and reads every setting there is, one a line, in the words a write of it @@ -184,7 +190,7 @@ the keyboard no pane does: `/focus` reads empty and every pane's `ctl` says `notcurrent`. A write gives the keyboard and nothing else: a folded pane stays folded (unfold it with `Collapse` on its ctl), as rio keeps `current` apart from `unhide`. A serial no pane has fails with `no such -window`; anything but a number, with `ill-formed control message`. +pane`; anything but a number, with `ill-formed control message`. A pane is made by **opening** `/pane/new`, and closed by Tremove on `/pane/<n>` (`rmdir`), which is the only remove the tree serves; Tcreate is @@ -236,7 +242,8 @@ same tree without leaving the process. or anything else, a command line. Written at a terminal at its prompt it is typed into that shell. From anywhere else -- a file, a scratch, a tag, a terminal whose tty a program holds -- it runs as a command pane: a - terminal whose child is `$SHELL -c` the line in the pane's directory, + terminal whose child is the root ctl's `Shell` (fish unless set) run + with `-c` and the line, in the pane's directory, which shows its output and then `exit N` (its tag reads `<dir> (<line>) running`, then `exit N`), and stays. The command is over when its process exits, as in acme, not when its terminal closes: a job it left in the @@ -247,17 +254,21 @@ same tree without leaving the process. leaves any alternate screen and turns off the modes a program left on (mouse reports, bracketed paste, a hidden cursor); a command that clears the screen and its scrollback (`clear`, ED3) erases the history above it. A command pane's own exec starts - the next command there too. The log says `run <serial> <word>` and `exit + the next command there too. The log says `run <serial> <line>` and `exit <serial> <N|?>`; `exec` reads back the command pane's serial; Kill ends its whole process group; a line is at most 1 KB. A misspelled word is a command that says so and ends `exit 127`. `echo Tty > pane/<n>/ctl` makes an interactive terminal in that pane's directory. A terminal can be bound as a language's REPL: `Repl python` in its tag or -on its `ctl` (the language names are the syntax table's; `Repl -` unbinds, +on its `ctl` (the language names are the syntax table's, or a code fence's +alias such as `py`, in any case; `Repl -` unbinds, `Repl` bare says the binding, `Repl python` again changes nothing). Its tag -shows its id, `python-a`, `python-b` for the next, a freed letter reused. -Then an exec made by a gesture on the body of a file in that language -- a +shows its id, `python-a`, `python-b` for the next, a freed letter reused, +and so does the end of its `ctl` line, after `current`/`notcurrent`. +A builtin's word still runs first, bound or not: `Del` clicked in the file +closes its pane. Then any other exec made by a gesture on the body of a file +in that language -- a middle click, the execute key, on a selection or a single word, even `make` in a comment -- or on the REPL's own body is typed into the REPL instead of run: bracketed paste when its program asked for it (DECSET 2004), else line @@ -265,14 +276,20 @@ by line, where a blank line inside a Python block ends the block (said once), then Enter. The message row says `→ python-a` in the tag's name tint and the log `send <from> <to> <id>`. With several REPLs bound for the language the pane asks which, on its notice band, one key answering and Esc -sending nowhere; nothing is remembered. A command pane whose command is done -is no REPL any more. Still commands, whatever is bound: a word in a tag (so +sending nowhere; nothing is remembered. A REPL takes text only while its +program has the terminal: a command pane's until its command is done (the +binding goes with it, and a done one cannot be bound), an interactive +terminal's while a program other than its shell holds the tty -- after +Ctrl-D the shell would run the text, so nothing is sent and the pane says +so. Still commands, whatever is bound: a word in a tag (so the tag is how to run `make` from that file), `Exec <text>` run by name (typed, a 2-1 chord onto `Exec`, a `ctl` line) and a command word @`cmd` in the text, looked at or clicked (`# @`pytest -x`` in a script). A 9P `exec` is no gesture and is never sent: a script writes to the REPL pane's -`pty/data`. The REPL gets the text wherever it is -- at a `pdb` or `input()` -prompt too. Bindings are not dumped, so a Restore leaves none. +`pty/data`, multi-line code as a bracketed paste (`\e[200~<code>\e[201~` +then `\r`), since line by line a blank line ends a Python block and Python +3.14's REPL auto-indents each line typed into it. The REPL gets the text +wherever it is -- at a `pdb` or `input()` prompt too. Bindings are not dumped, so a Restore leaves none. The root's pair clicks at the active pane and `/pane/<n>/look` and `/pane/<n>/exec` at that pane. Blank lines are skipped, and every other line @@ -293,7 +310,10 @@ pane's own `look` or `exec`, or to the root's while that pane has the keyboard, a click with no place in the text: an `F` record at `0 0` carrying the line. So a client holding `event` that wants a command run gets its own exec back as a record: it runs it through `ctl`, or writes the record back. -Writing a record back performs the action. acme takes back only `<origin> +Writing a record back performs the action, as the click would have (acme's +xfideventwrite): a body `X` goes to a REPL bound for the text as a middle +click does, where an `F` record, a line written to `exec`, runs as the +command it was. acme takes back only `<origin> <action><q0> <q1>`, the text of that range; pardes takes the record whole as it was read too, and for an empty range acts on its text, which is how such a line is done. A click in a file's body carries the offsets of the text it @@ -490,7 +510,9 @@ for ever: cancel the read (interrupt it, or close the open) to give up; `error not run` when the shell refused the line without running it (a fish syntax error; the line is taken back off the prompt); `error shell gone` when the pane closed or its shell was -replaced; `error no prompt marks` for a shell pardes could not instrument. +replaced; `error no prompt marks` for a shell pardes could not instrument; +`error command done; not a shell` (or `error a command runs here, not a +shell`) on a command pane, whose child is its command. It relies on the OSC 133 marks pardes injects into bash and fish, tagged `aid=pardes` so fish's own marks and a nested shell's are ignored. A second line on an open whose command still runs fails the write. `exec zsh` or a |
