Skip to content

Keep Projects and Workspaces Across Restart

In this exercise, start with ordinary directories, save an edit, explicitly create Projects, and reopen a named Workspace in a fresh editor. Then change its order and membership and dissolve it while keeping its Projects and files. Every command below is available through Alt-x in both profiles.

Prepare Two Disposable Directories

From the repository root:

cargo build --locked -p rur-editor --bin rur-terminal-proof
context_editor="$PWD/target/debug/rur-terminal-proof"
context_demo=$(mktemp -d)
mkdir "$context_demo/app" "$context_demo/other" "$context_demo/scratch"
mkdir "$context_demo/app/.git"
printf 'seed\r\n' > "$context_demo/app/note"
printf 'other source\n' > "$context_demo/other/note"
printf '# Use the factory context commands.\n' > "$context_demo/settings.rb"
context_profile=nonmodal
context_start() {
  XDG_CONFIG_HOME="$context_demo/config" XDG_STATE_HOME="$context_demo/state" \
    "$context_editor" --config "$context_demo/settings.rb" \
    --profile "$context_profile" --no-recovery --receipt "$@"
}
printf 'Exercise directory: %s\n' "$context_demo"
context_start "$context_demo/app"

Choose context_profile=modal before launching to use that profile. Enter Insert with i before typing source text there. This isolated exercise disables recovery; the previous chapter covers unsaved checkpoints.

The startup page identifies a Dir even though app/.git exists. No Project record is created merely by opening a directory. Choose find-file, paste the printed exercise directory followed by /app/note, and confirm. Paste absolute paths: the first slash typed interactively in Open... selects Home.

Insert saved λ before seed. Run project-promote; its editable name starts with the directory basename. Keep the suggested name or edit it, then confirm. The Project starts untrusted, and the unsaved text and panes stay in place. Save with Ctrl-X Ctrl-S. Back in the shell after the following exit, app/note will contain the inserted text and its original CRLF separator.

Run workspace-create, enter Solo, and confirm. A Workspace with one Project is valid. Use describe-project or describe-workspace to inspect the independent Project identity/trust and the saved ordered composition. Leave with exit-editor.

Compose a Second Workspace

In the same shell, start a fresh editor on the other directory:

context_start "$context_demo/other"

Run project-promote and confirm its name. Then run add-dir, paste the exercise directory followed by /app, and confirm. The existing local Project is recognized. The roots are ordered other, then app.

Run workspace-create with the name Pair. describe-workspace shows both members in that order, each with its own untrusted state. Leave with exit-editor. The two local Projects and both Workspace records survive.

Reopen, Protect an Edit and Change Membership

Start a third editor without a path:

context_start

At startup, press w, or choose open-workspace through Alt-x. Filter Pair and confirm its checked row. Opening activates the complete composition. A changed or missing member leaves the previous roots intact; it never opens only the available subset.

Open app/note with find-file and insert pending at its start. Run open-dir with the disposable scratch path. At the unsaved-work question, press Ctrl-G. The pending edit and Workspace remain active; the source on disk still contains only the earlier Save. Now explicitly Save with Ctrl-X Ctrl-S.

Use these commands in order:

CommandInputResult
workspace-move-project2 earlierPair becomes app, other.
workspace-remove-project2Pair retains app as its only member.
describe-workspaceNoneInspect the updated identity, generation and member.
workspace-unregisterChoose PairDissolve Pair; keep the live app root, Project and file.

Removing the final member is refused. Use workspace-unregister to dissolve a Workspace intentionally. Solo still exists and can be reopened. If status says Workspace updated; reopen to activate, the record was saved but the new roots were not activated. Resolve the pending work and explicitly reopen the Workspace to use its saved composition.

Choose What Happens When Leaving an Ordinary Dir

After saving, open scratch with open-dir. Leaving an ordinary Dir through replacement, removal or Exit asks Convert, No, Cancel or Disable, after any dirty/recovery decisions. Convert names and promotes that exact Dir; No applies only to this departure; Cancel keeps the pending root action from completing.

Run project-disable-promotion-prompt while scratch is current. Future departures from that exact normalized path no longer ask, including after restart. This stores a preference without creating scratch/.rur. Run project-enable-promotion-prompt to restore the question. A renamed or moved directory is a different suppression path. Failed preference persistence stops the pending departure.

Leave with exit-editor, choosing No when asked. The printed receipt confirms terminal restoration. Inspect app/note in the shell to see the two explicit Saves; other/note remains unchanged. The disposable directory retains your Projects, Solo and preferences for another restart.

For all commands, failure outcomes, storage paths and finite limits, see Directories, Projects and Workspaces. Project trust never automatically loads local Ruby, starts tools or changes the ability to edit and Save.

Previous: Files, Projects, and Workspaces | Part | User Guide | Next: Language Intelligence