From fbd9b3c298c4f04a533ecffdaba9d66b0dc5c4e7 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Tue, 1 Dec 2026 15:09:27 +0000 Subject: [PATCH] . --- .gitignore | 1 - .../document/development-environment.html | 126 ++++++++++++++++++ 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 developer/document/development-environment.html diff --git a/.gitignore b/.gitignore index be24c0f..2a21024 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ temp.* **/scratchpad/* !**/scratchpad/.gitignore -*.patch # Python __pycache__/ diff --git a/developer/document/development-environment.html b/developer/document/development-environment.html new file mode 100644 index 0000000..669e31f --- /dev/null +++ b/developer/document/development-environment.html @@ -0,0 +1,126 @@ + + + + + Development environment + + + + + + + + + + + +

A shell for each role

+ +

+ A Harmony project is worked on through its roles, each entered with ./setup <role> from the top of the project, $REPO_HOME (see Product development roles and workflow). Whatever the editor, the arrangement that works is a shell for each role, kept open for the whole session, each in its role's own directory: +

+ +
    +
  1. administrator, in $REPO_HOME: git, such as git apply and git commit, and the scripts that repair or migrate the project's data.
  2. +
  3. developer, in $REPO_HOME/developer: build and promote.
  4. +
  5. tester, in $REPO_HOME/tester: the tests, run on what was promoted to consumer.
  6. +
  7. a shell under no role, in $REPO_HOME/scratchpad, for running the installed program as its users do.
  8. +
  9. a root shell, in a terminal of its own, outside the editor, for installing what was promoted to consumer.
  10. +
+ +

+ Partitioned so, each shell's history holds one kind of work. The administrator's is the project's git history in the making; the developer's is builds; the tester's is test runs. history in a shell, or searching back through its input, finds the command wanted among others of its kind, and reads as a log of that role's part of the session. A shell's working directory does not change, so every path typed in it is relative to the same place, and a command found in its history runs again as it did before. +

+ +

+ Files handed to the project, such as patches and the scripts that come with them, are put in $REPO_HOME/scratchpad, which git ignores, so they never end up in the repository. The administrator applies a patch from there, git apply scratchpad/<name>.patch, and runs a script from there, scratchpad/<name>. +

+ +

+ The root shell is kept out of the editor because root does not run code another account can change. Emacs runs under the developer's account, and loads that account's files as code each time it starts: its init file, and every package. Any of that code can send text to any buffer's process, so a root shell in a buffer would take input from code the account can change. A terminal of its own, entered with su, keeps root's input out of that code's reach. +

+ +

Emacs

+ +

+ Emacs holds the role shells as buffers, one shell buffer for each, named for its role. Emacs's buffer list, C-x C-b, then reads as the session's layout: +

+ + + . * administrator 40279 Shell:run ~/project/Jizo/ + * run 2551302 Shell:run ~/project/Jizo/scratchpad/ + * developer 81001 Shell:run ~/project/Jizo/developer/ + * tester 456830 Shell:run ~/project/Jizo/tester/ + *scratch* 147 Lisp Interaction + %* *Messages* 22707 Messages + + +

+ The last column is each shell's working directory, as Emacs follows it. The size column is the buffer's text: a shell buffer keeps everything printed in it, so the session's output can be searched with C-s and saved as a file. +

+ +

Making the shells

+ +

+ M-x shell opens a shell in a buffer named *shell*, and called again it goes back to that buffer. Given a prefix argument, C-u M-x shell, it asks for the buffer's name, and a new name makes a new shell. So for each role: +

+ + + C-u M-x shell RET developer RET + cd ~/project/Jizo + ./setup developer + + +

+ setup starts the role's shell inside the buffer's shell, in the role's directory; exit leaves it, back to the shell the buffer started with. A buffer already open is renamed with M-x rename-buffer. The shell under no role is made the same way, named run, with cd ~/project/Jizo/scratchpad and no setup. +

+ +

History in a shell buffer

+ +

+ A shell buffer has two histories. The shell keeps its own, read with history, and written to the history file when it exits. Emacs keeps the input typed in the buffer, its input ring, one for each buffer: +

+ + + M-p, M-n the previous or next input, to edit and send again + M-r search back through the inputs, incrementally + C-c C-l list the inputs in a buffer of their own + C-c C-o delete the output of the last command + C-c C-r move to the start of the last command's output + + +

+ As each buffer holds one role's work, M-r build in the developer's buffer finds builds, and M-r apply in the administrator's finds the patches applied, with nothing of the other roles among them. +

+ +

The working directory

+ +

+ Emacs follows a shell's working directory by watching the cd, pushd and popd commands typed in it, and uses it as the buffer's default directory: C-x C-f in the developer's buffer starts in developer/, and M-x compile runs there. A directory changed some other way, such as by setup or a script, is not seen; M-x dirs asks the shell, and puts Emacs right. A role's shell staying in its directory keeps this right without thought. +

+ +

Other environments

+ +

+ A chapter for Eclipse or IntelliJ IDEA waits for someone working in one of them: what was written for them earlier is old, and is not kept here. +

+ +
+ + -- 2.20.1